diff --git a/LCTT翻译规范.md b/LCTT翻译规范.md new file mode 100644 index 0000000000..b9a514f115 --- /dev/null +++ b/LCTT翻译规范.md @@ -0,0 +1,4 @@ +# Linux中国翻译规范 +1. 翻译中出现的专有名词,可参见Dict.md中的翻译。 +2. 英文人名,如无中文对应译名,一般不译。 +2. 缩写词,一般不须翻译,可考虑旁注中文全名。 \ No newline at end of file diff --git a/README.md b/README.md index 968c8434a1..cfa5aee47e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ 简介 ------------------------------- -LCTT是“Linux中国”([http://linux.cn/](http://linux.cn/))的翻译组,负责从国外优秀媒体翻译Linux相关的技术、资讯、杂文等内容。 +LCTT是“Linux中国”([https://linux.cn/](https://linux.cn/))的翻译组,负责从国外优秀媒体翻译Linux相关的技术、资讯、杂文等内容。 -LCTT已经拥有近百余名活跃成员,并欢迎更多的Linux志愿者加入我们的团队。 +LCTT已经拥有几百名活跃成员,并欢迎更多的Linux志愿者加入我们的团队。 ![logo](http://img.linux.net.cn/static/image/common/lctt_logo.png) @@ -51,113 +51,133 @@ LCTT的组成 * 2014/12/25 提升runningwater为Core Translators成员。 * 2015/04/19 发起 LFS-BOOK-7.7-systemd 项目。 * 2015/06/09 提升ictlyh和dongfengweixiao为Core Translators成员。 +* 2015/11/10 提升strugglingyouth、FSSlc、Vic020、alim0x为Core Translators成员。 +* 2016/05/09 提升PurlingNayuki为校对。 活跃成员 ------------------------------- 目前 TP 活跃成员有: -- CORE @wxy, -- CORE @carolinewuyan, -- CORE @DeadFire, +- Leader @wxy, +- Source @oska874, +- Proofreader @PurlingNayuki, - CORE @geekpi, - CORE @GOLinux, -- CORE @reinoir, -- CORE @bazz2, -- CORE @zpl1025, - CORE @ictlyh, -- CORE @dongfengweixiao +- CORE @carolinewuyan, +- CORE @strugglingyouth, +- CORE @FSSlc +- CORE @zpl1025, +- CORE @runningwater, +- CORE @bazz2, +- CORE @Vic020, +- CORE @dongfengweixiao, +- CORE @alim0x, +- Senior @DeadFire, +- Senior @reinoir, - Senior @tinyeyeser, - Senior @vito-L, - Senior @jasminepeng, - Senior @willqian, - Senior @vizv, -- @ZTinoZ, -- @Vic020, -- @runningwater, -- @KayGuoWhu, -- @luoxcat, -- @alim0x, -- @2q1w2007, -- @theo-l, -- @FSSlc, -- @su-kaiyao, -- @blueabysm, -- @flsf, -- @martin2011qi, -- @SPccman, -- @wi-cuckoo, -- @Linchenguang, -- @linuhap, -- @crowner, -- @Linux-pdz, -- @H-mudcup, -- @yechunxiao19, -- @woodboow, -- @Stevearzh, -- @disylee, -- @cvsher, -- @wwy-hust, -- @johnhoow, -- @felixonmars, -- @TxmszLou, -- @shipsw, -- @scusjs, -- @wangjiezhe, -- @hyaocuk, -- @MikeCoder, -- @ZhouJ-sh, -- @boredivan, -- @goreliu, -- @l3b2w1, -- @JonathanKang, -- @NearTan, -- @jiajia9linuxer, -- @Love-xuan, -- @coloka, -- @owen-carter, -- @luoyutiantang, -- @JeffDing, -- @icybreaker, -- @tenght, -- @liuaiping, -- @mtunique, -- @rogetfan, -- @nd0104, -- @mr-ping, -- @szrlee, -- @lfzark, -- @CNprober, -- @DongShuaike, -- @ggaaooppeenngg, -- @haimingfg, -- @213edu, -- @Tanete, -- @guodongxiaren, -- @zzlyzq, -- @FineFan, -- @yujianxuechuan, -- @Medusar, -- @shaohaolin, -- @ailurus1991, -- @liaoishere, -- @CHINAANSHE, -- @stduolc, -- @yupmoon, -- @tomatoKiller, -- @zhangboyue, -- @kingname, -- @KevinSJ, -- @zsJacky, -- @willqian, -- @Hao-Ding, -- @JygjHappy, -- @Maclauring, -- @small-Wood, -- @cereuz, -- @fbigun, -- @lijhg, -- @soooogreen, +- ZTinoZ, +- theo-l, +- luoxcat, +- martin2011qi, +- wi-cuckoo, +- disylee, +- haimingfg, +- KayGuoWhu, +- wwy-hust, +- felixonmars, +- su-kaiyao, +- ivo-wang, +- GHLandy, +- cvsher, +- wyangsun, +- DongShuaike, +- flsf, +- SPccman, +- Stevearzh +- mr-ping, +- Linchenguang, +- Linux-pdz, +- 2q1w2007, +- H-mudcup, +- cposture, +- xiqingongzi, +- goreliu, +- NearTan, +- TxmszLou, +- ZhouJ-sh, +- wangjiezhe, +- icybreaker, +- shipsw, +- johnhoow, +- soooogreen, +- linuhap, +- blueabysm, +- boredivan, +- name1e5s, +- yechunxiao19, +- l3b2w1, +- XLCYun, +- KevinSJ, +- tenght, +- coloka, +- luoyutiantang, +- sonofelice, +- jiajia9linuxer, +- scusjs, +- tnuoccalanosrep, +- woodboow, +- 1w2b3l, +- JonathanKang, +- crowner, +- mtunique, +- dingdongnigetou, +- CNprober, +- hyaocuk, +- szrlee, +- KnightJoker, +- Xuanwo, +- nd0104, +- jerryling315, +- xiaoyu33, +- guodongxiaren, +- ynmlml, +- kylepeng93, +- ggaaooppeenngg, +- Ricky-Gong, +- zky001, +- Flowsnow, +- lfzark, +- 213edu, +- Tanete, +- liuaiping, +- bestony, +- Timeszoro, +- rogetfan, +- itsang, +- JeffDing, +- Yuking-net, +- MikeCoder, +- zhangboyue, +- liaoishere, +- yupmoon, +- Medusar, +- zzlyzq, +- yujianxuechuan, +- ailurus1991, +- tomatoKiller, +- stduolc, +- shaohaolin, +- FineFan, +- kingname, +- CHINAANSHE, + +(按提交行数排名前百) LFS 项目活跃成员有: @@ -169,7 +189,7 @@ LFS 项目活跃成员有: - @KevinSJ - @Yuking-net -(更新于2015/06/09,以Github contributors列表排名) +(更新于2016/05/09) 谢谢大家的支持! diff --git a/published/201311/3 Ways to Access And Use Cloud Storage (SkyDrive etc.) In Linux.md b/published/201311/3 Ways to Access And Use Cloud Storage (SkyDrive etc.) In Linux.md index e1716a1cd8..8972c25a3d 100644 --- a/published/201311/3 Ways to Access And Use Cloud Storage (SkyDrive etc.) In Linux.md +++ b/published/201311/3 Ways to Access And Use Cloud Storage (SkyDrive etc.) In Linux.md @@ -7,7 +7,7 @@ ![](http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2013/10/linux_accessing_cloud_ubuntu_one.jpg) -使用这种方式的明显好处就是你可以通过使用他们各自的官方应用访问你的各种云存储。目前,提供官方Linux客户端的服务提供商有[SpiderOak](1), [Dropbox](2), [Ubuntu One](3),[Copy](5)。[Ubuntu One](3)虽不出名但的确是[一个不错的云存储竞争着](4)。[Copy][5]则提供比Dropbox更多的空间,是[Dropbox的替代选择之一](6)。使用这些官方Linux客户端可以保持你的电脑与他们的服务器之间的通信,还可以让你进行属性设置,如选择性同步。 +使用这种方式的明显好处就是你可以通过使用他们各自的官方应用访问你的各种云存储。目前,提供官方Linux客户端的服务提供商有[SpiderOak][1], [Dropbox][2], [Ubuntu One][3],[Copy][5]。[Ubuntu One][3]虽不出名但的确是[一个不错的云存储竞争着][4]。[Copy][5]则提供比Dropbox更多的空间,是[Dropbox的替代选择之一][6]。使用这些官方Linux客户端可以保持你的电脑与他们的服务器之间的通信,还可以让你进行属性设置,如选择性同步。 对于普通桌面用户,使用官方客户端是最好的选择,因为官方客户端可以提供最多的功能和最好的兼容性。使用它们也很简单,只需要下载他们对应你的发行版的软件包,然后安装安装完后在运行一下就Ok了。安装客户端时,它一般会指导你完成这些简单的过程。 @@ -25,9 +25,9 @@ 当你运行最后一条命令后,脚本会提醒你这是你第一次运行这个脚本。它将告诉你去浏览一个Dropbox的特定网页以便访问你的账户。它还会告诉你所有你需要放入网站的信息,这是为了让Dropbox给你App Key和App Secret以及赋予这个脚本你给予的访问权限。现在脚本就拥有了访问你账户的合法授权了。 -这些一旦完成,你就可以这个脚本执行各种任务了,例如上传、下载、删除、移动、复制、创建文件夹、查看文件、共享文件、查看文件信息和取消共享。对于全部的语法解释,你可以查看一下[这个页面](9)。 +这些一旦完成,你就可以这个脚本执行各种任务了,例如上传、下载、删除、移动、复制、创建文件夹、查看文件、共享文件、查看文件信息和取消共享。对于全部的语法解释,你可以查看一下[这个页面][9]。 -###通过[Storage Made Easy](7)将SkyDrive带到Linux上 +###通过[Storage Made Easy][7]将SkyDrive带到Linux上 微软并没有提供SkyDrive的官方Linux客户端,这一点也不令人惊讶。但是你并不意味着你不能在Linux上访问SkyDrive,记住:SkyDrive的web版本是可用的。 @@ -41,7 +41,7 @@ 第一次启动时。它会要求你登录,还有询问你要把云存储挂载到什么地方。在你做完了这些后,你就可以浏览你选择的文件夹,你还可以访问你的Storage Made Easy空间以及你的SkyDrive空间了!这种方法对于那些想在Linux上使用SkyDrive的人来说非常好,对于想把他们的多个云存储服务整合到一个地方的人来说也很不错。这种方法的缺点是你无法使用他们各自官方客户端中可以使用的特殊功能。 -因为现在在你的Linux桌面上也可以使用SkyDrive,接下来你可能需要阅读一下我写的[SkyDrive与Google Drive的比较](8)以便于知道究竟哪种更适合于你。 +因为现在在你的Linux桌面上也可以使用SkyDrive,接下来你可能需要阅读一下我写的[SkyDrive与Google Drive的比较][8]以便于知道究竟哪种更适合于你。 ###结论 diff --git a/published/201407/Encrypting Your Cat Photos.md b/published/201407/Encrypting Your Cat Photos.md old mode 100755 new mode 100644 diff --git a/published/201505/20150326 How to set up server monitoring system with Monit.md b/published/201505/20150326 How to set up server monitoring system with Monit.md old mode 100755 new mode 100644 diff --git a/published/20150820 Which Open Source Linux Distributions Would Presidential Hopefuls Run.md b/published/20150820 Which Open Source Linux Distributions Would Presidential Hopefuls Run.md new file mode 100644 index 0000000000..22b7c1e498 --- /dev/null +++ b/published/20150820 Which Open Source Linux Distributions Would Presidential Hopefuls Run.md @@ -0,0 +1,53 @@ +如果总统候选人们要使用 Linux 发行版,他们会选择哪个? +================================================================================ +![Republican presidential candidate Donald Trump +](http://thevarguy.com/site-files/thevarguy.com/files/imagecache/medium_img/uploads/2015/08/donaldtrump.jpg) + +*共和党总统候选人 Donald Trump【译者注:唐纳德·特朗普,美国地产大亨、作家、主持人】* + +如果要竞选总统的人们使用 Linux 或其他的开源操作系统,那么会使用哪个发行版呢?问题的关键是存在许多其它的因素,比如,一些“政治立场”问题,或者是给一个发行版的名字添加上感叹号是否合适——而这问题一直被忽视。先不管这些忽视:接下来是时事新闻工作者关于总统大选和 Linux 发行版的报道。 + +对于那些已经看了很多年我的文字的人来说(除了我亲爱的的编辑之外,他们一直听我的瞎扯是不是倒霉到家了?),这篇文章听起来很熟悉,这是因为我在去年的总统选举期间写了一篇[类似的文章][1]。一些读者把这篇文章的内容看的比我想象的还要严肃,所以我会花点时间阐述我的观点:事实上,我不认为开源软件和政治运动彼此之间有多大的关系。我写那样的文章仅仅是新的一周的自我消遣罢了。 + +当然,你也可以认为它们彼此相关,毕竟你才是读者。 + +### Linux 发行版之选:共和党人们 ### + +今天,我只是谈及一些有关共和党人们的话题,我甚至只会谈论他们的其中一部分。因为共和党的提名人太多了,以至于我写满了整篇文章。由此开始: + +如果 **Jeb (Jeb!?) Bush** 使用 Linux,它一定是 [Debian][2]。Debian 属于一个相当无趣的分支,它是为真正意义上的、成熟的黑客设计的,这些人将清理那些由经验不甚丰富的开源爱好者所造成的混乱视为一大使命。当然,这也使得 Debian 显得很枯燥,所以它已有的用户基数一直在缩减。 + +**Scott Walker** ,对于他来说,应该是一个 [Damn Small Linux][3] (DSL) 用户。这个系统仅仅需要 50MB 的硬盘空间和 16MB 的 RAM 便可运行。DSL 可以使一台 20 年前的 486 计算机焕发新春,而这恰好符合了 **Scott Walker** 所主张的消减成本计划。当然,你在 DSL 上的用户体验也十分原始,这个系统平台只能够运行一个浏览器。但是至少你不用浪费钱财购买新的电脑硬件,你那台 1993 年购买的机器仍然可以为你好好的工作。 + +**Chris Christie** 会使用哪种系统呢?他肯定会使用 [Relax-and-Recover Linux][4],它号称“一次搞定(Setup-and-forget)的裸机 Linux 灾难恢复方案” 。从那次不幸的华盛顿大桥事故后,“一次搞定(Setup-and-forget)”基本上便成了 Christie 的政治主张。不管灾难恢复是否能够让 Christie 最终挽回一切,但是当他的电脑死机的时候,至少可以找到一两封意外丢失的机密邮件。 + +至于 **Carly Fiorina**,她无疑将要使用 [惠普][6] (HPQ)为“[The Machine][5]”开发的操作系统,她在 1999 年到 2005 年这 6 年期间管理该公司。事实上,The Machine 可以运行几种不同的操作系统,也许是基于 Linux 的,也许不是,我们并不太清楚,它的开发始于 **Carly Fiorina** 在惠普公司的任期结束后。不管怎么说,作为 IT 圈里一个成功的管理者,这是她履历里面重要的组成部分,同时这也意味着她很难与惠普彻底断绝关系。 + +最后,但并不是不重要,你也猜到了——**Donald Trump**。他显然会动用数百万美元去雇佣一个精英黑客团队去定制属于自己的操作系统——尽管他原本是想要免费获得一个完美的、现成的操作系统——然后还能向别人炫耀自己的财力。他可能会吹嘘自己的操作系统是目前最好的系统,虽然它可能没有兼容 POSIX 或者一些其它的标准,因为那样的话就需要花掉更多的钱。同时这个系统也将根本不会提供任何文档,因为如果 **Donald Trump** 向人们解释他的系统的实际运行方式,他会冒着所有机密被泄露至伊斯兰国家的风险,绝对是这样的。 + +另外,如果 **Donald Trump** 非要选择一种已有的 Linux 平台的话, [Ubuntu][7] 应该是明智的选择。就像 **Donald Trump** 一样, Ubuntu 的开发者秉承“我们做自己想要做的”原则,通过他们自己的实现来构建开源软件。自由软件纯化论者却很反感 Ubuntu 这一点,但是很多普通用户却更喜欢一些。当然,无论你是不是一个纯粹论者,无论是在软件领域还是政治领域,还需要时间才能知道分晓。 + +### 敬请期待 ### + +如果你想知道为什么我还没有提到民主党候选人,别想多了。我没有在这篇文章中提及他们,是因为我对民主党并不比共和党喜欢更多或更少一点(我个人认为,这种只有两个政党的美国特色是不荒谬的,根本不能体现民主,我也不相信这些党派候选人)。 + +另一方面,也可能会有很多人关心民主党候选人使用的 Linux 发行版。后续的帖子中我会提及的,请拭目以待。 + +-------------------------------------------------------------------------------- + +via: http://thevarguy.com/open-source-application-software-companies/081715/which-open-source-linux-distributions-would-presidential- + +作者:[Christopher Tozzi][a] +译者:[vim-kakali](https://github.com/vim-kakali) +校对:[PurlingNayuki](https://github.com/PurlingNayuki), [wxy](https://github.com/wxy/) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://thevarguy.com/author/christopher-tozzi +[1]:http://thevarguy.com/open-source-application-software-companies/aligning-linux-distributions-presidential-hopefuls +[2]:http://debian.org/ +[3]:http://www.damnsmalllinux.org/ +[4]:http://relax-and-recover.org/ +[5]:http://thevarguy.com/open-source-application-software-companies/061614/hps-machine-open-source-os-truly-revolutionary +[6]:http://hp.com/ +[7]:http://ubuntu.com/ diff --git a/published/201509/20141223 Defending the Free Linux World.md b/published/201509/20141223 Defending the Free Linux World.md new file mode 100644 index 0000000000..b554bf7f7e --- /dev/null +++ b/published/201509/20141223 Defending the Free Linux World.md @@ -0,0 +1,125 @@ +守卫自由的 Linux 世界 +================================================================================ +![](http://www.linuxinsider.com/ai/908455/open-invention-network.jpg) + +**合作是开源的一部分。OIN 的 CEO Keith Bergelt 解释说,开放创新网络(Open Invention Network)模式允许众多企业和公司决定它们该在哪较量,在哪合作。随着开源的演变,“我们需要为合作创造渠道,否则我们将会有几百个团体把数十亿美元花费到同样的技术上。”** + +[开放创新网络(Open Invention Network)][1],即 OIN,正在全球范围内开展让 Linux 远离专利诉讼的伤害的活动。它的努力得到了一千多个公司的热烈回应,它们的加入让这股力量成为了历史上最大的反专利管理组织。 + +开放创新网络以白帽子组织的身份创建于2005年,目的是保护 Linux 免受来自许可证方面的困扰。包括 Google、 IBM、 NEC、 Novell、 Philips、 [Red Hat][2] 和 Sony 这些成员的董事会给予了它可观的经济支持。世界范围内的多个组织通过签署自由 OIN 协议加入了这个社区。 + +创立开放创新网络的组织成员把它当作利用知识产权保护 Linux 的大胆尝试。它的商业模式非常的难以理解。它要求它的成员采用免版权许可证,并永远放弃由于 Linux 相关知识产权起诉其他成员的机会。 + +然而,从 Linux 收购风波——想想服务器和云平台——那时起,保护 Linux 知识产权的策略就变得越加的迫切。 + +在过去的几年里,Linux 的版图曾经历了一场变革。OIN 不必再向人们解释这个组织的定义,也不必再解释为什么 Linux 需要保护。据 OIN 的 CEO Keith Bergelt 说,现在 Linux 的重要性得到了全世界的关注。 + +“我们已经见到了一场人们了解到 OIN 如何让合作受益的文化变革,”他对 LinuxInsider 说。 + +### 如何运作 ### + +开放创新网络使用专利权的方式创建了一个协作环境。这种方法有助于确保创新的延续。这已经使很多软件厂商、顾客、新型市场和投资者受益。 + +开放创新网络的专利证可以让任何公司、公共机构或个人免版权使用。这些权利的获得建立在签署者同意不会专为了维护专利而攻击 Linux 系统的基础上。 + +OIN 确保 Linux 的源代码保持开放的状态。这让编程人员、设备厂商、独立软件开发者和公共机构在投资和使用 Linux 时不用过多的担心知识产权的问题。这让对 Linux 进行重新打包、嵌入和使用的公司省了不少钱。 + +“随着版权许可证越来越广泛的使用,对 OIN 许可证的需求也变得更加的迫切。现在,人们正在寻找更加简单或更实用的解决方法”,Bergelt 说。 + +OIN 法律防御援助对成员是免费的。成员必须承诺不对 OIN 名单上的软件发起专利诉讼。为了保护他们的软件,他们也同意提供他们自己的专利。最终,这些保证将让几十万的交叉许可通过该网络相互连接起来,Bergelt 如此解释道。 + +### 填补法律漏洞 ### + +“OIN 正在做的事情是非常必要的。它提供另一层 IP (知识产权)保护,”[休斯顿法律中心大学][3]的副教授 Greg R. Vetter 这样说道。 + +他回答 LinuxInsider 说,第二版 GPL 许可证被某些人认为提供了隐含的专利许可,但是律师们更喜欢明确的许可。 + +OIN 所提供的许可填补了这个空白。它还明确的覆盖了 Linux 内核。据 Vetter 说,明确的专利许可并不是 GPLv2 中的必要部分,但是这个部分被加入到了 GPLv3 中。(LCTT 译注:Linux 内核采用的是 GPLv2 的许可) + +拿一个在 GPLv3 中写了10000行代码的代码编写者来说。随着时间推移,其他的代码编写者会贡献更多行的代码,也加入到了知识产权中。GPLv3 中的软件专利许可条款将基于所有参与的贡献者的专利,保护全部代码的使用,Vetter 如此说道。 + +### 并不完全一样 ### + +专利权和许可证在法律结构上层层叠叠互相覆盖。弄清两者对开源软件的作用就像是穿越雷区。 + +Vetter 说“通常,许可证是授予建立在专利和版权法律上的额外权利的法律结构。许可证被认为是给予了人们做一些的可能会侵犯到其他人的知识产权权利的事的许可。” + +Vetter 指出,很多自由开源许可证(例如 Mozilla 公共许可、GNU GPLv3 以及 Apache 软件许可)融合了某些互惠专利权的形式。Vetter 指出,像 BSD 和 MIT 这样旧的许可证不会提到专利。 + +一个软件的许可证让其他人可以在某种程度上使用这个编程人员创造的代码。版权对所属权的建立是自动的,只要某个人写或者画了某个原创的东西。然而,版权只覆盖了个别的表达方式和衍生的作品。他并没有涵盖代码的功能性或可用的想法。 + +专利涵盖了功能性。专利权还可以被许可。版权可能无法保护某人如何独立地开发对另一个人的代码的实现,但是专利填补了这个小瑕疵,Vetter 解释道。 + +### 寻找安全通道 ### + +许可证和专利混合的法律性质可能会对开源开发者产生威胁。据 [Chaotic Moon Studios][4] 的创办者之一、 [IEEE][5] 计算机协会成员 William Hurley 说,对于某些人来说,即使是 GPL 也会成为威胁。 + +“在很久以前,开源是个完全不同的世界。被彼此间的尊重和把代码视为艺术而非资产的观点所驱动,那时的程序和代码比现在更加的开放。我相信很多为最好的愿景所做的努力几乎最后总是背负着意外的结果,”Hurley 这样告诉 LinuxInsider。 + +他暗示说,成员人数超越了1000人(的组织)可能会在知识产权保护重要性方面意见不一。这可能会继续搅混开源生态系统这滩浑水。 + +“最终,这些显现出了围绕着知识产权的常见的一些错误概念。拥有几千个开发者并不会减少风险——而是增加。给出了专利许可的开发者越多,它们看起来就越值钱,”Hurley 说。“它们看起来越值钱,有着类似专利的或者其他知识产权的人就越可能试图利用并从中榨取他们自己的经济利益。” + +### 共享与竞争共存 ### + +竞合策略是开源的一部分。OIN 模型让各个公司能够决定他们将在哪竞争以及在哪合作,Bergelt 解释道。 + +“开源演化中的许多改变已经把我们移到了另一个方向上。我们必须为合作创造渠道。否则我们将会有几百个团体把数十亿美元花费到同样的技术上,”他说。 + +手机产业的革新就是个很好的例子。各个公司放出了不同的标准。没有共享,没有合作,Bergelt 解释道。 + +他说:“这让我们在美国接触技术的能力落后了七到十年。我们接触设备的经验远远落后于世界其他地方的人。在我们用不上 CDMA (Code Division Multiple Access 码分多址访问通信技术)时对 GSM (Global System for Mobile Communications 全球移动通信系统) 还沾沾自喜。” + +### 改变格局 ### + +OIN 在去年经历了激增400个新许可的增长。这意味着着开源有了新趋势。 + +Bergelt 说:“市场到达了一个临界点,组织内的人们终于意识到直白地合作和竞争的需要。结果是两件事同时进行。这可能会变得复杂、费力。” + +然而,这个由人们开始考虑合作和竞争的文化革新所驱动的转换过程是可以接受的。他解释说,这也是一个人们怎样拥抱开源的转变——尤其是在 Linux 这个开源社区的领导者项目。 + +还有一个迹象是,最具意义的新项目都没有在 GPLv3 许可下开发。 + +### 二个总比一个好 ### + +“GPL 极为重要,但是事实是有一堆的许可模型正被使用着。在 Eclipse、Apache 和 Berkeley 许可中,专利问题的相对可解决性通常远远低于在 GPLv3 中的。”Bergelt 说。 + +GPLv3 对于解决专利问题是个自然的补充——但是 GPL 自身不足以独自解决围绕专利使用的潜在冲突。所以 OIN 的设计是以能够补充版权许可为目的的,他补充道。 + +然而,层层叠叠的专利和许可也许并没有带来多少好处。到最后,专利在几乎所有的案例中都被用于攻击目的——而不是防御目的,Bergelt 暗示说。 + +“如果你不准备对其他人采取法律行动,那么对于你的知识产权来说专利可能并不是最佳的法律保护方式”,他说。“我们现在生活在一个对软件——开放的和专有的——误会重重的世界里。这些软件还被错误而过时的专利系统所捆绑。我们每天在工业化和被扼杀的创新中挣扎”,他说。 + +### 法院是最后的手段### + +想到 OIN 的出现抑制了诉讼的泛滥就感到十分欣慰,Bergelt 说,或者至少可以说 OIN 的出现扼制了特定的某些威胁。 + +“可以说我们让人们放下他们的武器。同时我们正在创建一种新的文化规范。一旦你入股这个模型中的非侵略专利,所产生的相关影响就是对合作的鼓励”,他说。 + +如果你愿意承诺合作,你的第一反应就会趋向于不急着起诉。相反的,你会想如何让我们允许你使用我们所拥有的东西并让它为你赚钱,而同时我们也能使用你所拥有的东西,Bergelt 解释道。 + +“OIN 是个多面的解决方式。它鼓励签署者创造双赢协议”,他说,“这让起诉成为最逼不得已的行为。那才是它的位置。” + +### 底线### + +Bergelt 坚信,OIN 的运作是为了阻止 Linux 受到专利伤害。在这个需要 Linux 的世界里没有诉讼的地方。 + +唯一临近的是与微软的移动之争,这关系到行业的发展前景(原文: The only thing that comes close are the mobile wars with Microsoft, which focus on elements high in the stack. 不太理解,请指正。)。那些来自法律的挑战可能是为了提高包括使用 Linux 产品的所属权的成本,Bergelt 说。 + +尽管如此“这些并不是有关 Linux 诉讼”,他说。“他们的重点并不在于 Linux 的核心。他们关注的是 Linux 系统里都有些什么。” + +-------------------------------------------------------------------------------- + +via: http://www.linuxinsider.com/story/Defending-the-Free-Linux-World-81512.html + +作者:Jack M. Germain +译者:[H-mudcup](https://github.com/H-mudcup) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://www.openinventionnetwork.com/ +[2]:http://www.redhat.com/ +[3]:http://www.law.uh.edu/ +[4]:http://www.chaoticmoon.com/ +[5]:http://www.ieee.org/ diff --git a/published/20150225 How to set up IPv6 BGP peering and filtering in Quagga BGP router.md b/published/201509/20150225 How to set up IPv6 BGP peering and filtering in Quagga BGP router.md similarity index 100% rename from published/20150225 How to set up IPv6 BGP peering and filtering in Quagga BGP router.md rename to published/201509/20150225 How to set up IPv6 BGP peering and filtering in Quagga BGP router.md diff --git a/published/201509/20150623 Shilpa Nair Shares Her Interview Experience on RedHat Linux Package Management.md b/published/201509/20150623 Shilpa Nair Shares Her Interview Experience on RedHat Linux Package Management.md new file mode 100644 index 0000000000..0ca331b72b --- /dev/null +++ b/published/201509/20150623 Shilpa Nair Shares Her Interview Experience on RedHat Linux Package Management.md @@ -0,0 +1,348 @@ +Shilpa Nair 分享的 RedHat Linux 包管理方面的面试经验 +======================================================================== +**Shilpa Nair 刚于2015年毕业。她之后去了一家位于 Noida,Delhi 的国家新闻电视台,应聘实习生的岗位。在她去年毕业季的时候,常逛 Tecmint 寻求作业上的帮助。从那时开始,她就常去 Tecmint。** + +![Linux Interview Questions on RPM](http://www.tecmint.com/wp-content/uploads/2015/06/Linux-Interview-Questions-on-RPM.jpeg) + +*有关 RPM 方面的 Linux 面试题* + +所有的问题和回答都是 Shilpa Nair 根据回忆重写的。 + +> “大家好!我是来自 Delhi 的Shilpa Nair。我不久前才顺利毕业,正寻找一个实习的机会。在大学早期的时候,我就对 UNIX 十分喜爱,所以我也希望这个机会能适合我,满足我的兴趣。我被提问了很多问题,大部分都是关于 RedHat 包管理的基础问题。” + +下面就是我被问到的问题,和对应的回答。我仅贴出了与 RedHat GNU/Linux 包管理相关的,也是主要被提问的。 + +### 1,Linux 里如何查找一个包安装与否?假设你需要确认 ‘nano’ 有没有安装,你怎么做? ### + +**回答**:为了确认 nano 软件包有没有安装,我们可以使用 rpm 命令,配合 -q 和 -a 选项来查询所有已安装的包 + + # rpm -qa nano + 或 + # rpm -qa | grep -i nano + + nano-2.3.1-10.el7.x86_64 + +同时包的名字必须是完整的,不完整的包名会返回到提示符,不打印任何东西,就是说这包(包名字不全)未安装。下面的例子会更好理解些: + +我们通常使用 vim 替代 vi 命令。当时如果我们查找安装包 vi/vim 的时候,我们就会看到标准输出上没有任何结果。 + + # vi + # vim + +尽管如此,我们仍然可以像上面一样运行 vi/vim 命令来清楚地知道包有没有安装。只是因为我们不知道它的完整包名才不能找到的。如果我们不确切知道完整的文件名,我们可以使用通配符: + + # rpm -qa vim* + + vim-minimal-7.4.160-1.el7.x86_64 + +通过这种方式,我们可以获得任何软件包的信息,安装与否。 + +### 2. 你如何使用 rpm 命令安装 XYZ 软件包? ### + +**回答**:我们可以使用 rpm 命令安装任何的软件包(*.rpm),像下面这样,选项 -i(安装),-v(冗余或者显示额外的信息)和 -h(在安装过程中,打印#号显示进度)。 + + # rpm -ivh peazip-1.11-1.el6.rf.x86_64.rpm + + Preparing... ################################# [100%] + Updating / installing... + 1:peazip-1.11-1.el6.rf ################################# [100%] + +如果要升级一个早期版本的包,应加上 -U 选项,选项 -v 和 -h 可以确保我们得到用 # 号表示的冗余输出,这增加了可读性。 + +### 3. 你已经安装了一个软件包(假设是 httpd),现在你想看看软件包创建并安装的所有文件和目录,你会怎么做? ### + +**回答**:使用选项 -l(列出所有文件)和 -q(查询)列出 httpd 软件包安装的所有文件(Linux 哲学:所有的都是文件,包括目录)。 + + # rpm -ql httpd + + /etc/httpd + /etc/httpd/conf + /etc/httpd/conf.d + ... + +### 4. 假如你要移除一个软件包,叫 postfix。你会怎么做? ### + +**回答**:首先我们需要知道什么包安装了 postfix。查找安装 postfix 的包名后,使用 -e(擦除/卸载软件包)和 -v(冗余输出)两个选项来实现。 + + # rpm -qa postfix* + + postfix-2.10.1-6.el7.x86_64 + +然后移除 postfix,如下: + + # rpm -ev postfix-2.10.1-6.el7.x86_64 + + Preparing packages... + postfix-2:3.0.1-2.fc22.x86_64 + +### 5. 获得一个已安装包的具体信息,如版本,发行号,安装日期,大小,总结和一个简短的描述。 ### + +**回答**:我们通过使用 rpm 的选项 -qi,后面接包名,可以获得关于一个已安装包的具体信息。 + +举个例子,为了获得 openssh 包的具体信息,我需要做的就是: + + # rpm -qi openssh + + [root@tecmint tecmint]# rpm -qi openssh + Name : openssh + Version : 6.8p1 + Release : 5.fc22 + Architecture: x86_64 + Install Date: Thursday 28 May 2015 12:34:50 PM IST + Group : Applications/Internet + Size : 1542057 + License : BSD + .... + +### 6. 假如你不确定一个指定包的配置文件在哪,比如 httpd。你如何找到所有 httpd 提供的配置文件列表和位置。 ### + +**回答**: 我们需要用选项 -c 接包名,这会列出所有配置文件的名字和他们的位置。 + + # rpm -qc httpd + + /etc/httpd/conf.d/autoindex.conf + /etc/httpd/conf.d/userdir.conf + /etc/httpd/conf.d/welcome.conf + /etc/httpd/conf.modules.d/00-base.conf + /etc/httpd/conf/httpd.conf + /etc/sysconfig/httpd + +相似地,我们可以列出所有相关的文档文件,如下: + + # rpm -qd httpd + + /usr/share/doc/httpd/ABOUT_APACHE + /usr/share/doc/httpd/CHANGES + /usr/share/doc/httpd/LICENSE + ... + +我们也可以列出所有相关的证书文件,如下: + + # rpm -qL openssh + + /usr/share/licenses/openssh/LICENCE + +忘了说明上面的选项 -d 和 -L 分别表示 “文档” 和 “证书”,抱歉。 + +### 7. 你找到了一个配置文件,位于‘/usr/share/alsa/cards/AACI.conf’,现在你不确定该文件属于哪个包。你如何查找出包的名字? ### + +**回答**:当一个包被安装后,相关的信息就存储在了数据库里。所以使用选项 -qf(-f 查询包拥有的文件)很容易追踪谁提供了上述的包。 + + # rpm -qf /usr/share/alsa/cards/AACI.conf + alsa-lib-1.0.28-2.el7.x86_64 + +类似地,我们可以查找(谁提供的)关于任何子包,文档和证书文件的信息。 + +### 8. 你如何使用 rpm 查找最近安装的软件列表? ### + +**回答**:如刚刚说的,每一样被安装的文件都记录在了数据库里。所以这并不难,通过查询 rpm 的数据库,找到最近安装软件的列表。 + +我们通过运行下面的命令,使用选项 -last(打印出最近安装的软件)达到目的。 + + # rpm -qa --last + +上面的命令会打印出所有安装的软件,最近安装的软件在列表的顶部。 + +如果我们关心的是找出特定的包,我们可以使用 grep 命令从列表中匹配包(假设是 sqlite ),简单如下: + + # rpm -qa --last | grep -i sqlite + + sqlite-3.8.10.2-1.fc22.x86_64 Thursday 18 June 2015 05:05:43 PM IST + +我们也可以获得10个最近安装的软件列表,简单如下: + + # rpm -qa --last | head + +我们可以重定义一下,输出想要的结果,简单如下: + + # rpm -qa --last | head -n 2 + +上面的命令中,-n 代表数目,后面接一个常数值。该命令是打印2个最近安装的软件的列表。 + +### 9. 安装一个包之前,你如果要检查其依赖。你会怎么做? ### + +**回答**:检查一个 rpm 包(XYZ.rpm)的依赖,我们可以使用选项 -q(查询包),-p(指定包名)和 -R(查询/列出该包依赖的包,嗯,就是依赖)。 + + # rpm -qpR gedit-3.16.1-1.fc22.i686.rpm + + /bin/sh + /usr/bin/env + glib2(x86-32) >= 2.40.0 + gsettings-desktop-schemas + gtk3(x86-32) >= 3.16 + gtksourceview3(x86-32) >= 3.16 + gvfs + libX11.so.6 + ... + +### 10. rpm 是不是一个前端的包管理工具呢? ### + +**回答**:**不是!**rpm 是一个后端管理工具,适用于基于 Linux 发行版的 RPM (此处指 Redhat Package Management)。 + +[YUM][1],全称 Yellowdog Updater Modified,是一个 RPM 的前端工具。YUM 命令自动完成所有工作,包括解决依赖和其他一切事务。 + +最近,[DNF][2](YUM命令升级版)在Fedora 22发行版中取代了 YUM。尽管 YUM 仍然可以在 RHEL 和 CentOS 平台使用,我们也可以安装 dnf,与 YUM 命令共存使用。据说 DNF 较于 YUM 有很多提高。 + +知道更多总是好的,保持自我更新。现在我们移步到前端部分来谈谈。 + +### 11. 你如何列出一个系统上面所有可用的仓库列表。 ### + +**回答**:简单地使用下面的命令,我们就可以列出一个系统上所有可用的仓库列表。 + + # yum repolist + 或 + # dnf repolist + + Last metadata expiration check performed 0:30:03 ago on Mon Jun 22 16:50:00 2015. + repo id repo name status + *fedora Fedora 22 - x86_64 44,762 + ozonos Repository for Ozon OS 61 + *updates Fedora 22 - x86_64 - Updates + +上面的命令仅会列出可用的仓库。如果你需要列出所有的仓库,不管可用与否,可以这样做。 + + # yum repolist all + 或 + # dnf repolist all + + Last metadata expiration check performed 0:29:45 ago on Mon Jun 22 16:50:00 2015. + repo id repo name status + *fedora Fedora 22 - x86_64 enabled: 44,762 + fedora-debuginfo Fedora 22 - x86_64 - Debug disabled + fedora-source Fedora 22 - Source disabled + ozonos Repository for Ozon OS enabled: 61 + *updates Fedora 22 - x86_64 - Updates enabled: 5,018 + updates-debuginfo Fedora 22 - x86_64 - Updates - Debug + +### 12. 你如何列出一个系统上所有可用并且安装了的包? ### + +**回答**:列出一个系统上所有可用的包,我们可以这样做: + + # yum list available + 或 + # dnf list available + + ast metadata expiration check performed 0:34:09 ago on Mon Jun 22 16:50:00 2015. + Available Packages + 0ad.x86_64 0.0.18-1.fc22 fedora + 0ad-data.noarch 0.0.18-1.fc22 fedora + 0install.x86_64 2.6.1-2.fc21 fedora + 0xFFFF.x86_64 0.3.9-11.fc22 fedora + 2048-cli.x86_64 0.9-4.git20141214.723738c.fc22 fedora + 2048-cli-nocurses.x86_64 0.9-4.git20141214.723738c.fc22 fedora + .... + +而列出一个系统上所有已安装的包,我们可以这样做。 + + # yum list installed + 或 + # dnf list installed + + Last metadata expiration check performed 0:34:30 ago on Mon Jun 22 16:50:00 2015. + Installed Packages + GeoIP.x86_64 1.6.5-1.fc22 @System + GeoIP-GeoLite-data.noarch 2015.05-1.fc22 @System + NetworkManager.x86_64 1:1.0.2-1.fc22 @System + NetworkManager-libnm.x86_64 1:1.0.2-1.fc22 @System + aajohan-comfortaa-fonts.noarch 2.004-4.fc22 @System + .... + +而要同时满足两个要求的时候,我们可以这样做。 + + # yum list + 或 + # dnf list + + Last metadata expiration check performed 0:32:56 ago on Mon Jun 22 16:50:00 2015. + Installed Packages + GeoIP.x86_64 1.6.5-1.fc22 @System + GeoIP-GeoLite-data.noarch 2015.05-1.fc22 @System + NetworkManager.x86_64 1:1.0.2-1.fc22 @System + NetworkManager-libnm.x86_64 1:1.0.2-1.fc22 @System + aajohan-comfortaa-fonts.noarch 2.004-4.fc22 @System + acl.x86_64 2.2.52-7.fc22 @System + .... + +### 13. 你会怎么在一个系统上面使用 YUM 或 DNF 分别安装和升级一个包与一组包? ### + +**回答**:安装一个包(假设是 nano),我们可以这样做, + + # yum install nano + +而安装一组包(假设是 Haskell),我们可以这样做, + + # yum groupinstall 'haskell' + +升级一个包(还是 nano),我们可以这样做, + + # yum update nano + +而为了升级一组包(还是 haskell),我们可以这样做, + + # yum groupupdate 'haskell' + +### 14. 你会如何同步一个系统上面的所有安装软件到稳定发行版? ### + +**回答**:我们可以一个系统上(假设是 CentOS 或者 Fedora)的所有包到稳定发行版,如下, + + # yum distro-sync [在 CentOS/ RHEL] + 或 + # dnf distro-sync [在 Fedora 20之后版本] + +似乎来面试之前你做了相当不多的功课,很好!在进一步交谈前,我还想问一两个问题。 + +### 15. 你对 YUM 本地仓库熟悉吗?你尝试过建立一个本地 YUM 仓库吗?让我们简单看看你会怎么建立一个本地 YUM 仓库。 ### + +**回答**:首先,感谢你的夸奖。回到问题,我必须承认我对本地 YUM 仓库十分熟悉,并且在我的本地主机上也部署过,作为测试用。 + +1、 为了建立本地 YUM 仓库,我们需要安装下面三个包: + + # yum install deltarpm python-deltarpm createrepo + +2、 新建一个目录(假设 /home/$USER/rpm),然后复制 RedHat/CentOS DVD 上的 RPM 包到这个文件夹下 + + # mkdir /home/$USER/rpm + # cp /path/to/rpm/on/DVD/*.rpm /home/$USER/rpm + +3、 新建基本的库头文件如下。 + + # createrepo -v /home/$USER/rpm + +4、 在路径 /etc/yum.repo.d 下创建一个 .repo 文件(如 abc.repo): + + cd /etc/yum.repos.d && cat << EOF abc.repo + [local-installation]name=yum-local + baseurl=file:///home/$USER/rpm + enabled=1 + gpgcheck=0 + EOF + +**重要**:用你的用户名替换掉 $USER。 + +以上就是创建一个本地 YUM 仓库所要做的全部工作。我们现在可以从这里安装软件了,相对快一些,安全一些,并且最重要的是不需要 Internet 连接。 + +好了!面试过程很愉快。我已经问完了。我会将你推荐给 HR。你是一个年轻且十分聪明的候选者,我们很愿意你加入进来。如果你有任何问题,你可以问我。 + +**我**:谢谢,这确实是一次愉快的面试,我感到今天非常幸运,可以搞定这次面试... + +显然,不会在这里结束。我问了很多问题,比如他们正在做的项目。我会担任什么角色,负责什么,,,balabalabala + +小伙伴们,这之后的 3 天会经过 HR 轮,到时候所有问题到时候也会被写成文档。希望我当时表现不错。感谢你们所有的祝福。 + +谢谢伙伴们和 Tecmint,花时间来编辑我的面试经历。我相信 Tecmint 好伙伴们做了很大的努力,必要要赞一个。当我们与他人分享我们的经历的时候,其他人从我们这里知道了更多,而我们自己则发现了自己的不足。 + +这增加了我们的信心。如果你最近也有任何类似的面试经历,别自己蔵着。分享出来!让我们所有人都知道。你可以使用如下的表单来与我们分享你的经历。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-rpm-package-management-interview-questions/ + +作者:[Avishek Kumar][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ +[2]:https://linux.cn/article-5718-1.html diff --git a/published/20150722 Howto Interactively Perform Tasks with Docker using Kitematic.md b/published/201509/20150722 Howto Interactively Perform Tasks with Docker using Kitematic.md similarity index 100% rename from published/20150722 Howto Interactively Perform Tasks with Docker using Kitematic.md rename to published/201509/20150722 Howto Interactively Perform Tasks with Docker using Kitematic.md diff --git a/published/201509/20150728 Process of the Linux kernel building.md b/published/201509/20150728 Process of the Linux kernel building.md new file mode 100644 index 0000000000..13610c77f2 --- /dev/null +++ b/published/201509/20150728 Process of the Linux kernel building.md @@ -0,0 +1,690 @@ +你知道 Linux 内核是如何构建的吗? +================================================================================ + +###介绍 + +我不会告诉你怎么在自己的电脑上去构建、安装一个定制化的 Linux 内核,这样的[资料](https://encrypted.google.com/search?q=building+linux+kernel#q=building+linux+kernel+from+source+code)太多了,它们会对你有帮助。本文会告诉你当你在内核源码路径里敲下`make` 时会发生什么。 + +当我刚刚开始学习内核代码时,[Makefile](https://github.com/torvalds/linux/blob/master/Makefile) 是我打开的第一个文件,这个文件看起来真令人害怕 :)。那时候这个 [Makefile](https://en.wikipedia.org/wiki/Make_%28software%29) 还只包含了`1591` 行代码,当我开始写本文时,内核已经是[4.2.0的第三个候选版本](https://github.com/torvalds/linux/commit/52721d9d3334c1cb1f76219a161084094ec634dc) 了。 + +这个 makefile 是 Linux 内核代码的根 makefile ,内核构建就始于此处。是的,它的内容很多,但是如果你已经读过内核源代码,你就会发现每个包含代码的目录都有一个自己的 makefile。当然了,我们不会去描述每个代码文件是怎么编译链接的,所以我们将只会挑选一些通用的例子来说明问题。而你不会在这里找到构建内核的文档、如何整洁内核代码、[tags](https://en.wikipedia.org/wiki/Ctags) 的生成和[交叉编译](https://en.wikipedia.org/wiki/Cross_compiler) 相关的说明,等等。我们将从`make` 开始,使用标准的内核配置文件,到生成了内核镜像 [bzImage](https://en.wikipedia.org/wiki/Vmlinux#bzImage) 结束。 + +如果你已经很了解 [make](https://en.wikipedia.org/wiki/Make_%28software%29) 工具那是最好,但是我也会描述本文出现的相关代码。 + +让我们开始吧! + + +###编译内核前的准备 + +在开始编译前要进行很多准备工作。最主要的就是找到并配置好配置文件,`make` 命令要使用到的参数都需要从这些配置文件获取。现在就让我们深入内核的根 `makefile` 吧 + +内核的根 `Makefile` 负责构建两个主要的文件:[vmlinux](https://en.wikipedia.org/wiki/Vmlinux) (内核镜像可执行文件)和模块文件。内核的 [Makefile](https://github.com/torvalds/linux/blob/master/Makefile) 从定义如下变量开始: + +```Makefile +VERSION = 4 +PATCHLEVEL = 2 +SUBLEVEL = 0 +EXTRAVERSION = -rc3 +NAME = Hurr durr I'ma sheep +``` + +这些变量决定了当前内核的版本,并且被使用在很多不同的地方,比如同一个 `Makefile` 中的 `KERNELVERSION` : + +```Makefile +KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) +``` + +接下来我们会看到很多`ifeq` 条件判断语句,它们负责检查传递给 `make` 的参数。内核的 `Makefile` 提供了一个特殊的编译选项 `make help` ,这个选项可以生成所有的可用目标和一些能传给 `make` 的有效的命令行参数。举个例子,`make V=1` 会在构建过程中输出详细的编译信息,第一个 `ifeq` 就是检查传递给 make 的 `V=n` 选项。 + +```Makefile +ifeq ("$(origin V)", "command line") + KBUILD_VERBOSE = $(V) +endif +ifndef KBUILD_VERBOSE + KBUILD_VERBOSE = 0 +endif + +ifeq ($(KBUILD_VERBOSE),1) + quiet = + Q = +else + quiet=quiet_ + Q = @ +endif + +export quiet Q KBUILD_VERBOSE +``` +如果 `V=n` 这个选项传给了 `make` ,系统就会给变量 `KBUILD_VERBOSE` 选项附上 `V` 的值,否则的话`KBUILD_VERBOSE` 就会为 `0`。然后系统会检查 `KBUILD_VERBOSE` 的值,以此来决定 `quiet` 和`Q` 的值。符号 `@` 控制命令的输出,如果它被放在一个命令之前,这条命令的输出将会是 `CC scripts/mod/empty.o`,而不是`Compiling .... scripts/mod/empty.o`(LCTT 译注:CC 在 makefile 中一般都是编译命令)。在这段最后,系统导出了所有的变量。 + +下一个 `ifeq` 语句检查的是传递给 `make` 的选项 `O=/dir`,这个选项允许在指定的目录 `dir` 输出所有的结果文件: + +```Makefile +ifeq ($(KBUILD_SRC),) + +ifeq ("$(origin O)", "command line") + KBUILD_OUTPUT := $(O) +endif + +ifneq ($(KBUILD_OUTPUT),) +saved-output := $(KBUILD_OUTPUT) +KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ + && /bin/pwd) +$(if $(KBUILD_OUTPUT),, \ + $(error failed to create output directory "$(saved-output)")) + +sub-make: FORCE + $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \ + -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) + +skip-makefile := 1 +endif # ifneq ($(KBUILD_OUTPUT),) +endif # ifeq ($(KBUILD_SRC),) +``` + +系统会检查变量 `KBUILD_SRC`,它代表内核代码的顶层目录,如果它是空的(第一次执行 makefile 时总是空的),我们会设置变量 `KBUILD_OUTPUT` 为传递给选项 `O` 的值(如果这个选项被传进来了)。下一步会检查变量 `KBUILD_OUTPUT` ,如果已经设置好,那么接下来会做以下几件事: + +* 将变量 `KBUILD_OUTPUT` 的值保存到临时变量 `saved-output`; +* 尝试创建给定的输出目录; +* 检查创建的输出目录,如果失败了就打印错误; +* 如果成功创建了输出目录,那么就在新目录重新执行 `make` 命令(参见选项`-C`)。 + +下一个 `ifeq` 语句会检查传递给 make 的选项 `C` 和 `M`: + +```Makefile +ifeq ("$(origin C)", "command line") + KBUILD_CHECKSRC = $(C) +endif +ifndef KBUILD_CHECKSRC + KBUILD_CHECKSRC = 0 +endif + +ifeq ("$(origin M)", "command line") + KBUILD_EXTMOD := $(M) +endif +``` + +第一个选项 `C` 会告诉 `makefile` 需要使用环境变量 `$CHECK` 提供的工具来检查全部 `c` 代码,默认情况下会使用[sparse](https://en.wikipedia.org/wiki/Sparse)。第二个选项 `M` 会用来编译外部模块(本文不做讨论)。 + +系统还会检查变量 `KBUILD_SRC`,如果 `KBUILD_SRC` 没有被设置,系统会设置变量 `srctree` 为`.`: + +```Makefile +ifeq ($(KBUILD_SRC),) + srctree := . +endif + +objtree := . +src := $(srctree) +obj := $(objtree) + +export srctree objtree VPATH +``` + +这将会告诉 `Makefile` 内核的源码树就在执行 `make` 命令的目录,然后要设置 `objtree` 和其他变量为这个目录,并且将这些变量导出。接着就是要获取 `SUBARCH` 的值,这个变量代表了当前的系统架构(LCTT 译注:一般都指CPU 架构): + +```Makefile +SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ + -e s/sun4u/sparc64/ \ + -e s/arm.*/arm/ -e s/sa110/arm/ \ + -e s/s390x/s390/ -e s/parisc64/parisc/ \ + -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ + -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) +``` + +如你所见,系统执行 [uname](https://en.wikipedia.org/wiki/Uname) 得到机器、操作系统和架构的信息。因为我们得到的是 `uname` 的输出,所以我们需要做一些处理再赋给变量 `SUBARCH` 。获得 `SUBARCH` 之后就要设置`SRCARCH` 和 `hfr-arch`,`SRCARCH` 提供了硬件架构相关代码的目录,`hfr-arch` 提供了相关头文件的目录: + +```Makefile +ifeq ($(ARCH),i386) + SRCARCH := x86 +endif +ifeq ($(ARCH),x86_64) + SRCARCH := x86 +endif + +hdr-arch := $(SRCARCH) +``` + +注意:`ARCH` 是 `SUBARCH` 的别名。如果没有设置过代表内核配置文件路径的变量 `KCONFIG_CONFIG`,下一步系统会设置它,默认情况下就是 `.config` : + +```Makefile +KCONFIG_CONFIG ?= .config +export KCONFIG_CONFIG +``` + +以及编译内核过程中要用到的 [shell](https://en.wikipedia.org/wiki/Shell_%28computing%29) + +```Makefile +CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ + else if [ -x /bin/bash ]; then echo /bin/bash; \ + else echo sh; fi ; fi) +``` + +接下来就要设置一组和编译内核的编译器相关的变量。我们会设置主机的 `C` 和 `C++` 的编译器及相关配置项: + +```Makefile +HOSTCC = gcc +HOSTCXX = g++ +HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 +HOSTCXXFLAGS = -O2 +``` + +接下来会去适配代表编译器的变量 `CC`,那为什么还要 `HOST*` 这些变量呢?这是因为 `CC` 是编译内核过程中要使用的目标架构的编译器,但是 `HOSTCC` 是要被用来编译一组 `host` 程序的(下面我们就会看到)。 + +然后我们就看到变量 `KBUILD_MODULES` 和 `KBUILD_BUILTIN` 的定义,这两个变量决定了我们要编译什么东西(内核、模块或者两者): + +```Makefile +KBUILD_MODULES := +KBUILD_BUILTIN := 1 + +ifeq ($(MAKECMDGOALS),modules) + KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) +endif +``` + +在这我们可以看到这些变量的定义,并且,如果们仅仅传递了 `modules` 给 `make`,变量 `KBUILD_BUILTIN` 会依赖于内核配置选项 `CONFIG_MODVERSIONS`。 + +下一步操作是引入下面的文件: + +```Makefile +include scripts/Kbuild.include +``` + +文件 [Kbuild](https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kbuild.txt) 或者又叫做 `Kernel Build System` 是一个用来管理构建内核及其模块的特殊框架。`kbuild` 文件的语法与 makefile 一样。文件[scripts/Kbuild.include](https://github.com/torvalds/linux/blob/master/scripts/Kbuild.include) 为 `kbuild` 系统提供了一些常规的定义。因为我们包含了这个 `kbuild` 文件,我们可以看到和不同工具关联的这些变量的定义,这些工具会在内核和模块编译过程中被使用(比如链接器、编译器、来自 [binutils](http://www.gnu.org/software/binutils/) 的二进制工具包 ,等等): + +```Makefile +AS = $(CROSS_COMPILE)as +LD = $(CROSS_COMPILE)ld +CC = $(CROSS_COMPILE)gcc +CPP = $(CC) -E +AR = $(CROSS_COMPILE)ar +NM = $(CROSS_COMPILE)nm +STRIP = $(CROSS_COMPILE)strip +OBJCOPY = $(CROSS_COMPILE)objcopy +OBJDUMP = $(CROSS_COMPILE)objdump +AWK = awk +... +... +... +``` + +在这些定义好的变量后面,我们又定义了两个变量:`USERINCLUDE` 和 `LINUXINCLUDE`。他们包含了头文件的路径(第一个是给用户用的,第二个是给内核用的): + +```Makefile +USERINCLUDE := \ + -I$(srctree)/arch/$(hdr-arch)/include/uapi \ + -Iarch/$(hdr-arch)/include/generated/uapi \ + -I$(srctree)/include/uapi \ + -Iinclude/generated/uapi \ + -include $(srctree)/include/linux/kconfig.h + +LINUXINCLUDE := \ + -I$(srctree)/arch/$(hdr-arch)/include \ + ... +``` + +以及给 C 编译器的标准标志: + +```Makefile +KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ + -fno-strict-aliasing -fno-common \ + -Werror-implicit-function-declaration \ + -Wno-format-security \ + -std=gnu89 +``` + +这并不是最终确定的编译器标志,它们还可以在其他 makefile 里面更新(比如 `arch/` 里面的 kbuild)。变量定义完之后,全部会被导出供其他 makefile 使用。 + +下面的两个变量 `RCS_FIND_IGNORE` 和 `RCS_TAR_IGNORE` 包含了被版本控制系统忽略的文件: + +```Makefile +export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ + -name CVS -o -name .pc -o -name .hg -o -name .git \) \ + -prune -o +export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \ + --exclude CVS --exclude .pc --exclude .hg --exclude .git +``` + +这就是全部了,我们已经完成了所有的准备工作,下一个点就是如果构建`vmlinux`。 + +###直面内核构建 + +现在我们已经完成了所有的准备工作,根 makefile(注:内核根目录下的 makefile)的下一步工作就是和编译内核相关的了。在这之前,我们不会在终端看到 `make` 命令输出的任何东西。但是现在编译的第一步开始了,这里我们需要从内核根 makefile 的 [598](https://github.com/torvalds/linux/blob/master/Makefile#L598) 行开始,这里可以看到目标`vmlinux`: + +```Makefile +all: vmlinux + include arch/$(SRCARCH)/Makefile +``` + +不要操心我们略过的从 `export RCS_FIND_IGNORE.....` 到 `all: vmlinux.....` 这一部分 makefile 代码,他们只是负责根据各种配置文件(`make *.config`)生成不同目标内核的,因为之前我就说了这一部分我们只讨论构建内核的通用途径。 + +目标 `all:` 是在命令行如果不指定具体目标时默认使用的目标。你可以看到这里包含了架构相关的 makefile(在这里就指的是 [arch/x86/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/Makefile))。从这一时刻起,我们会从这个 makefile 继续进行下去。如我们所见,目标 `all` 依赖于根 makefile 后面声明的 `vmlinux`: + +```Makefile +vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) FORCE +``` + +`vmlinux` 是 linux 内核的静态链接可执行文件格式。脚本 [scripts/link-vmlinux.sh](https://github.com/torvalds/linux/blob/master/scripts/link-vmlinux.sh) 把不同的编译好的子模块链接到一起形成了 vmlinux。 + +第二个目标是 `vmlinux-deps`,它的定义如下: + +```Makefile +vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) +``` + +它是由内核代码下的每个顶级目录的 `built-in.o` 组成的。之后我们还会检查内核所有的目录,`kbuild` 会编译各个目录下所有的对应 `$(obj-y)` 的源文件。接着调用 `$(LD) -r` 把这些文件合并到一个 `build-in.o` 文件里。此时我们还没有`vmlinux-deps`,所以目标 `vmlinux` 现在还不会被构建。对我而言 `vmlinux-deps` 包含下面的文件: + +``` +arch/x86/kernel/vmlinux.lds arch/x86/kernel/head_64.o +arch/x86/kernel/head64.o arch/x86/kernel/head.o +init/built-in.o usr/built-in.o +arch/x86/built-in.o kernel/built-in.o +mm/built-in.o fs/built-in.o +ipc/built-in.o security/built-in.o +crypto/built-in.o block/built-in.o +lib/lib.a arch/x86/lib/lib.a +lib/built-in.o arch/x86/lib/built-in.o +drivers/built-in.o sound/built-in.o +firmware/built-in.o arch/x86/pci/built-in.o +arch/x86/power/built-in.o arch/x86/video/built-in.o +net/built-in.o +``` + +下一个可以被执行的目标如下: + +```Makefile +$(sort $(vmlinux-deps)): $(vmlinux-dirs) ; +$(vmlinux-dirs): prepare scripts + $(Q)$(MAKE) $(build)=$@ +``` + +就像我们看到的,`vmlinux-dir` 依赖于两部分:`prepare` 和 `scripts`。第一个 `prepare` 定义在内核的根 `makefile` 中,准备工作分成三个阶段: + +```Makefile +prepare: prepare0 +prepare0: archprepare FORCE + $(Q)$(MAKE) $(build)=. +archprepare: archheaders archscripts prepare1 scripts_basic + +prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ + include/config/auto.conf + $(cmd_crmodverdir) +prepare2: prepare3 outputmakefile asm-generic +``` + +第一个 `prepare0` 展开到 `archprepare` ,后者又展开到 `archheader` 和 `archscripts`,这两个变量定义在 `x86_64` 相关的 [Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/Makefile)。让我们看看这个文件。`x86_64` 特定的 makefile 从变量定义开始,这些变量都是和特定架构的配置文件 ([defconfig](https://github.com/torvalds/linux/tree/master/arch/x86/configs),等等)有关联。在定义了编译 [16-bit](https://en.wikipedia.org/wiki/Real_mode) 代码的编译选项之后,根据变量 `BITS` 的值,如果是 `32`, 汇编代码、链接器、以及其它很多东西(全部的定义都可以在[arch/x86/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/Makefile)找到)对应的参数就是 `i386`,而 `64` 就对应的是 `x86_84`。 + +第一个目标是 makefile 生成的系统调用列表(syscall table)中的 `archheaders` : + +```Makefile +archheaders: + $(Q)$(MAKE) $(build)=arch/x86/entry/syscalls all +``` + +第二个目标是 makefile 里的 `archscripts`: + +```Makefile +archscripts: scripts_basic + $(Q)$(MAKE) $(build)=arch/x86/tools relocs +``` + + 我们可以看到 `archscripts` 是依赖于根 [Makefile](https://github.com/torvalds/linux/blob/master/Makefile)里的`scripts_basic` 。首先我们可以看出 `scripts_basic` 是按照 [scripts/basic](https://github.com/torvalds/linux/blob/master/scripts/basic/Makefile) 的 makefile 执行 make 的: + +```Maklefile +scripts_basic: + $(Q)$(MAKE) $(build)=scripts/basic +``` + +`scripts/basic/Makefile` 包含了编译两个主机程序 `fixdep` 和 `bin2` 的目标: + +```Makefile +hostprogs-y := fixdep +hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c +always := $(hostprogs-y) + +$(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep +``` + +第一个工具是 `fixdep`:用来优化 [gcc](https://gcc.gnu.org/) 生成的依赖列表,然后在重新编译源文件的时候告诉make。第二个工具是 `bin2c`,它依赖于内核配置选项 `CONFIG_BUILD_BIN2C`,并且它是一个用来将标准输入接口(LCTT 译注:即 stdin)收到的二进制流通过标准输出接口(即:stdout)转换成 C 头文件的非常小的 C 程序。你可能注意到这里有些奇怪的标志,如 `hostprogs-y` 等。这个标志用于所有的 `kbuild` 文件,更多的信息你可以从[documentation](https://github.com/torvalds/linux/blob/master/Documentation/kbuild/makefiles.txt) 获得。在我们这里, `hostprogs-y` 告诉 `kbuild` 这里有个名为 `fixed` 的程序,这个程序会通过和 `Makefile` 相同目录的 `fixdep.c` 编译而来。 + +执行 make 之后,终端的第一个输出就是 `kbuild` 的结果: + +``` +$ make + HOSTCC scripts/basic/fixdep +``` + +当目标 `script_basic` 被执行,目标 `archscripts` 就会 make [arch/x86/tools](https://github.com/torvalds/linux/blob/master/arch/x86/tools/Makefile) 下的 makefile 和目标 `relocs`: + +```Makefile +$(Q)$(MAKE) $(build)=arch/x86/tools relocs +``` + +包含了[重定位](https://en.wikipedia.org/wiki/Relocation_%28computing%29) 的信息的代码 `relocs_32.c` 和 `relocs_64.c` 将会被编译,这可以在`make` 的输出中看到: + +```Makefile + HOSTCC arch/x86/tools/relocs_32.o + HOSTCC arch/x86/tools/relocs_64.o + HOSTCC arch/x86/tools/relocs_common.o + HOSTLD arch/x86/tools/relocs +``` + +在编译完 `relocs.c` 之后会检查 `version.h`: + +```Makefile +$(version_h): $(srctree)/Makefile FORCE + $(call filechk,version.h) + $(Q)rm -f $(old_version_h) +``` + +我们可以在输出看到它: + +``` +CHK include/config/kernel.release +``` + +以及在内核的根 Makefiel 使用 `arch/x86/include/generated/asm` 的目标 `asm-generic` 来构建 `generic` 汇编头文件。在目标 `asm-generic` 之后,`archprepare` 就完成了,所以目标 `prepare0` 会接着被执行,如我上面所写: + +```Makefile +prepare0: archprepare FORCE + $(Q)$(MAKE) $(build)=. +``` + +注意 `build`,它是定义在文件 [scripts/Kbuild.include](https://github.com/torvalds/linux/blob/master/scripts/Kbuild.include),内容是这样的: + +```Makefile +build := -f $(srctree)/scripts/Makefile.build obj +``` + +或者在我们的例子中,它就是当前源码目录路径:`.`: + +```Makefile +$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.build obj=. +``` + +脚本 [scripts/Makefile.build](https://github.com/torvalds/linux/blob/master/scripts/Makefile.build) 通过参数 `obj` 给定的目录找到 `Kbuild` 文件,然后引入 `kbuild` 文件: + +```Makefile +include $(kbuild-file) +``` + +并根据这个构建目标。我们这里 `.` 包含了生成 `kernel/bounds.s` 和 `arch/x86/kernel/asm-offsets.s` 的 [Kbuild](https://github.com/torvalds/linux/blob/master/Kbuild) 文件。在此之后,目标 `prepare` 就完成了它的工作。 `vmlinux-dirs` 也依赖于第二个目标 `scripts` ,它会编译接下来的几个程序:`filealias`,`mk_elfconfig`,`modpost` 等等。之后,`scripts/host-programs` 就可以开始编译我们的目标 `vmlinux-dirs` 了。 + +首先,我们先来理解一下 `vmlinux-dirs` 都包含了那些东西。在我们的例子中它包含了下列内核目录的路径: + +``` +init usr arch/x86 kernel mm fs ipc security crypto block +drivers sound firmware arch/x86/pci arch/x86/power +arch/x86/video net lib arch/x86/lib +``` + +我们可以在内核的根 [Makefile](https://github.com/torvalds/linux/blob/master/Makefile) 里找到 `vmlinux-dirs` 的定义: + +```Makefile +vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ + $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ + $(net-y) $(net-m) $(libs-y) $(libs-m))) + +init-y := init/ +drivers-y := drivers/ sound/ firmware/ +net-y := net/ +libs-y := lib/ +... +... +... +``` + +这里我们借助函数 `patsubst` 和 `filter`去掉了每个目录路径里的符号 `/`,并且把结果放到 `vmlinux-dirs` 里。所以我们就有了 `vmlinux-dirs` 里的目录列表,以及下面的代码: + +```Makefile +$(vmlinux-dirs): prepare scripts + $(Q)$(MAKE) $(build)=$@ +``` + +符号 `$@` 在这里代表了 `vmlinux-dirs`,这就表明程序会递归遍历从 `vmlinux-dirs` 以及它内部的全部目录(依赖于配置),并且在对应的目录下执行 `make` 命令。我们可以在输出看到结果: + +``` + CC init/main.o + CHK include/generated/compile.h + CC init/version.o + CC init/do_mounts.o + ... + CC arch/x86/crypto/glue_helper.o + AS arch/x86/crypto/aes-x86_64-asm_64.o + CC arch/x86/crypto/aes_glue.o + ... + AS arch/x86/entry/entry_64.o + AS arch/x86/entry/thunk_64.o + CC arch/x86/entry/syscall_64.o +``` + +每个目录下的源代码将会被编译并且链接到 `built-io.o` 里: + +``` +$ find . -name built-in.o +./arch/x86/crypto/built-in.o +./arch/x86/crypto/sha-mb/built-in.o +./arch/x86/net/built-in.o +./init/built-in.o +./usr/built-in.o +... +... +``` + +好了,所有的 `built-in.o` 都构建完了,现在我们回到目标 `vmlinux` 上。你应该还记得,目标 `vmlinux` 是在内核的根makefile 里。在链接 `vmlinux` 之前,系统会构建 [samples](https://github.com/torvalds/linux/tree/master/samples), [Documentation](https://github.com/torvalds/linux/tree/master/Documentation) 等等,但是如上文所述,我不会在本文描述这些。 + +```Makefile +vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) FORCE + ... + ... + +$(call if_changed,link-vmlinux) +``` + +你可以看到,调用脚本 [scripts/link-vmlinux.sh](https://github.com/torvalds/linux/blob/master/scripts/link-vmlinux.sh) 的主要目的是把所有的 `built-in.o` 链接成一个静态可执行文件,和生成 [System.map](https://en.wikipedia.org/wiki/System.map)。 最后我们来看看下面的输出: + +``` + LINK vmlinux + LD vmlinux.o + MODPOST vmlinux.o + GEN .version + CHK include/generated/compile.h + UPD include/generated/compile.h + CC init/version.o + LD init/built-in.o + KSYM .tmp_kallsyms1.o + KSYM .tmp_kallsyms2.o + LD vmlinux + SORTEX vmlinux + SYSMAP System.map +``` + +`vmlinux` 和`System.map` 生成在内核源码树根目录下。 + +``` +$ ls vmlinux System.map +System.map vmlinux +``` + +这就是全部了,`vmlinux` 构建好了,下一步就是创建 [bzImage](https://en.wikipedia.org/wiki/Vmlinux#bzImage). + +###制作bzImage + +`bzImage` 就是压缩了的 linux 内核镜像。我们可以在构建了 `vmlinux` 之后通过执行 `make bzImage` 获得`bzImage`。同时我们可以仅仅执行 `make` 而不带任何参数也可以生成 `bzImage` ,因为它是在 [arch/x86/kernel/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/Makefile) 里预定义的、默认生成的镜像: + +```Makefile +all: bzImage +``` + +让我们看看这个目标,它能帮助我们理解这个镜像是怎么构建的。我已经说过了 `bzImage` 是被定义在 [arch/x86/kernel/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/Makefile),定义如下: + +```Makefile +bzImage: vmlinux + $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) + $(Q)mkdir -p $(objtree)/arch/$(UTS_MACHINE)/boot + $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/$(UTS_MACHINE)/boot/$@ +``` + +在这里我们可以看到第一次为 boot 目录执行 `make`,在我们的例子里是这样的: + +```Makefile +boot := arch/x86/boot +``` + +现在的主要目标是编译目录 `arch/x86/boot` 和 `arch/x86/boot/compressed` 的代码,构建 `setup.bin` 和 `vmlinux.bin`,最后用这两个文件生成 `bzImage`。第一个目标是定义在 [arch/x86/boot/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/boot/Makefile) 的 `$(obj)/setup.elf`: + +```Makefile +$(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE + $(call if_changed,ld) +``` + +我们已经在目录 `arch/x86/boot` 有了链接脚本 `setup.ld`,和扩展到 `boot` 目录下全部源代码的变量 `SETUP_OBJS` 。我们可以看看第一个输出: + +```Makefile + AS arch/x86/boot/bioscall.o + CC arch/x86/boot/cmdline.o + AS arch/x86/boot/copy.o + HOSTCC arch/x86/boot/mkcpustr + CPUSTR arch/x86/boot/cpustr.h + CC arch/x86/boot/cpu.o + CC arch/x86/boot/cpuflags.o + CC arch/x86/boot/cpucheck.o + CC arch/x86/boot/early_serial_console.o + CC arch/x86/boot/edd.o +``` + +下一个源码文件是 [arch/x86/boot/header.S](https://github.com/torvalds/linux/blob/master/arch/x86/boot/header.S),但是我们不能现在就编译它,因为这个目标依赖于下面两个头文件: + +```Makefile +$(obj)/header.o: $(obj)/voffset.h $(obj)/zoffset.h +``` + +第一个头文件 `voffset.h` 是使用 `sed` 脚本生成的,包含用 `nm` 工具从 `vmlinux` 获取的两个地址: + +```C +#define VO__end 0xffffffff82ab0000 +#define VO__text 0xffffffff81000000 +``` + +这两个地址是内核的起始和结束地址。第二个头文件 `zoffset.h` 在 [arch/x86/boot/compressed/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/boot/compressed/Makefile) 可以看出是依赖于目标 `vmlinux`的: + +```Makefile +$(obj)/zoffset.h: $(obj)/compressed/vmlinux FORCE + $(call if_changed,zoffset) +``` + +目标 `$(obj)/compressed/vmlinux` 依赖于 `vmlinux-objs-y` —— 说明需要编译目录 [arch/x86/boot/compressed](https://github.com/torvalds/linux/tree/master/arch/x86/boot/compressed) 下的源代码,然后生成 `vmlinux.bin`、`vmlinux.bin.bz2`,和编译工具 `mkpiggy`。我们可以在下面的输出看出来: + +```Makefile + LDS arch/x86/boot/compressed/vmlinux.lds + AS arch/x86/boot/compressed/head_64.o + CC arch/x86/boot/compressed/misc.o + CC arch/x86/boot/compressed/string.o + CC arch/x86/boot/compressed/cmdline.o + OBJCOPY arch/x86/boot/compressed/vmlinux.bin + BZIP2 arch/x86/boot/compressed/vmlinux.bin.bz2 + HOSTCC arch/x86/boot/compressed/mkpiggy +``` + +`vmlinux.bin` 是去掉了调试信息和注释的 `vmlinux` 二进制文件,加上了占用了 `u32` (LCTT 译注:即4-Byte)的长度信息的 `vmlinux.bin.all` 压缩后就是 `vmlinux.bin.bz2`。其中 `vmlinux.bin.all` 包含了 `vmlinux.bin` 和`vmlinux.relocs`(LCTT 译注:vmlinux 的重定位信息),其中 `vmlinux.relocs` 是 `vmlinux` 经过程序 `relocs` 处理之后的 `vmlinux` 镜像(见上文所述)。我们现在已经获取到了这些文件,汇编文件 `piggy.S` 将会被 `mkpiggy` 生成、然后编译: + +```Makefile + MKPIGGY arch/x86/boot/compressed/piggy.S + AS arch/x86/boot/compressed/piggy.o +``` + +这个汇编文件会包含经过计算得来的、压缩内核的偏移信息。处理完这个汇编文件,我们就可以看到 `zoffset` 生成了: + +```Makefile + ZOFFSET arch/x86/boot/zoffset.h +``` + +现在 `zoffset.h` 和 `voffset.h` 已经生成了,[arch/x86/boot](https://github.com/torvalds/linux/tree/master/arch/x86/boot/) 里的源文件可以继续编译: + +```Makefile + AS arch/x86/boot/header.o + CC arch/x86/boot/main.o + CC arch/x86/boot/mca.o + CC arch/x86/boot/memory.o + CC arch/x86/boot/pm.o + AS arch/x86/boot/pmjump.o + CC arch/x86/boot/printf.o + CC arch/x86/boot/regs.o + CC arch/x86/boot/string.o + CC arch/x86/boot/tty.o + CC arch/x86/boot/video.o + CC arch/x86/boot/video-mode.o + CC arch/x86/boot/video-vga.o + CC arch/x86/boot/video-vesa.o + CC arch/x86/boot/video-bios.o +``` + +所有的源代码会被编译,他们最终会被链接到 `setup.elf` : + +```Makefile + LD arch/x86/boot/setup.elf +``` + +或者: + +``` +ld -m elf_x86_64 -T arch/x86/boot/setup.ld arch/x86/boot/a20.o arch/x86/boot/bioscall.o arch/x86/boot/cmdline.o arch/x86/boot/copy.o arch/x86/boot/cpu.o arch/x86/boot/cpuflags.o arch/x86/boot/cpucheck.o arch/x86/boot/early_serial_console.o arch/x86/boot/edd.o arch/x86/boot/header.o arch/x86/boot/main.o arch/x86/boot/mca.o arch/x86/boot/memory.o arch/x86/boot/pm.o arch/x86/boot/pmjump.o arch/x86/boot/printf.o arch/x86/boot/regs.o arch/x86/boot/string.o arch/x86/boot/tty.o arch/x86/boot/video.o arch/x86/boot/video-mode.o arch/x86/boot/version.o arch/x86/boot/video-vga.o arch/x86/boot/video-vesa.o arch/x86/boot/video-bios.o -o arch/x86/boot/setup.elf +``` + +最后的两件事是创建包含目录 `arch/x86/boot/*` 下的编译过的代码的 `setup.bin`: + +``` +objcopy -O binary arch/x86/boot/setup.elf arch/x86/boot/setup.bin +``` + +以及从 `vmlinux` 生成 `vmlinux.bin` : + +``` +objcopy -O binary -R .note -R .comment -S arch/x86/boot/compressed/vmlinux arch/x86/boot/vmlinux.bin +``` + +最最后,我们编译主机程序 [arch/x86/boot/tools/build.c](https://github.com/torvalds/linux/blob/master/arch/x86/boot/tools/build.c),它将会用来把 `setup.bin` 和 `vmlinux.bin` 打包成 `bzImage`: + +``` +arch/x86/boot/tools/build arch/x86/boot/setup.bin arch/x86/boot/vmlinux.bin arch/x86/boot/zoffset.h arch/x86/boot/bzImage +``` + +实际上 `bzImage` 就是把 `setup.bin` 和 `vmlinux.bin` 连接到一起。最终我们会看到输出结果,就和那些用源码编译过内核的同行的结果一样: + +``` +Setup is 16268 bytes (padded to 16384 bytes). +System is 4704 kB +CRC 94a88f9a +Kernel: arch/x86/boot/bzImage is ready (#5) +``` + + +全部结束。 + +###结论 + +这就是本文的结尾部分。本文我们了解了编译内核的全部步骤:从执行 `make` 命令开始,到最后生成 `bzImage`。我知道,linux 内核的 makefile 和构建 linux 的过程第一眼看起来可能比较迷惑,但是这并不是很难。希望本文可以帮助你理解构建 linux 内核的整个流程。 + + +###链接 + +* [GNU make util](https://en.wikipedia.org/wiki/Make_%28software%29) +* [Linux kernel top Makefile](https://github.com/torvalds/linux/blob/master/Makefile) +* [cross-compilation](https://en.wikipedia.org/wiki/Cross_compiler) +* [Ctags](https://en.wikipedia.org/wiki/Ctags) +* [sparse](https://en.wikipedia.org/wiki/Sparse) +* [bzImage](https://en.wikipedia.org/wiki/Vmlinux#bzImage) +* [uname](https://en.wikipedia.org/wiki/Uname) +* [shell](https://en.wikipedia.org/wiki/Shell_%28computing%29) +* [Kbuild](https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kbuild.txt) +* [binutils](http://www.gnu.org/software/binutils/) +* [gcc](https://gcc.gnu.org/) +* [Documentation](https://github.com/torvalds/linux/blob/master/Documentation/kbuild/makefiles.txt) +* [System.map](https://en.wikipedia.org/wiki/System.map) +* [Relocation](https://en.wikipedia.org/wiki/Relocation_%28computing%29) + +-------------------------------------------------------------------------------- + +via: https://github.com/0xAX/linux-insides/blob/master/Misc/how_kernel_compiled.md + +译者:[oska874](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150730 How to Setup iTOP (IT Operational Portal) on CentOS 7.md b/published/201509/20150730 How to Setup iTOP (IT Operational Portal) on CentOS 7.md similarity index 83% rename from translated/tech/20150730 How to Setup iTOP (IT Operational Portal) on CentOS 7.md rename to published/201509/20150730 How to Setup iTOP (IT Operational Portal) on CentOS 7.md index dd20493d77..a9adc3e68c 100644 --- a/translated/tech/20150730 How to Setup iTOP (IT Operational Portal) on CentOS 7.md +++ b/published/201509/20150730 How to Setup iTOP (IT Operational Portal) on CentOS 7.md @@ -1,16 +1,17 @@ -如何在CentOS上安装iTOP(IT操作门户) +如何在 CentOS 7 上安装开源 ITIL 门户 iTOP ================================================================================ -iTOP简单来说是一个简单的基于网络的开源IT服务管理工具。它有所有的ITIL功能包括服务台、配置管理、事件管理、问题管理、更改管理和服务管理。iTOP依赖于Apache/IIS、MySQL和PHP,因此它可以运行在任何支持这些软件的操作系统中。因为iTOP是一个网络程序,因此你不必在用户的PC端任何客户端程序。一个简单的浏览器就足够每天的IT环境操作了。 + +iTOP是一个简单的基于Web的开源IT服务管理工具。它有所有的ITIL功能,包括服务台、配置管理、事件管理、问题管理、变更管理和服务管理。iTOP依赖于Apache/IIS、MySQL和PHP,因此它可以运行在任何支持这些软件的操作系统中。因为iTOP是一个Web程序,因此你不必在用户的PC端任何客户端程序。一个简单的浏览器就足够每天的IT环境操作了。 我们要在一台有满足基本需求的LAMP环境的CentOS 7上安装和配置iTOP。 ### 下载 iTOP ### -iTOP的下载包现在在SOurceForge上,我们可以从这获取它的官方[链接][1]。 +iTOP的下载包现在在SourceForge上,我们可以从这获取它的官方[链接][1]。 ![itop download](http://blog.linoxide.com/wp-content/uploads/2015/07/1-itop-download.png) -我们从这里的连接用wget命令获取压缩文件 +我们从这里的连接用wget命令获取压缩文件。 [root@centos-007 ~]# wget http://downloads.sourceforge.net/project/itop/itop/2.1.0/iTop-2.1.0-2127.zip @@ -40,7 +41,7 @@ iTOP的下载包现在在SOurceForge上,我们可以从这获取它的官方[ installation.xml itop-change-mgmt-itil itop-incident-mgmt-itil itop-request-mgmt-itil itop-tickets itop-attachments itop-config itop-knownerror-mgmt itop-service-mgmt itop-virtualization-mgmt -在解压的目录下,通过不同的数据模型用复制命令迁移需要的扩展从datamodels复制到web扩展目录下。 +在解压的目录下,使用如下的 cp 命令将不同的数据模型从web 下的 datamodels 目录下复制到 extensions 目录,来迁移需要的扩展。 [root@centos-7 2.x]# pwd /var/www/html/itop/web/datamodels/2.x @@ -50,19 +51,19 @@ iTOP的下载包现在在SOurceForge上,我们可以从这获取它的官方[ 大多数服务端设置和配置已经完成了。最后我们安装web界面来完成安装。 -打开浏览器使用ip地址或者FQDN来访问WordPress web目录。 +打开浏览器使用ip地址或者完整域名来访问iTop 的 web目录。 http://servers_ip_address/itop/web/ 你会被重定向到iTOP的web安装页面。让我们按照要求配置,就像在这篇教程中做的那样。 -#### 先决要求验证 #### +#### 验证先决要求 #### 这一步你就会看到验证完成的欢迎界面。如果你看到了一些警告信息,你需要先安装这些软件来解决这些问题。 ![mcrypt missing](http://blog.linoxide.com/wp-content/uploads/2015/07/2-itop-web-install.png) -这一步一个叫php mcrypt的可选包丢失了。下载下面的rpm包接着尝试安装php mcrypt包。 +这一步有一个叫php mcrypt的可选包丢失了。下载下面的rpm包接着尝试安装php mcrypt包。 [root@centos-7 ~]#yum localinstall php-mcrypt-5.3.3-1.el6.x86_64.rpm libmcrypt-2.5.8-9.el6.x86_64.rpm. @@ -76,7 +77,7 @@ iTOP的下载包现在在SOurceForge上,我们可以从这获取它的官方[ #### iTop 许可协议 #### -勾选同意iTOP所有组件的许可协议并点击“NEXT”。 +勾选接受 iTOP所有组件的许可协议,并点击“NEXT”。 ![License Agreement](http://blog.linoxide.com/wp-content/uploads/2015/07/4.png) @@ -94,7 +95,7 @@ iTOP的下载包现在在SOurceForge上,我们可以从这获取它的官方[ #### 杂项参数 #### -让我们选择额外的参数来选择你是否需要安装一个演示内容或者使用全新的数据库,接着下一步。 +让我们选择额外的参数来选择你是否需要安装一个带有演示内容的数据库或者使用全新的数据库,接着下一步。 ![Misc Parameters](http://blog.linoxide.com/wp-content/uploads/2015/07/7.png) @@ -118,7 +119,7 @@ iTOP的下载包现在在SOurceForge上,我们可以从这获取它的官方[ #### 改变管理选项 #### -选择不同的ticket类型以便管理可用选项中的IT设备更改。我们选择ITTL更改管理选项。 +选择不同的ticket类型以便管理可用选项中的IT设备变更。我们选择ITTL变更管理选项。 ![ITIL Change](http://blog.linoxide.com/wp-content/uploads/2015/07/11.png) @@ -166,7 +167,7 @@ via: http://linoxide.com/tools/setup-itop-centos-7/ 作者:[Kashif Siddique][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20150730 Howto Configure Nginx as Rreverse Proxy or Load Balancer with Weave and Docker.md b/published/201509/20150730 Howto Configure Nginx as Rreverse Proxy or Load Balancer with Weave and Docker.md similarity index 100% rename from published/20150730 Howto Configure Nginx as Rreverse Proxy or Load Balancer with Weave and Docker.md rename to published/201509/20150730 Howto Configure Nginx as Rreverse Proxy or Load Balancer with Weave and Docker.md diff --git a/published/20150803 Managing Linux Logs.md b/published/201509/20150803 Managing Linux Logs.md similarity index 100% rename from published/20150803 Managing Linux Logs.md rename to published/201509/20150803 Managing Linux Logs.md diff --git a/published/20150806 Linux FAQs with Answers--How to enable logging in Open vSwitch for debugging and troubleshooting.md b/published/201509/20150806 Linux FAQs with Answers--How to enable logging in Open vSwitch for debugging and troubleshooting.md similarity index 100% rename from published/20150806 Linux FAQs with Answers--How to enable logging in Open vSwitch for debugging and troubleshooting.md rename to published/201509/20150806 Linux FAQs with Answers--How to enable logging in Open vSwitch for debugging and troubleshooting.md diff --git a/published/20150811 How to Install Snort and Usage in Ubuntu 15.04.md b/published/201509/20150811 How to Install Snort and Usage in Ubuntu 15.04.md similarity index 100% rename from published/20150811 How to Install Snort and Usage in Ubuntu 15.04.md rename to published/201509/20150811 How to Install Snort and Usage in Ubuntu 15.04.md diff --git a/published/20150811 fdupes--A Comamndline Tool to Find and Delete Duplicate Files in Linux.md b/published/201509/20150811 fdupes--A Comamndline Tool to Find and Delete Duplicate Files in Linux.md similarity index 100% rename from published/20150811 fdupes--A Comamndline Tool to Find and Delete Duplicate Files in Linux.md rename to published/201509/20150811 fdupes--A Comamndline Tool to Find and Delete Duplicate Files in Linux.md diff --git a/published/20150812 Linux Tricks--Play Game in Chrome Text-to-Speech Schedule a Job and Watch Commands in Linux.md b/published/201509/20150812 Linux Tricks--Play Game in Chrome Text-to-Speech Schedule a Job and Watch Commands in Linux.md similarity index 100% rename from published/20150812 Linux Tricks--Play Game in Chrome Text-to-Speech Schedule a Job and Watch Commands in Linux.md rename to published/201509/20150812 Linux Tricks--Play Game in Chrome Text-to-Speech Schedule a Job and Watch Commands in Linux.md diff --git a/translated/tech/20150813 Howto Run JBoss Data Virtualization GA with OData in Docker Container.md b/published/201509/20150813 Howto Run JBoss Data Virtualization GA with OData in Docker Container.md similarity index 85% rename from translated/tech/20150813 Howto Run JBoss Data Virtualization GA with OData in Docker Container.md rename to published/201509/20150813 Howto Run JBoss Data Virtualization GA with OData in Docker Container.md index 4d14bbc904..6564e13924 100644 --- a/translated/tech/20150813 Howto Run JBoss Data Virtualization GA with OData in Docker Container.md +++ b/published/201509/20150813 Howto Run JBoss Data Virtualization GA with OData in Docker Container.md @@ -1,7 +1,7 @@ 如何在 Docker 容器中运行支持 OData 的 JBoss 数据虚拟化 GA -Howto Run JBoss Data Virtualization GA with OData in Docker Container ================================================================================ -大家好,我们今天来学习如何在一个 Docker 容器中运行支持 OData(译者注:Open Data Protocol,开放数据协议) 的 JBoss 数据虚拟化 6.0.0 GA(译者注:GA,General Availability,具体定义可以查看[WIKI][4])。JBoss 数据虚拟化是数据提供和集成解决方案平台,有多种分散的数据源时,转换为一种数据源统一对待,在正确的时间将所需数据传递给任意的应用或者用户。JBoss 数据虚拟化可以帮助我们将数据快速组合和转换为可重用的商业友好的数据模型,通过开放标准接口简单可用。它提供全面的数据抽取、联合、集成、转换,以及传输功能,将来自一个或多个源的数据组合为可重复使用和共享的灵活数据。要了解更多关于 JBoss 数据虚拟化的信息,可以查看它的[官方文档][1]。Docker 是一个提供开放平台用于打包,装载和以轻量级容器运行任何应用的开源平台。使用 Docker 容器我们可以轻松处理和启用支持 OData 的 JBoss 数据虚拟化。 + +大家好,我们今天来学习如何在一个 Docker 容器中运行支持 OData(译者注:Open Data Protocol,开放数据协议) 的 JBoss 数据虚拟化 6.0.0 GA(译者注:GA,General Availability,具体定义可以查看[WIKI][4])。JBoss 数据虚拟化是数据提供和集成解决方案平台,将多种分散的数据源转换为一种数据源统一对待,在正确的时间将所需数据传递给任意的应用或者用户。JBoss 数据虚拟化可以帮助我们将数据快速组合和转换为可重用的商业友好的数据模型,通过开放标准接口简单可用。它提供全面的数据抽取、联合、集成、转换,以及传输功能,将来自一个或多个源的数据组合为可重复使用和共享的灵活数据。要了解更多关于 JBoss 数据虚拟化的信息,可以查看它的[官方文档][1]。Docker 是一个提供开放平台用于打包,装载和以轻量级容器运行任何应用的开源平台。使用 Docker 容器我们可以轻松处理和启用支持 OData 的 JBoss 数据虚拟化。 下面是该指南中在 Docker 容器中运行支持 OData 的 JBoss 数据虚拟化的简单步骤。 @@ -78,7 +78,6 @@ Howto Run JBoss Data Virtualization GA with OData in Docker Container "LinkLocalIPv6PrefixLen": 0, ### 6. Web 界面 ### -### 6. Web Interface ### 现在,如果一切如期望的那样进行,当我们用浏览器打开 http://container-ip:8080/ 和 http://container-ip:9990 时会看到支持 oData 的 JBoss 数据虚拟化登录界面和 JBoss 管理界面。管理验证的用户名和密码分别是 admin 和 redhat1!数据虚拟化验证的用户名和密码都是 user。之后,我们可以通过 web 界面在内容间导航。 @@ -94,7 +93,7 @@ via: http://linoxide.com/linux-how-to/run-jboss-data-virtualization-ga-odata-doc 作者:[Arun Pyasi][a] 译者:[ictlyh](http://www.mutouxiaogui.cn/blog) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20150813 Linux file system hierarchy v2.0.md b/published/201509/20150813 Linux file system hierarchy v2.0.md similarity index 100% rename from published/20150813 Linux file system hierarchy v2.0.md rename to published/201509/20150813 Linux file system hierarchy v2.0.md diff --git a/translated/tech/20150816 How to migrate MySQL to MariaDB on Linux.md b/published/201509/20150816 How to migrate MySQL to MariaDB on Linux.md similarity index 70% rename from translated/tech/20150816 How to migrate MySQL to MariaDB on Linux.md rename to published/201509/20150816 How to migrate MySQL to MariaDB on Linux.md index 70856ec874..40818ae8a5 100644 --- a/translated/tech/20150816 How to migrate MySQL to MariaDB on Linux.md +++ b/published/201509/20150816 How to migrate MySQL to MariaDB on Linux.md @@ -1,10 +1,9 @@ - 在 Linux 中怎样将 MySQL 迁移到 MariaDB 上 ================================================================================ -自从甲骨文收购 MySQL 后,很多 MySQL 的开发者和用户放弃了 MySQL 由于甲骨文对 MySQL 的开发和维护更多倾向于闭门的立场。在社区驱动下,促使更多人移到 MySQL 的另一个分支中,叫 MariaDB。在原有 MySQL 开发人员的带领下,MariaDB 的开发遵循开源的理念,并确保 [它的二进制格式与 MySQL 兼容][1]。Linux 发行版如 Red Hat 家族(Fedora,CentOS,RHEL),Ubuntu 和Mint,openSUSE 和 Debian 已经开始使用,并支持 MariaDB 作为 MySQL 的简易替换品。 +自从甲骨文收购 MySQL 后,由于甲骨文对 MySQL 的开发和维护更多倾向于闭门的立场,很多 MySQL 的开发者和用户放弃了 MySQL。在社区驱动下,促使更多人移到 MySQL 的另一个叫 MariaDB 的分支。在原有 MySQL 开发人员的带领下,MariaDB 的开发遵循开源的理念,并确保[它的二进制格式与 MySQL 兼容][1]。Linux 发行版如 Red Hat 家族(Fedora,CentOS,RHEL),Ubuntu 和 Mint,openSUSE 和 Debian 已经开始使用,并支持 MariaDB 作为 MySQL 的直接替换品。 -如果想要将 MySQL 中的数据库迁移到 MariaDB 中,这篇文章就是你所期待的。幸运的是,由于他们的二进制兼容性,MySQL-to-MariaDB 迁移过程是非常简单的。如果你按照下面的步骤,将 MySQL 迁移到 MariaDB 会是无痛的。 +如果你想要将 MySQL 中的数据库迁移到 MariaDB 中,这篇文章就是你所期待的。幸运的是,由于他们的二进制兼容性,MySQL-to-MariaDB 迁移过程是非常简单的。如果你按照下面的步骤,将 MySQL 迁移到 MariaDB 会是无痛的。 ### 准备 MySQL 数据库和表 ### @@ -69,7 +68,7 @@ ### 安装 MariaDB ### -在 CentOS/RHEL 7和Ubuntu(14.04或更高版本)上,最新的 MariaDB 包含在其官方源。在 Fedora 上,自19版本后 MariaDB 已经替代了 MySQL。如果你使用的是旧版本或 LTS 类型如 Ubuntu 13.10 或更早的,你仍然可以通过添加其官方仓库来安装 MariaDB。 +在 CentOS/RHEL 7和Ubuntu(14.04或更高版本)上,最新的 MariaDB 已经包含在其官方源。在 Fedora 上,自19 版本后 MariaDB 已经替代了 MySQL。如果你使用的是旧版本或 LTS 类型如 Ubuntu 13.10 或更早的,你仍然可以通过添加其官方仓库来安装 MariaDB。 [MariaDB 网站][2] 提供了一个在线工具帮助你依据你的 Linux 发行版中来添加 MariaDB 的官方仓库。此工具为 openSUSE, Arch Linux, Mageia, Fedora, CentOS, RedHat, Mint, Ubuntu, 和 Debian 提供了 MariaDB 的官方仓库. @@ -103,7 +102,7 @@ $ sudo yum install MariaDB-server MariaDB-client -安装了所有必要的软件包后,你可能会被要求为 root 用户创建一个新密码。设置 root 的密码后,别忘了恢复备份的 my.cnf 文件。 +安装了所有必要的软件包后,你可能会被要求为 MariaDB 的 root 用户创建一个新密码。设置 root 的密码后,别忘了恢复备份的 my.cnf 文件。 $ sudo cp /opt/my.cnf /etc/mysql/ @@ -111,7 +110,7 @@ $ sudo service mariadb start -或者: +或: $ sudo systemctl start mariadb @@ -141,13 +140,13 @@ ### 结论 ### -如你在本教程中看到的,MySQL-to-MariaDB 的迁移并不难。MariaDB 相比 MySQL 有很多新的功能,你应该知道的。至于配置方面,在我的测试情况下,我只是将我旧的 MySQL 配置文件(my.cnf)作为 MariaDB 的配置文件,导入过程完全没有出现任何问题。对于配置文件,我建议你在迁移之前请仔细阅读MariaDB 配置选项的文件,特别是如果你正在使用 MySQL 的特殊配置。 +如你在本教程中看到的,MySQL-to-MariaDB 的迁移并不难。你应该知道,MariaDB 相比 MySQL 有很多新的功能。至于配置方面,在我的测试情况下,我只是将我旧的 MySQL 配置文件(my.cnf)作为 MariaDB 的配置文件,导入过程完全没有出现任何问题。对于配置文件,我建议你在迁移之前请仔细阅读 MariaDB 配置选项的文件,特别是如果你正在使用 MySQL 的特定配置。 -如果你正在运行更复杂的配置有海量的数据库和表,包括群集或主从复制,看一看 Mozilla IT 和 Operations 团队的 [更详细的指南][3] ,或者 [官方的 MariaDB 文档][4]。 +如果你正在运行有海量的表、包括群集或主从复制的数据库的复杂配置,看一看 Mozilla IT 和 Operations 团队的 [更详细的指南][3] ,或者 [官方的 MariaDB 文档][4]。 ### 故障排除 ### -1.在运行 mysqldump 命令备份数据库时出现以下错误。 +1、 在运行 mysqldump 命令备份数据库时出现以下错误。 $ mysqldump --all-databases --user=root --password --master-data > backupdb.sql @@ -155,7 +154,7 @@ mysqldump: Error: Binlogging on server not active -通过使用 "--master-data",你要在导出的输出中包含二进制日志信息,这对于数据库的复制和恢复是有用的。但是,二进制日志未在 MySQL 服务器启用。要解决这个错误,修改 my.cnf 文件,并在 [mysqld] 部分添加下面的选项。 +通过使用 "--master-data",你可以在导出的输出中包含二进制日志信息,这对于数据库的复制和恢复是有用的。但是,二进制日志未在 MySQL 服务器启用。要解决这个错误,修改 my.cnf 文件,并在 [mysqld] 部分添加下面的选项。 log-bin=mysql-bin @@ -176,8 +175,8 @@ via: http://xmodulo.com/migrate-mysql-to-mariadb-linux.html 作者:[Kristophorus Hadiono][a] -译者:[strugglingyouth](https://github.com/译者ID) -校对:[strugglingyouth](https://github.com/校对者ID) +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150817 Linux FAQs with Answers--How to count the number of threads in a process on Linux.md b/published/201509/20150817 Linux FAQs with Answers--How to count the number of threads in a process on Linux.md similarity index 59% rename from translated/tech/20150817 Linux FAQs with Answers--How to count the number of threads in a process on Linux.md rename to published/201509/20150817 Linux FAQs with Answers--How to count the number of threads in a process on Linux.md index 96bf143533..8667e99712 100644 --- a/translated/tech/20150817 Linux FAQs with Answers--How to count the number of threads in a process on Linux.md +++ b/published/201509/20150817 Linux FAQs with Answers--How to count the number of threads in a process on Linux.md @@ -1,5 +1,4 @@ - -Linux 有问必答 - 如何在 Linux 中统计一个进程的线程数 +Linux 有问必答:如何在 Linux 中统计一个进程的线程数 ================================================================================ > **问题**: 我正在运行一个程序,它在运行时会派生出多个线程。我想知道程序在运行时会有多少线程。在 Linux 中检查进程的线程数最简单的方法是什么? @@ -7,11 +6,11 @@ Linux 有问必答 - 如何在 Linux 中统计一个进程的线程数 ### 方法一: /proc ### - proc 伪文件系统,它驻留在 /proc 目录,这是最简单的方法来查看任何活动进程的线程数。 /proc 目录以可读文本文件形式输出,提供现有进程和系统硬件相关的信息如 CPU, interrupts, memory, disk, 等等. +proc 伪文件系统,它驻留在 /proc 目录,这是最简单的方法来查看任何活动进程的线程数。 /proc 目录以可读文本文件形式输出,提供现有进程和系统硬件相关的信息如 CPU、中断、内存、磁盘等等. $ cat /proc//status -上面的命令将显示进程 的详细信息,包括过程状态(例如, sleeping, running),父进程 PID,UID,GID,使用的文件描述符的数量,以及上下文切换的数量。输出也包括**进程创建的总线程数**如下所示。 +上面的命令将显示进程 \ 的详细信息,包括过程状态(例如, sleeping, running),父进程 PID,UID,GID,使用的文件描述符的数量,以及上下文切换的数量。输出也包括**进程创建的总线程数**如下所示。 Threads: @@ -23,11 +22,11 @@ Linux 有问必答 - 如何在 Linux 中统计一个进程的线程数 输出表明该进程有28个线程。 -或者,你可以在 /proc//task 中简单的统计目录的数量,如下所示。 +或者,你可以在 /proc//task 中简单的统计子目录的数量,如下所示。 $ ls /proc//task | wc -这是因为,对于一个进程中创建的每个线程,在 /proc//task 中会创建一个相应的目录,命名为其线程 ID。由此在 /proc//task 中目录的总数表示在进程中线程的数目。 +这是因为,对于一个进程中创建的每个线程,在 `/proc//task` 中会创建一个相应的目录,命名为其线程 ID。由此在 `/proc//task` 中目录的总数表示在进程中线程的数目。 ### 方法二: ps ### @@ -35,7 +34,7 @@ Linux 有问必答 - 如何在 Linux 中统计一个进程的线程数 $ ps hH p | wc -l -如果你想监视一个进程的不同线程消耗的硬件资源(CPU & memory),请参阅[此教程][1]。(注:此文我们翻译过) +如果你想监视一个进程的不同线程消耗的硬件资源(CPU & memory),请参阅[此教程][1]。 -------------------------------------------------------------------------------- @@ -43,9 +42,9 @@ via: http://ask.xmodulo.com/number-of-threads-process-linux.html 作者:[Dan Nanni][a] 译者:[strugglingyouth](https://github.com/strugglingyouth) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://ask.xmodulo.com/author/nanni -[1]:http://ask.xmodulo.com/view-threads-process-linux.html +[1]:https://linux.cn/article-5633-1.html diff --git a/translated/tech/20150817 Linux FAQs with Answers--How to fix Wireshark GUI freeze on Linux desktop.md b/published/201509/20150817 Linux FAQs with Answers--How to fix Wireshark GUI freeze on Linux desktop.md similarity index 73% rename from translated/tech/20150817 Linux FAQs with Answers--How to fix Wireshark GUI freeze on Linux desktop.md rename to published/201509/20150817 Linux FAQs with Answers--How to fix Wireshark GUI freeze on Linux desktop.md index 9db7231a68..a59a946857 100644 --- a/translated/tech/20150817 Linux FAQs with Answers--How to fix Wireshark GUI freeze on Linux desktop.md +++ b/published/201509/20150817 Linux FAQs with Answers--How to fix Wireshark GUI freeze on Linux desktop.md @@ -1,14 +1,6 @@ - -Linux 有问必答--如何解决 Linux 桌面上的 Wireshark GUI 死机 +Linux 有问必答:如何解决 Linux 上的 Wireshark 界面僵死 ================================================================================ -> **问题**: 当我试图在 Ubuntu 上的 Wireshark 中打开一个 pre-recorded 数据包转储时,它的 UI 突然死机,在我发起 Wireshark 的终端出现了下面的错误和警告。我该如何解决这个问题? - -Wireshark 是一个基于 GUI 的数据包捕获和嗅探工具。该工具被网络管理员普遍使用,网络安全工程师或开发人员对于各种任务的 packet-level 网络分析是必需的,例如在网络故障,漏洞测试,应用程序调试,或逆向协议工程是必需的。 Wireshark 允许记录存活数据包,并通过便捷的图形用户界面浏览他们的协议首部和有效负荷。 - -![](https://farm1.staticflickr.com/722/20584224675_f4d7a59474_c.jpg) - -这是 Wireshark 的 UI,尤其是在 Ubuntu 桌面下运行,有时会挂起或冻结出现以下错误,而你是向上或向下滚动分组列表视图时,就开始加载一个 pre-recorded 包转储文件。 - +> **问题**: 当我试图在 Ubuntu 上的 Wireshark 中打开一个 pre-recorded 数据包转储时,它的界面突然死机,在我运行 Wireshark 的终端出现了下面的错误和警告。我该如何解决这个问题? (wireshark:3480): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GObject' (wireshark:3480): GLib-GObject-CRITICAL **: g_object_set_qdata_full: assertion 'G_IS_OBJECT (object)' failed @@ -22,6 +14,15 @@ Wireshark 是一个基于 GUI 的数据包捕获和嗅探工具。该工具被 (wireshark:3480): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion 'G_IS_OBJECT (object)' failed (wireshark:3480): Gtk-CRITICAL **: gtk_widget_set_name: assertion 'GTK_IS_WIDGET (widget)' failed + +Wireshark 是一个基于 GUI 的数据包捕获和嗅探工具。该工具被网络管理员普遍使用,网络安全工程师或开发人员对于各种任务的数据包级的网络分析是必需的,例如在网络故障,漏洞测试,应用程序调试,或逆向协议工程是必需的。 Wireshark 允许实时记录数据包,并通过便捷的图形用户界面浏览他们的协议首部和有效负荷。 + +![](https://farm1.staticflickr.com/722/20584224675_f4d7a59474_c.jpg) + +这是 Wireshark 的 UI,尤其是在 Ubuntu 桌面下运行时,当你向上或向下滚动分组列表视图时,或开始加载一个 pre-recorded 包转储文件时,有时会挂起或冻结,并出现以下错误。 + +![](https://farm1.staticflickr.com/589/20062177334_47c0f2aeae_c.jpg) + 显然,这个错误是由 Wireshark 和叠加滚动条之间的一些不兼容造成的,在最新的 Ubuntu 桌面还没有被解决(例如,Ubuntu 15.04 的桌面)。 一种避免 Wireshark 的 UI 卡死的办法就是 **暂时禁用叠加滚动条**。在 Wireshark 上有两种方法来禁用叠加滚动条,这取决于你在桌面上如何启动 Wireshark 的。 @@ -46,7 +47,7 @@ Wireshark 是一个基于 GUI 的数据包捕获和嗅探工具。该工具被 Exec=env LIBOVERLAY_SCROLLBAR=0 wireshark %f -虽然这种解决方法将有利于所有桌面用户的 system-wide,但它将无法升级 Wireshark。如果你想保留修改的 .desktop 文件,如下所示将它复制到你的主目录。 +虽然这种解决方法可以在系统级帮助到所有桌面用户,但升级 Wireshark 就没用了。如果你想保留修改的 .desktop 文件,如下所示将它复制到你的主目录。 $ cp /usr/share/applications/wireshark.desktop ~/.local/share/applications/ @@ -56,7 +57,7 @@ via: http://ask.xmodulo.com/fix-wireshark-gui-freeze-linux-desktop.html 作者:[Dan Nanni][a] 译者:[strugglingyouth](https://github.com/strugglingyouth) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201509/20150818 Debian GNU or Linux Birthday-- A 22 Years of Journey and Still Counting.md b/published/201509/20150818 Debian GNU or Linux Birthday-- A 22 Years of Journey and Still Counting.md new file mode 100644 index 0000000000..e14e0ba320 --- /dev/null +++ b/published/201509/20150818 Debian GNU or Linux Birthday-- A 22 Years of Journey and Still Counting.md @@ -0,0 +1,108 @@ +Debian GNU/Linux,22 年未完的美妙旅程 +================================================================================ + +在2015年8月16日, Debian项目组庆祝了 Debian 的22周年纪念日;这也是开源世界历史最悠久、热门的发行版之一。 Debian项目于1993年由Ian Murdock创立。彼时,Slackware 作为最早的 Linux 发行版已经名声在外。 + +![Happy 22nd Birthday to Debian](http://www.tecmint.com/wp-content/uploads/2014/08/Debian-22nd-Birthday.png) + +*22岁生日快乐! Debian Linux!* + +Ian Ashly Murdock, 一个美国职业软件工程师, 在他还是普渡大学的学生时构想出了 Debian 项目的计划。他把这个项目命名为 Debian 是由于这个名字组合了他彼时女友的名字 Debra Lynn 和他自己的名字 Ian。 他之后和 Lynn 结婚并在2008年1月离婚。 + +![Ian Murdock](http://www.tecmint.com/wp-content/uploads/2014/08/Ian-Murdock.jpeg) + +*Debian 创始人:Ian Murdock* + +Ian 目前是 ExactTarget 的平台与开发社区的副总裁。 + +Debian (如同Slackware一样) 都是由于当时缺乏满足合乎标准的发行版才应运而生的。 Ian 在一次采访中说:“免费提供一流的产品会是 Debian 项目的唯一使命。 尽管过去的 Linux 发行版均不尽然可靠抑或是优秀。 我印象里...比如在不同的文件系统间移动文件, 处理大型文件经常会导致内核出错。 但是 Linux 其实是很可靠的, 自由的源代码让这个项目本质上很有前途。” + +"我记得过去我像其他想解决问题的人一样, 想在家里运行一个像 UNIX 的东西。 但那是不可能的, 无论是经济上还是法律上或是别的什么角度。 然后我就听闻了 GNU 内核开发项目, 以及这个项目是如何没有任何法律纷争", Ian 补充到。 他早年在开发 Debian 时曾被自由软件基金会(FSF)资助, 这份资助帮助 Debian 取得了长足的发展; 尽管一年后由于学业原因 Ian 退出了 FSF 转而去完成他的学位。 + +### Debian开发历史 ### + +- **Debian 0.01 – 0.09** : 发布于 1993 年八月 – 1993 年十二月。 +- **Debian 0.91** : 发布于 1994 年一月。 有了原始的包管理系统, 没有依赖管理机制。 +- **Debian 0.93 rc5** : 发布于 1995 年三月。 “现代”意义的 Debian 的第一次发布, 在基础系统安装后会使用dpkg 安装以及管理其他软件包。 +- **Debian 0.93 rc6**: 发布于 1995 年十一月。 最后一次 a.out 发布, deselect 机制第一次出现, 有60位开发者在彼时维护着软件包。 +- **Debian 1.1**: 发布于 1996 年六月。 项目代号 – Buzz, 软件包数量 – 474, 包管理器 dpkg, 内核版本 2.0, ELF 二进制。 +- **Debian 1.2**: 发布于 1996 年十二月。 项目代号 – Rex, 软件包数量 – 848, 开发者数量 – 120。 +- **Debian 1.3**: 发布于 1997 年七月。 项目代号 – Bo, 软件包数量 974, 开发者数量 – 200。 +- **Debian 2.0**: 发布于 1998 年七月。 项目代号 - Hamm, 支持构架 – Intel i386 以及 Motorola 68000 系列, 软件包数量: 1500+, 开发者数量: 400+, 内置了 glibc。 +- **Debian 2.1**: 发布于1999 年三月九日。 项目代号 – slink, 支持构架 - Alpha 和 Sparc, apt 包管理器开始成型, 软件包数量 – 2250。 +- **Debian 2.2**: 发布于 2000 年八月十五日。 项目代号 – Potato, 支持构架 – Intel i386, Motorola 68000 系列, Alpha, SUN Sparc, PowerPC 以及 ARM 构架。 软件包数量: 3900+ (二进制) 以及 2600+ (源代码), 开发者数量 – 450。 有一群人在那时研究并发表了一篇论文, 论文展示了自由软件是如何在被各种问题包围的情况下依然逐步成长为优秀的现代操作系统的。 +- **Debian 3.0**: 发布于 2002 年七月十九日。 项目代号 – woody, 支持构架新增 – HP, PA_RISC, IA-64, MIPS 以及 IBM, 首次以DVD的形式发布, 软件包数量 – 8500+, 开发者数量 – 900+, 支持加密。 +- **Debian 3.1**: 发布于 2005 年六月六日。 项目代号 – sarge, 支持构架 – 新增 AMD64(非官方渠道发布), 内核 – 2.4 以及 2.6 系列, 软件包数量: 15000+, 开发者数量 : 1500+, 增加了诸如 OpenOffice 套件, Firefox 浏览器, Thunderbird, Gnome 2.8, 支持: RAID, XFS, LVM, Modular Installer。 +- **Debian 4.0**: 发布于 2007 年四月八日。 项目代号 – etch, 支持构架 – 如前,包括 AMD64。 软件包数量: 18,200+ 开发者数量 : 1030+, 图形化安装器。 +- **Debian 5.0**: 发布于 2009 年二月十四日。 项目代号 – lenny, 支持构架 – 新增 ARM。 软件包数量: 23000+, 开发者数量: 1010+。 +- **Debian 6.0**: 发布于 2009 年七月二十九日。 项目代号 – squeeze, 包含的软件包: 内核 2.6.32, Gnome 2.3. Xorg 7.5, 同时包含了 DKMS, 基于依赖包支持。 支持构架 : 新增 kfreebsd-i386 以及 kfreebsd-amd64, 基于依赖管理的启动过程。 +- **Debian 7.0**: 发布于 2013 年五月四日。 项目代号: wheezy, 支持 Multiarch, 私有云工具, 升级了安装器, 移除了第三方软件依赖, 全功能多媒体套件-codec, 内核版本 3.2, Xen Hypervisor 4.1.4 ,软件包数量: 37400+。 +- **Debian 8.0**: 发布于 2015 年五月二十五日。 项目代号: Jessie, 将 Systemd 作为默认的初始化系统, 内核版本 3.16, 增加了快速启动(fast booting), service进程所依赖的 cgroups 使隔离部分 service 进程成为可能, 43000+ 软件包。 Sysvinit 初始化工具在 Jessie 中可用。 + +**注意**: Linux的内核第一次是在1991 年十月五日被发布, 而 Debian 的首次发布则在1993 年九月十三日。 所以 Debian 已经在只有24岁的 Linux 内核上运行了整整22年了。 + +### Debian 的那些事 ### + +1994年管理和重整了 Debian 项目以使得其他开发者能更好地加入,所以在那一年并没有发布面向用户的更新, 当然, 内部版本肯定是有的。 + +Debian 1.0 从来就没有被发布过。 一家 CD-ROM 的生产商错误地把某个未发布的版本标注为了 1.0, 为了避免产生混乱, 原本的 Debian 1.0 以1.1的面貌发布了。 从那以后才有了所谓的官方CD-ROM的概念。 + +每个 Debian 新版本的代号都是玩具总动员里某个角色的名字哦。 + +Debian 有四种可用版本: 旧稳定版(old stable), 稳定版(stable), 测试版(testing) 以及 试验版(experimental)。 始终如此。 + +Debian 项目组一直工作在不稳定发行版上, 这个不稳定版本始终被叫做Sid(玩具总动员里那个邪恶的臭小孩)。 Sid是unstable版本的永久名称, 同时Sid也取自'Still In Development"(译者:还在开发中)的首字母。 Sid 将会成为下一个稳定版, 当前的稳定版本代号为 jessie。 + +Debian 的官方发行版只包含开源并且自由的软件, 绝无其他东西. 不过 contrib 和非自由软件包使得安装那些本身自由但是其依赖的软件包不自由(contrib)的软件和非自由软件成为了可能。 + +Debian 是一堆Linux 发行版之母。 举几个例子: + +- Damn Small Linux +- KNOPPIX +- Linux Advanced +- MEPIS +- Ubuntu +- 64studio (不再活跃开发) +- LMDE + +Debian 是世界上最大的非商业 Linux 发行版。它主要是由C编写的(32.1%), 一并的还有其他70多种语言。 + +![Debian 开发语言贡献表](http://www.tecmint.com/wp-content/uploads/2014/08/Debian-Programming.png) + +*Debian 开发语言贡献表,图片来源: [Xmodulo][1]* + +Debian 项目包含6,850万行代码, 以及 450万行空格和注释。 + +国际空间站放弃了 Windows 和红帽子, 进而换成了 Debian - 在上面的宇航员使用落后一个版本的稳定发行版, 目前是 squeeze; 这么做是为了稳定程度以及来自 Debian 社区的雄厚帮助支持。 + +感谢上帝! 我们差点就听到来自国际空间宇航员面对 Windows Metro 界面的尖叫了 :P + +#### 黑色星期三 #### + +2002 年十一月二十日, Twente 大学的网络运营中心(NOC)着火。 当地消防部门放弃了服务器区域。 NOC维护着satie.debian.org 的网站服务器, 这个网站包含了安全、非美国相关的存档、新维护者资料、数量报告、数据库等等;这一切都化为了灰烬。 之后这些服务由 Debian 重建了。 + +#### 未来版本 #### + +下一个待发布版本是 Debian 9, 项目代号 – Stretch, 它会带来什么还是个未知数。 满心期待吧! + +有很多发行版在 Linux 发行版的历史上出现过一瞬间然后很快消失了。 在多数情况下, 维护一个日渐庞大的项目是开发者们面临的挑战。 但这对 Debian 来说不是问题。 Debian 项目有全世界成百上千的开发者、维护者。 它在 Linux 诞生的之初起便一直存在。 + +Debian 在 Linux 生态环境中的贡献是难以用语言描述的。 如果 Debian 没有出现过, 那么 Linux 世界将不会像现在这样丰富和用户友好。 Debian 是为数不多可以被认为安全可靠又稳定的发行版,是作为网络服务器完美选择。 + +这仅仅是 Debian 的一个开始。 它走过了这么长的征程, 并将一直走下去。 未来即是现在! 世界近在眼前! 如果你到现在还从来没有使用过 Debian, 我只想问, 你还再等什么? 快去下载一份镜像试试吧, 我们会在此守候遇到任何问题的你。 + +- [Debian 主页][2] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/happy-birthday-to-debian-gnu-linux/ + +作者:[Avishek Kumar][a] +译者:[jerryling315](http://moelf.xyz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://xmodulo.com/2013/08/interesting-facts-about-debian-linux.html +[2]:https://www.debian.org/ diff --git a/translated/talk/20150818 Docker Working on Security Components Live Container Migration.md b/published/201509/20150818 Docker Working on Security Components Live Container Migration.md similarity index 77% rename from translated/talk/20150818 Docker Working on Security Components Live Container Migration.md rename to published/201509/20150818 Docker Working on Security Components Live Container Migration.md index bd3f0451c7..2e60571b52 100644 --- a/translated/talk/20150818 Docker Working on Security Components Live Container Migration.md +++ b/published/201509/20150818 Docker Working on Security Components Live Container Migration.md @@ -1,16 +1,16 @@ -Docker Working on Security Components, Live Container Migration +Docker 在安全组件、实时容器迁移方面的进展 ================================================================================ ![Docker Container Talk](http://www.eweek.com/imagesvr_ce/1905/290x195DockerMarianna.jpg) -**Docker 开发者在 Containercon 上的演讲,谈论将来的容器在安全和实时迁移方面的创新** +**这是 Docker 开发者在 Containercon 上的演讲,谈论将来的容器在安全和实时迁移方面的创新** 来自西雅图的消息。当前 IT 界最热的词汇是“容器”,美国有两大研讨会:Linuxcon USA 和 Containercon,后者就是为容器而生的。 Docker 公司是开源 Docker 项目的商业赞助商,本次研讨会这家公司有 3 位高管带来主题演讲,但公司创始人 Solomon Hykes 没上场演讲。 -Hykes 曾在 2014 年的 Linuxcon 上进行过一次主题演讲,但今年的 Containeron 他只坐在观众席上。而工程部高级副总裁 Marianna Tessel、Docker 首席安全员 Diogo Monica 和核心维护员 Michael Crosby 为我们演讲 Docker 新增的功能和将来会有的功能。 +Hykes 曾在 2014 年的 Linuxcon 上进行过一次主题演讲,但今年的 Containeron 他只坐在观众席上。而工程部高级副总裁 Marianna Tessel、Docker 首席安全官 Diogo Monica 和核心维护员 Michael Crosby 为我们演讲 Docker 新增的功能和将来会有的功能。 -Tessel 强调 Docker 现在已经被很多世界上最大的组织用在生产环境中,包括美国政府。Docker 也被用在小环境中,比如树莓派,一块树莓派上可以跑 2300 个容器。 +Tessel 强调 Docker 现在已经被很多世界上大型组织用在生产环境中,包括美国政府。Docker 也被用在小环境中,比如树莓派,一块树莓派上可以跑 2300 个容器。 “Docker 的功能正在变得越来越强大,而部署方法变得越来越简单。”Tessel 在会上说道。 @@ -18,9 +18,9 @@ Tessel 把 Docker 形容成一艘游轮,内部由强大而复杂的机器驱 Docker 试图解决的领域是简化安全配置。Tessel 认为对于大多数用户和组织来说,避免网络漏洞所涉及的安全问题是一个乏味而且复杂的过程。 -于是 Docker Content Trust 就出现在 Docker 1.8 release 版本中了。安全项目领导 Diogo Mónica 中加入 Tessel 上台讨论,说安全是一个难题,而 Docker Content Trust 就是为解决这个难道而存在的。 +于是 Docker Content Trust 就出现在 Docker 1.8 release 版本中了。安全项目领导 Diogo Mónica 中加入了 Tessel 的台上讨论,说安全是一个难题,而 Docker Content Trust 就是为解决这个难道而存在的。 -Docker Content Trusst 提供一种方法来验证一个 Docker 应用是否可信,以及多种方法来限制欺骗和病毒注入。 +Docker Content Trust 提供一种方法来验证一个 Docker 应用是否可信,以及多种方法来限制欺骗和病毒注入。 为了证明他的观点,Monica 做了个现场示范,演示 Content Trust 的效果。在一个实验中,一个网站在更新过程中其 Web App 被人为攻破,而当 Content Trust 启动后,这个黑客行为再也无法得逞。 @@ -32,7 +32,7 @@ Docker 首席维护员 Micheal Crosby 在台上做了个实时迁移的演示, 一个容器也可以克隆到另一个地方,Crosby 将他的克隆容器称为“多利”,就是世界上第一只被克隆出来的羊的名字。 -Tessel 也花了点时间聊了下 RunC 组件,这是个正在被 Open Container Initiative 作为多方开发的项目,目的是让窗口兼容 Linux、Windows 和 Solaris。 +Tessel 也花了点时间聊了下 RunC 组件,这是个正在被 Open Container Initiative 作为多方开发的项目,目的是让它可以从 Linux 扩展到包括 Windows 和 Solaris 在内的多种操作系统。 Tessel 总结说她不知道 Docker 的未来是什么样,但对此抱非常乐观的态度。 @@ -46,7 +46,7 @@ via: http://www.eweek.com/virtualization/docker-working-on-security-components-l 作者:[Sean Michael Kerner][a] 译者:[bazz2](https://github.com/bazz2) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/talk/20150819 Linuxcon--The Changing Role of the Server OS.md b/published/201509/20150819 Linuxcon--The Changing Role of the Server OS.md similarity index 89% rename from translated/talk/20150819 Linuxcon--The Changing Role of the Server OS.md rename to published/201509/20150819 Linuxcon--The Changing Role of the Server OS.md index 98a0f94b03..2c66635f89 100644 --- a/translated/talk/20150819 Linuxcon--The Changing Role of the Server OS.md +++ b/published/201509/20150819 Linuxcon--The Changing Role of the Server OS.md @@ -1,6 +1,6 @@ LinuxCon: 服务器操作系统的转型 ================================================================================ -来自西雅图。容器迟早要改变世界,以及改变操作系统的角色。这是 Wim Coekaerts 带来的 LinuxCon 演讲主题,Coekaerts 是 Oracle 公司 Linux 与虚拟化工程的高级副总裁。 +西雅图报道。容器迟早要改变世界,以及改变操作系统的角色。这是 Wim Coekaerts 带来的 LinuxCon 演讲主题,Coekaerts 是 Oracle 公司 Linux 与虚拟化工程的高级副总裁。 ![](http://www.serverwatch.com/imagesvr_ce/6421/wim-200x150.jpg) @@ -8,7 +8,7 @@ Coekaerts 在开始演讲的时候拿出一张关于“桌面之年”的幻灯 “你需要操作系统做什么事情?”,Coekaerts 回答现场观众:“只需一件事:运行一个应用。操作系统负责管理硬件和资源,来让你的应用运行起来。” -Coakaerts 说在 Docker 容器的帮助下,我们的注意力再次集中在应用上,而在 Oracle,我们将注意力放在如何让应用更好地运行在操作系统上。 +Coakaerts 补充说,在 Docker 容器的帮助下,我们的注意力再次集中在应用上,而在 Oracle,我们将注意力放在如何让应用更好地运行在操作系统上。 “许多人过去常常需要繁琐地安装应用,而现在的年轻人只需要按一个按钮就能让应用在他们的移动设备上运行起来”。 @@ -20,7 +20,6 @@ Docker 的出现不代表虚拟机的淘汰,容器化过程需要经过很长 在这段时间内,容器会与虚拟机共存,并且我们需要一些工具,将应用在容器和虚拟机之间进行转换迁移。Coekaerts 举例说 Oracle 的 VirtualBox 就可以用来帮助用户运行 Docker,而它原来是被广泛用在桌面系统上的一项开源技术。现在 Docker 的 Kitematic 项目将在 Mac 上使用 VirtualBox 运行 Docker。 -### The Open Compute Initiative and Write Once, Deploy Anywhere for Containers ### ### 容器的开放计算计划和一次写随处部署 ### 一个能让容器成功的关键是“一次写,随处部署”的概念。而在容器之间的互操作领域,Linux 基金会的开放计算计划(OCI)扮演一个非常关键的角色。 @@ -43,7 +42,7 @@ via: http://www.serverwatch.com/server-news/linuxcon-the-changing-role-of-the-se 作者:[Sean Michael Kerner][a] 译者:[bazz2](https://github.com/bazz2) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/talk/20150820 A Look at What's Next for the Linux Kernel.md b/published/201509/20150820 A Look at What's Next for the Linux Kernel.md similarity index 77% rename from translated/talk/20150820 A Look at What's Next for the Linux Kernel.md rename to published/201509/20150820 A Look at What's Next for the Linux Kernel.md index daf3e4d0e3..56969d3b24 100644 --- a/translated/talk/20150820 A Look at What's Next for the Linux Kernel.md +++ b/published/201509/20150820 A Look at What's Next for the Linux Kernel.md @@ -1,24 +1,24 @@ -Linux 内核的发展方向 +对 Linux 内核的发展方向的展望 ================================================================================ ![](http://www.eweek.com/imagesvr_ce/485/290x195cilinux1.jpg) -**即将到来的 Linux 4.2 内核涉及到史上最多的贡献者数量,内核开发者 Jonathan Corbet 如是说。** +** Linux 4.2 内核涉及到史上最多的贡献者数量,内核开发者 Jonathan Corbet 如是说。** -来自西雅图。Linux 内核持续增长:代码量在增加,代码贡献者数量也在增加。而随之而来的一些挑战需要处理一下。以上是 Jonathan Corbet 在今年的 LinuxCon 的内核年度报告上提出的主要观点。以下是他的主要演讲内容: +西雅图报道。Linux 内核持续增长:代码量在增加,代码贡献者数量也在增加。而随之而来的一些挑战需要处理一下。以上是 Jonathan Corbet 在今年的 LinuxCon 的内核年度报告上提出的主要观点。以下是他的主要演讲内容: -Linux 4.2 内核依然处于开发阶段,预计在8月23号释出。Corbet 强调有 1569 名开发者为这个版本贡献了代码,其中 277 名是第一次提交代码。 +Linux 4.2 内核已经于上月底释出。Corbet 强调有 1569 名开发者为这个版本贡献了代码,其中 277 名是第一次提交代码。 越来越多的开发者的加入,内核更新非常快,Corbet 估计现在大概 63 天就能产生一个新的内核里程碑。 Linux 4.2 涉及多方面的更新。其中一个就是引进了 OverLayFS,这是一种只读型文件系统,它可以实现在一个容器之上再放一个容器。 -网络系统对小包传输性能也有了提升,这对于高频传输领域如金融交易而言非常重要。提升的方面主要集中在减小处理数据包的时间的能耗。 +网络系统对小包传输性能也有了提升,这对于高频金融交易而言非常重要。提升的方面主要集中在减小处理数据包的时间的能耗。 依然有新的驱动中加入内核。在每个内核发布周期,平均会有 60 到 80 个新增或升级驱动中加入。 另一个主要更新是实时内核补丁,这个特性在 4.0 版首次引进,好处是系统管理员可以在生产环境中打上内核补丁而不需要重启系统。当补丁所需要的元素都已准备就绪,打补丁的过程会在后台持续而稳定地进行。 -**Linux 安全, IoT 和其他关注点 ** +**Linux 安全, IoT 和其他关注点** 过去一年中,安全问题在开源社区是一个很热的话题,这都归因于那些引发高度关注的事件,比如 Heartbleed 和 Shellshock。 @@ -26,9 +26,9 @@ Linux 4.2 涉及多方面的更新。其中一个就是引进了 OverLayFS,这 他强调说过去 10 年间有超过 3 百万行代码不再被开发者修改,而产生 Shellshock 漏洞的代码的年龄已经是 20 岁了,近年来更是无人问津。 -另一个关注点是 2038 问题,Linux 界的“千年虫”,如果不解决,2000 年出现过的问题还会重现。2038 问题说的是在 2038 年一些 Linux 和 Unix 机器会死机(LCTT:32 位系统记录的时间,在2038年1月19日星期二晚上03:14:07之后的下一秒,会变成负数)。Corbet 说现在离 2038 年还有 23 年时间,现在部署的系统都会考虑 2038 问题。 +另一个关注点是 2038 问题,Linux 界的“千年虫”,如果不解决,2000 年出现过的问题还会重现。2038 问题说的是在 2038 年一些 Linux 和 Unix 机器会死机(LCTT译注:32 位系统记录的时间,在2038年1月19日星期二晚上03:14:07之后的下一秒,会变成负数)。Corbet 说现在离 2038 年还有 23 年时间,现在部署的系统都会考虑 2038 问题。 -Linux 已经开始一些初步的方案来修复 2038 问题了,但做的还远远不够。“现在就要修复这个问题,而不是等 20 年后把这个头疼的问题留给下一代解决,我们却享受着退休的美好时光”。 +Linux 已经启动一些初步的方案来修复 2038 问题了,但做的还远远不够。“现在就要修复这个问题,而不是等 20 年后把这个头疼的问题留给下一代解决,我们却享受着退休的美好时光”。 物联网(IoT)也是 Linux 关注的领域,Linux 是物联网嵌入式操作系统的主要占有者,然而这并没有什么卵用。Corget 认为日渐臃肿的内核对于未来的物联网设备来说肯定过于庞大。 @@ -42,7 +42,7 @@ via: http://www.eweek.com/enterprise-apps/a-look-at-whats-next-for-the-linux-ker 作者:[Sean Michael Kerner][a] 译者:[bazz2](https://github.com/bazz2) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20150821 Top 4 open source command-line email clients.md b/published/201509/20150821 Top 4 open source command-line email clients.md similarity index 100% rename from published/20150821 Top 4 open source command-line email clients.md rename to published/201509/20150821 Top 4 open source command-line email clients.md diff --git a/translated/tech/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md b/published/201509/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md similarity index 76% rename from translated/tech/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md rename to published/201509/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md index 5ddb31d1ea..19b5a9cd02 100644 --- a/translated/tech/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md +++ b/published/201509/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md @@ -1,14 +1,15 @@ -网络管理命令行工具基础,Nmcli +Nmcli 网络管理命令行工具基础 ================================================================================ + ![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/08/networking1.jpg) ### 介绍 ### -在本教程中,我们会在CentOS / RHEL 7中讨论网络管理工具,也叫**nmcli**。那些使用**ifconfig**的用户应该在CentOS 7中避免使用这个命令。 +在本教程中,我们会在CentOS / RHEL 7中讨论网络管理工具(NetworkManager command line tool),也叫**nmcli**。那些使用**ifconfig**的用户应该在CentOS 7中避免使用**ifconfig** 了。 让我们用nmcli工具配置一些网络设置。 -### 要得到系统中所有接口的地址信息 ### +#### 要得到系统中所有接口的地址信息 #### [root@localhost ~]# ip addr show @@ -27,13 +28,13 @@ inet6 fe80::20c:29ff:fe67:2f4c/64 scope link valid_lft forever preferred_lft forever -#### 检索与连接的接口相关的数据包统计 #### +#### 检索与已连接的接口相关的数据包统计 #### [root@localhost ~]# ip -s link show eno16777736 **示例输出:** -![unxmen_(011)](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_0111.png) +![](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_0111.png) #### 得到路由配置 #### @@ -50,11 +51,11 @@ 输出像traceroute,但是更加完整。 -![unxmen_0121](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_01211.png) +![](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_01211.png) ### nmcli 工具 ### -**Nmcli** 是一个非常丰富和灵活的命令行工具。nmcli使用的情况有: +**nmcli** 是一个非常丰富和灵活的命令行工具。nmcli使用的情况有: - **设备** – 正在使用的网络接口 - **连接** – 一组配置设置,对于一个单一的设备可以有多个连接,可以在连接之间切换。 @@ -63,7 +64,7 @@ [root@localhost ~]# nmcli connection show -![unxmen_(013)](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_013.png) +![](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_013.png) #### 得到特定连接的详情 #### @@ -71,7 +72,7 @@ **示例输出:** -![unxmen_(014)](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_0141.png) +![](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_0141.png) #### 得到网络设备状态 #### @@ -89,7 +90,7 @@ 这里, -- **Connection add** – 添加新的连接 +- **connection add** – 添加新的连接 - **con-name** – 连接名 - **type** – 设备类型 - **ifname** – 接口名 @@ -100,7 +101,7 @@ Connection 'dhcp' (163a6822-cd50-4d23-bb42-8b774aeab9cb) successfully added. -#### 不同过dhcp分配IP,使用“static”添加地址 #### +#### 不通过dhcp分配IP,使用“static”添加地址 #### [root@localhost ~]# nmcli connection add con-name "static" ifname eno16777736 autoconnect no type ethernet ip4 192.168.1.240 gw4 192.168.1.1 @@ -112,25 +113,23 @@ [root@localhost ~]# nmcli connection up eno1 -Again Check, whether ip address is changed or not. 再检查一遍,ip地址是否已经改变 [root@localhost ~]# ip addr show -![unxmen_(015)](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_0151.png) +![](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_0151.png) #### 添加DNS设置到静态连接中 #### [root@localhost ~]# nmcli connection modify "static" ipv4.dns 202.131.124.4 -#### 添加额外的DNS值 #### +#### 添加更多的DNS #### -[root@localhost ~]# nmcli connection modify "static" +ipv4.dns 8.8.8.8 + [root@localhost ~]# nmcli connection modify "static" +ipv4.dns 8.8.8.8 **注意**:要使用额外的**+**符号,并且要是**+ipv4.dns**,而不是**ip4.dns**。 - -添加一个额外的ip地址: +####添加一个额外的ip地址#### [root@localhost ~]# nmcli connection modify "static" +ipv4.addresses 192.168.200.1/24 @@ -138,11 +137,11 @@ Again Check, whether ip address is changed or not. [root@localhost ~]# nmcli connection up eno1 -![unxmen_(016)](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_016.png) +![](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_016.png) 你会看见,设置生效了。 -完结 +完结。 -------------------------------------------------------------------------------- @@ -150,6 +149,6 @@ via: http://www.unixmen.com/basics-networkmanager-command-line-tool-nmcli/ 作者:Rajneesh Upadhyay 译者:[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/translated/tech/20150824 Fix No Bootable Device Found Error After Installing Ubuntu.md b/published/201509/20150824 Fix No Bootable Device Found Error After Installing Ubuntu.md similarity index 58% rename from translated/tech/20150824 Fix No Bootable Device Found Error After Installing Ubuntu.md rename to published/201509/20150824 Fix No Bootable Device Found Error After Installing Ubuntu.md index 91aa23d6aa..4b8e84bf1d 100644 --- a/translated/tech/20150824 Fix No Bootable Device Found Error After Installing Ubuntu.md +++ b/published/201509/20150824 Fix No Bootable Device Found Error After Installing Ubuntu.md @@ -1,44 +1,45 @@ -修复安装完 Ubuntu 后无可引导设备错误 +修复安装完 Ubuntu 后无可引导设备的错误 ================================================================================ -通常情况下,我启动 Ubuntu 和 Windows 双系统,但是这次我决定完全消除 Windows 纯净安装 Ubuntu。纯净安装 Ubuntu 完成后,结束时屏幕输出 **no bootable device found** 而不是进入 GRUB 界面。显然,安装搞砸了 UEFI 引导设置。 + +通常情况下,我会安装启动 Ubuntu 和 Windows 的双系统,但是这次我决定完全消除 Windows 纯净安装 Ubuntu。纯净安装 Ubuntu 完成后,结束时屏幕输出 **无可引导设备(no bootable device found)** 而不是进入 GRUB 界面。显然,安装搞砸了 UEFI 引导设置。 ![安装完 Ubuntu 后无可引导设备](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/08/No_Bootable_Device_Found_1.jpg) -我会告诉你我是如何修复**在宏碁笔记本上安装 Ubuntu 后出现无可引导设备错误**。我声明了我使用的是宏碁灵越 R13,这很重要,因为我们需要更改固件设置,而这些设置可能因制造商和设备有所不同。 +我会告诉你我是如何修复**在宏碁笔记本上安装 Ubuntu 后出现无可引导设备错误**的。我声明了我使用的是宏碁灵越 R13,这很重要,因为我们需要更改固件设置,而这些设置可能因制造商和设备有所不同。 因此在你开始这里介绍的步骤之前,先看一下发生这个错误时我计算机的状态: -- 我的宏碁灵越 R13 预装了 Windows8.1 和 UEFI 引导管理器 -- 关闭了 Secure boot(我的笔记本刚维修过,维修人员又启用了它,直到出现了问题我才发现)。你可以阅读这篇博文了解[如何在宏碁笔记本中关闭 secure boot][1] -- 我通过选择清除所有东西安装 Ubuntu,例如现有的 Windows 8.1,各种分区等。 +- 我的宏碁灵越 R13 预装了 Windows 8.1 和 UEFI 引导管理器 +- 安全引导( Secure boot)没有关闭,(我的笔记本刚维修过,维修人员又启用了它,直到出现了问题我才发现)。你可以阅读这篇博文了解[如何在宏碁笔记本中关闭安全引导(secure boot)][1] +- 我选择了清除所有东西安装 Ubuntu,例如现有的 Windows 8.1,各种分区等 - 安装完 Ubuntu 之后,从硬盘启动时我看到无可引导设备错误。但能从 USB 设备正常启动 -在我看来,没有禁用 secure boot 可能是这个错误的原因。但是,我没有数据支撑我的观点。这仅仅是预感。有趣的是,双系统启动 Windows 和 Linux 经常会出现这两个 Grub 问题: +在我看来,没有禁用安全引导(secure boot)可能是这个错误的原因。但是,我没有数据支撑我的观点。这仅仅是预感。有趣的是,双系统启动 Windows 和 Linux 经常会出现这两个 Grub 问题: -- [error: no such partition grub rescue][2] -- [Minimal BASH like line editing is supported][3] +- [错误:没有 grub 救援分区][2] +- [支持最小化 BASH 式的行编辑][3] 如果你遇到类似的情况,你可以试试我的修复方法。 ### 修复安装完 Ubuntu 后无可引导设备错误 ### -请原谅我没有丰富的图片。我的一加相机不能很好地拍摄笔记本屏幕。 +请原谅我的图片质量很差。我的一加相机不能很好地拍摄笔记本屏幕。 #### 第一步 #### -关闭电源并进入 boot 设置。我需要在宏碁灵越 R13 上快速地按 Fn+F2。如果你使用固态硬盘的话要按的非常快,因为固态硬盘启动速度很快。取决于你的制造商,你可能要用 Del 或 F10 或者 F12。 +关闭电源并进入引导设置。我需要在宏碁灵越 R13 上快速地按下 Fn+F2。如果你使用固态硬盘的话要按的非常快,因为固态硬盘启动速度很快。这取决于你的制造商,你可能要用 Del 或 F10 或者 F12。 #### 第二步 #### -在 boot 设置中,确保启用了 Secure Boot。它在 Boot 标签里。 +在引导设置中,确保启用了 Secure Boot。它在 Boot 标签里。 #### 第三步 #### -进入到 Security 标签,查找 “Select an UEFI file as trusted for executing” 并敲击回车。 +进入到 Security 标签,找到 “选择一个用于执行的可信任 UEFI 文件(Select an UEFI file as trusted for executing)” 并敲击回车。 ![修复无可引导设备错误](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/08/No_Bootable_Device_Found_2.jpg) -特意说明,我们这一步是要在你的设备中添加 UEFI 设置文件(安装 Ubuntu 的时候生成)到可信 UEFI 启动。如果你记得的话,UEFI 启动的主要目的是提供安全性,由于(可能)没有禁用 Secure Boot,设备不会试图从新安装的操作系统中启动。添加它到类似白名单的可信列表,会使设备从 Ubuntu UEFI 文件启动。 +特意说明,我们这一步是要在你的设备中添加 UEFI 设置文件(安装 Ubuntu 的时候生成)到可信 UEFI 启动中。如果你记得的话,UEFI 启动的主要目的是提供安全性,由于(可能)没有禁用安全引导(Secure Boot),设备不会试图从新安装的操作系统中启动。添加它到类似白名单的可信列表,会使设备从 Ubuntu UEFI 文件启动。 #### 第四步 #### @@ -48,13 +49,13 @@ #### 第五步 #### -你应该可以看到 ,敲击回车。 +你应该可以看到 \ 了,敲击回车。 ![在 UEFI 中修复设置](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/08/No_Bootable_Device_Found_4.jpg) #### 第六步 #### -在下一个屏幕中你会看到 。耐心点,马上就好了。 +在下一个屏幕中你会看到 \。耐心点,马上就好了。 ![安装完 Ubuntu 后修复启动错误](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/08/No_Bootable_Device_Found_5.jpg) @@ -71,7 +72,7 @@ #### 第八步 #### -当我们添加它到可信 EFI 文件并执行时,按 F10 保存并退出。 +当我们添加它到可信 EFI 文件并执行后,按 F10 保存并退出。 ![保存并退出固件设置](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/08/No_Bootable_Device_Found_8.jpg) @@ -87,7 +88,7 @@ via: http://itsfoss.com/no-bootable-device-found-ubuntu/ 作者:[Abhishek][a] 译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) -校对:[校对者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/20150824 How To Add Hindi And Devanagari Support In Antergos And Arch Linux.md b/published/201509/20150824 How To Add Hindi And Devanagari Support In Antergos And Arch Linux.md similarity index 85% rename from translated/tech/20150824 How To Add Hindi And Devanagari Support In Antergos And Arch Linux.md rename to published/201509/20150824 How To Add Hindi And Devanagari Support In Antergos And Arch Linux.md index 1bcc05a080..82063aae7a 100644 --- a/translated/tech/20150824 How To Add Hindi And Devanagari Support In Antergos And Arch Linux.md +++ b/published/201509/20150824 How To Add Hindi And Devanagari Support In Antergos And Arch Linux.md @@ -1,17 +1,19 @@ -为Antergos与Arch Linux添加印度语和梵文支持 +也许你需要在 Antergos 与 Arch Linux 中查看印度语和梵文? ================================================================================ ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/08/Indian-languages.jpg) -你们到目前或许知道,我最近一直在尝试体验[Antergos Linux][1]。在安装完[Antergos][2]后我所首先注意到的一些事情是在默认的Chromium浏览器中**没法正确显示印度语脚本**。 +你们到目前或许知道,我最近一直在尝试体验 [Antergos Linux][1]。在安装完[Antergos][2]后我所首先注意到的一些事情是在默认的 Chromium 浏览器中**没法正确显示印度语脚本**。 这是一件奇怪的事情,在我之前桌面Linux的体验中是从未遇到过的。起初,我认为是浏览器的问题,所以我安装了Firefox,然而问题依旧,Firefox也不能正确显示印度语。和Chromium不显示任何东西不同的是,Firefox确实显示了一些东西,但是毫无可读性。 ![No hindi support in Arch Linux based Antergos](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/08/Hindi_Support_Antergos_Arch_linux_1.jpeg) -Chromium中的印度语显示 + +*Chromium中的印度语显示* ![No hindi support in Arch Linux based Antergos](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/08/Hindi_Support_Antergos_Arch_linux_2.jpeg) -Firefox中的印度语显示 + +*Firefox中的印度语显示* 奇怪吧?那么,默认情况下基于Arch的Antergos Linux中没有印度语的支持吗?我没有去验证,但是我假设其它基于梵语脚本的印地语之类会产生同样的问题。 @@ -37,7 +39,7 @@ via: http://itsfoss.com/display-hindi-arch-antergos/ 作者:[Abhishek][a] 译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20150824 How to create an AP in Ubuntu 15.04 to connect to Android or iPhone.md b/published/201509/20150824 How to create an AP in Ubuntu 15.04 to connect to Android or iPhone.md similarity index 100% rename from published/20150824 How to create an AP in Ubuntu 15.04 to connect to Android or iPhone.md rename to published/201509/20150824 How to create an AP in Ubuntu 15.04 to connect to Android or iPhone.md diff --git a/translated/talk/20150824 Linux about to gain a new file system--bcachefs.md b/published/201509/20150824 Linux about to gain a new file system--bcachefs.md similarity index 53% rename from translated/talk/20150824 Linux about to gain a new file system--bcachefs.md rename to published/201509/20150824 Linux about to gain a new file system--bcachefs.md index 4fe4bf8ff9..c7946e9fad 100644 --- a/translated/talk/20150824 Linux about to gain a new file system--bcachefs.md +++ b/published/201509/20150824 Linux about to gain a new file system--bcachefs.md @@ -1,14 +1,15 @@ -Linux 界将出现一个新的文件系统:bcachefs +Linux 上将出现一个新的文件系统:bcachefs ================================================================================ -这个有 5 年历史,由 Kent Oberstreet 创建,过去属于谷歌的文件系统,最近完成了关键的组件。Bcachefs 文件系统自称其性能和稳定性与 ext4 和 xfs 相同,而其他方面的功能又可以与 btrfs 和 zfs 相媲美。主要特性包括校验、压缩、多设备支持、缓存、快照与其他好用的特性。 -Bcachefs 来自 **bcache**,这是一个块级缓存层,从 bcaceh 到一个功能完整的[写时复制][1]文件系统,堪称是一项质的转变。 +这个有 5 年历史,由 Kent Oberstreet 创建,过去属于谷歌的文件系统,最近完成了全部关键组件。Bcachefs 文件系统自称其性能和稳定性与 ext4 和 xfs 相同,而其他方面的功能又可以与 btrfs 和 zfs 相媲美。主要特性包括校验、压缩、多设备支持、缓存、快照与其他“漂亮”的特性。 -在自己提出问题“为什么要出一个新的文件系统”中,Kent Oberstreet 作了以下回答:当我还在谷歌的时候,我与其他在 bcache 上工作的同事在偶然的情况下意识到我们正在使用的东西可以成为一个成熟文件系统的功能块,我们可以用 bcache 创建一个拥有干净而优雅设计的文件系统,而最重要的一点是,bcachefs 的主要目的就是在性能和稳定性上能与 ext4 和 xfs 匹敌,同时拥有 btrfs 和 zfs 的特性。 +Bcachefs 来自 **bcache**,这是一个块级缓存层。从 bcaceh 到一个功能完整的[写时复制][1]文件系统,堪称是一项质的转变。 + +对自己的问题“为什么要出一个新的文件系统”中,Kent Oberstreet 自问自答道:当我还在谷歌的时候,我与其他在 bcache 上工作的同事在偶然的情况下意识到我们正在使用的东西可以成为一个成熟文件系统的功能块,我们可以用 bcache 创建一个拥有干净而优雅设计的文件系统,而最重要的一点是,bcachefs 的主要目的就是在性能和稳定性上能与 ext4 和 xfs 匹敌,同时拥有 btrfs 和 zfs 的特性。 Overstreet 邀请人们在自己的系统上测试 bcachefs,可以通过邮件列表[通告]获取 bcachefs 的操作指南。 -Linux 生态系统中文件系统几乎处于一家独大状态,Fedora 在第 16 版的时候就想用 btrfs 换掉 ext4 作为其默认文件系统,但是到现在(LCTT:都出到 Fedora 22 了)还在使用 ext4。而几乎所有 Debian 系的发行版(Ubuntu、Mint、elementary OS 等)也使用 ext4 作为默认文件系统,并且这些主流的发生版都没有替换默认文件系统的意思。 +Linux 生态系统中文件系统几乎处于一家独大状态,Fedora 在第 16 版的时候就想用 btrfs 换掉 ext4 作为其默认文件系统,但是到现在(LCTT:都出到 Fedora 22 了)还在使用 ext4。而几乎所有 Debian 系的发行版(Ubuntu、Mint、elementary OS 等)也使用 ext4 作为默认文件系统,并且这些主流的发行版都没有替换默认文件系统的意思。 -------------------------------------------------------------------------------- @@ -16,7 +17,7 @@ via: http://www.linuxveda.com/2015/08/22/linux-gain-new-file-system-bcachefs/ 作者:[Paul Hill][a] 译者:[bazz2](https://github.com/bazz2) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201509/20150824 Mhddfs--Combine Several Smaller Partition into One Large Virtual Storage.md b/published/201509/20150824 Mhddfs--Combine Several Smaller Partition into One Large Virtual Storage.md new file mode 100644 index 0000000000..eb462bfe6a --- /dev/null +++ b/published/201509/20150824 Mhddfs--Combine Several Smaller Partition into One Large Virtual Storage.md @@ -0,0 +1,157 @@ +Mhddfs:将多个小分区合并成一个大的虚拟存储 +================================================================================ + +让我们假定你有30GB的电影,并且你有3个驱动器,每个的大小为20GB。那么,你会怎么来存放东西呢? + +很明显,你可以将你的视频分割成2个或者3个不同的卷,并将它们手工存储到驱动器上。这当然不是一个好主意,它成了一项费力的工作,它需要你手工干预,而且花费你大量时间。 + +另外一个解决方案是创建一个 [RAID磁盘阵列][1]。然而,RAID在存储可靠性,磁盘空间可用性差等方面声名狼藉。另外一个解决方案,就是mhddfs。 + +![Combine Multiple Partitions in Linux](http://www.tecmint.com/wp-content/uploads/2015/08/Combine-Multiple-Partitions-in-Linux.png) + +*Mhddfs——在Linux中合并多个分区* + +mhddfs是一个用于Linux的设备驱动,它可以将多个挂载点合并到一个虚拟磁盘中。它是一个基于FUSE的驱动,提供了一个用于大数据存储的简单解决方案。它可以将所有小文件系统合并,创建一个单一的大虚拟文件系统,该文件系统包含其成员文件系统的所有内容,包括文件和空闲空间。 + +#### 你为什么需要Mhddfs? #### + +你的所有存储设备会创建为一个单一的虚拟池,它可以在启动时被挂载。这个小工具可以智能地照看并处理哪个存储满了,哪个存储空着,以及将数据写到哪个存储中。当你成功创建虚拟驱动器后,你可以使用[SAMBA][2]来共享你的虚拟文件系统。你的客户端将在任何时候都看到一个巨大的驱动器和大量的空闲空间。 + +#### Mhddfs特性 #### + +- 获取文件系统属性和系统信息。 +- 设置文件系统属性。 +- 创建、读取、移除和写入目录和文件。 +- 在单一设备上支持文件锁和硬链接。 + +|mhddfs的优点|mhddfs的缺点| +|-----------|-----------| +|适合家庭用户|mhddfs驱动没有内建在Linux内核中 | +|运行简单|运行时需要大量处理能力| +|没有明显的数据丢失|没有冗余解决方案| +|不需要分割文件|不支持移动硬链接| +|可以添加新文件到组成的虚拟文件系统|| +|可以管理文件保存的位置|| +|支持扩展文件属性|| + +### Linux中安装Mhddfs ### + +在Debian及其类似的移植系统中,你可以使用下面的命令来安装mhddfs包。 + + # apt-get update && apt-get install mhddfs + +![Install Mhddfs on Debian based Systems](http://www.tecmint.com/wp-content/uploads/2015/08/Install-Mhddfs-on-Ubuntu.png) + +*安装Mhddfs到基于Debian的系统中* + +在RHEL/CentOS Linux系统中,你需要开启[epel仓库][3],然后执行下面的命令来安装mhddfs包。 + + # yum install mhddfs + +在Fedora 22及以上系统中,你可以通过dnf包管理来获得它,就像下面这样。 + + # dnf install mhddfs + +![Install Mhddfs on Fedora](http://www.tecmint.com/wp-content/uploads/2015/08/Install-Mhddfs-on-Fedora.png) + +*安装Mhddfs到Fedora* + +如果万一mhddfs包不能从epel仓库获取到,那么你需要解决下面的依赖,然后像下面这样来编译源码并安装。 + +- FUSE头文件 +- GCC +- libc6头文件 +- uthash头文件 +- libattr1头文件(可选) + +接下来,只需从下面建议的地址下载最新的源码包,然后编译。 + + # wget http://mhddfs.uvw.ru/downloads/mhddfs_0.1.39.tar.gz + # tar -zxvf mhddfs*.tar.gz + # cd mhddfs-0.1.39/ + # make + +你应该可以在当前目录中看到mhddfs的二进制文件,以root身份将它移动到/usr/bin/和/usr/local/bin/中。 + + # cp mhddfs /usr/bin/ + # cp mhddfs /usr/local/bin/ + +一切搞定,mhddfs已经可以用了。 + +### 我怎么使用Mhddfs? ### + +1、 让我们看看当前所有挂载到我们系统中的硬盘。 + + $ df -h + +![Check Mounted Devices](http://www.tecmint.com/wp-content/uploads/2015/08/Check-Mounted-Devices.gif) + +**样例输出** + + Filesystem Size Used Avail Use% Mounted on + + /dev/sda1 511M 132K 511M 1% /boot/efi + /dev/sda2 451G 92G 336G 22% / + /dev/sdb1 1.9T 161G 1.7T 9% /media/avi/BD9B-5FCE + /dev/sdc1 555M 555M 0 100% /media/avi/Debian 8.1.0 M-A 1 + +注意这里的‘挂载点’名称,我们后面会使用到它们。 + +2、 创建目录‘/mnt/virtual_hdd’,所有这些文件系统将会在这里组织到一起。 + + # mkdir /mnt/virtual_hdd + +3、 然后,挂载所有文件系统。你可以通过root或者FUSE组中的某个用户来完成。 + + # mhddfs /boot/efi, /, /media/avi/BD9B-5FCE/, /media/avi/Debian\ 8.1.0\ M-A\ 1/ /mnt/virtual_hdd -o allow_other + +![Mount All File System in Linux](http://www.tecmint.com/wp-content/uploads/2015/08/Mount-All-File-System-in-Linux.png) + +*在Linux中挂载所有文件系统* + +**注意**:这里我们使用了所有硬盘的挂载点名称,很明显,你的挂载点名称会有所不同。也请注意“-o allow_other”选项可以让这个虚拟文件系统让其它所有人可见,而不仅仅是创建它的人。 + +4、 现在,运行“df -h”来看看所有文件系统。它应该包含了你刚才创建的那个。 + + $ df -h + +![Verify Virtual File System Mount](http://www.tecmint.com/wp-content/uploads/2015/08/Verify-Virtual-File-System.png) + +*验证虚拟文件系统挂载* + +你可以像对已挂在的驱动器那样给虚拟文件系统应用所有的选项。 + +5、 要在每次系统启动创建这个虚拟文件系统,你应该以root身份添加下面的这行代码(在你那里会有点不同,取决于你的挂载点)到/etc/fstab文件的末尾。 + + mhddfs# /boot/efi, /, /media/avi/BD9B-5FCE/, /media/avi/Debian\ 8.1.0\ M-A\ 1/ /mnt/virtual_hdd fuse defaults,allow_other 0 0 + +6、 如果在任何时候你想要添加/移除一个新的驱动器到/从虚拟硬盘,你可以挂载一个新的驱动器,拷贝/mnt/vritual_hdd的内容,卸载卷,弹出你要移除的的驱动器并/或挂载你要包含的新驱动器。使用mhddfs命令挂载全部文件系统到Virtual_hdd下,这样就全部搞定了。 + +#### 我怎么卸载Virtual_hdd? #### + +卸载virtual_hdd相当简单,就像下面这样 + + # umount /mnt/virtual_hdd + +![Unmount Virtual Filesystem](http://www.tecmint.com/wp-content/uploads/2015/08/Unmount-Virtual-Filesystem.png) + +*卸载虚拟文件系统* + +注意,是umount,而不是unmount,很多用户都输错了。 + +到现在为止全部结束了。我正在写另外一篇文章,你们一定喜欢读的。到那时,请保持连线。请在下面的评论中给我们提供有用的反馈吧。请为我们点赞并分享,帮助我们扩散。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/combine-partitions-into-one-in-linux-using-mhddfs/ + +作者:[Avishek Kumar][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/understanding-raid-setup-in-linux/ +[2]:http://www.tecmint.com/mount-filesystem-in-linux/ +[3]:https://linux.cn/article-2324-1.html diff --git a/published/20150824 Watch These Kids Having Fun With Linux Terminal In Ubuntu.md b/published/201509/20150824 Watch These Kids Having Fun With Linux Terminal In Ubuntu.md similarity index 100% rename from published/20150824 Watch These Kids Having Fun With Linux Terminal In Ubuntu.md rename to published/201509/20150824 Watch These Kids Having Fun With Linux Terminal In Ubuntu.md diff --git a/published/201509/20150826 Five Super Cool Open Source Games.md b/published/201509/20150826 Five Super Cool Open Source Games.md new file mode 100644 index 0000000000..418d6248a5 --- /dev/null +++ b/published/201509/20150826 Five Super Cool Open Source Games.md @@ -0,0 +1,66 @@ +五大超酷的开源游戏 +================================================================================ + +在2014年和2015年,Linux 涌入了一堆流行的付费游戏,例如备受欢迎的无主之地(Borderlands)、巫师(Witcher)、死亡岛(Dead Island) 和 CS 系列游戏。虽然这是令人激动的消息,但玩家有这个支出预算吗?付费游戏很好,但更好的是由了解玩家喜好的开发者开发的免费的替代品。 + +前段时间,我偶然看到了一个三年前发布的 YouTube 视频,标题非常的有正能量 [5个不算糟糕的开源游戏][1]。虽然视频表扬了一些开源游戏,我还是更喜欢用一个更加热情的方式来切入这个话题,至少如标题所说。所以,下面是我的一份五大超酷开源游戏的清单。 + +### Tux Racer ### + +![Tux Racer](http://fossforce.com/wp-content/uploads/2015/08/tuxracer-550x413.jpg) + +*Tux Racer* + +[《Tux Racer》][2]是这份清单上的第一个游戏,因为我对这个游戏很熟悉。最近,我的兄弟和我为了参加[玩电脑的孩子们][4]项目,在[去墨西哥的路途中][3],Tux Racer 是孩子和教师都喜欢玩的游戏之一。在这个游戏中,玩家使用 Linux 吉祥物——企鹅 Tux——在下山雪道上以计时赛的方式进行比赛。玩家们不断挑战他们自己的最佳纪录。目前还没有多玩家版本,但这是有可能改变的。它适用于 Linux、OS X、Windows 和 Android。 + +### Warsow ### + +![Warsow](http://fossforce.com/wp-content/uploads/2015/08/warsow-550x413.jpg) + +*Warsow* + +[《Warsow》][5]网站介绍道:“设定是有未来感的卡通世界,Warsow 是个完全开放的适用于 Windows、Linux 和 Mac OS X平台的快节奏第一人称射击游戏(FPS)。Warsow 是跨网络的尊重和体育精神的的艺术。(Warsow is the Art of Respect and Sportsmanship Over the Web. 大写回文字母组成 Warsow。)” 我很不情愿的把 FPS 类放到了这个列表中,因为很多人玩过这类的游戏,但是我的确被 Warsow 打动了。它对很多动作进行了优先级排序,游戏节奏很快,一开始就有八个武器。卡通化的风格让玩的过程变得没有那么严肃,更加的休闲,非常适合和亲友一同玩。然而,它却以充满竞争的游戏自居,并且当我体验这个游戏时,我发现周围确实有一些专家级的玩家。它适用于 Linux、Windows 和 OS X。 + +### M.A.R.S——一个荒诞的射击游戏 ### + +![M.A.R.S. - A ridiculous shooter](http://fossforce.com/wp-content/uploads/2015/08/MARS-screenshot-550x344.jpg) + +*M.A.R.S.——一个荒诞的射击游戏* + +[《M.A.R.S——一个荒诞的射击游戏》][6]之所以吸引人是因为它充满活力的色彩和画风。支持两个玩家使用同一个键盘,而一个在线多玩家版本目前正在开发中——这意味着想要和朋友们一起玩暂时还要等等。不论如何,它是个可以使用几个不同飞船和武器的有趣的太空射击游戏。飞船的形状不同,从普通的枪、激光、散射枪到更有趣的武器(随机出来的飞船中有一个会对敌人发射泡泡,这为这款混乱的游戏增添了很多乐趣)。游戏有几种模式,比如标准模式和对方进行殊死搏斗以获得高分或先达到某个分数线,还有其他的模式,空间球(Spaceball)、坟坑(Grave-itation Pit)和保加农炮(Cannon Keep)。它适用于 Linux、Windows 和 OS X。 + +### Valyria Tear ### + +![Valyria Tear](http://fossforce.com/wp-content/uploads/2015/08/bronnan-jump-to-enemy-550x413.jpg) + +*Valyria Tear* + +[Valyria Tear][7] 类似近年来拥有众多粉丝的角色扮演游戏(RPG)。故事设定在奇幻游戏的通用年代,充满了骑士、王国和魔法,以及主要角色 Bronann。设计团队在这个世界的设计上做的非常棒,实现了玩家对这类游戏所有的期望:隐藏的宝藏、偶遇的怪物、非玩家操纵角色(NPC)的互动以及所有 RPG 不可或缺的——在低级别的怪物上刷经验直到可以面对大 BOSS。我在试玩的时候,时间不允许我太过深入到这个游戏故事中,但是感兴趣的人可以看 YouTube 上由 Yohann Ferriera 用户发的‘[Let’s Play][8]’系列视频。它适用于 Linux、Windows 和 OS X。 + +### SuperTuxKart ### + +![SuperTuxKart](http://fossforce.com/wp-content/uploads/2015/08/hacienda_tux_antarctica-550x293.jpg) + +*SuperTuxKart* + +最后一个同样好玩的游戏是 [SuperTuxKart][9],一个效仿 Mario Kart(马里奥卡丁车)但丝毫不逊色的好游戏。它在2000年-2004年间开始以 Tux Kart 开发,但是在成品中有错误,结果开发就停止了几年。从2006年开始重新开发时起,它就一直在改进,直到四个月前0.9版首次发布。在游戏里,我们的老朋友 Tux 与马里奥和其他一些开源吉祥物一同开始。其中一个熟悉的面孔是 Suzanne,这是 Blender 的那只吉祥物猴子。画面很给力,游戏很流畅。虽然在线游戏还在计划阶段,但是分屏多玩家游戏是可以的。一个电脑最多可以供四个玩家同时玩。它适用于 Linux、Windows、OS X、AmigaOS 4、AROS 和 MorphOS。 + +-------------------------------------------------------------------------------- + +via: http://fossforce.com/2015/08/five-super-cool-open-source-games/ + +作者:Hunter Banks +译者:[H-mudcup](https://github.com/H-mudcup) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://www.youtube.com/watch?v=BEKVl-XtOP8 +[2]:http://tuxracer.sourceforge.net/download.html +[3]:http://fossforce.com/2015/07/banks-family-values-texas-linux-fest/ +[4]:http://www.kidsoncomputers.org/an-amazing-week-in-oaxaca +[5]:https://www.warsow.net/download +[6]:http://mars-game.sourceforge.net/ +[7]:http://valyriatear.blogspot.com/ +[8]:https://www.youtube.com/channel/UCQ5KrSk9EqcT_JixWY2RyMA +[9]:http://supertuxkart.sourceforge.net/ diff --git a/published/20150826 How to set up a system status page of your infrastructure.md b/published/201509/20150826 How to set up a system status page of your infrastructure.md similarity index 100% rename from published/20150826 How to set up a system status page of your infrastructure.md rename to published/201509/20150826 How to set up a system status page of your infrastructure.md diff --git a/published/201509/20150826 Mosh Shell--A SSH Based Client for Connecting Remote Unix or Linux Systems.md b/published/201509/20150826 Mosh Shell--A SSH Based Client for Connecting Remote Unix or Linux Systems.md new file mode 100644 index 0000000000..2b5c37992d --- /dev/null +++ b/published/201509/20150826 Mosh Shell--A SSH Based Client for Connecting Remote Unix or Linux Systems.md @@ -0,0 +1,110 @@ +mosh:一个基于 SSH 用于连接远程 Unix/Linux 系统的工具 +================================================================================ +Mosh 表示移动 Shell(Mobile Shell),是一个用于从客户端跨互联网连接远程服务器的命令行工具。它能用于 SSH 连接,但是比 Secure Shell 功能更多。它是一个类似于 SSH 而带有更多功能的应用。程序最初由 Keith Winstein 编写,用于类 Unix 的操作系统中,发布于GNU GPL v3协议下。 + +![Mosh Shell SSH Client](http://www.tecmint.com/wp-content/uploads/2015/08/Mosh-Shell-SSH-Client.png) + +*Mosh Shell SSH 客户端* + +#### Mosh的功能 #### + +- 它是一个支持漫游的远程终端程序。 +- 在所有主流的类 Unix 版本中可用,如 Linux、FreeBSD、Solaris、Mac OS X 和 Android。 +- 支持不稳定连接 +- 支持智能的本地回显 +- 支持用户输入的行编辑 +- 响应式设计及在 wifi、3G、长距离连接下的鲁棒性 +- 在 IP 改变后保持连接。它使用 UDP 代替 TCP(在 SSH 中使用),当连接被重置或者获得新的 IP 后 TCP 会超时,但是 UDP 仍然保持连接。 +- 在很长的时候之后恢复会话时仍然保持连接。 +- 没有网络延迟。立即显示用户输入和删除而没有延迟 +- 像 SSH 那样支持一些旧的方式登录。 +- 包丢失处理机制 + +### Linux 中 mosh 的安装 ### + +在 Debian、Ubuntu 和 Mint 类似的系统中,你可以很容易地用 [apt-get 包管理器][1]安装。 + + # apt-get update + # apt-get install mosh + +在基于 RHEL/CentOS/Fedora 的系统中,要使用 [yum 包管理器][3]安装 mosh,你需要打开第三方的 [EPEL][2]。 + + # yum update + # yum install mosh + +在 Fedora 22+的版本中,你需要使用 [dnf 包管理器][4]来安装 mosh。 + + # dnf install mosh + +### 我该如何使用 mosh? ### + +1、 让我们尝试使用 mosh 登录远程 Linux 服务器。 + + $ mosh root@192.168.0.150 + +![Mosh Shell Remote Connection](http://www.tecmint.com/wp-content/uploads/2015/08/Mosh-Shell-Remote-Connection.png) + +*mosh远程连接* + +**注意**:你有没有看到一个连接错误,因为我在 CentOS 7中还有打开这个端口。一个快速但是我并不建议的解决方法是: + + # systemctl stop firewalld [在远程服务器上] + +更好的方法是打开一个端口并更新防火墙规则。接着用 mosh 连接到预定义的端口中。至于更深入的细节,也许你会对下面的文章感兴趣。 + +- [如何配置 Firewalld][5] + +2、 让我们假设把默认的 22 端口改到 70,这时使用 -p 选项来使用自定义端口。 + + $ mosh -p 70 root@192.168.0.150 + +3、 检查 mosh 的版本 + + $ mosh --version + +![Check Mosh Version](http://www.tecmint.com/wp-content/uploads/2015/08/Check-Mosh-Version.png) + +*检查mosh版本* + +4、 你可以输入`exit`来退出 mosh 会话。 + + $ exit + +5、 mosh 支持很多选项,你可以用下面的方法看到: + + $ mosh --help + +![Mosh Shell Options](http://www.tecmint.com/wp-content/uploads/2015/08/Mosh-Shell-Options.png) + +*Mosh 选项* + +#### mosh 的优缺点 #### + +- mosh 有额外的需求,比如需要允许 UDP 直接连接,这在 SSH 不需要。 +- 动态分配的端口范围是 60000-61000。第一个打开的端口是分配好的。每个连接都需要一个端口。 +- 默认的端口分配是一个严重的安全问题,尤其是在生产环境中。 +- 支持 IPv6 连接,但是不支持 IPv6 漫游。 +- 不支持回滚 +- 不支持 X11 转发 +- 不支持 ssh-agent 转发 + +### 总结 ### + +mosh是一款在大多数linux发行版的仓库中可以下载的一款小工具。虽然它有一些差异尤其是安全问题和额外的需求,它的功能,比如漫游后保持连接是一个加分点。我的建议是任何一个使用ssh的linux用户都应该试试这个程序,mosh值得一试。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-mosh-shell-ssh-client-in-linux/ + +作者:[Avishek Kumar][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/useful-basic-commands-of-apt-get-and-apt-cache-for-package-management/ +[2]:https://linux.cn/article-2324-1.html +[3]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ +[4]:http://www.tecmint.com/dnf-commands-for-fedora-rpm-package-management/ +[5]:http://www.tecmint.com/configure-firewalld-in-centos-7/ diff --git a/translated/share/20150827 Xtreme Download Manager Updated With Fresh GUI.md b/published/201509/20150827 Xtreme Download Manager Updated With Fresh GUI.md similarity index 87% rename from translated/share/20150827 Xtreme Download Manager Updated With Fresh GUI.md rename to published/201509/20150827 Xtreme Download Manager Updated With Fresh GUI.md index d9ab3ab9f3..bd55b6fb66 100644 --- a/translated/share/20150827 Xtreme Download Manager Updated With Fresh GUI.md +++ b/published/201509/20150827 Xtreme Download Manager Updated With Fresh GUI.md @@ -1,4 +1,4 @@ -Xtreme下载管理器升级全新用户界面 +Xtreme 下载管理器升级带来全新用户界面 ================================================================================ ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/08/Xtreme-Download-Manager-Linux.jpg) @@ -6,11 +6,11 @@ Xtreme下载管理器升级全新用户界面 Xtreme 下载管理器,也被称作 XDM 或 XDMAN,它是一个跨平台的下载管理器,可以用于 Linux、Windows 和 Mac OS X 系统之上。同时它兼容于主流的浏览器,如 Chrome, Firefox, Safari 等,因此当你从浏览器下载东西的时候可以直接使用 XDM 下载。 -当你的网络连接超慢并且需要管理下载文件的时候,像 XDM 这种软件可以帮到你大忙。例如说你在一个慢的要死的网络速度下下载一个超大文件, XDM 可以帮助你暂停并且继续下载。 +当你的网络连接超慢并且需要管理下载文件的时候,像 XDM 这种软件可以帮到你大忙。例如说你在一个慢的要死的网络速度下下载一个超大文件,或者你想要暂停和恢复下载的话, XDM 可以帮助你。 XDM 的主要功能: -- 暂停和继续下载 +- 暂停和恢复下载 - [从 YouTube 下载视频][3],其他视频网站同样适用 - 强制聚合 - 下载加速 @@ -23,11 +23,11 @@ XDM 的主要功能: ![Old XDM](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/08/Xtreme-Download-Manager-700x400_c.jpg) -老版本XDM +*老版本XDM* ![New XDM](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/08/Xtreme_Download_Manager.png) -新版本XDM +*新版本XDM* ### 在基于 Ubuntu 的 Linux 发行版上安装 Xtreme下载管理器 ### @@ -48,15 +48,15 @@ XDM 的主要功能: 对于其他Linux发行版,可以通过以下连接下载: -- [Download Xtreme Download Manager][4] +- [下载 Xtreme 下载管理器][4] -------------------------------------------------------------------------------- via: http://itsfoss.com/xtreme-download-manager-install/ 作者:[Abhishek][a] -译者:[译者ID](https://github.com/mr-ping) -校对:[校对者ID](https://github.com/校对者ID) +译者:[mr-ping](https://github.com/mr-ping) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201509/20150901 How to Defragment Linux Systems.md b/published/201509/20150901 How to Defragment Linux Systems.md new file mode 100644 index 0000000000..4c14b5fc5f --- /dev/null +++ b/published/201509/20150901 How to Defragment Linux Systems.md @@ -0,0 +1,126 @@ +如何在 Linux 中整理磁盘碎片 +================================================================================ + +![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-featured.png) + +有一神话是 linux 的磁盘从来不需要整理碎片。在大多数情况下这是真的,大多数因为是使用的是优秀的日志系统(ext2、3、4等等)来处理文件系统。然而,在一些特殊情况下,碎片仍旧会产生。如果正巧发生在你身上,解决方法很简单。 + +### 什么是磁盘碎片 ### + +文件系统会按块更新文件,如果这些块没有连成一整块而是分布在磁盘的各个角落中时,就会形成磁盘碎片。这对于 FAT 和 FAT32 文件系统而言是这样的。在 NTFS 中这种情况有所减轻,但在 Linux(extX)中却几乎不会发生。下面是原因: + +在像 FAT 和 FAT32 这类文件系统中,文件紧挨着写入到磁盘中。文件之间没有空间来用于增长或者更新: + +![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-fragmented.png) + +NTFS 中在文件之间保留了一些空间,因此有空间进行增长。但因块之间的空间是有限的,碎片也会随着时间出现。 + +![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-ntfs.png) + +Linux 的日志型文件系统采用了一个不同的方案。与文件相互挨着不同,每个文件分布在磁盘的各处,每个文件之间留下了大量的剩余空间。这就给文件更新和增长留下了很大的空间,碎片很少会发生。 + +![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-journal.png) + +此外,碎片一旦出现了,大多数 Linux 文件系统会尝试将文件和块重新连续起来。 + +### Linux 中的磁盘整理 ### + +除非你用的是一个很小的硬盘或者空间不够了,不然 Linux 很少会需要磁盘整理。一些可能需要磁盘整理的情况包括: + +- 如果你编辑的是大型视频文件或者 RAW 照片,但磁盘空间有限 +- 如果你使用一个老式硬件,如旧笔记本,你的硬盘会很小 +- 如果你的磁盘开始满了(大约使用了85%) +- 如果你的家目录中有许多小分区 + +最好的解决方案是购买一个大硬盘。如果不可能,磁盘碎片整理就很有用了。 + +### 如何检查碎片 ### + +`fsck` 命令会为你做这个,换句话说,如果你可以在 LiveCD 中运行它,那么就可以用于**所有卸载的分区**。 + +这一点很重要:**在已经挂载的分区中运行 fsck 将会严重危害到你的数据和磁盘**。 + +你已经被警告过了。开始之前,先做一个完整的备份。 + +**免责声明**: 本文的作者与本站将不会对您的文件、数据、系统或者其他损害负责。你需要自己承担风险。如果你继续,你需要接受并了解这点。 + +你应该启动到一个 live 会话中(如使用安装磁盘,系统救援CD等)并在你**卸载**的分区上运行 `fsck` 。要检查是否有任何问题,请在使用 root 权限运行下面的命令: + + fsck -fn [/path/to/your/partition] + +您可以运行以下命令找到分区的路径 + + sudo fdisk -l + +有一个在已挂载的分区中运行 `fsck`(相对)安全的方法是使用`-n`开关。这会对分区进行只读文件系统检查,而不会写入任何东西。当然,这并不能保证十分安全,你应该在创建备份之后进行。在 ext2 中,运行 + + sudo fsck.ext2 -fn /path/to/your/partition + +这会产生大量的输出,大多数错误信息的原因是分区已经挂载了。最后会给出一个碎片相关的信息。 + +![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-fsck.png) + +如果碎片率大于 20% 了,那么你应该开始整理你的磁盘碎片了。 + +### 如何简单地在 Linux 中整理碎片 ### + +你要做的是备份你**所有**的文件和数据到另外一块硬盘中(手动**复制**他们),格式化分区,然后重新复制回去(不要使用备份软件)。日志型文件系统会把它们作为新的文件,并将它们整齐地放置到磁盘中而不产生碎片。 + +要备份你的文件,运行 + + cp -afv [/path/to/source/partition]/* [/path/to/destination/folder] + +记住星号(*)是很重要的。 + +注意:通常认为复制大文件或者大量文件,使用 `dd` 或许是最好的。这是一个非常底层的操作,它会复制一切,包含空闲的空间甚至是留下的垃圾。这不是我们想要的,因此这里最好使用 `cp`。 + +现在你只需要删除源文件。 + + sudo rm -rf [/path/to/source/partition]/* + +**可选**:你可以使用如下命令将空闲空间用零填充。也可以用格式化来达到这点,但是如果你并没有复制整个分区而仅仅是复制大文件(它通常会形成碎片)的话,就不应该使用格式化的方法了。 + + sudo dd if=/dev/zero of=[/path/to/source/partition]/temp-zero.txt + +等待它结束。你可以用 `pv` 来监测进度。 + + sudo apt-get install pv + sudo pv -tpreb | of=[/path/to/source/partition]/temp-zero.txt + +![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-dd.png) + +这就完成了,只要删除这个用于填充的临时文件就行。 + + sudo rm [/path/to/source/partition]/temp-zero.txt + +待你清零了空闲空间(或者跳过了这步)。重新复制回文件,将第一个`cp`命令翻转一下: + + cp -afv [/path/to/original/destination/folder]/* [/path/to/original/source/partition] + +### 使用 e4defrag ### + +如果你想要简单的方法,安装 `e2fsprogs`, + + sudo apt-get install e2fsprogs + +用 root 权限在分区中运行 `e4defrag`。如果你不想或不能卸载该分区,你可以使用它的挂载点而不是路径。要整理整个系统的碎片,运行: + + sudo e4defrag / + +在挂载的情况下不保证成功(你也应该在它运行时不要使用你的系统),但是它比复制全部文件再重新复制回来简单多了。 + +### 总结 ### + +linux 系统中由于它的日志型文件系统有效的数据处理很少会出现碎片。如果你因任何原因产生了碎片,简单的方法是重新分配你的磁盘,如复制出去所有文件并复制回来,或者使用`e4defrag`。然而重要的是保证你数据的安全,因此在进行任何可能影响你全部或者大多数文件的操作之前,确保你的文件已经被备份到了另外一个安全的地方去了。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/defragment-linux/ + +作者:[Attila Orosz][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/attilaorosz/ diff --git a/published/20150901 How to Install or Upgrade to Linux Kernel 4.2 in Ubuntu.md b/published/201509/20150901 How to Install or Upgrade to Linux Kernel 4.2 in Ubuntu.md similarity index 100% rename from published/20150901 How to Install or Upgrade to Linux Kernel 4.2 in Ubuntu.md rename to published/201509/20150901 How to Install or Upgrade to Linux Kernel 4.2 in Ubuntu.md diff --git a/published/20150901 How to automatically dim your screen on Linux.md b/published/201509/20150901 How to automatically dim your screen on Linux.md similarity index 100% rename from published/20150901 How to automatically dim your screen on Linux.md rename to published/201509/20150901 How to automatically dim your screen on Linux.md diff --git a/translated/tech/20150901 Install The Latest Linux Kernel in Ubuntu Easily via A Script.md b/published/201509/20150901 Install The Latest Linux Kernel in Ubuntu Easily via A Script.md similarity index 73% rename from translated/tech/20150901 Install The Latest Linux Kernel in Ubuntu Easily via A Script.md rename to published/201509/20150901 Install The Latest Linux Kernel in Ubuntu Easily via A Script.md index dbe5dec7cd..a2e5f1e276 100644 --- a/translated/tech/20150901 Install The Latest Linux Kernel in Ubuntu Easily via A Script.md +++ b/published/201509/20150901 Install The Latest Linux Kernel in Ubuntu Easily via A Script.md @@ -1,22 +1,22 @@ -使用脚本便捷地在Ubuntu系统中安装最新的Linux内核 +使用脚本便捷地在 Ubuntu 中安装最新 Linux 内核 ================================================================================ ![](http://ubuntuhandbook.org/wp-content/uploads/2014/12/linux-kernel-icon-tux.png) 想要安装最新的Linux内核吗?一个简单的脚本就可以在Ubuntu系统中方便的完成这项工作。 -Michael Murphy 写了一个脚本用来将最新的候选版、标准版、或者低延时版内核安装到 Ubuntu 系统中。这个脚本会在询问一些问题后从 [Ubuntu kernel mainline page][1] 下载安装最新的 Linux 内核包。 +Michael Murphy 写了一个脚本用来将最新的候选版、标准版、或者低延时版的内核安装到 Ubuntu 系统中。这个脚本会在询问一些问题后从 [Ubuntu 内核主线页面][1] 下载安装最新的 Linux 内核包。 ### 通过脚本来安装、升级Linux内核: ### -1. 点击 [github page][2] 右上角的 “Download Zip” 来下载脚本。 +1. 点击这个 [github 页面][2] 右上角的 “Download Zip” 来下载该脚本。 -2. 鼠标右键单击用户下载目录下的 Zip 文件,选择 “Extract Here” 将其解压到此处。 +2. 鼠标右键单击用户下载目录下的 Zip 文件,选择 “在此展开” 将其解压。 -3. 右键点击解压后的文件夹,选择 “Open in Terminal” 在终端中导航到此文件夹下。 +3. 右键点击解压后的文件夹,选择 “在终端中打开” 到此文件夹下。 ![](http://ubuntuhandbook.org/wp-content/uploads/2015/08/open-terminal.jpg) -此时将会打开一个终端,并且自动导航到结果文件夹下。如果你找不到 “Open in Terminal” 选项的话,在 Ubuntu 软件中心搜索安装 `nautilus-open-terminal` ,然后重新登录系统即可(也可以再终端中运行 `nautilus -q` 来取代重新登录系统的操作)。 +此时将会打开一个终端,并且自动导航到目标文件夹下。如果你找不到 “在终端中打开” 选项的话,在 Ubuntu 软件中心搜索安装 `nautilus-open-terminal` ,然后重新登录系统即可(也可以再终端中运行 `nautilus -q` 来取代重新登录系统的操作)。 4. 当进入终端后,运行以下命令来赋予脚本执行本次操作的权限。 chmod +x * @@ -39,7 +39,7 @@ Michael Murphy 写了一个脚本用来将最新的候选版、标准版、或 ### 如何移除旧的(或新的)内核: ### -1. 从Ubuntu软件中心安装 Synaptic Package Manager。 +1. 从 Ubuntu 软件中心安装 Synaptic Package Manager。 2. 打开 Synaptic Package Manager 然后如下操作: @@ -68,8 +68,8 @@ Michael Murphy 写了一个脚本用来将最新的候选版、标准版、或 via: http://ubuntuhandbook.org/index.php/2015/08/install-latest-kernel-script/ 作者:[Ji m][a] -译者:[译者ID](https://github.com/mr-ping) -校对:[校对者ID](https://github.com/校对者ID) +译者:[mr-ping](https://github.com/mr-ping) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201509/20150901 Is Linux Right For You.md b/published/201509/20150901 Is Linux Right For You.md new file mode 100644 index 0000000000..af88b9bfee --- /dev/null +++ b/published/201509/20150901 Is Linux Right For You.md @@ -0,0 +1,63 @@ +Linux 系统是否适合于您? +================================================================================ +> 并非人人都适合使用 Linux --对许多用户来说,Windows 或 OSX 会是更好的选择。 + +我喜欢使用 Linux 桌面系统,并不是因为软件的政治性质,也不是不喜欢其它操作系统。我喜欢 Linux 系统因为它能满足我的需求并且确实适合使用。 + +我的经验是,并非人人都适合切换至“Linux 的生活方式”。本文将帮助您通过分析使用 Linux 系统的利弊来供您自行判断使用 Linux 是否真正适合您。 + +### 什么时候更换系统? ### + +当有充分的理由时,将系统切换到 Linux 系统是很有意义的。这对 Windows 用户将系统更换到 OSX 或类似的情况都同样适用。为让您的系统转变成功,您必须首先确定为什么要做这种转换。 + +对某些人来说,更换系统通常意味着他们不满于当前的系统操作平台。也许是最新的升级给了他们糟糕的用户体验,而他们也已准备好更换到别的系统,也许仅仅是因为对某个系统好奇。不管动机是什么,必须要有充分的理由支撑您做出更换操作系统的决定。如果没有一个充足的原因让您这样做,往往不会成功。 + +然而事事都有例外。如果您确实对 Linux 桌面非常感兴趣,或许可以选择一种折衷的方式。 + +### 放慢起步的脚步 ### + +第一次尝试运行 Linux 系统后,我看到就有人开始批判 Windows 安装过程的费时,完全是因为他们20分钟就用闪存安装好 Ubuntu 的良好体验。但是伙伴们,这并不只是一次测验。相反,我有如下建议: + +- 用一周的时间尝试在[虚拟机上运行 Linux 系统][1]。这意味着您将在该系统上执行所有的浏览器工作、邮箱操作和其它想要完成的任务。 +- 如果运行虚拟机资源消耗太大,您可以尝试用提供了[一些持久存储][2]的 USB 驱动器来运行 Linux,您的主操作系统将不受任何影响。与此同时,您仍可以运行 Linux 系统。 +- 运行 Linux 系统一周后,如果一切进展顺利,下一步您可以计算一下这周内登入 Windows 的次数。如果只是偶尔登录 Windows 系统,下一步就可以尝试运行 Windows 和 Linux 的[双系统][3]。对那些只运行了 Linux 系统的用户,可以考虑尝试将系统真正更换为 Linux 系统。 +- 在你完全删除 Windows 分区前,更应该购买一个新硬盘来安装 Linux 系统。这样有了充足的硬盘空间,您就可以使用双系统。如果必须要启动 Windows 系统做些事情的话,Windows 系统也是可以运行的。 + +### 使用 Linux 系统的好处是什么? ### + +将系统更换到 Linux 有什么好处呢?一般而言,这种好处对大多数人来说可以归结到释放个性自由。在使用 Linux 系统的时候,如果您不喜欢某些设置,可以自行更改它们。同时使用 Linux 可以为用户节省大量的硬件升级开支和不必要的软件开支。另外,您不需再费力找寻已丢失的软件许可证密钥,而且如果您不喜欢即将发布的系统版本,大可轻松地更换到别的版本。 + +在 Linux 桌面方面可以选择的桌面种类是惊人的多,看起来对新手来说做这种选择非常困难。但是如果您发现了喜欢的一款 Linux 版本(Debian、Fedora、Arch等),最困难的工作其实已经完成了,您需要做的就是找到各版本的区别并选择出您最喜欢的系统版本环境。 + +如今我听到的最常见的抱怨之一是用户发现没有太多的软件能适用于 Linux 系统。然而,这并不是事实。尽管别的操作系统可能会提供更多软件,但是如今的 Linux 也已经提供了足够多应用程序满足您的各种需求,包括视频剪辑(家用和专业级)、摄影、办公管理软件、远程访问、音乐软件、等等等等。 + +### 使用 Linux 系统您会失去些什么? ### + +虽然我喜欢使用 Linux,但我妻子的家庭办公依然依赖于 OS X。对于用 Linux 系统完成一些特定的任务她心满意足,但是她需要 OS X 来运行一些不支持 Linux 的软件。这是许多想要更换系统的用户会遇到的一个常见的问题。如果要更换系统,您需要考虑是否愿意失去一些关键的软件工具。 + +有时这个问题是因为软件的数据只能用该软件打开。别的情况下,是传统应用程序的工作流和功能并不适用于在 Linux 系统上可运行的软件。我自己并没有遇到过这类问题,但是我知道确实存在这些问题。许多 Linux 上的软件在其它操作系统上也都可以用。所以如果担心这类软件兼容问题,建议您先尝试在已有的系统上操作一下几款类似的应用程序。 + +更换成 Linux 系统后,另一件您可能会失去的是本地系统支持服务。人们通常会嘲笑这种愚蠢行径,但我知道,无数的新手在使用 Linux 时会发现解决 Linux 上各种问题的唯一资源就是来自网络另一端的陌生人提供的帮助。如果只是他们的 PC 遇到了一些问题,这将会比较麻烦。Windows 和 OS X 的用户已经习惯各城市遍布了支持他们操作系统的各项技术服务。 + +### 如何开启新旅程? ### + +这里建议大家要记住最重要的就是总要有个回退方案。如果您将 Windows 10 从硬盘中擦除,您会发现重新安装它又会花费金钱。对那些从其它 Windows 发布版本升级的用户来说尤其会遇到这种情况。请接受这个建议,对新手来说使用闪存安装 Linux 或使用 Windows 和 Linux 双系统都是更值得提倡的做法。您也许会如鱼得水般使用 Linux系统,但是有了一份回退方案,您将高枕无忧。 + +相反,如果数周以来您一直依赖于使用双操作系统,但是已经准备好冒险去尝试一下单操作系统,那么就去做吧。格式化您的驱动器,重新安装您喜爱的 Linux 发行版。数年来我一直都是“全职” Linux 使用爱好者,这里可以确定地告诉您,使用 Linux 系统感觉棒极了。这种感觉会持续多久?我第一次的 Linux 系统使用经验还是来自早期的 Red Hat 系统,最终在2003年,我在自己的笔记本上整个安装了 Linux 系统。 + +Linux 爱好者们,你们什么时候开始使用 Linux 的?您在最初更换成 Linux 系统时是兴奋还是焦虑呢?欢迎点击评论分享你们的经验。 + +-------------------------------------------------------------------------------- + +via: http://www.datamation.com/open-source/is-linux-right-for-you.html + +作者:[Matt Hartley][a] +译者:[icybreaker](https://github.com/icybreaker) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.datamation.com/author/Matt-Hartley-3080.html +[1]:http://www.psychocats.net/ubuntu/virtualbox +[2]:http://www.howtogeek.com/howto/14912/create-a-persistent-bootable-ubuntu-usb-flash-drive/ +[3]:http://www.linuxandubuntu.com/home/dual-boot-ubuntu-15-04-14-10-and-windows-10-8-1-8-step-by-step-tutorial-with-screenshots diff --git a/published/20150901 Setting Up High-Performance 'HHVM' and Nginx or Apache with MariaDB on Debian or Ubuntu.md b/published/201509/20150901 Setting Up High-Performance 'HHVM' and Nginx or Apache with MariaDB on Debian or Ubuntu.md similarity index 100% rename from published/20150901 Setting Up High-Performance 'HHVM' and Nginx or Apache with MariaDB on Debian or Ubuntu.md rename to published/201509/20150901 Setting Up High-Performance 'HHVM' and Nginx or Apache with MariaDB on Debian or Ubuntu.md diff --git a/published/201509/20150906 Do Simple Math In Ubuntu And elementary OS With NaSC.md b/published/201509/20150906 Do Simple Math In Ubuntu And elementary OS With NaSC.md new file mode 100644 index 0000000000..5b3c20d03a --- /dev/null +++ b/published/201509/20150906 Do Simple Math In Ubuntu And elementary OS With NaSC.md @@ -0,0 +1,53 @@ +在 Ubuntu 和 Elementary OS 上使用 NaSC 进行简单数学运算 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Make-Math-Simpler-with-NaSC.jpg) + +[NaSC][1],Not a Soulver Clone 的缩写,是为 elementary 操作系统开发的第三方应用程序。正如名字暗示的那样,NaSC 的灵感来源于 [Soulver][2],后者是像普通人一样进行数学计算的 OS X 应用。 + +Elementary OS 它自己本身借鉴了 OS X,也就不奇怪它的很多第三方应用灵感都来自于 OS X 应用。 + +回到 NaSC,“像普通人一样进行数学计算”到底是什么意思呢?事实上,它意味着正如你想的那样去书写。按照该应用程序的介绍: + +> “它能使你像平常那样进行计算。它允许你输入任何你想输入的,智能识别其中的数学部分并在右边面板打印出结果。然后你可以在后面的等式中使用这些结果,如果结果发生了改变,等式中使用的也会同样变化。” + +还不相信?让我们来看一个截图。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/NaSC.png) + +现在,你明白什么是 “像普通人一样做数学” 了吗?坦白地说,我并不是这类应用程序的粉丝,但对你们中的某些人可能会有用。让我们来看看怎么在 Elementary OS、Ubuntu 和 Linux Mint 上安装 NaSC。 + +### 在 Ubuntu、Elementary OS 和 Mint 上安装 NaSC ### + +安装 NaSC 有一个可用的 PPA。PPA 是 ‘每日’,意味着每日构建(意即,不稳定),但作为我的快速测试,并没什么影响。 + +打开一个终端并运行下面的命令: + + sudo apt-add-repository ppa:nasc-team/daily + sudo apt-get update + sudo apt-get install nasc + +这是 Ubuntu 15.04 中使用 NaSC 的一个截图: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/NaSC-Ubuntu.png) + +如果你想卸载它,可以使用下面的命令: + + sudo apt-get remove nasc + sudo apt-add-repository --remove ppa:nasc-team/daily + +如果你试用了这个软件,要分享你的经验哦。除此之外,你也可以在第三方 Elementary OS 应用中体验 [Vocal podcast app for Linux][3]。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/math-ubuntu-nasc/ + +作者:[Abhishek][a] +译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://parnold-x.github.io/nasc/ +[2]:http://www.acqualia.com/soulver/ +[3]:http://itsfoss.com/podcast-app-vocal-linux/ \ No newline at end of file diff --git a/published/20150906 FISH--A smart and user-friendly command line shell for Linux.md b/published/201509/20150906 FISH--A smart and user-friendly command line shell for Linux.md similarity index 100% rename from published/20150906 FISH--A smart and user-friendly command line shell for Linux.md rename to published/201509/20150906 FISH--A smart and user-friendly command line shell for Linux.md diff --git a/translated/tech/20150906 How To Set Up Your FTP Server In Linux.md b/published/201509/20150906 How To Set Up Your FTP Server In Linux.md similarity index 62% rename from translated/tech/20150906 How To Set Up Your FTP Server In Linux.md rename to published/201509/20150906 How To Set Up Your FTP Server In Linux.md index 8c754786fe..90a1895ff0 100644 --- a/translated/tech/20150906 How To Set Up Your FTP Server In Linux.md +++ b/published/201509/20150906 How To Set Up Your FTP Server In Linux.md @@ -1,12 +1,12 @@ -如何在linux中搭建FTP服务 +如何在 linux 中搭建 FTP 服务 ===================================================================== ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Setup-FTP-Server-in-Linux.jpg) -在本教程中,我将会解释如何搭建你自己的FTP服务。但是,首先我们应该来的学习一下FTP是什么。 +在本教程中,我将会介绍如何搭建你自己的FTP服务。但是,首先我们应该来的学习一下FTP是什么。 ###FTP是什么?### -[FTP][1] 是文件传输协议(File Transfer Protocol)的缩写。顾名思义,FTP是用于计算机之间通过网络进行文件传输。你可以通过FTP在计算机账户间进行文件传输,也可以在账户和桌面计算机之间传输文件,或者访问在线软件文档。但是,需要注意的是多数的FTP站点的使用率非常高,并且在连接前需要进行多次尝试。 +[FTP][1] 是文件传输协议(File Transfer Protocol)的缩写。顾名思义,FTP用于计算机之间通过网络进行文件传输。你可以通过FTP在计算机账户间进行文件传输,也可以在账户和桌面计算机之间传输文件,或者访问在线软件归档。但是,需要注意的是多数的FTP站点的使用率非常高,可能需要多次重连才能连接上。 FTP地址和HTTP地址(即网页地址)非常相似,只是FTP地址使用ftp://前缀而不是http:// @@ -16,23 +16,23 @@ FTP地址和HTTP地址(即网页地址)非常相似,只是FTP地址使用f 现在,我们来开始一个特别的冒险,我们将会搭建一个FTP服务用于和家人、朋友进行文件共享。在本教程,我们将以[vsftpd][2]作为ftp服务。 -VSFTPD是一个自称为最安全的FTP服务端软件。事实上VSFTPD的前两个字母表示“非常安全的(very secure)”。该软件的构建绕开了FTP协议的漏洞。 +VSFTPD是一个自称为最安全的FTP服务端软件。事实上VSFTPD的前两个字母表示“非常安全的(very secure)”。该软件的构建绕开了FTP协议的漏洞。 -尽管如此,你应该知道还有更安全的方法进行文件管理和传输,如:SFTP(使用[OpenSSH][3])。FTP协议对于共享非敏感数据是非常有用和可靠的。 +尽管如此,你应该知道还有更安全的方法进行文件管理和传输,如:SFTP(使用[OpenSSH][3])。FTP协议对于共享非敏感数据是非常有用和可靠的。 -####在rpm distributions中安装VSFTPD:#### +####使用 rpm 安装VSFTPD:#### 你可以使用如下命令在命令行界面中快捷的安装VSFTPD: dnf -y install vsftpd -####在deb distributions中安装VSFTPD:#### +####使用 deb 安装VSFTPD:#### 你可以使用如下命令在命令行界面中快捷的安装VSFTPD: sudo apt-get install vsftpd -####在Arch distribution中安装VSFTPD:#### +####在Arch 中安装VSFTPD:#### 你可以使用如下命令在命令行界面中快捷的安装VSFTPD: @@ -52,41 +52,41 @@ VSFTPD是一个自称为最安全的FTP服务端软件。事实上VSFTPD的前 write_enable=YES -**允许本地用户登陆:** +**允许本地(系统)用户登录:** -为了允许文件/etc/passwd中记录的用户可以登陆ftp服务,“local_enable”标记必须设置为YES。 +为了允许文件/etc/passwd中记录的用户可以登录ftp服务,“local_enable”标记必须设置为YES。 local_enable=YES -**匿名用户登陆** +**匿名用户登录** -下面配置内容控制匿名用户是否允许登陆: +下面配置内容控制匿名用户是否允许登录: - # Allow anonymous login + # 允许匿名用户登录 anonymous_enable=YES - # No password is required for an anonymous login (Optional) - no_anon_password=YES - # Maximum transfer rate for an anonymous client in Bytes/second (Optional) + # 匿名登录不需要密码(可选) + no_anon_password=YES + # 匿名登录的最大传输速率,Bytes/second(可选) anon_max_rate=30000 - # Directory to be used for an anonymous login (Optional) + # 匿名登录的目录(可选) anon_root=/example/directory/ **根目录限制(Chroot Jail)** -(译者注:chroot jail是类unix系统中的一种安全机制,用于修改进程运行的根目录环境,限制该线程不能感知到其根目录树以外的其他目录结构和文件的存在。详情参看[chroot jail][4]) +( LCTT 译注:chroot jail是类unix系统中的一种安全机制,用于修改进程运行的根目录环境,限制该线程不能感知到其根目录树以外的其他目录结构和文件的存在。详情参看[chroot jail][4]) 有时我们需要设置根目录(chroot)环境来禁止用户离开他们的家(home)目录。在配置文件中增加/修改下面配置开启根目录限制(Chroot Jail): chroot_list_enable=YES chroot_list_file=/etc/vsftpd.chroot_list -“chroot_list_file”变量指定根目录监狱所包含的文件/目录(译者注:即用户只能访问这些文件/目录) +“chroot\_list\_file”变量指定根目录限制所包含的文件/目录( LCTT 译注:即用户只能访问这些文件/目录) 最后你必须重启ftp服务,在命令行中输入以下命令: sudo systemctl restart vsftpd -到此为止,你的ftp服务已经搭建完成并且启动了 +到此为止,你的ftp服务已经搭建完成并且启动了。 -------------------------------------------------------------------------------- @@ -94,7 +94,7 @@ via: http://itsfoss.com/set-ftp-server-linux/ 作者:[alimiracle][a] 译者:[cvsher](https://github.com/cvsher) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201509/20150906 How to Install DNSCrypt and Unbound in Arch Linux.md b/published/201509/20150906 How to Install DNSCrypt and Unbound in Arch Linux.md new file mode 100644 index 0000000000..c83f639e7e --- /dev/null +++ b/published/201509/20150906 How to Install DNSCrypt and Unbound in Arch Linux.md @@ -0,0 +1,174 @@ +如何在 Arch Linux 中安装 DNSCrypt 和 Unbound +================================================================================ + +**DNSCrypt** 是一个用于对 DNS 客户端和 DNS 解析器之间通信进行加密和验证的协议。它可以阻止 DNS 欺骗或中间人攻击。 DNSCrypt 可用于大多数的操作系统,包括 Linux,Windows,MacOSX ,Android 和 iOS。而在本教程中我使用的是内核为4.1的 archlinux。 + +**Unbound** 是用来解析收到的任意 DNS 查询的 DNS 缓存服务器。如果用户请求一个新的查询,unbound 会将其存储到缓存中,并且当用户再次请求相同的请求时,unbound 将采用已经保存的缓存。这将比第一次请求查询更快。 + +现在我将尝试安装“DNSCrypt”,以确保 DNS 的通信的安全,并用“Unbound”加速。 + +### 第一步 - 安装 yaourt ### + +Yaourt 是AUR(ARCH 用户仓库)的辅助工具之一,它可以使用户能够很容易地从 AUR 安装程序。 Yaourt 和 pacman 使用相同的语法,你可以使用 yaourt 安装该程序。下面是安装 yaourt 的简单方法: + +1、 用 nano 或者 vi 编辑 arch 仓库配置文件,存放在“/etc/pacman.conf”中。 + + $ nano /etc/pacman.conf + +2、 在 yaourt 仓库底部添加,粘贴下面的脚本: + + [archlinuxfr] + SigLevel = Never + Server = http://repo.archlinux.fr/$arch + +3、 用“Ctrl + x”,接着用“Y”保存。 + +4、 接着升级仓库数据库并用pacman安装yaourt: + + $ sudo pacman -Sy yaourt + +### 第二步 - 安装 DNSCrypt 和 Unbound ### + +DNSCrypt 和 unbound 就在 archlinux 仓库中,你可以用下面的 pacman 命令安装: + + $ sudo pacman -S dnscrypt-proxy unbound + +接着在安装的过程中按下“Y”。 + +### 第三步 - 安装 dnscrypt-autoinstall ### + +Dnscrypt-autoinstall 是一个在基于 Linux 的系统上自动安装和配置 DNSCrypt 的脚本。DNSCrypt 在 AUR 中,因此你必须使用“yaourt”命令来安装它。 + + $ yaourt -S dnscrypt-autoinstall + +注意 : + +-S = 这和 pacman -S 安装程序一样。 + +### 第四步 - 运行 dnscrypt-autoinstall ### + +用 root 权限运行“dnscrypt-autoinstall”来自动配置 DNSCrypt。 + + $ sudo dnscrypt-autoinstall + +下一步中按下“回车”,接着输入"Y"来选择你想使用的 DNS 提供者,我这里使用不带日志和 DNSSEC 的 DNSCrypt.eu。 + +![DNSCrypt autoinstall](http://blog.linoxide.com/wp-content/uploads/2015/08/DNSCrypt-autoinstall.png) + +### 第五步 - 配置 DNSCrypt 和 Unbound ### + +1、 打开 dnscrypt 的“/etc/conf.d/dnscrypt-config” ,确认配置文件中“DNSCRYPT_LOCALIP”指向**本地ip**,“DNSCRYPT_LOCALPORT”根据你本人的意愿配置,我是用的是**40**端口。 + + $ nano /etc/conf.d/dnscrypt-config + + DNSCRYPT_LOCALIP=127.0.0.1 + DNSCRYPT_LOCALIP2=127.0.0.2 + DNSCRYPT_LOCALPORT=40 + +![DNSCrypt Configuration](http://blog.linoxide.com/wp-content/uploads/2015/08/DNSCryptConfiguration.png) + +保存并退出。 + +2、 现在你用 nano 编辑器编辑“/etc/unbound/”下 unbound 的配置文件: + + $ nano /etc/unbound/unbound.conf + +3、 在脚本最后添加下面的行: + + do-not-query-localhost: no + forward-zone: + name: "." + forward-addr: 127.0.0.1@40 + +确保**forward-addr**和DNSCrypt中的“**DNSCRYPT_LOCALPORT**”一致。如你所见,用的是**40**端口。 + +![Unbound Configuration](http://blog.linoxide.com/wp-content/uploads/2015/08/UnboundConfiguration.png) + +接着保存并退出。 + +### 第六步 - 运行 DNSCrypt 和 Unbound,接着添加到开机启动中 ### + +请用 root 权限运行 DNSCrypt 和 unbound,你可以用 systemctl 命令来运行: + + $ sudo systemctl start dnscrypt-proxy unbound + +将服务添加到启动中。你可以运行“systemctl enable”: + + $ sudo systemctl enable dnscrypt-proxy unbound + +命令将会创建软链接到“/usr/lib/systemd/system/”目录的服务。 + +### 第七步 - 配置 resolv.conf 并重启所有服务 ### + +resolv.conf 是一个在 linux 中用于配置 DNS 解析器的文件。它是一个由管理员创建的纯文本,因此你必须用 root 权限编辑并让它不能被其他人修改。 + +用 nano 编辑器编辑: + + $ nano /etc/resolv.conf + +并添加本地IP “**127.0.0.1**”。现在用“chattr”命令使他只读: + + $ chattr +i /etc/resolv.conf + +注意: + +如果你想要重新编辑,用“chattr -i /etc/resolv.conf”加入写权限。 + +现在你需要重启 DNSCrypt 和 unbound 和网络; + + $ sudo systemctl restart dnscrypt-proxy unbound netctl + +如果你看到错误,检查配置文件。 + +### 测试 ### + +1、 测试 DNSCrypt + +你可以通过 https://dnsleaktest.com/ 来确认 DNSCrypt,点击“标准测试”或者“扩展测试”,然后等待程序运行结束。 + +现在你可以看到 DNSCrypt.eu 就已经与作为 DNS 提供商的 DNSCrypt 协同工作了。 + +![Testing DNSCrypt](http://blog.linoxide.com/wp-content/uploads/2015/08/TestingDNSCrypt.png) + + +2、 测试 Unbound + +现在你应该确保 unbound 可以正确地与“dig”和“drill”命令一起工作。 + +这是 dig 命令的结果: + + $ dig linoxide.com + +我们现在看下结果,“Query time”是“533 msec”: + + ;; Query time: 533 msec + ;; SERVER: 127.0.0.1#53(127.0.0.1) + ;; WHEN: Sun Aug 30 14:48:19 WIB 2015 + ;; MSG SIZE rcvd: 188 + +再次输入命令,我们看到“Query time”是“0 msec”。 + + ;; Query time: 0 msec + ;; SERVER: 127.0.0.1#53(127.0.0.1) + ;; WHEN: Sun Aug 30 14:51:05 WIB 2015 + ;; MSG SIZE rcvd: 188 + +![Unbound Test](http://blog.linoxide.com/wp-content/uploads/2015/08/UnboundTest.png) + +DNSCrypt 对 DNS 客户端和解析端之间的通讯加密做的很好,并且 Unbound 通过缓存让相同的请求在另一次请求同速度更快。 + +### 总结 ### + +DNSCrypt 是一个可以加密 DNS 客户端和 DNS 解析器之间的数据流的协议。 DNSCrypt 可以在不同的操作系统上运行,无论是移动端或桌面端。选择 DNS 提供商还包括一些重要的事情,应选择那些提供 DNSSEC 同时没有日志的。Unbound 可被用作 DNS 缓存,从而加快解析过程,因为 Unbound 将请求缓存,那么接下来客户端请求相同的查询时,unbound 将从缓存中取出保存的值。 DNSCrypt 和 Unbound 是针对安全性和速度的一个强大的组合。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/tools/install-dnscrypt-unbound-archlinux/ + +作者:[Arul][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arulm/ diff --git a/translated/tech/20150906 How to Install QGit Viewer in Ubuntu 14.04.md b/published/201509/20150906 How to Install QGit Viewer in Ubuntu 14.04.md similarity index 70% rename from translated/tech/20150906 How to Install QGit Viewer in Ubuntu 14.04.md rename to published/201509/20150906 How to Install QGit Viewer in Ubuntu 14.04.md index 317e610a6f..e841c7f645 100644 --- a/translated/tech/20150906 How to Install QGit Viewer in Ubuntu 14.04.md +++ b/published/201509/20150906 How to Install QGit Viewer in Ubuntu 14.04.md @@ -1,8 +1,9 @@ -如何在Ubuntu中安装QGit浏览器 +如何在 Ubuntu 中安装 QGit 客户端 ================================================================================ -QGit是一款Marco Costalba用Qt和C++写的开源GUI Git浏览器。它是一款在GUI环境下更好地提供浏览历史记录、提交记录和文件补丁的浏览器。它利用git命令行来执行并显示输出。它有一些常规的功能像浏览历史、比较、文件历史、文件标注、档案树。我们可以格式化并用选中的提交应用补丁,在两个实例之间拖拽并提交等等。它允许我们创建自定义的按钮来用它内置的生成器来执行特定的命令。 -这里有简单的几步在Ubuntu 14.04 LTS "Trusty"中编译并安装QGit浏览器。 +QGit是一款由Marco Costalba用Qt和C++写的开源的图形界面 Git 客户端。它是一款可以在图形界面环境下更好地提供浏览版本历史、查看提交记录和文件补丁的客户端。它利用git命令行来执行并显示输出。它有一些常规的功能像浏览版本历史、比较、文件历史、文件标注、归档树。我们可以格式化并用选中的提交应用补丁,在两个或多个实例之间拖拽并提交等等。它允许我们用它内置的生成器来创建自定义的按钮去执行特定的命令。 + +这里有简单的几步在Ubuntu 14.04 LTS "Trusty"中编译并安装QGit客户端。 ### 1. 安装 QT4 库 ### @@ -16,7 +17,7 @@ QGit是一款Marco Costalba用Qt和C++写的开源GUI Git浏览器。它是一 $ sudo apt-get install git -现在,我们要使用下面的git命令来克隆仓库。 +现在,我们要使用下面的git命令来克隆QGit客户端的仓库。 $ git clone git://repo.or.cz/qgit4/redivivus.git @@ -30,25 +31,25 @@ QGit是一款Marco Costalba用Qt和C++写的开源GUI Git浏览器。它是一 ### 3. 编译 QGit ### -克隆之后,我们现在进入redivivus的目录,并创建我们编译需要的makefile文件。因此,要进入目录,我们要运行下面的命令。 +克隆之后,我们现在进入redivivus的目录,并创建我们编译需要的makefile文件。进入目录,运行下面的命令。 $ cd redivivus -接下来,我们运行下面的命令从qmake项目也就是qgit.pro来生成新的Makefile。 +接下来,我们运行下面的命令从qmake项目文件(qgit.pro)来生成新的Makefile。 $ qmake qgit.pro -生成Makefile之后,我们现在终于要编译qgit的源代码并得到二进制的输出。首先我们要安装make和g++包用于编译,因为这是一个用C++写的程序。 +生成Makefile之后,我们现在终于可以编译qgit的源代码并生成二进制。首先我们要安装make和g++包用于编译,因为这是一个用C++写的程序。 $ sudo apt-get install make g++ -现在,我们要用make命令来编译代码了 +现在,我们要用make命令来编译代码了。 $ make ### 4. 安装 QGit ### -成功编译QGit的源码之后,我们就要在Ubuntu 14.04中安装它了,这样就可以在系统中执行它。因此我们将运行下面的命令、 +成功编译QGit的源码之后,我们就要在Ubuntu 14.04中安装它了,这样就可以在系统中执行它。因此我们将运行下面的命令。 $ sudo make install @@ -75,30 +76,30 @@ QGit是一款Marco Costalba用Qt和C++写的开源GUI Git浏览器。它是一 [Desktop Entry] Name=qgit - GenericName=git GUI viewer + GenericName=git 图形界面 viewer Exec=qgit Icon=qgit Type=Application - Comment=git GUI viewer + Comment=git 图形界面 viewer Terminal=false MimeType=inode/directory; Categories=Qt;Development;RevisionControl; 完成之后,保存并退出。 -### 6. 运行 QGit 浏览器 ### +### 6. 运行 QGit 客户端 ### QGit安装完成之后,我们现在就可以从任何启动器或者程序菜单中启动它了。要在终端下面运行QGit,我们可以像下面那样。 $ qgit -这会打开基于Qt4框架GUI模式的QGit。 +这会打开基于Qt4框架图形界面模式的QGit。 ![QGit Viewer](http://blog.linoxide.com/wp-content/uploads/2015/07/qgit-viewer.png) ### 总结 ### -QGit是一个很棒的基于QT的git浏览器。它可以在Linux、MAC OSX和 Microsoft Windows所有这三个平台中运行。它帮助我们很容易地浏览历史、版本、分支等等git仓库提供的信息。它减少了使用命令行的方式去执行诸如浏览版本、历史、比较功能的需求,并用图形化的方式来简化了这些任务。最新的qgit版本也在默认仓库中,你可以使用 **apt-get install qgit** 命令来安装。因此。qgit用它简单的GUI使得我们的工作更加简单和快速。 +QGit是一个很棒的基于QT的git客户端。它可以在Linux、MAC OSX和 Microsoft Windows所有这三个平台中运行。它帮助我们很容易地浏览历史、版本、分支等等git仓库提供的信息。它减少了使用命令行的方式去执行诸如浏览版本、历史、比较功能的需求,并用图形化的方式来简化了这些任务。最新的qgit版本也在默认仓库中,你可以使用 **apt-get install qgit** 命令来安装。因此,QGit用它简单的图形界面使得我们的工作更加简单和快速。 -------------------------------------------------------------------------------- @@ -106,7 +107,7 @@ via: http://linoxide.com/ubuntu-how-to/install-qgit-viewer-ubuntu-14-04/ 作者:[Arun Pyasi][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201509/20150906 Install Qmmp 0.9.0 Winamp-like Audio Player in Ubuntu.md b/published/201509/20150906 Install Qmmp 0.9.0 Winamp-like Audio Player in Ubuntu.md new file mode 100644 index 0000000000..1b5ca2ce43 --- /dev/null +++ b/published/201509/20150906 Install Qmmp 0.9.0 Winamp-like Audio Player in Ubuntu.md @@ -0,0 +1,65 @@ +在 Ubuntu 上安装类 Winamp 的音频播放器 Qmmp 0.9.0 +================================================================================ +![](http://ubuntuhandbook.org/wp-content/uploads/2015/01/qmmp-icon-simple.png) + +Qmmp,一个基于 Qt 的音频播放器,与 Winamp 或 xmms 的用户界面类似,现在最新版本是0.9.0。PPA 已经在 Ubuntu 15.10,Ubuntu 15.04,Ubuntu 14.04,Ubuntu 12.04 和其衍生版本中已经更新了。 + +Qmmp 0.9.0 是一个较大的版本,有许多新的功能,有许多改进和新的转变。它添加了如下功能: + +- 音频-信道序列转换器; +- 9通道支持均衡器; +- 支持艺术家专辑标签; +- 异步排序; +- 不用修改 qmmp.pri 来禁用插件(仅在 qmake 中)功能 +- 记住播放列表滚动位置功能; +- 排除 cue 数据文件功能; +- 更改用户代理功能; +- 改变窗口标题功能; +- 禁用 gme 插件淡出的功能; +- 简单用户界面(QSUI)有以下变化: + - 增加了多列的支持; + - 增加了按艺术家专辑排序; + - 增加了按文件的修改日期进行排序; + - 增加了隐藏歌曲长度功能; + - 增加了“Rename List”的默认热键; + - 增加了“Save List”功能到标签菜单; + - 增加了复位字体功能; + - 增加了复位快捷键功能; + - 改进了状态栏; + +它还改进了播放列表的改变通知,播放列表容器,采样率转换器,cmake 构建脚本,标题格式化,在 mpeg 插件中支持 ape 标签,fileops 插件,降低了 cpu 占用率,改变默认的皮肤(炫光)和分离的播放列表。 + +![qmmp-090](http://ubuntuhandbook.org/wp-content/uploads/2015/09/qmmp-090.jpg) + +### 在 Ubuntu 中安装 Qmmp 0.9.0 : ### + +新版本已经制做了 PPA,适用于目前所有 Ubuntu 发行版和衍生版。 + +1、 添加 [Qmmp PPA][1]. + +从 Dash 中打开终端并启动应用,通过按 Ctrl+Alt+T 快捷键。当它打开时,运行命令: + + sudo add-apt-repository ppa:forkotov02/ppa + +![qmmp-ppa](http://ubuntuhandbook.org/wp-content/uploads/2015/09/qmmp-ppa.jpg) + +2、 在添加 PPA 后,通过更新软件来升级 Qmmp 播放器。刷新系统缓存,并通过以下命令安装软件: + + sudo apt-get update + + sudo apt-get install qmmp qmmp-plugin-pack + +就是这样。尽情享受吧! + +-------------------------------------------------------------------------------- + +via: http://ubuntuhandbook.org/index.php/2015/09/qmmp-0-9-0-in-ubuntu/ + +作者:[Ji m][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ubuntuhandbook.org/index.php/about/ +[1]:https://launchpad.net/~forkotov02/+archive/ubuntu/ppa diff --git a/published/201509/20150908 How to Download Install and Configure Plank Dock in Ubuntu.md b/published/201509/20150908 How to Download Install and Configure Plank Dock in Ubuntu.md new file mode 100644 index 0000000000..ea125f9bbe --- /dev/null +++ b/published/201509/20150908 How to Download Install and Configure Plank Dock in Ubuntu.md @@ -0,0 +1,66 @@ +在 Ubuntu 里如何下载、安装和配置 Plank Dock +============================================================================= +一个众所周知的事实就是,Linux 是一个用户可以高度自定义的系统,有很多选项可以选择 —— 作为操作系统,有各种各样的发行版,而对于单个发行版来说,又有很多桌面环境可以选择。与其他操作系统的用户一样,Linux 用户也有不同的口味和喜好,特别是对于桌面来说。 + +一些用户并非很在意他们的桌面,而其他一些则非常关心,要确保他们的桌面看起来很酷,很有吸引力,对于这种情况,有很多不错的应用可以派上用场。有一个应用可以给你的桌面带来活力 —— 特别是当你常用一个全局菜单的时候 —— 这就是 dock 。Linux 上有很多 dock 应用可选用;如果你希望是一个最简洁的,那么就选择 [Plank][1] 吧,文章接下来就要讨论这个应用。 + +**注意**:接下提到的例子和命令都已在 Ubuntu(版本 14.10)和 Plank(版本 0.9.1.1383)上测试通过。 + +### Plank ### + +官方的文档描述 Plank 是“这个星球上最简洁的 dock”。该项目的目的就是仅提供一个 dock 需要的功能,尽管这是很基础的一个库,却可以被扩展,创造其他的含更多高级功能的 dock 程序。 + +这里值得一提的就是,在 elementary OS 里,Plank 是预装的。并且 Plank 是 Docky 的基础,Docky 也是一个非常流行的 dock 应用,在功能上与 Mac OS X 的 Dock 非常相似。 + +### 下载和安装 ### + +通过在终端里执行下面的命令,可以下载并安装 Plank: + + sudo add-apt-repository ppa:docky-core/stable + sudo apt-get update + sudo apt-get install plank + +安装成功后,你就可以在 Unity Dash(见下面图片)里通过输入 Plank 来打开该应用,或者从应用菜单里面打开,如果你没有使用 Unity 环境的话。 + +![](https://www.maketecheasier.com/assets/uploads/2015/09/plank-unity-dash.png) + +### 特性 ### + +当 Plank 启用后,你会看见它停靠在你桌面的底部中间位置。 + +![](https://www.maketecheasier.com/assets/uploads/2015/09/plank-enabled-new.jpg) + +正如上面图片显示的那样,dock 包含许多带橙色标示的应用图标,这表明这些应用正处于运行状态。无需说,你可以点击一个图标来打开那个应用。同时,右击一个应用图标会给出更多的选项,你可能会感兴趣。举个例子,看下面的屏幕快照: + +![](https://www.maketecheasier.com/assets/uploads/2015/09/plank-right-click-icons-new.jpg) + +为了获得配置的选项,你需要右击一下 Plank 的图标(左数第一个),然后点击 Preferences 选项。这就会出现如下的窗口。 + +![](https://www.maketecheasier.com/assets/uploads/2015/09/plank-preferences.png) + +如你所见,Preferences 窗口包含两个标签:Apperance 和 Behavior,前者是默认选中的。Appearance 标签栏包含 Plank 主题相关的设置,dock 的位置,对齐,还有图标相关的,而 Behavior 标签栏包含 dock 本身相关的设定。 + +![](https://www.maketecheasier.com/assets/uploads/2015/09/plank-behavior-settings.png) + +举个例子,我在 Appearance 里改变 dock 的位置为右侧,在 Behavior 里锁定图标(这表示右击选项中不再有 “Keep in Dock”)。 + +![](https://www.maketecheasier.com/assets/uploads/2015/09/plank-right-lock-new.jpg) + +如你所见的上面屏幕快照一样,改变生效了。类似地,根据你个人需求,改变任何可用的设定。 + +### 结论 ### + +如我开始所说的那样,使用 dock 不是强制的。尽管如此,使用一个会让事情变得方便,特别是你习惯了 Mac,而最近由于一些原因切换到了 Linux 系统。就其本身而言,Plank 不仅提供简洁性,还有可信任和稳定性 —— 该项目一直被很好地维护着。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/download-install-configure-plank-dock-ubuntu/ + +作者:[Himanshu Arora][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/himanshu/ +[1]:https://launchpad.net/plank diff --git a/published/201509/20150908 List Of 10 Funny Linux Commands.md b/published/201509/20150908 List Of 10 Funny Linux Commands.md new file mode 100644 index 0000000000..9b89da3b2b --- /dev/null +++ b/published/201509/20150908 List Of 10 Funny Linux Commands.md @@ -0,0 +1,184 @@ +10 条真心有趣的 Linux 命令 +================================================================================ + +**在终端工作是一件很有趣的事情。今天,我们将会列举一些有趣得为你带来欢笑的Linux命令。** + +### 1. rev ### + +创建一个文件,在文件里面输入几个单词,rev命令会将你写的东西反转输出到控制台。 + + # rev + +![Selection_002](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0021.png) + +![Selection_001](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0011.png) + +### 2. fortune ### + +这个命令没有被默认安装,用apt-get命令安装它,fortune命令会随机显示一些句子 + + crank@crank-System:~$ sudo apt-get install fortune + +![Selection_003](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0031.png) + +利用fortune命令的**_s** 选项,他会限制一个句子的输出长度。 + + # fortune -s + +![Selection_004](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0042.png) + +### 3. yes ### + + # yes + +这个命令会不停打印字符串,直到用户把这进程给结束掉。 + + # yes unixmen + +![Selection_005](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0054.png) + +### 4. figlet ### + +这个命令可以用apt-get安装,安装之后,在**/usr/share/figlet**可以看到一些ascii字体文件。 + + cd /usr/share/figlet + +---------- + + #figlet -f + #figlet -f big.flf unixmen + +![Selection_006](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0062.png) + + #figlet -f block.flf unixmen + +![Selection_007](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0072.png) + +当然,你也可以尝试使用其他的选项。 + +### 5. asciiquarium ### + +这个命令会将你的终端变成一个海洋馆。 + +下载term animator: + + # wget http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-2.4.tar.gz + +安装并且配置这个包: + + # tar -zxvf Term-Animation-2.4.tar.gz + # cd Term-Animation-2.4/ + # perl Makefile.PL && make && make test + # sudo make install + +接着安装下面这个包: + + # apt-get install libcurses-perl + +下载并且安装asciiquarium: + + # wget http://www.robobunny.com/projects/asciiquarium/asciiquarium.tar.gz + # tar -zxvf asciiquarium.tar.gz + # cd asciiquarium_1.0/ + # cp asciiquarium /usr/local/bin/ + +执行如下命令: + + # /usr/local/bin/asciiquarium + +![asciiquarium_1.1 : perl_008](http://www.unixmen.com/wp-content/uploads/2015/09/asciiquarium_1.1-perl_008.png) + +### 6. bb ### + + # apt-get install bb + # bb + +看看会输出什么? + +![Selection_009](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0092.png) + +### 7. sl ### + +有的时候你可能把 **ls** 误打成了 **sl**,其实 **sl** 也是一个命令,如果你打 sl的话,你会看到一个移动的火车头 + + # apt-get install sl + +---------- + + # sl + +![Selection_012](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0122.png) + +### 8. cowsay ### + +一个很常见的命令,它会用ascii显示你想说的话。 + + apt-get install cowsay + +---------- + + # cowsay + +![Selection_013](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0132.png) + +或者,你可以用其他的角色来取代默认角色来说这句话,这些角色都存储在**/usr/share/cowsay/cows**目录下 + + # cd /usr/share/cowsay/cows + +---------- + + cowsay -f ghostbusters.cow unixmen + +![Selection_014](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0141.png) + +或者 + + # cowsay -f bud-frogs.cow Rajneesh + +![Selection_015](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0151.png) + +### 9. toilet ### + +你没看错,这是个命令来的,他会将字符串以彩色的ascii字符串形式输出到终端 + + # apt-get install toilet + +---------- + + # toilet --gay unixmen + +![Selection_016](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0161.png) + + toilet -F border -F gay unixmen + +![Selection_020](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_020.png) + + toilet -f mono12 -F metal unixmen + +![Selection_018](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0181.png) + +### 10. aafire ### + +aafire能让你的终端燃起来。 + + # apt-get install libaa-bin + +---------- + + # aafire + +![Selection_019](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0191.png) + +就这么多,祝你们在Linux终端玩得开心哈!!! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/list-10-funny-linux-commands/ + +作者:[Rajneesh Upadhyay][a] +译者:[tnuoccalanosrep](https://github.com/tnuoccalanosrep) +校对:[wxy](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/rajneesh/ diff --git a/published/201509/20150909 Linux Server See the Historical and Statistical Uptime of System With tuptime Utility.md b/published/201509/20150909 Linux Server See the Historical and Statistical Uptime of System With tuptime Utility.md new file mode 100644 index 0000000000..4c6356ec4e --- /dev/null +++ b/published/201509/20150909 Linux Server See the Historical and Statistical Uptime of System With tuptime Utility.md @@ -0,0 +1,153 @@ +使用 tuptime 工具查看 Linux 服务器系统的开机时间的历史和统计 +================================================================================ + +你可以使用下面的工具来查看 Linux 或类 Unix 系统运行了多长时间: + +- uptime : 告诉你服务器运行了多长的时间。 +- lastt : 显示重启和关机时间。 +- tuptime : 报告系统的运行时间历史和运行时间统计,这是指重启之间的运行时间。和 uptime 命令类似,不过输出结果更有意思。 + +### 找出系统上次重启时间和日期 ### + +你[可以使用下面的命令来获取Linux操作系统的上次重启和关机时间及日期][1](在OSX/类Unix系统上也可以用): + + ### 显示系统重启和关机时间 + who -b + last reboot + last shutdown + ### 开机信息 + uptime + cat /proc/uptime + awk '{ print "up " $1 /60 " minutes"}' /proc/uptime + w + +**样例输出:** + +![Fig.01: Various Linux commands in action to find out the server uptime](http://s0.cyberciti.org/uploads/cms/2015/09/uptime-w-awk-outputs.jpg) + +*图01:用于找出服务器开机时间的多个Linux命令* + +###跟 tuptime 问打个招呼吧### + +tuptime 命令行工具可以报告基于 Linux 的系统上的下列信息: + +1. 系统启动次数统计 +2. 注册首次启动时间(也就是安装时间) +3. 正常关机和意外关机统计 +4. 平均开机时间和故障停机时间 +5. 当前开机时间 +6. 首次启动以来的开机和故障停机率 +7. 累积系统开机时间、故障停机时间和合计 +8. 报告每次启动、开机时间、关机和故障停机时间 + +#### 安装 #### + +输入[下面的命令来克隆 git 仓库到 Linux 系统中][2]: + + $ cd /tmp + $ git clone https://github.com/rfrail3/tuptime.git + $ ls + $ cd tuptime + $ ls + +**样例输出:** + +![Fig.02: Cloning a git repo](http://s0.cyberciti.org/uploads/cms/2015/09/git-install-tuptime.jpg) + +*图02:克隆git仓库* + +确保你安装了带有 sys,optparse,os,re,string,sqlite3,datetime,disutils 和 locale 模块的 Python v2.7。 + +你可以像下面这样来安装: + + $ sudo tuptime-install.sh + +或者,可以手工安装(基于 systemd 或非 systemd ): + + $ sudo cp /tmp/tuptime/latest/cron.d/tuptime /etc/cron.d/tuptime + +如果系统是systemd的,拷贝服务文件并启用: + + $ sudo cp /tmp/tuptime/latest/systemd/tuptime.service /lib/systemd/system/ + $ sudo systemctl enable tuptime.service + +如果系统不是systemd的,拷贝初始化文件: + + $ sudo cp /tmp/tuptime/latest/init.d/tuptime.init.d-debian7 /etc/init.d/tuptime + $ sudo update-rc.d tuptime defaults + +####运行#### + +只需输入以下命令: + + $ sudo tuptime + +**样例输出:** + +![Fig.03: tuptime in action](http://s0.cyberciti.org/uploads/cms/2015/09/tuptime-output.jpg) + +*图03:tuptime工作中* + +在一次更新内核后,我重启了系统,然后再次输入了同样的命令: + + $ sudo tuptime + System startups: 2 since 03:52:16 PM 08/21/2015 + System shutdowns: 1 ok - 0 bad + Average uptime: 7 days, 16 hours, 48 minutes and 3 seconds + Average downtime: 2 hours, 30 minutes and 5 seconds + Current uptime: 5 minutes and 28 seconds since 06:23:06 AM 09/06/2015 + Uptime rate: 98.66 % + Downtime rate: 1.34 % + System uptime: 15 days, 9 hours, 36 minutes and 7 seconds + System downtime: 5 hours, 0 minutes and 11 seconds + System life: 15 days, 14 hours, 36 minutes and 18 seconds + +你可以像下面这样修改日期和时间格式: + + $ sudo tuptime -d '%H:%M:%S %m-%d-%Y' + +**样例输出:** + + System startups: 1 since 15:52:16 08-21-2015 + System shutdowns: 0 ok - 0 bad + Average uptime: 15 days, 9 hours, 21 minutes and 19 seconds + Average downtime: 0 seconds + Current uptime: 15 days, 9 hours, 21 minutes and 19 seconds since 15:52:16 08-21-2015 + Uptime rate: 100.0 % + Downtime rate: 0.0 % + System uptime: 15 days, 9 hours, 21 minutes and 19 seconds + System downtime: 0 seconds + System life: 15 days, 9 hours, 21 minutes and 19 seconds + +计算每次启动、开机时间、关机和故障停机时间: + + $ sudo tuptime -e + +**样例输出:** + + Startup: 1 at 03:52:16 PM 08/21/2015 + Uptime: 15 days, 9 hours, 22 minutes and 33 seconds + + System startups: 1 since 03:52:16 PM 08/21/2015 + System shutdowns: 0 ok - 0 bad + Average uptime: 15 days, 9 hours, 22 minutes and 33 seconds + Average downtime: 0 seconds + Current uptime: 15 days, 9 hours, 22 minutes and 33 seconds since 03:52:16 PM 08/21/2015 + Uptime rate: 100.0 % + Downtime rate: 0.0 % + System uptime: 15 days, 9 hours, 22 minutes and 33 seconds + System downtime: 0 seconds + System life: 15 days, 9 hours, 22 minutes and 33 seconds + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/hardware/howto-see-historical-statistical-uptime-on-linux-server/ + +作者:Vivek Gite +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.cyberciti.biz/hardware/howto-see-historical-statistical-uptime-on-linux-server/ +[2]:http://www.cyberciti.biz/faq/debian-ubunut-linux-download-a-git-repository/ diff --git a/published/201509/20150911 10 Useful Linux Command Line Tricks for Newbies--Part 2.md b/published/201509/20150911 10 Useful Linux Command Line Tricks for Newbies--Part 2.md new file mode 100644 index 0000000000..86ae1ec668 --- /dev/null +++ b/published/201509/20150911 10 Useful Linux Command Line Tricks for Newbies--Part 2.md @@ -0,0 +1,251 @@ +给新手的 10 个有用 Linux 命令行技巧 +================================================================================ + +我记得我第一次使用 Linux 的时候,我还习惯于 Windows 的图形界面,我真的很讨厌 Linux 终端。那时候我觉得命令难以记忆,不能正确使用它们。随着时间推移,我意识到了 Linux 终端的优美、灵活和可用性,说实话,我没有一天不使用它。今天,我很高兴和刚开始接触 Linux 的人一起来分享一些有用的技巧和提示,希望能帮助他们更好的向 Linux 过渡,并帮助他们学到一些新的东西(希望如此)。 + +![给新手的 10 个命令行技巧](http://www.tecmint.com/wp-content/uploads/2015/09/10-Linux-Commandline-Tricks.jpg) + +*10 个 Linux 命令行技巧* + +- [5 个有趣的 Linux 命令行技巧][1] +- [管理 Linux 文件类型的 5 个有用命令][2] + +这篇文章希望向你展示一些不需要很高的技术就可以像一个高手一样使用 Linux 终端的有用技巧。你只需要一个 Linux 终端和一些自由时间来体会这些命令。 + +### 1. 找到正确的命令 ### + +执行正确的命令对你的系统来说非常重要。然而在 Linux 中有如此多的、难以记忆的各种的命令行。那么怎样才能找到你需要的正确命令呢?答案是 apropos。你只需要运行: + + # apropos + +其中你要用真正描述你要查找的命令的语句代替 “description”。这里有一个例子: + + # apropos "list directory" + + dir (1) - list directory contents + ls (1) - list directory contents + ntfsls (8) - list directory contents on an NTFS filesystem + vdir (1) - list directory contents + +左边你看到的是命令,右边是它们的描述。 + +### 2. 执行之前的命令 ### + +很多时候你需要一遍又一遍执行相同的命令。尽管你可以重复按你键盘上的向上光标键,但你也可以用 history 命令替代。这个命令会列出自从你上次启动终端以来所有输入过的命令: + + # history + + 1 fdisk -l + 2 apt-get install gnome-paint + 3 hostname tecmint.com + 4 hostnamectl tecmint.com + 5 man hostnamectl + 6 hostnamectl --set-hostname tecmint.com + 7 hostnamectl -set-hostname tecmint.com + 8 hostnamectl set-hostname tecmint.com + 9 mount -t "ntfs" -o + 10 fdisk -l + 11 mount -t ntfs-3g /dev/sda5 /mnt + 12 mount -t rw ntfs-3g /dev/sda5 /mnt + 13 mount -t -rw ntfs-3g /dev/sda5 /mnt + 14 mount -t ntfs-3g /dev/sda5 /mnt + 15 mount man + 16 man mount + 17 mount -t -o ntfs-3g /dev/sda5 /mnt + 18 mount -o ntfs-3g /dev/sda5 /mnt + 19 mount -ro ntfs-3g /dev/sda5 /mnt + 20 cd /mnt + ... + +正如你上面看到的,你会得到一个你运行过的命令的列表。每一行中有一个数字表示你在第几行输入了命令。你可以通过以下方法重新调用该命令: + + !# + +其中要用命令的实际编号代替 #。为了更好的理解,请看下面的例子: + + !501 + +等价于: + + # history + +### 3. 使用 midnight 命令 ### + +如果你不习惯使用类似 cd、cp、mv、rm 等命令,你可以使用 midnight 命令。它是一个简单的可视化 shell,你可以在上面使用鼠标: + +![Midnight 命令](http://www.tecmint.com/wp-content/uploads/2015/09/mc-command.jpg) + +*Midnight 命令* + +借助 F1 到 F12 键,你可以轻易地执行不同任务。只需要在底部选择对应的命令。要选择文件或者目录,按下 “Insert” 键。 + +简而言之 midnight 就是所谓的 “mc”。要安装 mc,只需要运行: + + $ sudo apt-get install mc [On Debian based systems] + +---------- + + # yum install mc [On Fedora based systems] + +下面是一个使用 midnight 命令器的简单例子。通过输入以下命令打开 mc: + + # mc + +现在使用 TAB 键选择不同的窗口 - 左和右。我有一个想要移动到 “Software” 目录的 LibreOffice 文件: + +![Midnight 命令移动文件](http://www.tecmint.com/wp-content/uploads/2015/09/Midnight-Commander-Move-Files.jpg) + +*Midnight 命令移动文件* + +按 F6 按钮移动文件到新的目录。MC 会请求你确认: + +![移动文件到新目录](http://www.tecmint.com/wp-content/uploads/2015/09/Move-Files-to-new-Directory.png) + +*移动文件到新目录* + +确认了之后,文件就会被移动到新的目标目录。 + +- 扩展阅读:[如何在 Linux 中使用 Midnight 命令文件管理器][4] + +### 4. 在指定时间关闭计算机 ### + +有时候你需要在下班几个小时后再关闭计算机。你可以通过使用下面的命令在指定时间关闭你的计算机: + + $ sudo shutdown 21:00 + +这会告诉你在你指定的时间关闭计算机。你也可以告诉系统在指定分钟后关闭: + + $ sudo shutdown +15 + +这表示计算机会在 15 分钟后关闭。 + +### 5. 显示已知用户的信息 ### + +你可以使用一个简单的命令列出你 Linux 系统的用户以及一些关于它们的基本信息。 + + # lslogins + +这会输出下面的结果: + + UID USER PWD-LOCK PWD-DENY LAST-LOGIN GECOS + 0 root 0 0 Apr29/11:35 root + 1 bin 0 1 bin + 2 daemon 0 1 daemon + 3 adm 0 1 adm + 4 lp 0 1 lp + 5 sync 0 1 sync + 6 shutdown 0 1 Jul19/10:04 shutdown + 7 halt 0 1 halt + 8 mail 0 1 mail + 10 uucp 0 1 uucp + 11 operator 0 1 operator + 12 games 0 1 games + 13 gopher 0 1 gopher + 14 ftp 0 1 FTP User + 23 squid 0 1 + 25 named 0 1 Named + 27 mysql 0 1 MySQL Server + 47 mailnull 0 1 + 48 apache 0 1 Apache + ... + +### 6. 查找文件 ### + +查找文件有时候并不像你想象的那么简单。一个搜索文件的好例子是: + + # find /home/user -type f + +这个命令会搜索 /home/user 目录下的所有文件。find 命令真的很强大,你可以传递更多选项给它使得你的搜索更加详细。如果你想搜索超过特定大小的文件,可以使用: + + # find . -type f -size 10M + +上面的命令会搜索当前目录中所有大于 10M 的文件。确保不要在你 Linux 系统的根目录运行该命令,因为这可能导致你的机器 I/O 瓶颈。 + +我最经常和 find 命令一起使用的选项之一是 “exec”,这允许你对 find 命令的结果运行一些操作。 + +例如,假如我们想查找一个目录中的所有文件并更改权限。可以通过以下简单命令完成: + + # find /home/user/files/ -type f -exec chmod 644 {} \; + +上面的命令会递归搜索指定目录内的所有文件,并对找到的文件执行 chmod 命令。推荐你阅读 [35 个 Linux ‘find’ 命令的使用方法][5],我肯定你会发现这个命令更多的使用方法。 + +### 7. 用一个命令创建目录树 ### + +你很可能知道可以使用 mkdir 命令创建新的目录。因此如果你想创建一个新的目录,你可能会运行: + + # mkdir new_folder + +但如果你想在该目录下创建 5 个子目录呢?运行 5 次 mkdir 命令并非是一个好的选择。相反你可以类似下面这样使用 -p 选项: + + # mkdir -p new_folder/{folder_1,folder_2,folder_3,folder_4,folder_5} + +最后你会在 new_folder 中有 5 个目录: + + # ls new_folder/ + + folder_1 folder_2 folder_3 folder_4 folder_5 + +### 8. 复制文件到多个目录 ### + +通常使用 cp 命令进行文件复制。复制文件通常看起来类似: + + # cp /path-to-file/my_file.txt /path-to-new-directory/ + +现在假设你需要复制该文件到多个目录: + + # cp /home/user/my_file.txt /home/user/1 + # cp /home/user/my_file.txt /home/user/2 + # cp /home/user/my_file.txt /home/user/3 + +这有点荒唐。相反,你可以用简单的一行命令解决问题: + + # echo /home/user/1/ /home/user/2/ /home/user/3/ | xargs -n 1 cp /home/user/my_file.txt + +### 9. 删除大文件 ### + +有时候文件可能会变得很大。我看过由于缺乏管理技能一个日志文件就超过 250G 的例子。用 rm 命令可能不足以删除该文件,因为有大量的数据需要移除。应该避免这个很“笨重”的操作。相反,你可以使用一个简单的方法解决这个问题: + + # > /path-to-file/huge_file.log + +当然你需要根据你实际情况替换路径和文件名。上面的命令写一个空输出到该文件。用更简单的话说它会清空文件而不会导致你的系统产生大的 I/O 消耗。 + +### 10. 在多个 Linux 服务器上运行相同命令 ### + +最近我们的一个读者在 [LinuxSay 论坛][6]提问说如何通过 ssh 在多个 Linux 服务器上执行一个命令。他机器的 IP 地址是: + + 10.0.0.1 + 10.0.0.2 + 10.0.0.3 + 10.0.0.4 + 10.0.0.5 + +这里有一个简单的解决方法。将服务器的 IP 地址写到文件 list.txt 中,像上面那样一行一个。然后运行: + + # for in $i(cat list.txt); do ssh user@$i 'bash command'; done + +上面的命令中你需要用实际登录的用户替换 “user”,用你希望执行的实际命令替换 “bash command”。这个方法非常适用于通过[使用 SSH 密钥进行无密码验证][7],因为这样你不需要每次都为用户输入密码。 + +注意取决于你 Linux 系统的设置,你可能还需要传递一些额外的参数给 SSH 命令。 + +### 总结 ### + +上面的例子都很简单,我希望它们能帮助你发现 Linux 的优美之处,你如何能简单实现在其它操作系统上需要更多时间的不同操作。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/10-useful-linux-command-line-tricks-for-newbies/ + +作者:[Marin Todorov][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/marintodorov89/ +[1]:https://linux.cn/article-5485-1.html +[2]:http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/ +[3]:http://www.tecmint.com/history-command-examples/ +[4]:http://www.tecmint.com/midnight-commander-a-console-based-file-manager-for-linux/ +[5]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/ +[6]:http://www.linuxsay.com/ +[7]:https://linux.cn/article-5202-1.html \ No newline at end of file diff --git a/published/201509/20150914 Linux FAQs with Answers--How to remove unused old kernel images on Ubuntu.md b/published/201509/20150914 Linux FAQs with Answers--How to remove unused old kernel images on Ubuntu.md new file mode 100644 index 0000000000..4ac40ff485 --- /dev/null +++ b/published/201509/20150914 Linux FAQs with Answers--How to remove unused old kernel images on Ubuntu.md @@ -0,0 +1,68 @@ +Linux有问必答:如何删除Ubuntu上不再使用的旧内核 +================================================================================ +> **提问**:过去我已经在我的Ubuntu上升级了几次内核。现在我想要删除这些旧的内核镜像来节省我的磁盘空间。如何用最简单的方法删除Ubuntu上先前版本的内核? + +在Ubuntu上,有几个方法来升级内核。在Ubuntu桌面中,软件更新允许你每天检查并更新到最新的内核上。在Ubuntu服务器上,最为重要的安全更新项目之一就是 unattended-upgrades 软件包会自动更新内核。然而,你也可以手动用apt-get或者aptitude命令来更新。 + +随着时间的流逝,持续的内核更新会在系统中积聚大量的不再使用的内核,浪费你的磁盘空间。每个内核镜像和其相关联的模块/头文件会占用200-400MB的磁盘空间,因此由不再使用的内核而浪费的磁盘空间会快速地增加。 + +![](https://farm1.staticflickr.com/636/21352725115_29ae7aab5f_c.jpg) + +GRUB管理器为每个旧内核都维护了一个GRUB入口,以备你想要使用它们。 + +![](https://farm6.staticflickr.com/5803/21164866468_07760fc23c_z.jpg) + +作为磁盘清理的一部分,如果你不再使用这些,你可以考虑清理掉这些镜像。 + +### 如何清理旧内核镜像 ### + +在删除旧内核之前,记住最好留有2个最近的内核(最新的和上一个版本),以防主要的版本出错。现在就让我们看看如何在Ubuntu上清理旧内核。 + +在Ubuntu内核镜像包含了以下的包。 + +- **linux-image-**: 内核镜像 +- **linux-image-extra-**: 额外的内核模块 +- **linux-headers-**: 内核头文件 + +首先检查系统中安装的内核镜像。 + + $ dpkg --list | grep linux-image + $ dpkg --list | grep linux-headers + +在列出的内核镜像中,你可以移除一个特定的版本(比如3.19.0-15)。 + + $ sudo apt-get purge linux-image-3.19.0-15 + $ sudo apt-get purge linux-headers-3.19.0-15 + +上面的命令会删除内核镜像和它相关联的内核模块和头文件。 + +注意如果你还没有升级内核那么删除旧内核会自动触发安装新内核。这样在删除旧内核之后,GRUB配置会自动升级来移除GRUB菜单中相关GRUB入口。 + +如果你有很多没用的内核,你可以用shell表达式来一次性地删除多个内核。注意这个括号表达式只在bash或者兼容的shell中才有效。 + + $ sudo apt-get purge linux-image-3.19.0-{18,20,21,25} + $ sudo apt-get purge linux-headers-3.19.0-{18,20,21,25} + +![](https://farm6.staticflickr.com/5619/21352725355_39cc4fc2d0_c.jpg) + +上面的命令会删除4个内核镜像:3.19.0-18、3.19.0-20、3.19.0-21 和 3.19.0-25。 + +如果GRUB配置由于任何原因在删除旧内核后没有正确升级,你可以尝试手动用update-grub2命令来更新配置。 + + $ sudo update-grub2 + +现在就重启来验证GRUB菜单是否已经正确清理了。 + +![](https://farm1.staticflickr.com/593/20731623163_cccfeac854_z.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/remove-kernel-images-ubuntu.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/published/201509/20150915 Ubuntu Linux-Based Open Source OS Runs 42 Percent of Dell PCs in China.md b/published/201509/20150915 Ubuntu Linux-Based Open Source OS Runs 42 Percent of Dell PCs in China.md new file mode 100644 index 0000000000..6364017ac7 --- /dev/null +++ b/published/201509/20150915 Ubuntu Linux-Based Open Source OS Runs 42 Percent of Dell PCs in China.md @@ -0,0 +1,38 @@ +Ubuntu 开源操作系统运行在中国 42% 的 Dell PC 上 +================================================================================ + +> Dell 称它在中国市场出售的 42% 的 PC 运行的是 Kylin,这是一款 Canonical 帮助开发的基于 Ubuntu 的操作系统。 + +让开源粉丝欢喜的是:Linux 桌面年来了。或者说中国正在接近这个目标,[Dell][1] 报告称它售卖的超过 40% 的 PC 机运行的是 [Canonical][3] 帮助开发的 [Ubuntu Linux][2]。 + +特别地,Dell 称 42% 的中国电脑运行 NeoKylin(中标麒麟),一款中国本土倾力打造的用于替代 [Microsoft][4] Windows的操作系统。它也简称麒麟,这是一款从 2013 年出来的基于 Ubuntu 的操作系统,也是这年开始 Canonical 公司与中国政府合作建立一个专供中国市场的 Ubuntu 变种。 + +麒麟的早期版本出现于 2001 年左右,也是基于其他操作系统,包括 FreeBSD,这是一个开放源码但是不同于 Linux 的类 Unix 操作系统。 + +Ubuntu 麒麟的外观和感觉很像 Ubuntu 的现代版本。它拥有的 [Unity][5] 界面,并运行开源软件的标准套件,以及专门的如 Youker 助理程序,它是一个图形化的前端,帮助用户管理基本计算任务。但是麒麟的默认主题使得它看起来有点像 Windows 而不是 Ubuntu。 + + 鉴于桌面 Linux PC 市场在世界上大多数国家的相对停滞,戴尔的宣布是令人吃惊的。结合中国对当前版本 windows 的轻微[敌意][6],这个消息并不看好着微软在中国市场的前景。 + +紧跟着 Dell 公司[宣布][7]在华投资1.25亿美元之后,一位决策者给华尔街杂志的评论中提到了 Dell 在中国市场上 PC 的销售。 + + ![Ubuntu Kylin](http://thevarguy.com/site-files/thevarguy.com/files/imagecache/medium_img/uploads/2015/09/hey_2.png) + + +-------------------------------------------------------------------------------- + +via: http://thevarguy.com/open-source-application-software-companies/091515/ubuntu-linux-based-open-source-os-runs-42-percent-dell-pc + +作者:[Christopher Tozzi][a] +译者:[geekpi](https://github.com/geeekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://thevarguy.com/author/christopher-tozzi +[1]:http://dell.com/ +[2]:http://ubuntu.com/ +[3]:http://canonical.com/ +[4]:http://microsoft.com/ +[5]:http://unity.ubuntu.com/ +[6]:http://www.wsj.com/articles/windows-8-faces-new-criticism-in-china-1401882772 +[7]:http://thevarguy.com/business-technology-solution-sales/091415/dell-125-million-directed-china-jobs-new-business-and-innovation diff --git a/published/201509/20150916 Enable Automatic System Updates In Ubuntu.md b/published/201509/20150916 Enable Automatic System Updates In Ubuntu.md new file mode 100644 index 0000000000..2a3ef499e9 --- /dev/null +++ b/published/201509/20150916 Enable Automatic System Updates In Ubuntu.md @@ -0,0 +1,48 @@ +开启 Ubuntu 系统自动升级 +================================================================================ +在学习如何开启Ubuntu系统自动升级之前,先解释下为什么需要自动升级。 + +默认情况下,ubuntu每天一次检查更新。但是一周只会弹出一次软件升级提醒,除非当有安全性升级时,才会立即弹出。所以,如果你已经使用Ubuntu一段时间,你肯定很熟悉这个画面: + +![Ubuntu软件升级提醒](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Software-Update-Ubntu.png) + +但是做为一个正常桌面用户,根本不会去关心有什么更新细节。而且这个提醒完全就是浪费时间,你肯定信任Ubuntu提供的升级补丁,对不对?所以,大部分情况你肯定会选择“现在安装”,对不对? + +所以,你需要做的就只是点一下升级按钮。现在,明白为什么需要自动系统升级了吧?开启自动系统升级意味着所有最新的更新都会自动下载并安装,并且没有请求确认。是不是很方便? + +### 开启Ubuntu自动升级 ### + +演示使用Ubuntu15.04,Ubuntu 14.04步骤类似。 + +打开Unity Dash ,找到软件&更新: + +![Ubuntu 软件升级设置](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/08/Software_Update_Ubuntu.jpeg) + +打开软件资源设置,切换到升级标签: + +![Ubuntu 软件升级设置](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Software-Update-Ubntu-1.png) + +可以发现,默认设置就是每日检查并立即提醒安全升级。 + +![改变软件更新频率](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Software-Update-Ubntu-2.png) + +改变 ‘当有安全升级’和‘当有其他升级’的选项为:下载并自动安装。 + +![Automatic updates in Ubuntu](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Software-Update-Ubntu-3.png) + +关闭对话框完成设定。这样每次Ubuntu检查更新后就会自动升级。事实上,这篇文章十分类似[改变Ubuntu升级提醒频率][1]。 + +你喜欢自动升级还是手动安装升级呢?欢迎评论。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/automatic-system-updates-ubuntu/ + +作者:[Abhishek][a] +译者:[Vic020/VicYu](http://vicyu.net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/ubuntu-notify-updates-frequently/ diff --git a/published/201509/20150916 Linux FAQs with Answers--How to find out which CPU core a process is running on.md b/published/201509/20150916 Linux FAQs with Answers--How to find out which CPU core a process is running on.md new file mode 100644 index 0000000000..be9b16e5e4 --- /dev/null +++ b/published/201509/20150916 Linux FAQs with Answers--How to find out which CPU core a process is running on.md @@ -0,0 +1,81 @@ +Linux 有问必答:如何知道进程运行在哪个 CPU 内核上? +================================================================================ +>问题:我有个 Linux 进程运行在多核处理器系统上。怎样才能找出哪个 CPU 内核正在运行该进程? + +当你在 [多核 NUMA 处理器上][1]运行需要较高性能的 HPC(高性能计算)程序或非常消耗网络资源的程序时,CPU/memory 的亲和力是限度其发挥最大性能的重要因素之一。在同一 NUMA 节点上调度最相关的进程可以减少缓慢的远程内存访问。像英特尔 Sandy Bridge 处理器,该处理器有一个集成的 PCIe 控制器,你可以在同一 NUMA 节点上调度网络 I/O 负载(如网卡)来突破 PCI 到 CPU 亲和力限制。 + +作为性能优化和故障排除的一部分,你可能想知道特定的进程被调度到哪个 CPU 内核(或 NUMA 节点)上运行。 + +这里有几种方法可以 **找出哪个 CPU 内核被调度来运行给定的 Linux 进程或线程**。 + +### 方法一 ### + +如果一个进程使用 [taskset][2] 命令明确的被固定(pinned)到 CPU 的特定内核上,你可以使用 taskset 命令找出被固定的 CPU 内核: + + $ taskset -c -p + +例如, 如果你对 PID 5357 这个进程有兴趣: + + $ taskset -c -p 5357 + +---------- + + pid 5357's current affinity list: 5 + +输出显示这个过程被固定在 CPU 内核 5上。 + +但是,如果你没有明确固定进程到任何 CPU 内核,你会得到类似下面的亲和力列表。 + + pid 5357's current affinity list: 0-11 + +输出表明该进程可能会被安排在从0到11中的任何一个 CPU 内核。在这种情况下,taskset 不能识别该进程当前被分配给哪个 CPU 内核,你应该使用如下所述的方法。 + +### 方法二 ### + +ps 命令可以告诉你每个进程/线程目前分配到的 (在“PSR”列)CPU ID。 + + $ ps -o pid,psr,comm -p + +---------- + + PID PSR COMMAND + 5357 10 prog + +输出表示进程的 PID 为 5357(名为"prog")目前在CPU 内核 10 上运行着。如果该过程没有被固定,PSR 列会根据内核可能调度该进程到不同内核而改变显示。 + +### 方法三 ### + +top 命令也可以显示 CPU 被分配给哪个进程。首先,在top 命令中使用“P”选项。然后按“f”键,显示中会出现 "Last used CPU" 列。目前使用的 CPU 内核将出现在 “P”(或“PSR”)列下。 + + $ top -p 5357 + +![](https://farm6.staticflickr.com/5698/21429268426_e7d1d73a04_c.jpg) + +相比于 ps 命令,使用 top 命令的好处是,你可以连续监视随着时间的改变, CPU 是如何分配的。 + +### 方法四 ### + +另一种来检查一个进程/线程当前使用的是哪个 CPU 内核的方法是使用 [htop 命令][3]。 + +从命令行启动 htop。按 键,进入"Columns",在"Available Columns"下会添加 PROCESSOR。 + +每个进程当前使用的 CPU ID 将出现在“CPU”列中。 + +![](https://farm6.staticflickr.com/5788/21444522832_a5a206f600_c.jpg) + +请注意,所有以前使用的命令 taskset,ps 和 top 分配CPU 内核的 IDs 为 0,1,2,...,N-1。然而,htop 分配 CPU 内核 IDs 从 1开始(直到 N)。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/cpu-core-process-is-running.html + +作者:[Dan Nanni][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://xmodulo.com/identify-cpu-processor-architecture-linux.html +[2]:http://xmodulo.com/run-program-process-specific-cpu-cores-linux.html +[3]:https://linux.cn/article-3141-1.html diff --git a/published/201510/20150202 How to filter BGP routes in Quagga BGP router.md b/published/201510/20150202 How to filter BGP routes in Quagga BGP router.md new file mode 100644 index 0000000000..17bf6fbbcc --- /dev/null +++ b/published/201510/20150202 How to filter BGP routes in Quagga BGP router.md @@ -0,0 +1,201 @@ +如何使用 Quagga BGP(边界网关协议)路由器来过滤 BGP 路由 +================================================================================ +在[之前的文章][1]中,我们介绍了如何使用 Quagga 将 CentOS 服务器变成一个 BGP 路由器,也介绍了 BGP 对等体和前缀交换设置。在本教程中,我们将重点放在如何使用**前缀列表(prefix-list)**和**路由映射(route-map)**来分别控制数据注入和数据输出。 + +之前的文章已经说过,BGP 的路由判定是基于前缀的收取和前缀的广播。为避免错误的路由,你需要使用一些过滤机制来控制这些前缀的收发。举个例子,如果你的一个 BGP 邻居开始广播一个本不属于它们的前缀,而你也将错就错地接收了这些不正常前缀,并且也将它转发到网络上,这个转发过程会不断进行下去,永不停止(所谓的“黑洞”就这样产生了)。所以确保这样的前缀不会被收到,或者不会转发到任何网络,要达到这个目的,你可以使用前缀列表和路由映射。前者是基于前缀的过滤机制,后者是更为常用的基于前缀的策略,可用于精调过滤机制。 + +本文会向你展示如何在 Quagga 中使用前缀列表和路由映射。 + +### 拓扑和需求 ### + +本教程使用下面的拓扑结构。 + +![](https://farm8.staticflickr.com/7394/16407625405_4f7d24d1f6_c.jpg) + +服务供应商A和供应商B已经将对方设置成为 eBGP 对等体,实现互相通信。他们的自治系统号和前缀分别如下所示。 + +- **对等区段**: 192.168.1.0/24 +- **服务供应商A**: 自治系统号 100, 前缀 10.10.0.0/16 +- **服务供应商B**: 自治系统号 200, 前缀 10.20.0.0/16 + +在这个场景中,供应商B只想从A接收 10.10.10.0/23, 10.10.10.0/24 和 10.10.11.0/24 三个前缀。 + +### 安装 Quagga 和设置 BGP 对等体 ### + +在[之前的教程][1]中,我们已经写了安装 Quagga 和设置 BGP 对等体的方法,所以这里就不再详细说明了,只简单介绍下 BGP 配置和前缀广播: + +![](https://farm8.staticflickr.com/7428/16219986668_97cb193b15_c.jpg) + +上图说明 BGP 对等体已经开启。Router-A 在向 router-B 广播多个前缀,而 Router-B 也在向 router-A 广播一个前缀 10.20.0.0/16。两个路由器都能正确无误地收发前缀。 + +### 创建前缀列表 ### + +路由器可以使用 ACL 或前缀列表来过滤一个前缀。前缀列表比 ACL 更常用,因为前者处理步骤少,而且易于创建和维护。 + + ip prefix-list DEMO-PRFX permit 192.168.0.0/23 + +上面的命令创建了名为“DEMO-FRFX”的前缀列表,只允许存在 192.168.0.0/23 这个前缀。 + +前缀列表的另一个强大功能是支持子网掩码区间,请看下面的例子: + + ip prefix-list DEMO-PRFX permit 192.168.0.0/23 le 24 + +这个命令创建的前缀列表包含在 192.168.0.0/23 和 /24 之间的前缀,分别是 192.168.0.0/23, 192.168.0.0/24 和 192.168.1.0/24。运算符“le”表示小于等于,你也可以使用“ge”表示大于等于。 + +一个前缀列表语句可以有多个允许或拒绝操作。每个语句都自动或手动地分配有一个序列号。 + +如果存在多个前缀列表语句,则这些语句会按序列号顺序被依次执行。在配置前缀列表的时候,我们需要注意在所有前缀列表语句之后是**隐性拒绝**语句,就是说凡是不被明显允许的,都会被拒绝。 + +如果要设置成允许所有前缀,前缀列表语句设置如下: + + ip prefix-list DEMO-PRFX permit 0.0.0.0/0 le 32 + +我们已经知道如何创建前缀列表语句了,现在我们要创建一个名为“PRFX-LST”的前缀列表,来满足我们实验场景的需求。 + + router-b# conf t + router-b(config)# ip prefix-list PRFX-LST permit 10.10.10.0/23 le 24 + +### 创建路由映射 ### + +除了前缀列表和 ACL,这里还有另一种机制,叫做路由映射,也可以在 BGP 路由器中控制前缀。事实上,路由映射针对前缀匹配的微调效果比前缀列表和 ACL 都强。 + +与前缀列表类似,路由映射语句也可以指定允许和拒绝操作,也需要分配一个序列号。每个路由匹配可以有多个允许或拒绝操作。例如: + + route-map DEMO-RMAP permit 10 + +上面的语句创建了名为“DEMO-RMAP”的路由映射,添加序列号为10的允许操作。现在我们在这个序列号所对应的路由映射下使用 match 命令进行匹配。 + + router-a(config-route-map)# match (press ? in the keyboard) + +---------- + + as-path Match BGP AS path list + community Match BGP community list + extcommunity Match BGP/VPN extended community list + interface match first hop interface of route + ip IP information + ipv6 IPv6 information + metric Match metric of route + origin BGP origin code + peer Match peer address + probability Match portion of routes defined by percentage value + tag Match tag of route + +如你所见,路由映射可以匹配很多属性,在本教程中匹配的是前缀。 + + route-map DEMO-RMAP permit 10 + match ip address prefix-list DEMO-PRFX + +这个 match 命令会匹配之前建好的前缀列表中允许的 IP 地址(也就是前缀 192.168.0.0/23, 192.168.0.0/24 和 192.168.1.0/24)。 + +接下来,我们可以使用 set 命令来修改这些属性。例子如下: + + route-map DEMO-RMAP permit 10 + match ip address prefix-list DEMO-PRFX + set (press ? in keyboard) + +---------- + + aggregator BGP aggregator attribute + as-path Transform BGP AS-path attribute + atomic-aggregate BGP atomic aggregate attribute + comm-list set BGP community list (for deletion) + community BGP community attribute + extcommunity BGP extended community attribute + forwarding-address Forwarding Address + ip IP information + ipv6 IPv6 information + local-preference BGP local preference path attribute + metric Metric value for destination routing protocol + metric-type Type of metric + origin BGP origin code + originator-id BGP originator ID attribute + src src address for route + tag Tag value for routing protocol + vpnv4 VPNv4 information + weight BGP weight for routing table + +如你所见,set 命令也可以修改很多属性。为了作个示范,我们修改一下 BGP 的 local-preference 这个属性。 + + route-map DEMO-RMAP permit 10 + match ip address prefix-list DEMO-PRFX + set local-preference 500 + +如同前缀列表,路由映射语句的末尾也有隐性拒绝操作。所以我们需要添加另外一个允许语句(使用序列号20)来允许所有前缀。 + + route-map DEMO-RMAP permit 10 + match ip address prefix-list DEMO-PRFX + set local-preference 500 + ! + route-map DEMO-RMAP permit 20 + +序列号20未指定任何匹配命令,所以默认匹配所有前缀。在这个路由映射语句中,所有的前缀都被允许。 + +回想一下,我们的需求是只允许或只拒绝一些前缀,所以上面的 set 命令不应该存在于这个场景中。我们只需要一个允许语句,如下如示: + + router-b# conf t + router-b(config)# route-map RMAP permit 10 + router-b(config-route-map)# match ip address prefix-list PRFX-LST + +这个路由映射才是我们需要的效果。 + +### 应用路由映射 ### + +注意,在被应用于一个接口或一个 BGP 邻居之前,ACL、前缀列表和路由映射都不会生效。与 ACL 和前缀列表一样,一条路由映射语句也能被多个接口或邻居使用。然而,一个接口或一个邻居只能有一条路由映射语句应用于输入端,以及一条路由映射语句应用于输出端。 + +下面我们将这条路由映射语句应用于 router-B 的 BGP 配置,为 router-B 的邻居 192.168.1.1 设置输入前缀广播。 + + router-b# conf terminal + router-b(config)# router bgp 200 + router-b(config-router)# neighbor 192.168.1.1 route-map RMAP in + +现在检查下广播路由和收取路由。 + +显示广播路由的命令: + + show ip bgp neighbor-IP advertised-routes + +显示收取路由的命令: + + show ip bgp neighbor-IP routes + +![](https://farm8.staticflickr.com/7424/16221405429_4d86119548_c.jpg) + +可以看到,router-A 有4条路由前缀到达 router-B,而 router-B 只接收3条。查看一下范围,我们就能知道只有被路由映射允许的前缀才能在 router-B 上显示出来,其他的前缀一概丢弃。 + +**小提示**:如果接收前缀内容没有刷新,试试重置下 BGP 会话,使用这个命令:`clear ip bgp neighbor-IP`。本教程中命令如下: + + clear ip bgp 192.168.1.1 + +我们能看到系统已经满足我们的要求了。接下来我们可以在 router-A 和 router-B 上创建相似的前缀列表和路由映射语句来更好地控制输入输出的前缀。 + +这里把配置过程总结一下,方便查看。 + + router bgp 200 + network 10.20.0.0/16 + neighbor 192.168.1.1 remote-as 100 + neighbor 192.168.1.1 route-map RMAP in + ! + ip prefix-list PRFX-LST seq 5 permit 10.10.10.0/23 le 24 + ! + route-map RMAP permit 10 + match ip address prefix-list PRFX-LST + +### 总结 ### + +在本教程中我们演示了如何在 Quagga 中设置前缀列表和路由映射来过滤 BGP 路由。我们也展示了如何将前缀列表结合进路由映射来进行输入前缀的微调功能。你可以参考这些方法来设置满足自己需求的前缀列表和路由映射。这些工具是保护网络免受路由毒化和来自 bogon 路由(LCTT 译注:指不该出现在internet路由表中的地址)的广播。 + +希望本文对你有帮助。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/filter-bgp-routes-quagga-bgp-router.html + +作者:[Sarmed Rahman][a] +译者:[bazz2](https://github.com/bazz2) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/sarmed +[1]:https://linux.cn/article-4609-1.html diff --git a/published/201510/20150716 Interview--Larry Wall.md b/published/201510/20150716 Interview--Larry Wall.md new file mode 100644 index 0000000000..c08b46910c --- /dev/null +++ b/published/201510/20150716 Interview--Larry Wall.md @@ -0,0 +1,132 @@ +Larry Wall 专访——语言学、Perl 6 的设计和发布 +================================================================================ + +> 经历了15年的打造,Perl 6 终将在年底与大家见面。我们预先采访了它的作者了解一下新特性。 + +Larry Wall 是个相当有趣的人。他是编程语言 Perl 的创造者,这种语言被广泛的誉为将互联网粘在一起的胶水,也由于大量地在各种地方使用非字母的符号被嘲笑为‘只写’语言——以难以阅读著称。Larry 本人具有语言学背景,以其介绍 Perl 未来发展的演讲“[洋葱的状态][1](State of the Onion)”而闻名。(LCTT 译注:“洋葱的状态”是 Larry Wall 的年度演讲的主题,洋葱也是 Perl 基金会的标志。) + +在2015年布鲁塞尔的 FOSDEM 上,我们赶上了 Larry,问了问他为什么 Perl 6 花了如此长的时间(Perl 5 的发布时间是1994年),了解当项目中的每个人都各执己见时是多么的难以管理,以及他的语言学背景自始至终究竟给 Perl 带来了怎样的影响。做好准备,让我们来领略其中的奥妙…… + +![](http://www.linuxvoice.com/wp-content/uploads/2015/07/wall1.jpg) + +**Linux Voice:你曾经有过计划去寻找世界上某个地方的某种不见经传的语言,然后为它创造书写的文字,但你从未有机会去实现它。如果你能回到过去,你会去做么?** + +Larry Wall:你首先得是个年轻人才能搞得定!做这些事需要投入很大的努力和人力,以至于已经不适合那些上了年纪的人了。健康、活力是其中的一部分,同样也因为人们在年轻的时候更容易学习一门新的语言,只有在你学会了语言之后你才能写呀。 + +我自学了日语十年,由于我的音系学和语音学的训练我能说的比较流利——但要理解别人的意思对我来说还十分困难。所以到了日本我会问路,但我听不懂他们的回答! + +通常需要一门语言学习得足够好才能开发一个文字体系,并可以使用这种语言进行少量的交流。在你能够实际推广它和用本土人自己的文化教育他们前,那还需要一些年。最后才可以教授本土人如何以他们的文明书写。 + +当然如果在语言方面你有帮手 —— 经过别人的提醒我们不再使用“语言线人”来称呼他们了,那样显得我们像是在 CIA 工作的一样!—— 你可以通过他们的帮助来学习外语。他们不是老师,但他们会以另一种方式来启发你学习 —— 当然他们也能教你如何说。他们会拿着一根棍子,指着它说“这是一根棍子”,然后丢掉同时说“棒子掉下去了”。然后,你就可以记下一些东西并将其系统化。 + +大多数让人们有这样做的动力是翻译圣经。但是这只是其中的一方面;另一方面也是为了文化保护。传教士在这方面臭名昭著,因为人类学家认为人们应该基于自己的文明来做这件事。但有些人注定会改变他们的文化——他们可能是军队、或是商业侵入,如可口可乐或者缝纫机,或传教士。在这三者之间,传教士相对来讲伤害最小的了,如果他们恪守本职的话。 + +**LV:许多文字系统有本可依,相较而言你的发明就像是格林兰语…** + +印第安人照搬字母就发明了他们自己的语言,而且没有在这些字母上施加太多我们给这些字母赋予的涵义,这种做法相当随性。它们只要能够表达出人们的所思所想,使交流顺畅就行。经常是有些声调语言(Tonal language)使用的是西方文字拼写,并尽可能的使用拉丁文的字符变化,然后用重音符或数字标注出音调。 + +在你开始学习如何使用语音和语调表示之后,你也开始变得迷糊——或者你的书写就不如从前准确。或者你对话的时候像在讲英文,但发音开始无法匹配拼写。 + +**LV:当你在开发 Perl 的时候,你的语言学背景会不会使你认为:“这对程序设计语言真的非常重要”?** + +LW:我在人们是如何使用语言上想了很多。在现实的语言中,你有一套名词、动词和形容词的体系,并且你知道这些单词的词性。在现实的自然语言中,你时常将一个单词放到不同的位置。我所学的语言学理论也被称为法位学(phoenetic),它解释了这些在自然语言中工作的原理 —— 也就是有些你当做名词的东西,有时候你可以将它用作动词,并且人们总是这样做。 + +你能很好的将任何单词放在任何位置而进行沟通。我比较喜欢的例子是将一个整句用作为一个形容词。这句话会是这样的:“我不喜欢你的[我可以用任何东西来取代这个形容词的]态度”! + +所以自然语言非常灵活,因为聆听者非常聪明 —— 至少,相对于电脑而言 —— 你相信他们会理解你最想表达的意思,即使存在歧义。当然对电脑而言,你必须保证歧义不大。 + +> “在 Perl 6 中,我们试图让电脑更准确的了解我们。” + +可以说在 Perl 1到5上,我们针对歧义方面处理做得还不够。有时电脑会在不应该的时候迷惑。在 Perl 6上,我们找了许多方法,使得电脑对你所说的话能更准确的理解,就算用户并不清楚这底是字符串还是数字,电脑也能准确的知道它的类型。我们找到了内部以强类型存储,而仍然可以无视类型的“以此即彼”的方法。 + +![](http://www.linuxvoice.com/wp-content/uploads/2015/07/wall2.jpg) + +**LV:Perl 被视作互联网上的“胶水(glue)”语言已久,能将点点滴滴组合在一起。在你看来 Perl 6 的发布是否符合当前用户的需要,或者旨在招揽更多新用户,能使它重获新生吗?** + +LW:最初的设想是为 Perl 程序员带来更好的 Perl。但在看到了 Perl 5 上的不足后,很明显改掉这些不足会使 Perl 6更易用,就像我在讨论中提到过 —— 类似于 [托尔金(J. R. R. Tolkien) 在《指环王》前言中谈到的适用性一样][2]。 + +重点是“简单的东西应该简单,而困难的东西应该可以实现”。让我们回顾一下,在 Perl 2和3之间的那段时间。在 Perl 2上我们不能处理二进制数据或嵌入的 null 值 —— 只支持 C 语言风格的字符串。我曾说过“Perl 只是文本处理语言 —— 在文本处理语言里你并不需要这些功能”。 + +但当时发生了一大堆的问题,因为大多数的文本中会包含少量的二进制数据 —— 如网络地址(network addresses)及类似的东西。你使用二进制数据打开套接字,然后处理文本。所以通过支持二进制数据,语言的适用性(applicability)翻了一倍。 + +这让我们开始探讨在语言中什么应该简单。现在的 Perl 中有一条原则,是我们偷师了哈夫曼编码(Huffman coding)的做法,它在位编码系统中为字符采取了不同的尺寸,常用的字符占用的位数较少,不常用的字符占用的位数更多。 + +我们偷师了这种想法并将它作为 Perl 的一般原则,针对常用的或者说常输入的 —— 这些常用的东西必须简单或简洁。不过,另一方面,也显得更加的不规则(irregular)。在自然语言中也是这样的,最常用的动词实际上往往是最不规则的。 + +所以在这样的情况下需要更多的差异存在。我很喜欢一本书是 Umberto Eco 写的的《探寻完美的语言(The Search for the Perfect Language)》,说的并不是计算机语言;而是哲学语言,大体的意思是古代的语言也许是完美的,我们应该将它们带回来。 + +所有的这类语言错误的认为类似的事物其编码也应该总是类似的。但这并不是我们沟通的方式。如果你的农场中有许多动物,他们都有相近的名字,当你想杀一只鸡的时候说“走,去把 Blerfoo 宰了”,你的真实想法是宰了 Blerfee,但有可能最后死的是一头牛(LCTT 译注:这是杀鸡用牛刀的意思吗?哈哈)。 + +所以在这种时候我们其实更需要好好的将单词区分开,使沟通信道的冗余增加。常用的单词应该有更多的差异。为了达到更有效的通讯,还有一种自足(LCTT 译注:self-clocking ,自同步,[概念][3]来自电信和电子行业,此处译为“自足”更能体现涵义)编码。如果你在一个货物上看到过 UPC 标签(条形码),它就是一个自足编码,每对“条”和“空”总是以七个列宽为单位,据此你就知道“条”的宽度加起来总是这么宽。这就是自足。 + +在电子产品中还有另一种自足编码。在老式的串行传输协议中有停止和启动位,来保持同步。自然语言中也会包含这些。比如说,在写日语时,不用使用空格。由于书写方式的原因,他们会在每个词组的开头使用中文中的汉字字符,然后用音节表(syllabary)中的字符来结尾。 + +**LV:是平假名,对吗?** + +LW: 是的,平假名。所以在这一系统,每个词组的开头就自然就很重要了。同样的,在古希腊,大多数的动词都是搭配好的(declined 或 conjugated),所以它们的标准结尾是一种自足机制。在他们的书写体系中空格也是可有可无的 —— 引入空格是更近代的发明。 + +所以在计算机语言上也要如此,有的值也可以自足编码。在 Perl 上我们重度依赖这种方法,而且在 Perl 6 上相较于前几代这种依赖更重。当你使用表达式时,你要么得到的是一个词,要么得到的是插值(infix)操作符。当你想要得到一个词,你有可能得到的是一个前缀操作符,它也在相同的位置;同样当你想要得到一个插值操作符,你也可能得到的是前一个词的后缀。 + +但是反过来。如果编译器准确的知道它想要什么,你可以稍微重载(overload)它们,其它的让 Perl 来完成。所以在斜线“/”后面是单词时它会当成正则表达式,而斜线“/”在字串中时视作除法。而我们并不会重载所有东西,因为那只会使你失去自足冗余。 + +多数情况下我们提示的比较好的语法错误消息,是出于发现了一行中出现了两个关键词,然后我们尝试找出为什么一行会出现两个关键字 —— “哦,你一定漏掉了上一行的分号”,所以我们相较于很多其他的按步照班的解析器可以生成更好的错误消息。 + +![](http://www.linuxvoice.com/wp-content/uploads/2015/07/wall3.jpg) + +**LV:为什么 Perl 6 花了15年?当每个人对事物有不同看法时一定十分难于管理,而且正确和错误并不是绝对的。** + +LW:这必须要非常小心地平衡。刚开始会有许多的好的想法 —— 好吧,我并不是说那些全是好的想法。也有很多令人烦恼的地方,就像有361条 RFC [功能建议文件],而我也许只想要20条。我们需要坐下来,将它们全部看完,并忽略其中的解决方案,因为它们通常流于表象、视野狭隘。几乎每一条只针对一样事物,如若我们将它们全部拼凑起来,那简直是一堆垃圾。 + +> “掌握平衡时需要格外小心。毕竟在刚开始的时候总会有许多的好主意。” + +所以我们必须基于人们在使用 Perl 5 时的真实感受重新整理,寻找统一、深层的解决方案。这些 RFC 文档许多都提到了一个事实,就是类型系统的不足。通过引入更条理分明的类型系统,我们可以解决很多问题并且即聪明又紧凑。 + +同时我们开始关注其他方面:如何统一特征集并开始重用不同领域的想法,这并不需要它们在下层相同。我们有一种标准的书写配对(pair)的方式——好吧,在 Perl 里面有两种!但使用冒号书写配对的方法同样可以用于基数计数法或是任何进制的文本编号。同样也可以用于其他形式的引用(quoting)。在 Perl 里我们称它为“奇妙的一致”。 + +> “做了 Perl 6 的早期实现的朋友们,握着我的手说:“我们真的很需要一位语言的设计者。”” + +同样的想法涌现出来,你说“我已经熟悉了语法如何运作,但是我看见它也被用在别处”,所以说视角相同才能找出这种一致。那些提出各种想法和做了 Perl 6 的早期实现的人们回来看我,握着我的手说:“我们真的需要一位语言的设计者。您能作为我们的[仁慈独裁者][4](benevolent dictator)吗?”(LCTT 译注:Benevolent Dictator For Life,或 BDFL,指开源领袖,通常指对社区争议拥有最终裁决权的领袖,典故来自 Python 创始人 Guido van Rossum, 具体参考维基条目[解释][4]) + +所以我是语言的设计者,但总是听到:“不要管具体实现(implementation)!我们目睹了你对 Perl 5 做的那些,我们不想历史重演!”真是让我忍俊不禁,因为他们作为起步的核心和原先 Perl 5 的内部结构上几乎别无二致,也许这就是为什么一些早期的实现做的并不好的原因。 + +因为我们仍然在摸索我们的整个设计,其实现在做了许多 VM (虚拟机)该做什么和不该做什么的假设,所以最终这个东西就像面向对象的汇编语言一样。类似的问题在伊始阶段无处不在。然后 Pugs 这家伙走过来说:“用用看 Haskell 吧,它能让你们清醒的认识自己正在干什么,让我们用它来弄清楚下层的语义模型(semantic model)。” + +因此,我们明确了其中的一些语义模型,但更重要的是,我们开始建立符合那些语义模型的测试套件。在这之后,Parrot VM 继续进行开发,并且出现了另一个实现 Niecza ,它基于 .Net,是由一个年轻的家伙搞出来的。他很聪明,实现了 Perl 6 的一个很大的子集。不过他还是一个人干,并没有找到什么好方法让别人介入他的项目。 + +同时 Parrot 项目变得过于庞大,以至于任何人都不能真正的深入掌控它,并且很难重构。同时,开发 Rakudo 的人们觉得我们可能需要在更多平台上运行它,而不只是在 Parrot VM 上。 于是他们发明了所谓的可移植层 NQP ,即 “Not Quite Perl”。他们一开始将它移植到 JVM(Java虚拟机)上运行,与此同时,他们还秘密的开发了一个叫做 MoarVM 的 VM ,它去年才刚刚为人知晓。 + +无论 MoarVM 还是 JVM 在回归测试(regression test)中表现得十分接近 —— 在许多方面 Parrot 算是尾随其后。这样不挑剔 VM 真的很棒,我们也能开始考虑将 NQP 发扬光大。谷歌夏季编码大赛(Google Summer of Code project)的目标就是针对 JavaScript 的 NQP,这应该靠谱,因为 MoarVM 也同样使用 Node.js 作为日常处理。 + +我们可能要将今年余下的时光投在 MoarVM 上,直到 6.0 发布,方可休息片刻。 + +**LV:去年英国,政府开展编程年活动(Year of Code),来激发年轻人对编程的兴趣。针对活动的建议五花八门——类似为了让人们准确的认识到内存的使用你是否应该从低阶语言开始讲授,或是一门高阶语言。你对此作何看法?** + +LW:到现在为止,Python 社区在低阶方面的教学工作做得比我们要好。我们也很想在这一方面做点什么,这也是我们有蝴蝶 logo 的部分原因,以此来吸引七岁大小的女孩子! + +![Perl 6 : Camelia](https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Camelia.svg/640px-Camelia.svg.png) + +> “到现在为止,Python 社区在低阶方面的教学工作做得比我们要好。” + +我们认为将 Perl 6 作为第一门语言来学习是可行的。一大堆的将 Perl 5 作为第一门语言学习的人让我们吃惊。你知道,在 Perl 5 中有许多相当大的概念,如闭包,词法范围,和一些你通常在函数式编程中见到的特性。甚至在 Perl 6 中更是如此。 + +Perl 6 花了这么长时间的部分原因是我们尝试去坚持将近 50 种互不相同的原则,在设计语言的最后对于“哪点是最重要的规则”这个问题还是悬而未决。有太多的问题需要讨论。有时我们做出了决定,并已经工作了一段时间,才发现这个决定并不很正确。 + +之前我们并未针对并发程序设计或指定很多东西,直到 Jonathan Worthington 的出现,他非常巧妙的权衡了各个方面。他结合了一些其他语言诸如 Go 和 C# 的想法,将并发原语写的非常好。可组合性(Composability)是一个语言至关重要的一部分。 + +有很多的程序设计系统的并发和并行写的并不好 —— 比如线程和锁,不良的操作方式有很多。所以在我看来,额外花点时间看一下 Go 或者 C# 这种高阶原语的开发是很值得的 —— 那是一种关键字上的矛盾 —— 写的相当棒。 + +-------------------------------------------------------------------------------- + +via: http://www.linuxvoice.com/interview-larry-wall/ + +作者:[Mike Saunders][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxvoice.com/author/mike/ +[1]:https://en.wikipedia.org/wiki/Perl#State_of_the_Onion +[2]:http://tinyurl.com/nhpr8g2 +[3]:http://en.wikipedia.org/wiki/Self-clocking_signal +[4]:https://en.wikipedia.org/wiki/Benevolent_dictator_for_life \ No newline at end of file diff --git a/published/201510/20150821 Linux 4.3 Kernel To Add The MOST Driver Subsystem.md b/published/201510/20150821 Linux 4.3 Kernel To Add The MOST Driver Subsystem.md new file mode 100644 index 0000000000..40f63a4c8d --- /dev/null +++ b/published/201510/20150821 Linux 4.3 Kernel To Add The MOST Driver Subsystem.md @@ -0,0 +1,28 @@ +Linux 4.3 内核增加了 MOST 驱动子系统 +================================================================================ +当 4.2 内核还没有正式发布的时候,Greg Kroah-Hartman 就为他维护的各种子系统模块打开了4.3 的合并窗口。 + +之前 Greg KH 发起的拉取请求(pull request)里包含了 linux 4.3 的合并窗口更新,内容涉及驱动核心、TTY/串口、USB 驱动、字符/杂项以及暂存区内容。这些拉取申请没有提供任何震撼性的改变,大部分都是改进/附加/修改bug。暂存区内容又是大量的修正和清理,但是还是有一个新的驱动子系统。 + +Greg 提到了[4.3 的暂存区改变][2],“这里的很多东西,几乎全部都是细小的修改和改变。通常的 IIO 更新和新驱动,以及我们已经添加了的 MOST 驱动子系统,已经在源码树里整理了。ozwpan 驱动最终还是被删掉,因为它很明显被废弃了而且也没有人关心它。” + +MOST 驱动子系统是面向媒体的系统传输(Media Oriented Systems Transport)的简称。在 linux 4.3 新增的文档里面解释道,“MOST 驱动支持 LInux 应用程序访问 MOST 网络:汽车信息骨干网(Automotive Information Backbone),高速汽车多媒体网络的事实上的标准。MOST 定义了必要的协议、硬件和软件层,提供高效且低消耗的传输控制,实时的数据包传输,而只需要使用一个媒介(物理层)。目前使用的媒介是光线、非屏蔽双绞线(UTP)和同轴电缆。MOST 也支持多种传输速度,最高支持150Mbps。”如文档解释的,MOST 主要是关于 Linux 在汽车上的应用。 + +当 Greg KH 发出了他为 Linux 4.3 多个子系统做出的更新,但是他还没有打算提交 [KDBUS][5] 的内核代码。他之前已经放出了 [linux 4.3 的 KDBUS] 的开发计划,所以我们将需要等待官方的4.3 合并窗口,看看会发生什么。 + +-------------------------------------------------------------------------------- + +via: http://www.phoronix.com/scan.php?page=news_item&px=Linux-4.3-Staging-Pull + +作者:[Michael Larabel][a] +译者:[oska874](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.michaellarabel.com/ +[1]:http://www.phoronix.com/scan.php?page=search&q=Linux+4.2 +[2]:http://lkml.iu.edu/hypermail/linux/kernel/1508.2/02604.html +[3]:http://www.phoronix.com/scan.php?page=news_item&px=KDBUS-Not-In-Linux-4.2 +[4]:http://www.phoronix.com/scan.php?page=news_item&px=Linux-4.2-rc7-Released +[5]:http://www.phoronix.com/scan.php?page=search&q=KDBUS diff --git a/published/201510/20150906 Installing NGINX and NGINX Plus With Ansible.md b/published/201510/20150906 Installing NGINX and NGINX Plus With Ansible.md new file mode 100644 index 0000000000..10e16e3082 --- /dev/null +++ b/published/201510/20150906 Installing NGINX and NGINX Plus With Ansible.md @@ -0,0 +1,449 @@ +使用 ansible 安装 NGINX 和 NGINX Plus +================================================================================ +在生产环境中,我会更喜欢做与自动化相关的所有事情。如果计算机能完成你的任务,何必需要你亲自动手呢?但是,在不断变化并存在多种技术的环境中,创建和实施自动化是一项艰巨的任务。这就是为什么我喜欢 [Ansible][1] 的原因。Ansible 是一个用于 IT 配置管理,部署和业务流程的开源工具,使用起来非常方便。 + +我最喜欢 Ansible 的一个特点是,它是完全无客户端的。要管理一个系统,通过 SSH 建立连接,它使用[Paramiko][2](一个 Python 库)或本地的 [OpenSSH][3]。Ansible 另一个吸引人的地方是它有许多可扩展的模块。这些模块可被系统管理员用于执行一些的常见任务。特别是,它们使用 Ansible 这个强有力的工具可以跨多个服务器、环境或操作系统安装和配置任何程序,只需要一个控制节点。 + +在本教程中,我将带你使用 Ansible 完成安装和部署开源 [NGINX][4] 和我们的商业产品 [NGINX Plus][5]。我将在 [CentOS][6] 服务器上演示,但我也在下面的“在 Ubuntu 上创建 Ansible Playbook 来安装 NGINX 和 NGINX Plus”小节中包含了在 Ubuntu 服务器上部署的细节。 + +在本教程中我将使用 Ansible 1.9.2 版本,并在 CentOS 7.1 服务器上部署运行。 + + $ ansible --version + ansible 1.9.2 + + $ cat /etc/redhat-release + CentOS Linux release 7.1.1503 (Core) + +如果你还没有 Ansible,可以在 [Ansible 网站][8] 查看说明并安装它。 + +如果你使用的是 CentOS,安装 Ansible 十分简单,只要输入以下命令。如果你想使用源码编译安装或使用其他发行版,请参阅上面 Ansible 链接中的说明。 + + $ sudo yum install -y epel-release && sudo yum install -y ansible + +根据环境的不同,在本教程中的命令有的可能需要 sudo 权限。文件路径,用户名和目标服务器取决于你的环境的情况。 + +### 创建一个 Ansible Playbook 来安装 NGINX (CentOS) ### + +首先,我们要为 NGINX 的部署创建一个工作目录,包括子目录和部署配置文件。我通常建议在你的主目录中创建该目录,在文章的所有例子中都会有说明。 + + $ cd $HOME + $ mkdir -p ansible-nginx/tasks/ + $ touch ansible-nginx/deploy.yml + $ touch ansible-nginx/tasks/install_nginx.yml + +目录结构看起来是这样的。你可以使用 tree 命令来查看。 + + $ tree $HOME/ansible-nginx/ + /home/kjones/ansible-nginx/ + ├── deploy.yml + └── tasks + └── install_nginx.yml + + 1 directory, 2 files + +如果你没有安装 tree 命令,使用以下命令去安装。 + + $ sudo yum install -y tree + +#### 创建主部署文件 #### + +接下来,我们在文本编辑器中打开 **deploy.yml**。我喜欢在命令行上使用 vim 来编辑配置文件,在整个教程中也都将使用它。 + + $ vim $HOME/ansible-nginx/deploy.yml + +**deploy.yml** 文件是 Ansible 部署的主要文件,在“使用 Ansible 部署 NGINX”小节中,我们运行 ansible‑playbook 命令时会使用此文件。在这个文件中,我们指定 Ansible 运行时使用的库以及其它配置文件。 + +在这个例子中,我使用 [include][10] 模块来指定配置文件一步一步来安装NGINX。虽然可以创建一个非常大的 playbook 文件,我建议你将其分割为小文件,让它们更有条理。include 的示例中可以复制静态内容,复制配置文件,为更高级的部署使用逻辑配置设定变量。 + +在文件中输入以下行。我在顶部的注释包含了文件名用于参考。 + + # ./ansible-nginx/deploy.yml + + - hosts: nginx + tasks: + - include: 'tasks/install_nginx.yml' + +hosts 语句说明 Ansible 部署 **nginx** 组的所有服务器,服务器在 **/etc/ansible/hosts** 中指定。我们会在下面的“创建 NGINX 服务器列表”小节编辑此文件。 + +include 语句说明 Ansible 在部署过程中从 **tasks** 目录下读取并执行 **install\_nginx.yml** 文件中的内容。该文件包括以下几步:下载,安装,并启动 NGINX。我们将在下一节创建此文件。 + +#### 为 NGINX 创建部署文件 #### + +现在,先保存 **deploy.yml** 文件,并在编辑器中打开 **install\_nginx.yml** 。 + + $ vim $HOME/ansible-nginx/tasks/install_nginx.yml + +该文件包含有指令(使用 [YAML][12] 格式写的), Ansible 会按照指令安装和配置我们的 NGINX 部署过程。每个节(过程中的步骤)起始于一个描述此步骤的 `name` 语句(前面有连字符)。 `name` 后的字符串是 Ansible 部署过程中输出到标准输出的,可以根据你的意愿来修改。YAML 文件中的节的下一行是在部署过程中将使用的模块。在下面的配置中,使用了 [`yum`][13] 和 [`service`][14] 模块。`yum` 模块用于在 CentOS 上安装软件包。`service` 模块用于管理 UNIX 的服务。在这个节的最后一行或几行指定了几个模块的参数(在本例中,这些行以 `name` 和 `state` 开始)。 + +在文件中输入以下行。就像 **deploy.yml**,在我们文件的第一行是用于参考的文件名的注释。第一个节告诉 Ansible 在CentOS 7 上从 NGINX 仓库安装该 **.rpm** 文件。这让软件包管理器直接从 NGINX 仓库安装最新最稳定的版本。根据你的 CentOS 版本修改路径。所有可用的包的列表可以在 [开源 NGINX 网站][15] 上找到。接下来的两节告诉 Ansible 使用 `yum` 模块安装最新的 NGINX 版本,然后使用 `service` 模块启动 NGINX。 + +**注意:** 在第一个节中,CentOS 包中的路径名可能由于宽度显示为连着的两行。请在一行上输入其完整路径。 + + # ./ansible-nginx/tasks/install_nginx.yml + + - name: NGINX | Installing NGINX repo rpm + yum: + name: http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm + + - name: NGINX | Installing NGINX + yum: + name: nginx + state: latest + + - name: NGINX | Starting NGINX + service: + name: nginx + state: started + +#### 创建 NGINX 服务器列表 #### + +现在,我们设置好了 Ansible 部署的所有配置文件,我们需要告诉 Ansible 部署哪个服务器。我们需要在 Ansible 中指定 **hosts** 文件。先备份现有的文件,并新建一个新文件来部署。 + + $ sudo mv /etc/ansible/hosts /etc/ansible/hosts.backup + $ sudo vim /etc/ansible/hosts + +在文件中输入(或编辑)以下行来创建一个名为 **nginx** 的组并列出安装 NGINX 的服务器。你可以通过主机名、IP 地址、或者在一个范围,例如 **server[1-3].domain.com** 来指定服务器。在这里,我通过 IP 地址指定一台服务器。 + + # /etc/ansible/hosts + + [nginx] + 172.16.239.140 + +#### 设置安全性 #### + +接近完成了,但在部署之前,我们需要确保 Ansible 已被授权通过 SSH 访问我们的目标服务器。 + +首选并且最安全的方法是添加 Ansible 所要部署服务器的 RSA SSH 密钥到目标服务器的 **authorized\_keys** 文件中,这给予 Ansible 在目标服务器上的不受限制 SSH 权限。要了解更多关于此配置,请参阅 wiki.centos.org 上 [安全加固 OpenSSH][16]。这样,你就可以自动部署而无需用户交互。 + +另外,你也可以在部署过程中要求输入密码。我强烈建议你只在测试过程中使用这种方法,因为它是不安全的,没有办法跟踪目标主机的身份(fingerprint)变化。如果你想这样做,将每个目标主机 **/etc/ssh/ssh\_config** 文件中 StrictHostKeyChecking 的默认值 yes 改为 no。然后在 ansible-playbook 命令中添加 --ask-pass 参数来让 Ansible 提示输入 SSH 密码。 + +在这里,我将举例说明如何编辑 **ssh\_config** 文件来禁用在目标服务器上严格的主机密钥检查。我们手动连接 SSH 到我们将部署 NGINX 的服务器,并将 StrictHostKeyChecking 的值更改为 no。 + + $ ssh kjones@172.16.239.140 + kjones@172.16.239.140's password:*********** + + [kjones@nginx ]$ sudo vim /etc/ssh/ssh_config + +当你更改后,保存 **ssh\_config**,并通过 SSH 连接到你的 Ansible 服务器。保存后的设置应该如下所示。 + + # /etc/ssh/ssh_config + + StrictHostKeyChecking no + +#### 运行 Ansible 部署 NGINX #### + +如果你一直照本教程的步骤来做,你可以运行下面的命令来使用 Ansible 部署 NGINX。(再次提示,如果你设置了 RSA SSH 密钥认证,那么 --ask-pass 参数是不需要的。)在 Ansible 服务器运行命令,并使用我们上面创建的配置文件。 + + $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx/deploy.yml + +Ansible 提示输入 SSH 密码,输出如下。recap 中显示 failed=0 这条信息,意味着部署成功了。 + + $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx/deploy.yml + SSH password: + + PLAY [all] ******************************************************************** + + GATHERING FACTS *************************************************************** + ok: [172.16.239.140] + + TASK: [NGINX | Installing NGINX repo rpm] ************************************* + changed: [172.16.239.140] + + TASK: [NGINX | Installing NGINX] ********************************************** + changed: [172.16.239.140] + + TASK: [NGINX | Starting NGINX] ************************************************ + changed: [172.16.239.140] + + PLAY RECAP ******************************************************************** + 172.16.239.140 : ok=4 changed=3 unreachable=0 failed=0 + +如果你没有得到一个成功的 play recap,你可以尝试用 -vvvv 参数(带连接调试的详细信息)再次运行 ansible-playbook 命令来解决部署过程的问题。 + +当部署成功(假如我们是第一次部署)后,你可以在远程服务器上运行基本的 [cURL][17] 命令验证 NGINX 。在这里,它会返回 200 OK。Yes!我们使用 Ansible 成功安装了 NGINX。 + + $ curl -Is 172.16.239.140 | grep HTTP + HTTP/1.1 200 OK + +### 创建 Ansible Playbook 来安装 NGINX Plus (CentOS) ### + +现在,我已经展示了如何安装 NGINX 的开源版本,我将带你完成安装 NGINX Plus。这需要更改一些额外的部署配置,并展示了一些 Ansible 的其他功能。 + +#### 复制 NGINX Plus 上的证书和密钥到 Ansible 服务器 #### + +使用 Ansible 安装和配置 NGINX Plus 时,首先我们需要将 [NGINX Plus Customer Portal][18] NGINX Plus 订阅的密钥和证书复制到 Ansible 部署服务器上的标准位置。 + +购买了 NGINX Plus 或正在试用的客户也可以访问 NGINX Plus Customer Portal。如果你有兴趣测试 NGINX Plus,你可以申请免费试用30天,[点击这里][19]。在你注册后不久你将收到一个试用证书和密钥的链接。 + +在 Mac 或 Linux 主机上,我在这里使用 [scp][20] 工具演示。在 Microsoft Windows 主机,可以使用 [WinSCP][21]。在本教程中,先下载文件到我的 Mac 笔记本电脑上,然后使用 scp 将其复制到 Ansible 服务器。密钥和证书的位置都在我的家目录下。 + + $ cd /path/to/nginx-repo-files/ + $ scp nginx-repo.* user@destination-server:. + +接下来,我们通过 SSH 连接到 Ansible 服务器,确保 NGINX Plus 的 SSL 目录存在,移动文件到这儿。 + + $ ssh user@destination-server + $ sudo mkdir -p /etc/ssl/nginx/ + $ sudo mv nginx-repo.* /etc/ssl/nginx/ + +验证你的 **/etc/ssl/nginx** 目录包含了证书(**.crt**)和密钥(**.key**)文件。你可以使用 tree 命令检查。 + + $ tree /etc/ssl/nginx + /etc/ssl/nginx + ├── nginx-repo.crt + └── nginx-repo.key + + 0 directories, 2 files + +如果你没有安装 tree,可以使用下面的命令去安装。 + + $ sudo yum install -y tree + +#### 创建 Ansible 目录结构 #### + +以下执行的步骤和我们的“创建 Ansible Playbook 来安装 NGINX(CentOS)”小节中部署开源 NGINX 的非常相似。首先,我们建一个工作目录用于部署 NGINX Plus 使用。我喜欢将它创建为我主目录的子目录。 + + $ cd $HOME + $ mkdir -p ansible-nginx-plus/tasks/ + $ touch ansible-nginx-plus/deploy.yml + $ touch ansible-nginx-plus/tasks/install_nginx_plus.yml + +目录结构看起来像这样。 + + $ tree $HOME/ansible-nginx-plus/ + /home/kjones/ansible-nginx-plus/ + ├── deploy.yml + └── tasks + └── install_nginx_plus.yml + + 1 directory, 2 files + +#### 创建主部署文件 #### + +接下来,像开源的 NGINX 一样,我们使用 vim 创建 **deploy.yml** 文件。 + + $ vim ansible-nginx-plus/deploy.yml + +和开源 NGINX 的部署唯一的区别是,我们将包含文件的名称修改为 **install\_nginx\_plus.yml**。该文件告诉 Ansible 在 **nginx** 组中的所有服务器(**/etc/ansible/hosts** 中定义的)上部署 NGINX Plus ,然后在部署过程中从 **tasks** 目录读取并执行 **install\_nginx\_plus.yml** 的内容。 + + # ./ansible-nginx-plus/deploy.yml + + - hosts: nginx + tasks: + - include: 'tasks/install_nginx_plus.yml' + +如果你之前没有安装过的话,你需要创建 hosts 文件,详细说明在上面的“创建 NGINX 服务器的列表”小节。 + +#### 为 NGINX Plus 创建部署文件 #### + +在文本编辑器中打开 **install\_nginx\_plus.yml**。该文件包含了使用 Ansible 来安装和配置 NGINX Plus 部署过程中的指令。这些命令和模块仅针对 CentOS,有些是 NGINX Plus 独有的。 + + $ vim ansible-nginx-plus/tasks/install_nginx_plus.yml + +第一节使用 [`file`][24] 模块,告诉 Ansible 使用指定的`path`和`state`参数为 NGINX Plus 创建特定的 SSL 目录,设置属主为 root,将权限 `mode` 更改为0700。 + + # ./ansible-nginx-plus/tasks/install_nginx_plus.yml + + - name: NGINX Plus | 创建 NGINX Plus ssl 证书目录 + file: path=/etc/ssl/nginx state=directory group=root mode=0700 + +接下来的两节使用 [copy][25] 模块从 Ansible 部署服务器上将 NGINX Plus 的证书和密钥复制到 NGINX Plus 服务器上,再修改属主为 root,权限 `mode` 为0700。 + + - name: NGINX Plus | 复制 NGINX Plus repo 证书 + copy: src=/etc/ssl/nginx/nginx-repo.crt dest=/etc/ssl/nginx/nginx-repo.crt owner=root group=root mode=0700 + + - name: NGINX Plus | 复制 NGINX Plus 密钥 + copy: src=/etc/ssl/nginx/nginx-repo.key dest=/etc/ssl/nginx/nginx-repo.key owner=root group=root mode=0700 + +接下来,我们告诉 Ansible 使用 [`get_url`][26] 模块在 url 参数指定的远程位置从 NGINX Plus 仓库下载 CA 证书,通过 `dest` 参数把它放在指定的目录 `dest` ,并设置权限 `mode` 为 0700。 + + - name: NGINX Plus | 下载 NGINX Plus CA 证书 + get_url: url=https://cs.nginx.com/static/files/CA.crt dest=/etc/ssl/nginx/CA.crt mode=0700 + +同样,我们告诉 Ansible 使用 `get_url` 模块下载 NGINX Plus repo 文件,并将其复制到 NGINX Plus 服务器上的 **/etc/yum.repos.d** 目录下。 + + - name: NGINX Plus | 下载 yum NGINX Plus 仓库 + get_url: url=https://cs.nginx.com/static/files/nginx-plus-7.repo dest=/etc/yum.repos.d/nginx-plus-7.repo mode=0700 + +最后两节的 `name` 告诉 Ansible 使用 `yum` 和 `service` 模块下载并启动 NGINX Plus。 + + - name: NGINX Plus | 安装 NGINX Plus + yum: + name: nginx-plus + state: latest + + - name: NGINX Plus | 启动 NGINX Plus + service: + name: nginx + state: started + +#### 运行 Ansible 来部署 NGINX Plus #### + +在保存 **install\_nginx\_plus.yml** 文件后,运行 ansible-playbook 命令来部署 NGINX Plus。同样在这里,我们使用 --ask-pass 参数使用 Ansible 提示输入 SSH 密码并把它传递给每个 NGINX Plus 服务器,并指定主配置文件路径 **deploy.yml** 文件。 + + $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx-plus/deploy.yml + + PLAY [nginx] ****************************************************************** + + GATHERING FACTS *************************************************************** + ok: [172.16.239.140] + + TASK: [NGINX Plus | Creating NGINX Plus ssl cert repo directory] ************** + changed: [172.16.239.140] + + TASK: [NGINX Plus | Copying NGINX Plus repository certificate] **************** + changed: [172.16.239.140] + + TASK: [NGINX Plus | Copying NGINX Plus repository key] ************************ + changed: [172.16.239.140] + + TASK: [NGINX Plus | Downloading NGINX Plus CA certificate] ******************** + changed: [172.16.239.140] + + TASK: [NGINX Plus | Downloading yum NGINX Plus repository] ******************** + changed: [172.16.239.140] + + TASK: [NGINX Plus | Installing NGINX Plus] ************************************ + changed: [172.16.239.140] + + TASK: [NGINX Plus | Starting NGINX Plus] ************************************** + changed: [172.16.239.140] + + PLAY RECAP ******************************************************************** + 172.16.239.140 : ok=8 changed=7 unreachable=0 failed=0 + +playbook 的 recap 成功完成。现在,使用 curl 命令来验证 NGINX Plus 是否在运行。太好了,我们得到的是 200 OK!成功了!我们使用 Ansible 成功地安装了 NGINX Plus。 + + $ curl -Is http://172.16.239.140 | grep HTTP + HTTP/1.1 200 OK + +### 在 Ubuntu 上创建 Ansible Playbook 来安装 NGINX 和 NGINX Plus ### + +在 [Ubuntu 服务器][27] 上部署 NGINX 和 NGINX Plus 的过程与 CentOS 很相似,我将一步一步的指导来完成整个部署文件,并指出和 CentOS 的细微差异。 + +首先和 CentOS 一样,创建 Ansible 目录结构和 Ansible 主部署文件。也按“创建 NGINX 服务器的列表”小节的描述创建 **/etc/ansible/hosts** 文件。对于 NGINX Plus,你也需要安装“复制 NGINX Plus 证书和密钥到 Ansible 服务器”小节的描述复制证书和密钥。 + +下面是开源 NGINX 的 **install\_nginx.yml** 部署文件。在第一节,我们使用 [`apt_key`][30] 模块导入 NGINX 的签名密钥。接下来的两节使用 [`lineinfile`][31] 模块来添加 Ubuntu 14.04 的软件包 URL 到 **sources.list** 文件中。最后,我们使用 [`apt`][32] 模块来更新缓存并安装 NGINX(`apt` 取代了我们在 CentOS 中部署时的 `yum` 模块)。 + + # ./ansible-nginx/tasks/install_nginx.yml + + - name: NGINX | 添加 NGINX 签名密钥 + apt_key: url=http://nginx.org/keys/nginx_signing.key state=present + + - name: NGINX | 为 NGINX 添加 sources.list deb url + lineinfile: dest=/etc/apt/sources.list line="deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx" + + - name: NGINX Plus | 为 NGINX 添加 sources.list deb-src url + lineinfile: dest=/etc/apt/sources.list line="deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx" + + - name: NGINX | 更新 apt 缓存 + apt: + update_cache: yes + + - name: NGINX | 安装 NGINX + apt: + pkg: nginx + state: latest + + - name: NGINX | 启动 NGINX + service: + name: nginx + state: started + +下面是 NGINX Plus 的部署文件 **install\_nginx.yml**。前四节设置了 NGINX Plus 密钥和证书。然后,我们像开源的 NGINX 一样用 `apt_key` 模块导入签名密钥,`get_url` 模块为 NGINX Plus 下载 `apt` 配置文件。[`shell`][33] 模块使用 `printf` 命令写下输出到 **sources.list.d** 目录中的 **nginx-plus.list** 文件。最终的 `name` 模块和开源 NGINX 一样。 + + # ./ansible-nginx-plus/tasks/install_nginx_plus.yml + + - name: NGINX Plus | 创建 NGINX Plus ssl 证书 repo 目录 + file: path=/etc/ssl/nginx state=directory group=root mode=0700 + + - name: NGINX Plus | 复制 NGINX Plus 仓库证书 + copy: src=/etc/ssl/nginx/nginx-repo.crt dest=/etc/ssl/nginx/nginx-repo.crt owner=root group=root mode=0700 + + - name: NGINX Plus | 复制 NGINX Plus 仓库密钥 + copy: src=/etc/ssl/nginx/nginx-repo.key dest=/etc/ssl/nginx/nginx-repo.key owner=root group=root mode=0700 + + - name: NGINX Plus | 安装 NGINX Plus CA 证书 + get_url: url=https://cs.nginx.com/static/files/CA.crt dest=/etc/ssl/nginx/CA.crt mode=0700 + + - name: NGINX Plus | 添加 NGINX Plus 签名密钥 + apt_key: url=http://nginx.org/keys/nginx_signing.key state=present + + - name: NGINX Plus | 安装 Apt-Get NGINX Plus 仓库 + get_url: url=https://cs.nginx.com/static/files/90nginx dest=/etc/apt/apt.conf.d/90nginx mode=0700 + + - name: NGINX Plus | 为 NGINX Plus 添加 sources.list url + shell: printf "deb https://plus-pkgs.nginx.com/ubuntu `lsb_release -cs` nginx-plus\n" >/etc/apt/sources.list.d/nginx-plus.list + + - name: NGINX Plus | 运行 apt-get update + apt: + update_cache: yes + + - name: NGINX Plus | 安装 NGINX Plus 通过 apt-get + apt: + pkg: nginx-plus + state: latest + + - name: NGINX Plus | 启动 NGINX Plus + service: + name: nginx + state: started + +现在我们已经准备好运行 ansible-playbook 命令: + + $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx-plus/deploy.yml + +你应该得到一个成功的 play recap。如果你没有成功,你可以使用冗余参数,以帮助你解决出现的问题。 + +### 小结 ### + +我在这个教程中演示是什么是 Ansible,可以做些什么来帮助你自动部署 NGINX 或 NGINX Plus,这仅仅是个开始。还有许多有用的模块,包括从用户账号管理到自定义配置模板等。如果你有兴趣了解关于这些的更多信息,请访问 [Ansible 官方文档][35]。 + + +-------------------------------------------------------------------------------- + +via: https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/ + +作者:[Kevin Jones][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.nginx.com/blog/author/kjones/ +[1]:http://www.ansible.com/ +[2]:http://www.paramiko.org/ +[3]:http://www.openssh.com/ +[4]:http://nginx.org/en/ +[5]:https://www.nginx.com/products/ +[6]:http://www.centos.org/ +[7]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#ubuntu +[8]:http://docs.ansible.com/ansible/intro_installation.html#installing-the-control-machine +[9]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#deploy-nginx +[10]:http://docs.ansible.com/ansible/playbooks_roles.html#task-include-files-and-encouraging-reuse +[11]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#list-nginx +[12]:http://docs.ansible.com/ansible/YAMLSyntax.html +[13]:http://docs.ansible.com/ansible/yum_module.html +[14]:http://docs.ansible.com/ansible/service_module.html +[15]:http://nginx.org/en/linux_packages.html +[16]:http://wiki.centos.org/HowTos/Network/SecuringSSH +[17]:http://curl.haxx.se/ +[18]:https://cs.nginx.com/ +[19]:https://www.nginx.com/#free-trial +[20]:http://linux.die.net/man/1/scp +[21]:https://winscp.net/eng/download.php +[22]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#playbook-nginx +[23]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#list-nginx +[24]:http://docs.ansible.com/ansible/file_module.html +[25]:http://docs.ansible.com/ansible/copy_module.html +[26]:http://docs.ansible.com/ansible/get_url_module.html +[27]:http://www.ubuntu.com/ +[28]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#list-nginx +[29]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#copy-cert-key +[30]:http://docs.ansible.com/ansible/apt_key_module.html +[31]:http://docs.ansible.com/ansible/lineinfile_module.html +[32]:http://docs.ansible.com/ansible/apt_module.html +[33]:http://docs.ansible.com/ansible/shell_module.html +[34]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#deploy-nginx +[35]:http://docs.ansible.com/ +[36]:https://www.nginx.com/nginxconf/ diff --git a/published/201510/20150908 How to Run ISO Files Directly From the HDD with GRUB2.md b/published/201510/20150908 How to Run ISO Files Directly From the HDD with GRUB2.md new file mode 100644 index 0000000000..ae5ea004d4 --- /dev/null +++ b/published/201510/20150908 How to Run ISO Files Directly From the HDD with GRUB2.md @@ -0,0 +1,92 @@ +如何使用 GRUB 2 直接从硬盘运行 ISO 文件 +================================================================================ +![](https://www.maketecheasier.com/assets/uploads/2015/07/rundirectiso-featured.png) + +大多数 Linux 发行版都会提供一个可以从 USB 启动的 live 环境,以便用户无需安装即可测试系统。我们可以用它来评测这个发行版或仅仅是当成一个一次性系统,并且很容易将这些文件复制到一个 U 盘上,在某些情况下,我们可能需要经常运行同一个或不同的 ISO 镜像。GRUB 2 可以配置成直接从启动菜单运行一个 live 环境,而不需要烧录这些 ISO 到硬盘或 USB 设备。 + +### 获取和检查可启动的 ISO 镜像 ### + +为了获取 ISO 镜像,我们通常应该访问所需的发行版的网站下载与我们架构兼容的镜像文件。如果这个镜像可以从 U 盘启动,那它也应该可以从 GRUB 菜单启动。 + +当镜像下载完后,我们应该通过 MD5 校验检查它的完整性。这会输出一大串数字与字母合成的序列。 + +![](https://www.maketecheasier.com/assets/uploads/2015/07/rundirectiso-md5.png) + +将这个序列与下载页提供的 MD5 校验码进行比较,两者应该完全相同。 + +### 配置 GRUB 2 ### + +ISO 镜像文件包含了整个系统。我们要做的仅仅是告诉 GRUB 2 哪里可以找到 kernel 和 initramdisk 或 initram 文件系统(这取决于我们所使用的发行版)。 + +在下面的例子中,一个 Kubuntu 15.04 live 环境将被配置到 Ubuntu 14.04 机器的 Grub 启动菜单项。这应该能在大多数新的以 Ubuntu 为基础的系统上运行。如果你是其它系统并且想实现一些其它的东西,你可以从[这些文件][1]了解更多细节,但这会要求你拥有一点 GRUB 使用经验。 + +这个例子的文件 `kubuntu-15.04-desktop-amd64.iso` 放在位于 `/dev/sda1` 的 `/home/maketecheasier/TempISOs/` 上。 + +为了使 GRUB 2 能正确找到它,我们应该编辑 + + /etc/grub.d40-custom + +![](https://www.maketecheasier.com/assets/uploads/2015/07/rundirectiso-40-custom-empty.png) + + menuentry "Kubuntu 15.04 ISO" { + set isofile="/home/maketecheasier/TempISOs/kubuntu-15.04-desktop-amd64.iso" + loopback loop (hd0,1)$isofile + echo "Starting $isofile..." + linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=${isofile} quiet splash + initrd (loop)/casper/initrd.lz + } + +![](https://www.maketecheasier.com/assets/uploads/2015/07/rundirectiso-40-custom-new.png) + +### 分析上述代码 ### + +首先设置了一个变量名 `$menuentry` ,这是 ISO 文件的所在位置 。如果你想换一个 ISO ,你应该修改 `isofile="/path/to/file/name-of-iso-file-.iso"`. + +下一行是指定回环设备,且必须给出正确的分区号码。 + + loopback loop (hd0,1)$isofile + +注意 hd0,1 这里非常重要,它的意思是第一硬盘,第一分区 (`/dev/sda1`)。 + +GRUB 的命名在这里稍微有点困惑,对于硬盘来说,它从 “0” 开始计数,第一块硬盘为 #0 ,第二块为 #1 ,第三块为 #2 ,依此类推。但是对于分区来说,它从 “1” 开始计数,第一个分区为 #1 ,第二个分区为 #2 ,依此类推。也许这里有一个很好的原因,但肯定不是明智的(明显用户体验很糟糕).. + +在 Linux 中第一块硬盘,第一个分区是 `/dev/sda1` ,但在 GRUB2 中则是 `hd0,1` 。第二块硬盘,第三个分区则是 `hd1,3`, 依此类推. + +下一个重要的行是: + + linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=${isofile} quiet splash + +这会载入内核镜像,在新的 Ubuntu Live CD 中,内核被存放在 `/casper` 目录,并且命名为 `vmlinuz.efi` 。如果你使用的是其它系统,可能会没有 `.efi` 扩展名或内核被存放在其它地方 (可以使用归档管理器打开 ISO 文件在 `/casper` 中查找确认)。最后一个选项, `quiet splash` ,是一个常规的 GRUB 选项,改不改无所谓。 + +最后 + + initrd (loop)/casper/initrd.lz + +这会载入 `initrd` ,它负责载入 RAMDisk 到内存用于启动。 + +### 启动 live 系统 ### + +做完上面所有的步骤后,需要更新 GRUB2: + + sudo update-grub + +![](https://www.maketecheasier.com/assets/uploads/2015/07/rundirectiso-updare-grub.png) + +当重启系统后,应该可以看见一个新的、并且允许我们启动刚刚配置的 ISO 镜像的 GRUB 条目: + +![](https://www.maketecheasier.com/assets/uploads/2015/07/rundirectiso-grub-menu.png) + +选择这个新条目就允许我们像从 DVD 或 U 盘中启动一个 live 环境一样。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/run-iso-files-hdd-grub2/ + +作者:[Attila Orosz][a] +译者:[Locez](https://github.com/locez) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/attilaorosz/ +[1]:http://git.marmotte.net/git/glim/tree/grub2 \ No newline at end of file diff --git a/published/201510/20150911 5 Useful Commands to Manage File Types and System Time in Linu--Part 3.md b/published/201510/20150911 5 Useful Commands to Manage File Types and System Time in Linu--Part 3.md new file mode 100644 index 0000000000..bfa4068997 --- /dev/null +++ b/published/201510/20150911 5 Useful Commands to Manage File Types and System Time in Linu--Part 3.md @@ -0,0 +1,279 @@ +5 个在 Linux 中管理文件类型和系统时间的有用命令 +================================================================================ +对于想学习 Linux 的初学者来说要适应使用命令行或者终端可能非常困难。由于终端比图形用户界面程序更能帮助用户控制 Linux 系统,我们必须习惯在终端中运行命令。因此为了有效记忆 Linux 不同的命令,你应该每天使用终端并明白怎样将命令和不同选项以及参数一同使用。 + +![在 Linux 中管理文件类型并设置时间](http://www.tecmint.com/wp-content/uploads/2015/09/Find-File-Types-in-Linux.jpg) + +*在 Linux 中管理文件类型并设置时间* + +请先查看我们 Linux 小技巧系列之前的文章: + +- [5 个有趣的 Linux 命令行技巧][2] +- [给新手的 10 个有用 Linux 命令行技巧][3] + +在这篇文章中,我们打算看看终端中 5 个和文件以及时间相关的提示和技巧。 + +### Linux 中的文件类型 ### + +在 Linux 中,一切皆文件,你的设备、目录以及普通文件都认为是文件。 + +Linux 系统中文件有不同的类型: + +- 普通文件:可能包含命令、文档、音频文件、视频、图像,归档文件等。 +- 设备文件:系统用于访问你硬件组件。 + +这里有两种表示存储设备的设备文件:块文件,例如硬盘,它们以块读取数据;字符文件,以逐个字符读取数据。 + +- 硬链接和软链接:用于在 Linux 文件系统的任意地方访问文件。 +- 命名管道和套接字:允许不同的进程之间进行交互。 + +#### 1. 用 ‘file’ 命令确定文件类型 #### + +你可以像下面这样使用 file 命令确定文件的类型。下面的截图显示了用 file 命令确定不同文件类型的例子。 + + tecmint@tecmint ~/Linux-Tricks $ dir + BACKUP master.zip + crossroads-stable.tar.gz num.txt + EDWARD-MAYA-2011-2012-NEW-REMIX.mp3 reggea.xspf + Linux-Security-Optimization-Book.gif tmp-link + + tecmint@tecmint ~/Linux-Tricks $ file BACKUP/ + BACKUP/: directory + + tecmint@tecmint ~/Linux-Tricks $ file master.zip + master.zip: Zip archive data, at least v1.0 to extract + + tecmint@tecmint ~/Linux-Tricks $ file crossroads-stable.tar.gz + crossroads-stable.tar.gz: gzip compressed data, from Unix, last modified: Tue Apr 5 15:15:20 2011 + + tecmint@tecmint ~/Linux-Tricks $ file Linux-Security-Optimization-Book.gif + Linux-Security-Optimization-Book.gif: GIF image data, version 89a, 200 x 259 + + tecmint@tecmint ~/Linux-Tricks $ file EDWARD-MAYA-2011-2012-NEW-REMIX.mp3 + EDWARD-MAYA-2011-2012-NEW-REMIX.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 192 kbps, 44.1 kHz, JntStereo + + tecmint@tecmint ~/Linux-Tricks $ file /dev/sda1 + /dev/sda1: block special + + tecmint@tecmint ~/Linux-Tricks $ file /dev/tty1 + /dev/tty1: character special + +#### 2. 用 ‘ls’ 和 ‘dir’ 命令确定文件类型 #### + +确定文件类型的另一种方式是用 ls 和 [dir][4] 命令显示一长串结果。 + +用 ls -l 确定一个文件的类型。 + +当你查看文件权限时,第一个字符显示了文件类型,其它字符显示文件权限。 + + tecmint@tecmint ~/Linux-Tricks $ ls -l + total 6908 + drwxr-xr-x 2 tecmint tecmint 4096 Sep 9 11:46 BACKUP + -rw-r--r-- 1 tecmint tecmint 1075620 Sep 9 11:47 crossroads-stable.tar.gz + -rwxr----- 1 tecmint tecmint 5916085 Sep 9 11:49 EDWARD-MAYA-2011-2012-NEW-REMIX.mp3 + -rw-r--r-- 1 tecmint tecmint 42122 Sep 9 11:49 Linux-Security-Optimization-Book.gif + -rw-r--r-- 1 tecmint tecmint 17627 Sep 9 11:46 master.zip + -rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:48 num.txt + -rw-r--r-- 1 tecmint tecmint 0 Sep 9 11:46 reggea.xspf + -rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:47 tmp-link + +使用 ls -l 确定块和字符文件 + + tecmint@tecmint ~/Linux-Tricks $ ls -l /dev/sda1 + brw-rw---- 1 root disk 8, 1 Sep 9 10:53 /dev/sda1 + + tecmint@tecmint ~/Linux-Tricks $ ls -l /dev/tty1 + crw-rw---- 1 root tty 4, 1 Sep 9 10:54 /dev/tty1 + +使用 dir -l 确定一个文件的类型。 + + tecmint@tecmint ~/Linux-Tricks $ dir -l + total 6908 + drwxr-xr-x 2 tecmint tecmint 4096 Sep 9 11:46 BACKUP + -rw-r--r-- 1 tecmint tecmint 1075620 Sep 9 11:47 crossroads-stable.tar.gz + -rwxr----- 1 tecmint tecmint 5916085 Sep 9 11:49 EDWARD-MAYA-2011-2012-NEW-REMIX.mp3 + -rw-r--r-- 1 tecmint tecmint 42122 Sep 9 11:49 Linux-Security-Optimization-Book.gif + -rw-r--r-- 1 tecmint tecmint 17627 Sep 9 11:46 master.zip + -rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:48 num.txt + -rw-r--r-- 1 tecmint tecmint 0 Sep 9 11:46 reggea.xspf + -rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:47 tmp-link + +#### 3. 统计指定类型文件的数目 #### + +下面我们来看看在一个目录中用 ls,[grep][5] 和 [wc][6] 命令统计指定类型文件数目的技巧。命令之间的交互通过命名管道完成。 + +- grep – 用户根据给定模式或正则表达式进行搜索的命令。 +- wc – 用于统计行、字和字符的命令。 + +**统计普通文件的数目** + +在 Linux 中,普通文件用符号 `-` 表示。 + + tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^- | wc -l + 7 + +**统计目录的数目** + +在 Linux 中,目录用符号 `d` 表示。 + + tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^d | wc -l + 1 + +**统计符号链接和硬链接的数目** + +在 Linux 中,符号链接和硬链接用符号 `l` 表示。 + + tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^l | wc -l + 0 + +**统计块文件和字符文件的数目** + +在 Linux 中,块和字符文件用符号 `b` 和 `c` 表示。 + + tecmint@tecmint ~/Linux-Tricks $ ls -l /dev | grep ^b | wc -l + 37 + tecmint@tecmint ~/Linux-Tricks $ ls -l /dev | grep ^c | wc -l + 159 + +#### 4. 在 Linux 系统中查找文件 #### + +下面我们来看看在 Linux 系统中查找文件一些命令,它们包括 locate、find、whatis 和 which 命令。 + +**用 locate 命令查找文件** + +在下面的输出中,我想要定位系统中的 [Samba 服务器配置文件][7] + + tecmint@tecmint ~/Linux-Tricks $ locate samba.conf + /usr/lib/tmpfiles.d/samba.conf + /var/lib/dpkg/info/samba.conffiles + +**用 find 命令查找文件** + +想要学习如何在 Linux 中使用 find 命令,你可以阅读我们以下的文章,里面列出了 find 命令的 30 多个例子和使用方法。 + +- [Linux 中 35 个 ‘find’ 命令示例][8] + +**用 whatis 命令定位命令** + +whatis 命令通常用于定位命令,它很特殊,因为它给出关于一个命令的信息,它还能查找配置文件和命令的帮助手册条目。 + + tecmint@tecmint ~/Linux-Tricks $ whatis bash + bash (1) - GNU Bourne-Again SHell + + tecmint@tecmint ~/Linux-Tricks $ whatis find + find (1) - search for files in a directory hierarchy + + tecmint@tecmint ~/Linux-Tricks $ whatis ls + ls (1) - list directory contents + +**用 which 命令定位命令** + +which 命令用于定位文件系统中的命令。 + + tecmint@tecmint ~/Linux-Tricks $ which mkdir + /bin/mkdir + + tecmint@tecmint ~/Linux-Tricks $ which bash + /bin/bash + + tecmint@tecmint ~/Linux-Tricks $ which find + /usr/bin/find + + tecmint@tecmint ~/Linux-Tricks $ $ which ls + /bin/ls + +#### 5.处理 Linux 系统的时间 #### + +在联网环境中,保持你 Linux 系统时间准确是一个好的习惯。Linux 系统中有很多服务要求时间正确才能在联网条件下正常工作。 + +让我们来看看你可以用来管理你机器时间的命令。在 Linux 中,有两种方式管理时间:系统时间和硬件时间。 + +系统时间由系统时钟管理,硬件时间由硬件时钟管理。 + +要查看你的系统时间、日期和时区,像下面这样使用 date 命令。 + + tecmint@tecmint ~/Linux-Tricks $ date + Wed Sep 9 12:25:40 IST 2015 + +像下面这样用 date -s 或 date -set=“STRING” 设置系统时间。 + + tecmint@tecmint ~/Linux-Tricks $ sudo date -s "12:27:00" + Wed Sep 9 12:27:00 IST 2015 + + tecmint@tecmint ~/Linux-Tricks $ sudo date --set="12:27:00" + Wed Sep 9 12:27:00 IST 2015 + +你也可以像下面这样设置时间和日期。 + + tecmint@tecmint ~/Linux-Tricks $ sudo date 090912302015 + Wed Sep 9 12:30:00 IST 2015 + +使用 cal 命令从日历中查看当前日期。 + + tecmint@tecmint ~/Linux-Tricks $ cal + September 2015 + Su Mo Tu We Th Fr Sa + 1 2 3 4 5 + 6 7 8 9 10 11 12 + 13 14 15 16 17 18 19 + 20 21 22 23 24 25 26 + 27 28 29 30 + +使用 hwclock 命令查看硬件时钟时间。 + + tecmint@tecmint ~/Linux-Tricks $ sudo hwclock + Wednesday 09 September 2015 06:02:58 PM IST -0.200081 seconds + +要设置硬件时钟时间,像下面这样使用 hwclock –set –date=“STRING” 命令。 + + tecmint@tecmint ~/Linux-Tricks $ sudo hwclock --set --date="09/09/2015 12:33:00" + + tecmint@tecmint ~/Linux-Tricks $ sudo hwclock + Wednesday 09 September 2015 12:33:11 PM IST -0.891163 seconds + +系统时间是由硬件时钟时间在启动时设置的,系统关闭时,硬件时间被重置为系统时间。 + +因此你查看系统时间和硬件时间时,它们是一样的,除非你更改了系统时间。当你的 CMOS 电量不足时,硬件时间可能不正确。 + +你也可以像下面这样使用硬件时钟的时间设置系统时间。 + + $ sudo hwclock --hctosys + +也可以像下面这样用系统时钟时间设置硬件时钟时间。 + + $ sudo hwclock --systohc + +要查看你的 Linux 系统已经运行了多长时间,可以使用 uptime 命令。 + + tecmint@tecmint ~/Linux-Tricks $ uptime + 12:36:27 up 1:43, 2 users, load average: 1.39, 1.34, 1.45 + + tecmint@tecmint ~/Linux-Tricks $ uptime -p + up 1 hour, 43 minutes + + tecmint@tecmint ~/Linux-Tricks $ uptime -s + 2015-09-09 10:52:47 + +### 总结 ### + +对于初学者来说理解 Linux 中的文件类型是一个好的尝试,同时时间管理也非常重要,尤其是在需要可靠有效地管理服务的服务器上。希望这篇指南能对你有所帮助。如果你有任何反馈,别忘了给我们写评论。和我们保持联系。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/ + +作者:[Aaron Kili][a] +译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/aaronkili/ +[1]:http://www.tecmint.com/tag/linux-tricks/ +[2]:https://linux.cn/article-5485-1.html +[3]:https://linux.cn/article-6314-1.html +[4]:http://www.tecmint.com/linux-dir-command-usage-with-examples/ +[5]:https://linux.cn/article-2250-1.html +[6]:http://www.tecmint.com/wc-command-examples/ +[7]:http://www.tecmint.com/setup-samba-file-sharing-for-linux-windows-clients/ +[8]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/ \ No newline at end of file diff --git a/published/201510/20150914 How to Setup Node JS v4.0.0 on Ubuntu 14.04 or 15.04.md b/published/201510/20150914 How to Setup Node JS v4.0.0 on Ubuntu 14.04 or 15.04.md new file mode 100644 index 0000000000..b96571c9fc --- /dev/null +++ b/published/201510/20150914 How to Setup Node JS v4.0.0 on Ubuntu 14.04 or 15.04.md @@ -0,0 +1,102 @@ +在 Ubuntu 14.04/15.04 上配置 Node JS v4.0.0 +================================================================================ +大家好,Node.JS 4.0 发布了,这个流行的服务器端 JS 平台合并了 Node.js 和 io.js 的代码,4.0 版就是这两个项目结合的产物——现在合并为一个代码库。这次最主要的变化是 Node.js 封装了4.5 版本的 Google V8 JS 引擎,与当前的 Chrome 所带的一致。所以,紧跟 V8 的发布可以让 Node.js 运行的更快、更安全,同时更好的利用 ES6 的很多语言特性。 + +![Node JS](http://blog.linoxide.com/wp-content/uploads/2015/09/nodejs.png) + +Node.js 4.0 发布的主要目标是为 io.js 用户提供一个简单的升级途径,所以这次并没有太多重要的 API 变更。下面的内容让我们来看看如何轻松的在 ubuntu server 上安装、配置 Node.js。 + +### 基础系统安装 ### + +Node 在 Linux,Macintosh,Solaris 这几个系统上都可以完美的运行,linux 的发行版本当中使用 Ubuntu 相当适合。这也是我们为什么要尝试在 ubuntu 15.04 上安装 Node.js,当然了在 14.04 上也可以使用相同的步骤安装。 + +#### 1) 系统资源 #### + +Node.js 所需的基本的系统资源取决于你的架构需要。本教程我们会在一台 1GB 内存、 1GHz 处理器和 10GB 磁盘空间的服务器上进行,最小安装即可,不需要安装 Web 服务器或数据库服务器。 + +#### 2) 系统更新 #### + +在我们安装 Node.js 之前,推荐你将系统更新到最新的补丁和升级包,所以请登录到系统中使用超级用户运行如下命令: + + # apt-get update + +#### 3) 安装依赖 #### + +Node.js 仅需要你的服务器上有一些基本系统和软件功能,比如 'make'、'gcc'和'wget' 之类的。如果你还没有安装它们,运行如下命令安装: + + # apt-get install python gcc make g++ wget + +### 下载最新版的Node JS v4.0.0 ### + +访问链接 [Node JS Download Page][1] 下载源代码. + +![nodejs download](http://blog.linoxide.com/wp-content/uploads/2015/09/download.png) + +复制其中的最新的源代码的链接,然后用`wget` 下载,命令如下: + + # wget https://nodejs.org/download/rc/v4.0.0-rc.1/node-v4.0.0-rc.1.tar.gz + +下载完成后使用命令`tar` 解压缩: + + # tar -zxvf node-v4.0.0-rc.1.tar.gz + +![wget nodejs](http://blog.linoxide.com/wp-content/uploads/2015/09/wget.png) + +### 安装 Node JS v4.0.0 ### + +现在可以开始使用下载好的源代码编译 Node.js。在开始编译前,你需要在 ubuntu server 上切换到源代码解压缩后的目录,运行 configure 脚本来配置源代码。 + + root@ubuntu-15:~/node-v4.0.0-rc.1# ./configure + +![Installing NodeJS](http://blog.linoxide.com/wp-content/uploads/2015/09/configure.png) + +现在运行命令 'make install' 编译安装 Node.js: + + root@ubuntu-15:~/node-v4.0.0-rc.1# make install + +make 命令会花费几分钟完成编译,安静的等待一会。 + +### 验证 Node.js 安装 ### + +一旦编译任务完成,我们就可以开始验证安装工作是否 OK。我们运行下列命令来确认 Node.js 的版本。 + + root@ubuntu-15:~# node -v + v4.0.0-pre + +在命令行下不带参数的运行`node` 就会进入 REPL(Read-Eval-Print-Loop,读-执行-输出-循环)模式,它有一个简化版的emacs 行编辑器,通过它你可以交互式的运行JS和查看运行结果。 + +![node version](http://blog.linoxide.com/wp-content/uploads/2015/09/node.png) + +### 编写测试程序 ### + +我们也可以写一个很简单的终端程序来测试安装是否成功,并且工作正常。要做这个,我们将会创建一个“test.js” 文件,包含以下代码,操作如下: + + root@ubuntu-15:~# vim test.js + var util = require("util"); + console.log("Hello! This is a Node Test Program"); + :wq! + +现在为了运行上面的程序,在命令行运行下面的命令。 + + root@ubuntu-15:~# node test.js + +![Node Program](http://blog.linoxide.com/wp-content/uploads/2015/09/node-test.png) + +在一个成功安装了 Node JS 的环境下运行上面的程序就会在屏幕上得到上图所示的输出,这个程序加载类 “util” 到变量 “util” 中,接着用对象 “util” 运行终端任务,console.log 这个命令作用类似 C++ 里的cout + +### 结论 ### + +就是这些了。如果你刚刚开始使用 Node.js 开发应用程序,希望本文能够通过在 ubuntu 上安装、运行 Node.js 让你了解一下Node.js 的大概。最后,我们可以认为我们可以期待 Node JS v4.0.0 能够取得显著性能提升。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/setup-node-js-4-0-ubuntu-14-04-15-04/ + +作者:[Kashif Siddique][a] +译者:[osk874](https://github.com/osk874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/kashifs/ +[1]:https://nodejs.org/download/rc/v4.0.0-rc.1/ diff --git a/published/201510/20150914 Linux FAQs with Answers--How to check weather forecasts from the command line on Linux.md b/published/201510/20150914 Linux FAQs with Answers--How to check weather forecasts from the command line on Linux.md new file mode 100644 index 0000000000..dae869445b --- /dev/null +++ b/published/201510/20150914 Linux FAQs with Answers--How to check weather forecasts from the command line on Linux.md @@ -0,0 +1,72 @@ +Linux 有问必答:如何在 Linux 命令行下浏览天气预报 +================================================================================ +> **Q**: 我经常在 Linux 桌面查看天气预报。然而,是否有一种在终端环境下,不通过桌面小插件或者浏览器查询天气预报的方法? + +对于 Linux 桌面用户来说,有很多办法获取天气预报,比如使用专门的天气应用、桌面小插件,或者面板小程序。但是如果你的工作环境是基于终端的,这里也有一些在命令行下获取天气的手段。 + +其中有一个就是 [wego][1],**一个终端下的小巧程序**。使用基于 ncurses 的接口,这个命令行程序允许你查看当前的天气情况和之后的预报。它也会通过一个天气预报的 API 收集接下来 5 天的天气预报。 + +### 在 Linux 下安装 wego ### + +安装 wego 相当简单。wego 是用 Go 编写的,引起第一个步骤就是安装 [Go 语言][2]。然后再安装 wego。 + + $ go get github.com/schachmat/wego + +wego 会被安装到 $GOPATH/bin,所以要将 $GOPATH/bin 添加到 $PATH 环境变量。 + + $ echo 'export PATH="$PATH:$GOPATH/bin"' >> ~/.bashrc + $ source ~/.bashrc + +现在就可与直接从命令行启动 wego 了。 + + $ wego + +第一次运行 weg 会生成一个配置文件(`~/.wegorc`),你需要指定一个天气 API key。 +你可以从 [worldweatheronline.com][3] 获取一个免费的 API key。免费注册和使用。你只需要提供一个有效的邮箱地址。 + +![](https://farm6.staticflickr.com/5781/21317466341_5a368b0d26_c.jpg) + +你的 .wegorc 配置文件看起来会这样: + +![](https://farm6.staticflickr.com/5620/21121418558_df0d27cd0a_b.jpg) + +除了 API key,你还可以把你想要查询天气的地方、使用的城市/国家名称、语言配置在 `~/.wegorc` 中。 +注意,这个天气 API 的使用有限制:每秒最多 5 次查询,每天最多 250 次查询。 +当你重新执行 wego 命令,你将会看到最新的天气预报(当然是你的指定地方),如下显示。 + +![](https://farm6.staticflickr.com/5776/21121218110_dd51e03ff4_c.jpg) + +显示出来的天气信息包括:(1)温度,(2)风速和风向,(3)可视距离,(4)降水量和降水概率 +默认情况下会显示3 天的天气预报。如果要进行修改,可以通过参数改变天气范围(最多5天),比如要查看 5 天的天气预报: + + $ wego 5 + +如果你想检查另一个地方的天气,只需要提供城市名即可: + + $ wego Seattle + +### 问题解决 ### + +1. 可能会遇到下面的错误: + + user: Current not implemented on linux/amd64 + + 当你在一个不支持原生 Go 编译器的环境下运行 wego 时就会出现这个错误。在这种情况下你只需要使用 gccgo ——一个 Go 的编译器前端来编译程序即可。这一步可以通过下面的命令完成。 + + $ sudo yum install gcc-go + $ go get -compiler=gccgo github.com/schachmat/wego + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/weather-forecasts-command-line-linux.html + +作者:[Dan Nanni][a] +译者:[oska874](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:https://github.com/schachmat/wego +[2]:http://ask.xmodulo.com/install-go-language-linux.html +[3]:https://developer.worldweatheronline.com/auth/register diff --git a/published/201510/20150917 TERMINATOR 0.98 INSTALL IN UBUNTU AND LINUX MINT.md b/published/201510/20150917 TERMINATOR 0.98 INSTALL IN UBUNTU AND LINUX MINT.md new file mode 100644 index 0000000000..983f68a687 --- /dev/null +++ b/published/201510/20150917 TERMINATOR 0.98 INSTALL IN UBUNTU AND LINUX MINT.md @@ -0,0 +1,57 @@ +在 Ubuntu 和 Linux Mint 上安装 Terminator 0.98 +================================================================================ +[Terminator][1],它可以在一个窗口内打开多个终端。该项目的目标之一是为摆放终端提供一个有用的工具。它的灵感来自于类似 gnome-multi-term,quankonsole 等程序,这些程序关注于按网格摆放终端。 Terminator 0.98 带来了更完美的标签功能,更好的布局保存/恢复,改进了偏好用户界面和多处 bug 修复。 + +![](http://www.ewikitech.com/wp-content/uploads/2015/09/Screenshot-from-2015-09-17-094828.png) + +###TERMINATOR 0.98 的更改和新特性 + +- 添加了一个布局启动器,允许在不用布局之间简单切换(用 Alt + L 打开一个新的布局切换器); +- 添加了一个新的手册(使用 F1 打开); +- 保存的时候,布局现在会记住: + - 最大化和全屏状态 + - 窗口标题 + - 激活的标签 + - 激活的终端 + - 每个终端的工作目录 +- 添加选项用于启用/停用非同类(non-homogenous)标签和滚动箭头; +- 添加快捷键用于按行/半页/一页向上/下滚动; +- 添加使用 Ctrl+鼠标滚轮来放大/缩小,Shift+鼠标滚轮向上/下滚动页面; +- 为下一个/上一个配置文件(profile)添加快捷键 +- 改进自定义命令菜单的一致性 +- 新增快捷方式/代码来切换所有/标签分组; +- 改进监视插件 +- 增加搜索栏切换; +- 清理和重新组织偏好(preferences)窗口,包括一个完整的全局便签更新 +- 添加选项用于设置 ActivityWatcher 插件静默时间 +- 其它一些改进和 bug 修复 +- [点击此处查看完整更新日志][2] + +### 安装 Terminator 0.98: + +Terminator 0.98 有可用的 PPA,首先我们需要在 Ubuntu/Linux Mint 上添加库。在终端里运行下面的命令来安装 Terminator 0.98。 + + $ sudo add-apt-repository ppa:gnome-terminator/nightly + $ sudo apt-get update + $ sudo apt-get install terminator + +如果你想要移除 Terminator,只需要在终端中运行下面的命令(可选) + + $ sudo apt-get remove terminator + +-------------------------------------------------------------------------------- + +via: http://www.ewikitech.com/articles/linux/terminator-install-ubuntu-linux-mint/ + +作者:[admin][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.ewikitech.com/author/admin/ +[1]:https://launchpad.net/terminator +[2]:http://bazaar.launchpad.net/~gnome-terminator/terminator/trunk/view/head:/ChangeLog + + + diff --git a/published/201510/20150918 How To Add And Remove Bookmarks In Ubuntu Beginner Tip.md b/published/201510/20150918 How To Add And Remove Bookmarks In Ubuntu Beginner Tip.md new file mode 100644 index 0000000000..0cc17b9465 --- /dev/null +++ b/published/201510/20150918 How To Add And Remove Bookmarks In Ubuntu Beginner Tip.md @@ -0,0 +1,48 @@ +[新手技巧] 如何在Ubuntu中添加和删除书签 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Add-Bookmark.jpg) + +这是一篇对完全是新手的一篇技巧,我将向你展示如何在Ubuntu文件管理器中添加书签。 + +现在如果你想知道为什么要这么做,答案很简单。它可以让你可以快速地在左边栏中访问。比如,我[在Ubuntu中安装了Copy 云服务][1]。它创建在/Home/Copy。先进入Home目录再进入Copy目录并不是很麻烦,但是我想要更快地访问它。因此我添加了一个书签这样我就可以直接从侧边栏访问了。 + +### 在Ubuntu中添加书签 ### + +打开Files。进入你想要保存快速访问的目录。你需要在标记书签的目录里面。 + +现在,你有两种方法: + +#### 方法1: #### + +当你在Files(Ubuntu中的文件管理器)中时,查看顶部菜单。你会看到书签按钮。点击它你会看到将当前路径保存为书签的选项。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Add-Bookmark-Ubuntu.jpeg) + +#### 方法 2: #### + +你可以直接按下Ctrl+D就可以将当前位置保存为书签。 + +如你所见,这里左边栏就有一个新添加的Copy目录: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Add-Bookmark-Ubuntu-1.jpeg) + +### 管理书签 ### + +如果你不想要太多的书签或者你错误地添加了一个书签,你可以很简单地删除它。按下Ctrl+B查看所有的书签。现在选择想要删除的书签并点击删除。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Remove-bookmark-ubuntu.png) + +这就是在Ubuntu中管理书签需要做的。我知道这对于大多数用户而言很简单,但是这也许多Ubuntu的新手而言或许还有用。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/add-remove-bookmarks-ubuntu/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/install-copy-in-ubuntu-14-04/ diff --git a/published/201510/20150918 Install Justniffer In Ubuntu 15.04.md b/published/201510/20150918 Install Justniffer In Ubuntu 15.04.md new file mode 100644 index 0000000000..2aec58c91d --- /dev/null +++ b/published/201510/20150918 Install Justniffer In Ubuntu 15.04.md @@ -0,0 +1,152 @@ +在 Ubuntu 15.04 上安装 Justniffer +================================================================================ +### 简介 ### +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/09/monitoring1.jpg) + +[Justniffer][1] 是一个可用于替代 Snort 的网络协议分析器。它非常流行,可交互式地跟踪/探测一个网络连接。它能从实时环境中抓取流量,支持 “lipcap” 和 “tcpdump” 文件格式。它可以帮助用户分析一个用 wireshark 难以抓包的复杂网络。尤其是它可以有效的帮助你分析应用层流量,能提取类似图像、脚本、HTML 等 http 内容。Justniffer 有助于理解不同组件之间是如何通信的。 + +### 功能 ### + +Justniffer 可以收集一个复杂网络的所有流量而不影响系统性能,这是 Justniffer 的一个优势,它还可以保存日志用于之后的分析,Justniffer 其它一些重要功能包括: + +1. 可靠的 TCP 流重建 + + 它可以使用主机 Linux 内核的一部分用于记录并重现 TCP 片段和 IP 片段。 + +2. 日志 + + 保存日志用于之后的分析,并能自定义保存内容和时间。 + +3. 可扩展 + + 可以通过外部的 python、 perl 和 bash 脚本扩展来从分析报告中获取一些额外的结果。 + +4. 性能管理 + + 基于连接时间、关闭时间、响应时间或请求时间等提取信息。 + +### 安装 ### + +Justniffer 可以通过 PPA 安装: + +运行下面命令添加库: + + $ sudo add-apt-repository ppa:oreste-notelli/ppa + +更新系统: + + $ sudo apt-get update + +安装 Justniffer 工具: + + $ sudo apt-get install justniffer + +make 的时候失败了,然后我运行下面的命令并尝试重新安装服务 + + $ sudo apt-get -f install + +### 示例 ### + +首先用 -v 选项验证安装的 Justniffer 版本,你需要用超级用户权限来使用这个工具。 + + $ sudo justniffer -V + +示例输出: + +![j](http://www.unixmen.com/wp-content/uploads/2015/09/j.png) + +**1、 以类似 apache 的格式导出 eth1 接口流量,显示到终端** + + $ sudo justniffer -i eth1 + +示例输出: + +![Selection_001](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0013.png) + +**2、 可以用下面的选项跟踪正在运行的 tcp 流** + + $ sudo justniffer -i eth1 -r + +示例输出: + +![Selection_002](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0023.png) + +**3、 获取 web 服务器的响应时长** + + $ sudo justniffer -i eth1 -a " %response.time" + +示例输出: + +![Selection_003](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0033.png) + +**4、 使用 Justniffer 读取一个 tcpdump 抓取的文件** + +首先,用 tcpdump 抓取流量。 + + $ sudo tcpdump -w /tmp/file.cap -s0 -i eth0 + +然后用 Justniffer 访问数据 + + $ justniffer -f file.cap + +示例输出: + +![Selection_005](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0056.png) + +**5、 只抓取 http 数据** + + $ sudo justniffer -i eth1 -r -p "port 80 or port 8080" + +示例输出: + +![Selection_006](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0064.png) + +**6、 获取一个指定主机 http 数据** + + $ justniffer -i eth1 -r -p "host 192.168.1.250 and tcp port 80" + +示例输出: + +![Selection_007](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0074.png) + +**7、 以更精确的格式抓取数据** + +当你输入 **justniffer -h** 的时候你可以看到很多用于以更精确的方式获取数据的格式关键字 + + $ justniffer -h + +示例输出: + +![Selection_008](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0083.png) + +让我们用 Justniffer 根据预先定义的参数提取数据 + + $ justniffer -i eth1 -l "%request.timestamp %request.header.host %request.url %response.time" + +示例输出: + +![Selection_009](http://www.unixmen.com/wp-content/uploads/2015/09/Selection_0094.png) + +其中还有很多你可以探索的选项。 + +### 总结 ### + +Justniffer 是一个很好的用于网络测试的工具。在我看来对于那些用 Snort 来进行网络探测的用户来说,Justniffer 是一个更简单的工具。它提供了很多 **格式关键字** 用于按照你的需要精确地提取数据。你可以用 .cap 文件格式记录网络信息,之后用于分析监视网络服务性能。 + +**参考资料:** + +- [Justniffer 官网][2] + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/install-justniffer-ubuntu-15-04/ + +作者:[Rajneesh Upadhyay][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/rajneesh/ +[1]:http://sourceforge.net/projects/justniffer/?source=directory +[2]:http://justniffer.sourceforge.net/ \ No newline at end of file diff --git a/published/201510/20150921 How to Setup IonCube Loaders on Ubuntu 14.04 or 15.04.md b/published/201510/20150921 How to Setup IonCube Loaders on Ubuntu 14.04 or 15.04.md new file mode 100644 index 0000000000..365729905c --- /dev/null +++ b/published/201510/20150921 How to Setup IonCube Loaders on Ubuntu 14.04 or 15.04.md @@ -0,0 +1,89 @@ +如何在Ubuntu 14.04 / 15.04中设置IonCube Loaders +================================================================================ +IonCube Loaders是一个PHP中用于加解密的工具,并带有加速页面运行的功能。它也可以保护你的PHP代码不会查看和运行在未授权的计算机上。要使用ionCube编码、加密的PHP文件,需要在web服务器上安装一个叫ionCube Loader的文件,并需要让 PHP 可以访问到,很多 PHP 应用都在用它。它可以在运行时读取并执行编码过后的代码。PHP只需在‘php.ini’中添加一行就可以使用这个loader。 + +### 前提条件 ### + +在这篇文章中,我们将在Ubuntu14.04/15.04安装Ioncube Loader ,以便它可以在所有PHP模式中使用。本教程的唯一要求就是你系统安装了LEMP,并有“php.ini”文件。 + +### 下载 IonCube Loader ### + +根据你系统的架构是32位或者64位来下载最新的IonCube loader包。你可以用超级用户权限或者root用户运行下面的命令。 + + # wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz + +![download ioncube](http://blog.linoxide.com/wp-content/uploads/2015/09/download1.png) + +下载完成后用下面的命令解压到“/usr/local/src/"。 + + # tar -zxvf ioncube_loaders_lin_x86-64.tar.gz -C /usr/local/src/ + +![extracting archive](http://blog.linoxide.com/wp-content/uploads/2015/09/2-extract.png) + +解压完成后我们就可以看到所有提供的模块。但是我们只需要我们所安装的PHP版本的对应模块。 + +要检查PHP版本,你可以运行下面的命令来找出相应的模块。 + + # php -v + +![ioncube modules](http://blog.linoxide.com/wp-content/uploads/2015/09/modules.png) + +根据上面的命令我们知道我们安装的是PHP 5.6.4,因此我们需要拷贝合适的模块到PHP模块目录下。 + +首先我们在“/usr/local/”创建一个叫“ioncube”的目录并复制所需的ioncube loader到这里。 + + root@ubuntu-15:/usr/local/src/ioncube# mkdir /usr/local/ioncube + root@ubuntu-15:/usr/local/src/ioncube# cp ioncube_loader_lin_5.6.so ioncube_loader_lin_5.6_ts.so /usr/local/ioncube/ + +### PHP 配置 ### + +我们要在位于"/etc/php5/cli/"文件夹下的"php.ini"中加入如下的配置行并重启web服务和php模块。 + + # vim /etc/php5/cli/php.ini + +![ioncube zend extension](http://blog.linoxide.com/wp-content/uploads/2015/09/zend-extension.png) + +此时我们安装的是nginx,因此我们用下面的命令来重启服务。 + + # service php5-fpm restart + # service nginx restart + +![web services](http://blog.linoxide.com/wp-content/uploads/2015/09/web-services.png) + +### 测试 IonCube Loader ### + +要为我们的网站测试ioncube loader。用下面的内容创建一个"info.php"文件并放在网站的web目录下。 + + # vim /usr/share/nginx/html/info.php + +加入phpinfo的脚本后重启web服务后用域名或者ip地址访问“info.php”。 + +你会在最下面的php模块信息里看到下面这段。 + +![php info](http://blog.linoxide.com/wp-content/uploads/2015/09/php-info.png) + +在终端中运行下面的命令来验证php版本并显示PHP Loader已经启用了。 + + # php -v + +![php ioncube loader](http://blog.linoxide.com/wp-content/uploads/2015/09/php-ioncube.png) + +上面的php版本输出明显地显示了IonCube loader已经成功与PHP集成了。 + +### 总结 ### + +教程的最后你已经了解了如何在安装有nginx的Ubuntu中安装和配置ionCube Loader,如果你正在使用其他的web服务,这与其他服务没有明显的差别。因此安装Loader是很简单的,并且在大多数服务器上的安装都不会有问题。然而并没有一个所谓的“标准PHP安装”,服务可以通过许多方式安装,并启用或者禁用功能。 + +如果你是在共享服务器上,那么确保运行了ioncube-loader-helper.php脚本,并点击链接来测试运行时安装。如果安装时你仍然遇到了问题,欢迎联系我们及给我们留下评论。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/setup-ioncube-loaders-ubuntu-14-04-15-04/ + +作者:[Kashif Siddique][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/kashifs/ diff --git a/published/201510/20150921 Meet The New Ubuntu 15.10 Default Wallpaper.md b/published/201510/20150921 Meet The New Ubuntu 15.10 Default Wallpaper.md new file mode 100644 index 0000000000..dc27b3609c --- /dev/null +++ b/published/201510/20150921 Meet The New Ubuntu 15.10 Default Wallpaper.md @@ -0,0 +1,44 @@ +看看新的 Ubuntu 15.10 默认壁纸 +================================================================================ +**全新的Ubuntu 15.10 Wily Werewolf默认壁纸已经亮相** + +乍一看你几乎无法发现与今天4月发布的Ubuntu 15.04中受到折纸启发的‘Suru’设计有什么差别。但是仔细看你就会发现默认背景有一些细微差别。 + +其中一点是更淡,受到由左上角图片发出的橘黄色光的帮助。保持了角褶皱和色块,但是增加了块和矩形部分。 + +新的背景由Canonica设计团队的Alex Milazzo设计。 + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/09/ubuntu-1510-wily-werewolf-wallpaper.jpg) + +*Ubuntu 15.10 默认桌面背景* + +为了凸显变化,这个是Ubuntu 15.04的默认壁纸作为比较: + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/03/suru-desktop-wallpaper-ubuntu-vivid.jpg) + +*Ubuntu 15.04 默认壁纸* + +### 下载Ubuntu 15.10 壁纸 ### + +如果你正运行的是Ubuntu 15.10 Wily Werewolf每日构建版本,那么你无法看到这个默认壁纸:设计已经亮相但是还没有打包到Wily中。 + +你不必等到10月份来使用新的设计来作为你的桌面背景。你可以点击下面的按钮下载4096×2304高清壁纸。 + +- [下载Ubuntu 15.10新的默认壁纸][1] + +最后,如我们每次在有新壁纸时说的,你不必在意发布版品牌和设计细节。如果壁纸不合你的口味或者不想永远用它,轻易地就换掉,毕竟这不是Ubuntu Phone! + +**你是新版本的粉丝么?在评论中让我们知道** + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/09/ubuntu-15-10-wily-werewolf-default-wallpaper + +作者:[Joey-Elijah Sneddon][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:https://launchpadlibrarian.net/218258177/Wolf_Wallpaper_Desktop_4096x2304_Purple_PNG-24.png diff --git a/published/201510/20150921 Red Hat CEO Optimistic on OpenStack Revenue Opportunity.md b/published/201510/20150921 Red Hat CEO Optimistic on OpenStack Revenue Opportunity.md new file mode 100644 index 0000000000..f09b4a5473 --- /dev/null +++ b/published/201510/20150921 Red Hat CEO Optimistic on OpenStack Revenue Opportunity.md @@ -0,0 +1,41 @@ +红帽 CEO 对 OpenStack 收益表示乐观 +================================================================================ +得益于围绕 Linux 和云不断发展的平台与基础设施技术,红帽正在持续快速发展。红帽宣布在九月二十一日完成了 2016 财年第二季度的财务业绩,再次超过预期。 + +![](http://www.serverwatch.com/imagesvr_ce/1212/icon-redhatcloud-r.jpg) + +这一季度,红帽的收入为 5 亿 4 百万美元,和去年同比增长 13%。净收入为 5 千 1 百万美元,超过了 2015 财年第二季度的 4 千 7 百万美元。 + +展望未来,红帽为下一季度和全年提供了积极的目标。对于第三季度,红帽希望指导收益能在 5亿1千9百万美元和5亿2千3百万美元之间,和去年同期相比增长 15%。 + +对于 2016 财年,红帽的全年指导目标是 20亿4千4百万美元,和去年相比增长 14%。 + +红帽 CFO Frank Calderoni 在电话会议上指出,红帽最高的 30 个订单差不多甚至超过了 1 百万美元。其中有 4 个订单超过 5 百万美元,还有一个超过 1 千万美元。 + +从近几年的经验来看,红帽产品的交叉销售非常成功,全部订单中有超过 65% 的订单包括了一个或多个红帽应用和新兴技术产品组件。 + +Calderoni 说 “我们希望这些技术,例如中间件、RHEL OpenStack 平台、OpenShift、云管理和存储能持续推动收益增长。” + +### OpenStack ### + +在电话会议中,红帽 CEO Jim Whitehurst 多次问到 OpenStack 的预期收入。Whitehurst 说得益于安装程序的改进,最近发布的 Red Hat OpenStack Platform 7.0 向前垮了一大步。 + +Whitehurst 提到:“在识别硬件和使用方面它做的很好,当然,这也意味着在硬件识别并正确使用它们方便还有很多工作要做。” + +Whitehurst 说他已经开始注意到很多的生产应用程序开始迁移到 OpenStack 云上来。他也警告说在产业化方面迁移到 OpenStack 大部分只是尝鲜,还并没有成为主流。 + +对于竞争对手, Whitehurst 尤其提到了微软、惠普和 Mirantis。在他看来,很多组织仍然会使用多种操作系统,如果他们部分使用了微软产品,会更倾向于开源方案作为替代选项。Whitehurst 说在云方面他还没有看到太多和惠普面对面的竞争,但和 Mirantis 则确实如此。 + +Whitehurst 说 “我们也有几次胜利,客户从 Mirantis 转到了 RHEL。” + +-------------------------------------------------------------------------------- + +via: http://www.serverwatch.com/server-news/red-hat-ceo-optimistic-on-openstack-revenue-opportunity.html + +作者:[Sean Michael Kerner][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.serverwatch.com/author/Sean-Michael-Kerner-101580.htm \ No newline at end of file diff --git a/published/201510/20150923 How To Upgrade From Oracle 11g To Oracle 12c.md b/published/201510/20150923 How To Upgrade From Oracle 11g To Oracle 12c.md new file mode 100644 index 0000000000..3d27b772d8 --- /dev/null +++ b/published/201510/20150923 How To Upgrade From Oracle 11g To Oracle 12c.md @@ -0,0 +1,155 @@ +如何将 Oracle 11g 升级到 Orcale 12c +================================================================================ +大家好。今天我们来学习一下如何将 Oracle 11g 升级到 Oracle 12c。开始吧。 + +在此,我使用的是 CentOS 7 64 位 Linux 发行版。我假设你已经在你的系统上安装了 Oracle 11g。这里我会展示一下安装 Oracle 11g 时我的操作步骤。 + +我在 Oracle 11g 上选择 “Create and configure a database”,如下图所示。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage1.png) + +然后我选择安装 Oracle 11g “Decktop Class”。如果是生产环境,你必须选择 “Server Class”。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage2.png) + +然后你输入安装 Oracle 11g 的各种路径以及密码。下面是我自己的 Oracle 11g 安装配置。确保你正确输入了 Oracle 的密码。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage3.png) + +下一步,我按照如下设置 Inventory Directory。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage4.png) + +到这里,我已经向你展示了我安装 Oracle 11g 所做的工作,因为我们开始想升级到 12c。 + +让我们将 Oracle 11g 升级到 Oracle 12c 吧。 + +你需要从该[链接][1]上下载两个 zip 文件。下载并解压两个文件到相同目录。文件名为 **linuxamd64_12c_database_1of2.zip** & **linuxamd64_12c_database_2of2.zip**。提取或解压完后,它会创建一个名为 database 的文件夹。 + +注意:升级到 12c 之前,请确保在你的 CentOS 上已经安装了所有必须的软件包,并且所有的路径变量也已经正确配置,还有其它前提条件也已经满足。 + +下面是必须使用正确版本安装的一些软件包 + +- binutils +- compat-libstdc++ +- gcc +- glibc +- libaio +- libgcc +- libstdc++ +- make +- sysstat +- unixodbc + +在因特网上搜索正确的 rpm 版本。 + +你也可以用一个查询处理多个软件包,然后在输出中查找正确版本。例如,在终端中输入下面的命令: + + rpm -q binutils compat-libstdc++ gcc glibc libaio libgcc libstdc++ make sysstat unixodbc + +你的系统中必须安装了以下软件包(版本可能或新或旧) + +- binutils-2.23.52.0.1-12.el7.x86_64 +- compat-libcap1-1.10-3.el7.x86_64 +- gcc-4.8.2-3.el7.x86_64 +- gcc-c++-4.8.2-3.el7.x86_64 +- glibc-2.17-36.el7.i686 +- glibc-2.17-36.el7.x86_64 +- glibc-devel-2.17-36.el7.i686 +- glibc-devel-2.17-36.el7.x86_64 +- ksh +- libaio-0.3.109-9.el7.i686 +- libaio-0.3.109-9.el7.x86_64 +- libaio-devel-0.3.109-9.el7.i686 +- libaio-devel-0.3.109-9.el7.x86_64 +- libgcc-4.8.2-3.el7.i686 +- libgcc-4.8.2-3.el7.x86_64 +- libstdc++-4.8.2-3.el7.i686 +- libstdc++-4.8.2-3.el7.x86_64 +- libstdc++-devel-4.8.2-3.el7.i686 +- libstdc++-devel-4.8.2-3.el7.x86_64 +- libXi-1.7.2-1.el7.i686 +- libXi-1.7.2-1.el7.x86_64 +- libXtst-1.2.2-1.el7.i686 +- libXtst-1.2.2-1.el7.x86_64 +- make-3.82-19.el7.x86_64 +- sysstat-10.1.5-1.el7.x86_64 + +你也需要 unixODBC-2.3.1 或更新版本的驱动。 + +我希望你安装 Oracle 11g 的时候已经在你的 CentOS 7 上创建了名为 oracle 的用户。让我们以用户 oracle 登录 CentOS。以用户 oracle 登录到 CentOS 之后,在你的 CentOS上打开一个终端。 + +使用终端更改工作目录并导航到你解压两个 zip 文件的目录。在终端中输入以下命令开始安装 12c。 + + ./runInstaller + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212image5.png) + +如果一切顺利,你会看到类似下面的截图,已经开始安装 12c。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage6.png) + +然后你可以选择跳过更新或者下载最近更新。如果是生产服务器,建议你必须更新。我这里选择跳过。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage7.png) + +现在,选择升级现有数据库。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage8.png) + +对于语言,这里已经有 English。点击下一步继续,或者你可以根据你的需要添加语言。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage9.png) + +现在,选择企业版。你可以根据你的需求选择。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage10.png) + +然后选择软件位置路径,这些都是不言自明的。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage11.png) + +对于第七步,像下面这样使用默认的选择继续下一步。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage12.png) + +在第九步中,你会看到一个类似下面这样的总结报告。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage13.png) + +如果一切正常,你可以点击第九步中的 install 开始安装,进入第十步。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/11g212cimage14.png) + +其中你可能会遇到一些错误,你需要通过谷歌找到这些错误的解决方法。你可能遇到的问题会有很多,因此我没有在这里详细介绍。 + +要有耐心,一步一步走下来最后它会告诉你成功了。否则,在谷歌上搜索做必要的操作解决问题。再一次说明,由于你可能会遇到的错误有很多,我无法在这里提供所有详细介绍。 + +现在,只需要按照下面屏幕指令配置监听器。 + +配置完监听器之后,它会启动数据库升级助手(Database Upgrade Assistant)。选择 Upgrade Oracle Database。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/DUAimage15.png) + +在第二步,你会发现它显示了 11g 的位置路径以及 12c 的位置路径。同时你也会发现它指示说从原来的 Oracle Home Release 11 安装 Oracle Home Release 12.点击下一步进入步骤三。 + +![](http://www.unixmen.com/wp-content/uploads/2015/09/DUAimage16.png) + +按照屏幕上的说明完成安装。 + +在最后一步,你会看到一个成功窗口,其中你会看到成功升级了 oracle 数据库。 + +**一个忠告**:对于你的生产服务器,在升级到 12c 之前,请确保你已经在其它平台上测试过,以便你能修复升级过程中遇到的所有错误。永远不要尝试一无所知的时候就升级生产服务器。 + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/upgrade-from-oracle-11g-to-oracle-12c/ + +作者:[Mohammad Forhad Iftekher][a] +译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/forhad/ +[1]:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-linux-download-1959253.html \ No newline at end of file diff --git a/published/201510/20150923 Xenlism WildFire--Minimal Icon Theme For Linux Desktop.md b/published/201510/20150923 Xenlism WildFire--Minimal Icon Theme For Linux Desktop.md new file mode 100644 index 0000000000..0049dd5a6e --- /dev/null +++ b/published/201510/20150923 Xenlism WildFire--Minimal Icon Theme For Linux Desktop.md @@ -0,0 +1,86 @@ +Xenlism WildFire: Linux 桌面的极简风格图标主题 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Xenlism-icon-theme-linux-3.png) + +有那么一段时间我没更换主题了,可能最近的一段时间没有一款主题能让我眼前一亮了。我考虑过更换 [Ubuntu 上最好的图标主题][1],但是它们和 Numix 和 Moka 差不多,而且我觉得 Numix 也不错。 + +但是前几天我试了试 [Xenslim WildFire][2],我必须承认,它看起来太棒了。极简风格是设计界当前的流行趋势,而 Xenlism 完美的表现了这种风格。平滑而美观,Xenlism 显然受到了诺基亚的 Meego 和苹果图标的影响。 + +让我们来看一下它的几个不同应用的图标: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Xenlism-icons.png) + +文件夹图标看起来像这样: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Xenlism-icons-1.png) + +主题开发者 [Nattapong Pullkhow][3] 说,这个图标主题最适合 GNOME,但是在 Unity 和 KDE,Mate 上也表现良好。 + +### 安装 Xenlism Wildfire ### + +Xenlism Theme 大约有 230 MB, 对于一个主题来说确实很大,但是考虑到它所支持的庞大的软件数量,这个大小,确实也不是那么令人吃惊。 + +#### 在 Ubuntu/Debian 上安装 Xenlism #### + +在 Ubuntu 系列中安装之前,用以下的命令添加 GPG 秘钥: + + sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 90127F5B + +添加完成之后,输入如下的命令进行安装: + + echo "deb http://downloads.sourceforge.net/project/xenlism-wildfire/repo deb/" | sudo tee -a /etc/apt/sources.list + sudo apt-get update + sudo apt-get install xenlism-wildfire-icon-theme + +除了主题之外,你也可以选择是否下载配套的桌面背景图: + + sudo apt-get install xenlism-artwork-wallpapers + +#### 在 Arch 上安装 Xenlism #### + +你需要编辑 Pacman 软件仓库。在终端中使用如下命令: + + sudo nano /etc/pacman.conf + +添加如下的代码块,在配置文件中: + + [xenlism-arch] + SigLevel = Never + Server = http://downloads.sourceforge.net/project/xenlism-wildfire/repo/arch + +更新系统并且安装: + + sudo pacman -Syyu + sudo pacman -S xenlism-wildfire + +#### 使用 Xenlism 主题 #### + +在 Ubuntu Unity, [可以使用 Unity Tweak Tool 来改变主题][4]。 在 GNOME 中,[使用 Gnome Tweak Tool 改变主题][5]。 我确信你会接下来的步骤,如果你不会,请来信通知我,我会继续完善这篇文章。 + +这就是 Xenlism 在 Ubuntu 15.04 Unity 中的截图。同时也使用了 Xenlism 桌面背景。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Xenlism-icons-2.png) + +这看来真棒,不是吗?如果你试用了,并且喜欢它,你可以感谢它的开发者: + +> [Xenlism 是一个用于 Linux 的、令人兴奋的极简风格的图标主题,感谢 @xenatt 做出这么漂亮的主题。][6] + +我希望你喜欢它。同时也希望你分享你对这个主题的看法,或者你喜欢的主题。Xenlism 真的很棒,可能会替换掉你最喜欢的主题。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/xenlism-wildfire-theme/ + +作者:[Abhishek][a] +译者:[MikeCoder](https://github.com/MikeCoder) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/best-icon-themes-ubuntu-1404/ +[2]:http://xenlism.github.io/wildfire/ +[3]:https://plus.google.com/+NattapongPullkhow +[4]:http://itsfoss.com/install-numix-ubuntu/ +[5]:http://itsfoss.com/install-switch-themes-gnome-shell/ +[6]:https://twitter.com/share?text=Xenlism+is+a+stunning+minimal+icon+theme+for+Linux.+Thanks+%40xenatt+for+this+beautiful+theme.&via=itsfoss&related=itsfoss&url=http://itsfoss.com/xenlism-wildfire-theme/ diff --git a/published/201510/20150925 HTTP 2 Now Fully Supported in NGINX Plus.md b/published/201510/20150925 HTTP 2 Now Fully Supported in NGINX Plus.md new file mode 100644 index 0000000000..f02b42b5a1 --- /dev/null +++ b/published/201510/20150925 HTTP 2 Now Fully Supported in NGINX Plus.md @@ -0,0 +1,127 @@ +NGINX Plus 现在完全支持 HTTP/2 +================================================================================ +早些时候,我们发布了支持 HTTP/2 协议的 [NGINX Plus R7][1]。作为 HTTP 协议的最新标准,HTTP/2 的设计为现在的 web 应用程序带来了更高的性能和安全性。(LCTT 译注: [开源版本的 NGINX 1.95 也支持 HTTP/2 了][18]。) + +NGINX Plus 所实现的 HTTP/2 协议可与现有的网站和应用程序进行无缝衔接。只需要一点改变,不管用户选择什么样的浏览器,NGINX Plus 都能为用户同时提供 HTTP/1.x 与HTTP/2 的最佳体验。 + +要支持 HTTP/2 仅需通过可选的 **nginx‑plus‑http2** 软件包。**nginx‑plus** 和 **nginx‑plus‑extras** 软件包支持 SPDY 协议,目前推荐用于生产站点,因为其被大多数浏览器所支持并且代码也是相当成熟了。 + +### 为什么要使用 HTTP/2? ### + +HTTP/2 使数据传输更高效,对你的应用程序更安全。 HTTP/2 相比于 HTTP/1.x 有五个提高性能特点: + +- **完全复用** – 在一个保持激活(keepalive)的连接上,HTTP/1.1 强制按严格的顺序来处理请求。一个请求必须在下一个请求开始前结束。 HTTP/2 消除了这一要求,允许并行和乱序来处理请求。 + +- **单一,持久连接** – 由于 HTTP/2 允许请求完全复用,所以可以通过单一连接并行下载网页上的所有对象。在 HTTP/1.x 中,使用多个连接来并行下载资源,从而导致使用底层 TCP 协议效率很低。 + +- **二进制编码** – Header 信息使用紧凑的二进制格式发送,而不是纯文本格式,节省了传输字节。 + +- **Header 压缩** – Headers 使用专用的 HPACK 压缩算法来进行压缩,这进一步降低数据通过网络传输的字节。 + +- **SSL/TLS 加密** – 在 HTTP/2 中,强制使用 SSL/TLS。在 [RFC][2] 中并没有强制,其允许纯文本的 HTTP/2,但是当前所有实现 HTTP/2的 Web 浏览器都只支持加密。 SSL/TLS 可以使你的网站更安全,并且使用 HTTP/2 各项性能会有提升,加密和解密过程的性能损失就减少了。 + +要了解更多关于 HTTP/2: + +- 请阅读我们的 [白皮书][3],它涵盖了你需要了解HTTP/2 的一切。 +- 下载由 Google 的 Ilya Grigorik 编写的 [特别版的高性能浏览器网络电子书][4] 。 + +### NGINX Plus 如何实现 HTTP/2 ### + +我们的 HTTP/2 实现是基于 SPDY 支持的,它已经被广泛部署(使用了 NGINX 或 NGINX Plus 的网站近 75% 都使用了 SPDY)。使用 NGINX Plus 部署 HTTP/2 时,几乎不会改变你应用程序的配置。本节将讨论 NGINX Plus如何实现对 HTTP/2 的支持。 + +#### 一个 HTTP/2 网关 #### + +![](https://www.nginx.com/wp-content/uploads/2015/09/http2-27-1024x300.png) + +NGINX Plus 作为一个 HTTP/2 网关。它与支持 HTTP/2 的客户端 Web 浏览器用 HTTP/2 通讯,而转换 HTTP/2 请求给后端服务器通信时使用 HTTP/1.x(或者 FastCGI, SCGI, uWSGI, 等等. – 取决于你目前正在使用的协议)。 + +#### 向后兼容性 #### + +![](https://www.nginx.com/wp-content/uploads/2015/09/http2-281-1024x581.png) + +在一段时间内,你需要同时支持 HTTP/2 和 HTTP/1.x。在撰写本文时,超过50%的用户使用的 Web 浏览器已经[支持 HTTP/2][5],但这也意味着近50%的人还没有使用。 + +为了同时支持 HTTP/1.x 和 HTTP/2,NGINX Plus 实现了 TLS 上的 Next Protocol Negotiation (NPN)扩展。当 Web 浏览器连接到服务器时,其将所支持的协议列表发送到服务器端。如果浏览器支持的协议列表中包括 h2 - 即 HTTP/2,NGINX Plus 将使用 HTTP/2 连接到浏览器。如果浏览器不支持 NPN 或在发送支持的协议列表中没有 h2,NGINX Plus 将继续回落到 HTTP/1.x。 + +### 转向 HTTP/2 ### + +NGINX 公司会尽可能帮助大家无缝过渡到使用 HTTP/2。本节介绍了通过对你应用进行改变来启用对 HTTP/2 支持,其中只需对 NGINX Plus 配置进行几个变化。 + +#### 前提条件 #### + +使用 **nginx‑plus‑http2** 软件包升级到 NGINX Plus R7。注意现在还没有支持 HTTP/2 版本的 **nginx‑plus‑extras** 软件包。 + +#### 重定向所有流量到 SSL/TLS #### + +如果你的应用尚未使用 SSL/TLS 加密,现在启用它正是一个好的时机。加密你的应用程序可以保护你免受间谍以及来自其他中间人的攻击。一些搜索引擎甚至在搜索结果中对加密站点[提高排名][6]。下面的配置块重定向所有的普通 HTTP 请求到该网站的加密版本。 + + server { + listen 80; + location / { + return 301 https://$host$request_uri; + } + } + +#### 启用 HTTP/2 #### + +要启用对 HTTP/2 的支持,只需将 http2 参数添加到所有的 [listen][7] 指令中,也要包括 SSL 参数,因为浏览器不支持不加密的 HTTP/2 请求。 + + server { + listen 443 ssl http2 default_server; + + ssl_certificate server.crt; + ssl_certificate_key server.key; + … + } + +如果有必要,重启 NGINX Plus,例如通过运行 `nginx -s reload` 命令。要验证 HTTP/2 是否正常工作,你可以在 [Google Chrome][8] 和 [Firefox][9] 中使用 “HTTP/2 and SPDY indicator” 插件来检查。 + +### 注意事项 ### + +- 在安装 **nginx‑plus‑http2** 包之前, 你必须删除配置文件中所有 listen 指令后的 SPDY 参数(使用 http2 和 ssl 参数来替换它以启用对 HTTP/2 的支持)。使用这个包后,如果 listen 指令后有 spdy 参数,NGINX Plus 将无法启动。 + +- 如果你在 NGINX Plus 前端使用了 Web 应用防火墙(WAF),请确保它能够解析 HTTP/2,或者把它移到 NGINX Plus 后面。 + +- 此版本不支持在 HTTP/2 RFC 中定义的 “Server Push” 特性。 NGINX Plus 以后的版本可能会支持它。 + +- NGINX Plus R7 同时支持 SPDY 和 HTTP/2(LCTT 译注:但是你只能同时使用其中一种)。在以后的版本中,我们将弃用对 SPDY 的支持。谷歌在2016年初将 [弃用 SPDY][10],因此同时支持这两种协议也非必要。 + +- 如果 [ssl_prefer_server_ciphers][11] 设置为 on 或者使用了定义在 [Appendix A: TLS 1.2 Ciper Suite Black List][13] 中的 [ssl_ciphers][12] 列表时,浏览器会出现 handshake-errors 而无法正常工作。详细内容请参阅 [section 9.2.2 of the HTTP/2 RFC][14]。 + +### 特别感谢 ### + +NGINX 公司要感谢 [Dropbox][15] 和 [Automattic][16],他们是我们软件的重度使用者,并帮助我们实现 HTTP/2。他们的贡献帮助我们加速完成这个软件,我们希望你也能支持他们。 + +![](https://www.nginx.com/wp-content/themes/nginx-theme/assets/img/landing-page/highperf_nginx_ebook.png) + +[O'REILLY'S BOOK ABOUT HTTP/2 & PERFORMANCE TUNING][17] + +-------------------------------------------------------------------------------- + +via: https://www.nginx.com/blog/http2-r7/ + +作者:[Faisal Memon][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.nginx.com/blog/author/fmemon/ +[1]:https://www.nginx.com/blog/nginx-plus-r7-released/ +[2]:https://tools.ietf.org/html/rfc7540 +[3]:https://www.nginx.com/wp-content/uploads/2015/09/NGINX_HTTP2_White_Paper_v4.pdf +[4]:https://www.nginx.com/http2-ebook/ +[5]:http://caniuse.com/#feat=http2 +[6]:http://googlewebmastercentral.blogspot.co.uk/2014/08/https-as-ranking-signal.html +[7]:http://nginx.org/en/docs/http/ngx_http_core_module.html#listen +[8]:https://chrome.google.com/webstore/detail/http2-and-spdy-indicator/mpbpobfflnpcgagjijhmgnchggcjblin?hl=en +[9]:https://addons.mozilla.org/en-us/firefox/addon/spdy-indicator/ +[10]:http://blog.chromium.org/2015/02/hello-http2-goodbye-spdy-http-is_9.html +[11]:http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_prefer_server_ciphers +[12]:http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_ciphers +[13]:https://tools.ietf.org/html/rfc7540#appendix-A +[14]:https://tools.ietf.org/html/rfc7540#section-9.2.2 +[15]:http://dropbox.com/ +[16]:http://automattic.com/ +[17]:https://www.nginx.com/http2-ebook/ +[18]:http://mailman.nginx.org/pipermail/nginx-announce/2015/000162.html \ No newline at end of file diff --git a/published/201510/20150930 Debian dropping the Linux Standard Base.md b/published/201510/20150930 Debian dropping the Linux Standard Base.md new file mode 100644 index 0000000000..c854ba8dfe --- /dev/null +++ b/published/201510/20150930 Debian dropping the Linux Standard Base.md @@ -0,0 +1,65 @@ +Debian 拋弃 Linux 标准规范(LSB) +======================= + +Linux 标准规范(LSB)是一个意图定义 Linux 发行版为第三方程序所提供的服务和应用层 ABI(Application Binary Interfaces,程序二进制界面) 的[规范][1]。但 Debian 项目内的某些人正在质疑是否值得维持兼容 LSB,他们认为,该项工作的工作量巨大,但好处有限。 + +LSB 于2001年首次公布,其模型建立在 [POSIX][2] 和[单一 UNIX 规范(Single UNIX Specification)][3]的基础之上。目前,LSB 由 Linux 基金会的一个[工作小组][4]维护。最新的版本是于2015年6月发布的 [LSB 5.0][5]。它定义了五个 LSB 模块(核芯(core)、桌面、语言、成像(imaging)和试用)。 + +每个模块都包含了一系列所需的库及其强制性版本,外加对每个库的公共函数和数据定义的描述。这些模块还包括命名和组织规范,如[文件系统层次标准(FHS,Filesystem Hierarchy Standard)][6]中的文件系统布局或象 Freedesktop 的[XDG 基础目录(XDG Base Directory)][7]规范这样的目录规范。 + +似乎只是一个巧合,就在 LSB 5.0 发布的同一周,Debian 项目内部针对其是否值得保持兼容 LSB 进行了一次讨论。在另一个贴子中,在提及兼容 LSB 后,Didier Raboud 顺势[提议][8]将 Debian 的兼容工作维持在最低水平。他说,目前的情况是,Debian 的“lsb-*” 元包( meta-packages)试图规定该标准中提及的库的正确版本,但事实上却没有人去检查所有的符号和数据定义是否满足要求。 + +另外,LSB 还不断在膨胀;他说, LSB 4.1 版(接近 Debian “jessie” 发布时的最新版本)包含“*1493个组件、1672个库、38491条命令、30176个类和716202个接口*”。似乎没有人有兴趣检查 Debian 包中的这些细节,他解释道,又补充说,“*去年在 DebConf 上我举行过一次 LSB BoF,后来又与很多人讨论过 src:lsb,我收回自己的‘几乎没有人在意’的说法*”。但,重要的是,Debian 似乎并不仅局限于兴趣的缺乏: + + 我认为,这个问题的关键在于是否值得去玩这整个游戏:我还没听说有哪个软件通过 LSB 包来发行。LSB 认证的应用清单上只有 6个公司的_8_个应用,其中仅有一个是针对不低于 LSB 4 的。 + +Raboud 提议 Debian 摈弃除了 [lsb-base][9] 包(目前包括一个用于启动系统所需的小的 shell 函数集合)和 [lsb-release][10] 包(提供一个简单工具,用户可用它查询发行版的身份以及该发行版宣称的与哪个 LSB 级别兼容)之外的所有内容。 + +[后来][11],他又称,将 LSB 基本上改变为“*Debian 和 FLOSS 世界中的所有的其它人所_实际_做的任何事*”可能会使得该标准(以及在 Debian 为支持它所做的工作)更有价值。但此时他再次质疑是否有人会对推动这个目标有兴趣。 + +如果说他最初称 LSB 中缺乏兴趣没有足够的证据,随后整整三个月之内没有任何人对维持 LSB 兼容的包提供支持,并进行了两次拋弃它们的投票。最后,9月17日,Raboud [宣布][12]他已经抽掉 `src:lsb` 包(如前所述,保留了`lsb-base` 和 `lsb-release`),将将其上载到 “unstable” 归档中。这个最小的工具集可以让感兴趣的用户在启动了下一个 Debian 版本后查询它是否兼容 LSB:结果将为“否”。 + +Raboud 补充说,即便摈弃了兼容 LSB,Debian 仍计划继续兼容 FHS: + + 但 Debian 并没有放弃所有的 LSB:我们仍将严格遵守 FHS(直到 Debian Policy 版本 2.3;虽然今年8月已经发布了3.0),而且我们的 SysV 启动脚本几乎全部遵循 VIII.22.{2-8}。但请不要误解,此次 src:lsb 上载明确说明我们将离开 LSB。 + +在该宣告之后,Nikolaus Rath [回应][13]称某些私有应用依赖`/lib`和`/lib64`中的符号链接`ld-lsb.so*`,而这些符号链接由`lsb-*`包提供。Raboud 则[建议][14]应改由`libc6`包提供;该包维护人员Aurelien Jarno [称][15],如果提供这样一个补丁,他将会接受它。 + +似乎唯一的遗留问题只是某些打印机驱动包会依赖 LSB 兼容。Raboud 称,在其首个贴子中已经说明,据他所知,实际发布的唯一一个依赖 LSB 兼容的包为 [OpenPrinting][16] 驱动程序。Michael Biebl [称][17],主归档中有这样一个驱动包;Raboud 则[回应][18]说,他认为这个有问题的包应该被移到非自由仓库,因其包括了一个二进制驱动。 + +于是,这个问题看上去已经尘埃落定,至于对于目前的 Debian 开发周期来说是如此的状况。很自然的是,未来让人更感觉兴趣的是,如果该决定存在一些影响的话,那么人们将会看到它对更广泛的 LSB 接受度有何影响。正如 Raboud 所说的那样,被认证为 LSB 兼容的发行版数量很[少][19]。人们很难不会注意到这些发行版很大程度上是“企业”的变种。 + +也许,对某些商业领域来说,LSB 仍很重要,但很难知道有多少那些企业发行版的客户真正关心 LSB 认证标签。然而,如果 Debian 的经验靠得住的话,对这种认证的一般兴趣可能会急剧下降。 + +---- + +via:https://lwn.net/Articles/658809/ + +作者:Nathan Willis +译者:[Yuking](https://github.com/Yuking-net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译, +[Linux中国](https://linux.cn/) 荣誉推出 + + +[1]:http://refspecs.linuxfoundation.org/lsb.shtml +[2]:https://en.wikipedia.org/wiki/POSIX +[3]:https://en.wikipedia.org/wiki/Single_UNIX_Specification +[4]:http://www.linuxfoundation.org/collaborate/workgroups/lsb +[5]:http://www.linuxfoundation.org/collaborate/workgroups/lsb/lsb-50 +[6]:http://www.linuxfoundation.org/collaborate/workgroups/lsb/fhs +[7]:http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html +[8]:https://lwn.net/Articles/658838/ +[9]:https://packages.debian.org/sid/lsb-base +[10]:https://packages.debian.org/sid/lsb-release +[11]:https://lwn.net/Articles/658842/ +[12]:https://lwn.net/Articles/658843/ +[13]:https://lwn.net/Articles/658846/ +[14]:https://lwn.net/Articles/658847/ +[15]:https://lwn.net/Articles/658848/ +[16]:http://www.linuxfoundation.org/collaborate/workgroups/openprinting/ +[17]:https://lwn.net/Articles/658844/ +[18]:https://lwn.net/Articles/658845/ +[19]:https://www.linuxbase.org/lsb-cert/productdir.php?by_lsb + diff --git a/published/201510/20150930 Install and use Ansible (Automation Tool) in CentOS 7.md b/published/201510/20150930 Install and use Ansible (Automation Tool) in CentOS 7.md new file mode 100644 index 0000000000..f80f6a6125 --- /dev/null +++ b/published/201510/20150930 Install and use Ansible (Automation Tool) in CentOS 7.md @@ -0,0 +1,100 @@ +在 CentOS 7 中安装并使用自动化工具 Ansible +================================================================================ + +Ansible是一款为类Unix系统开发的自由开源的配置和自动化工具。它用Python写成,类似于Chef和Puppet,但是有一个不同和优点是我们不需要在节点中安装任何客户端。它使用SSH来和节点进行通信。 + +本篇中我们将在CentOS 7上安装并配置Ansible,并且尝试管理两个节点。 + +- **Ansible 服务端** – ansible.linuxtechi.com ( 192.168.1.15 ) + +- **节点** – 192.168.1.9 , 192.168.1.10 + +### 第一步: 设置EPEL仓库 ### + +Ansible仓库默认不在yum仓库中,因此我们需要使用下面的命令启用epel仓库。 + + [root@ansible ~]# rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm + +### 第二步: 使用yum安装Ansible ### + + [root@ansible ~]# yum install ansible + +安装完成后,检查ansible版本: + + [root@ansible ~]# ansible --version + +![ansible-version](http://www.linuxtechi.com/wp-content/uploads/2015/09/ansible-version.jpg) + +### 第三步: 设置用于节点鉴权的SSH密钥 ### + +在Ansible服务端生成密钥,并且复制公钥到节点中。 + + root@ansible ~]# ssh-keygen + +![ssh-keygen](http://www.linuxtechi.com/wp-content/uploads/2015/09/ssh-keygen.jpg) + +使用ssh-copy-id命令来复制Ansible公钥到节点中。 + +![ssh-copy-id-command](http://www.linuxtechi.com/wp-content/uploads/2015/09/ssh-copy-id-command.jpg) + +### 第四步:为Ansible定义节点的清单 ### + +文件 `/etc/ansible/hosts` 维护着Ansible中服务器的清单。 + + [root@ansible ~]# vi /etc/ansible/hosts + [test-servers] + 192.168.1.9 + 192.168.1.10 + +保存并退出文件。 + +主机文件示例如下: + +![ansible-host](http://www.linuxtechi.com/wp-content/uploads/2015/09/ansible-host.jpg) + +### 第五步:尝试在Ansible服务端运行命令 ### + +使用ping检查‘test-servers’或者ansible节点的连通性。 + + [root@ansible ~]# ansible -m ping 'test-servers' + +![ansible-ping](http://www.linuxtechi.com/wp-content/uploads/2015/09/ansible-ping.jpg) + +#### 执行shell命令 #### + +**例子1:检查Ansible节点的运行时间(uptime)** + + [root@ansible ~]# ansible -m command -a "uptime" 'test-servers' + +![ansible-uptime](http://www.linuxtechi.com/wp-content/uploads/2015/09/ansible-uptime.jpg) + +**例子2:检查节点的内核版本** + + [root@ansible ~]# ansible -m command -a "uname -r" 'test-servers' + +![kernel-version-ansible](http://www.linuxtechi.com/wp-content/uploads/2015/09/kernel-version-ansible.jpg) + +**例子3:给节点增加用户** + + [root@ansible ~]# ansible -m command -a "useradd mark" 'test-servers' + [root@ansible ~]# ansible -m command -a "grep mark /etc/passwd" 'test-servers' + +![useradd-ansible](http://www.linuxtechi.com/wp-content/uploads/2015/09/useradd-ansible.jpg) + +**例子4:重定向输出到文件中** + + [root@ansible ~]# ansible -m command -a "df -Th" 'test-servers' > /tmp/command-output.txt + +![redirecting-output-ansible](http://www.linuxtechi.com/wp-content/uploads/2015/09/redirecting-output-ansible.jpg) + +-------------------------------------------------------------------------------- + +via: http://www.linuxtechi.com/install-and-use-ansible-in-centos-7/ + +作者:[Pradeep Kumar][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxtechi.com/author/pradeep/ diff --git a/published/201510/20151005 pyinfo() A good looking phpinfo-like python script.md b/published/201510/20151005 pyinfo() A good looking phpinfo-like python script.md new file mode 100644 index 0000000000..480abefef8 --- /dev/null +++ b/published/201510/20151005 pyinfo() A good looking phpinfo-like python script.md @@ -0,0 +1,42 @@ +pyinfo():一个像 phpinfo 一样的 Python 脚本 +================================================================================ +作为一个热衷于 php 的家伙,我已经习惯了使用 `phpinfo()` 函数来让我轻松访问 php.ini 里的配置和加载的模块等信息。当然我也想要使用一个不存在的 `pyinfo()` 函数,但没有成功。按下 CTRL-E,google 一下是否有人实现了它? + +是的,有人已经实现了。但是,对我来说它非常难看。荒谬!因为我无法忍受丑陋的布局,*咳咳*,我不得不亲自动手来改改。我用找到的代码,并重新进行布局使之更好看点。Python 官方网站的布局看起来不错,那么何不借用他们的颜色和背景图片呢?是的,这听起来像一个计划。 + +- [Gist 代码地址][1] +- [下载地址][2] +- [例子][3] + +提醒你下,我仅仅在 Python 2.6.4 上运行过它,所以在别的版本上可能有风险(将它移植到任何其他版本它应该是没有问题的)。要使用它,只需要导入该文件, 并调用`pyinfo()`函数得到它的返回值打印到屏幕上。好嘞! + +如果你在使用 [mod_wsgi][4] 时没有得到正确的返回结果,你可以如下运行它(当然得替换路径): + +``` +def application(environ, start_response): + import sys + path = 'YOUR_WWW_ROOT_DIRECTORY' + if path not in sys.path: + sys.path.append(path) + from pyinfo import pyinfo + output = pyinfo() + start_response('200 OK', [('Content-type', 'text/html')]) + return [output] +``` +--- + +via:http://bran.name/articles/pyinfo-a-good-looking-phpinfo-like-python-script/ + +作者:[Bran van der Meer][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译, +[Linux中国](https://linux.cn/) 荣誉推出 + + +[a]:http://bran.name/resume/ +[1]:https://gist.github.com/951825#file_pyinfo.py +[2]:http://bran.name/dump/pyinfo.zip +[3]:http://bran.name/dump/pyinfo/index.py +[4]:http://code.google.com/p/modwsgi/ diff --git a/published/201510/20151007 How To Download Videos Using youtube-dl In Linux.md b/published/201510/20151007 How To Download Videos Using youtube-dl In Linux.md new file mode 100644 index 0000000000..4d268e4c23 --- /dev/null +++ b/published/201510/20151007 How To Download Videos Using youtube-dl In Linux.md @@ -0,0 +1,93 @@ +如何在 Linux 中使用 youtube-dl 下载视频 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Download-YouTube-Videos.jpeg) + +我知道你已经看过[如何下载 YouTube 视频][1]。但那些工具大部分都采用图形用户界面的方式。我会向你展示如何通过终端使用 youtube-dl 下载 YouTube 视频。 + +### youtube-dl ### + +[youtube-dl][2] 是基于 Python 的命令行小工具,允许你从 YouTube.com、Dailymotion、Google Video、Photobucket、Facebook、Yahoo、Metacafe、Depositfiles 以及其它一些类似网站中下载视频。它是用 pygtk 编写的,需要 Python 解析器来运行,对平台要求并不严格。它能够在 Unix、Windows 或者 Mac OS X 系统上运行。 + +youtube-dl 支持断点续传。如果在下载的过程中 youtube-dl 被杀死了(例如通过 Ctrl-C 或者丢失网络连接),你只需要使用相同的 YouTube 视频 URL 再次运行它。只要当前目录中有下载的部分文件,它就会自动恢复没有完成的下载,也就是说,你不需要[下载管理器][3]来恢复下载。 + +#### 安装 youtube-dl #### + +如果你运行的是基于 Ubuntu 的 Linux 发行版,你可以使用下面的命令安装: + + sudo apt-get install youtube-dl + +对于任何 Linux 发行版,你都可以通过下面的命令行在你的系统上快速安装 youtube-dl: + + sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O/usr/local/bin/youtube-dl + +获取到该文件后,为了能正常执行你需要给脚本设置可执行权限。 + + sudo chmod a+rx /usr/local/bin/youtube-dl + +#### 使用 youtube-dl 下载视频: #### + +要下载一个视频文件,只需要运行下面的命令。其中 “VIDEO_URL” 是你想要下载视频的 url。 + + youtube-dl VIDEO_URL + +#### 以多种格式下载 YouTube 视频: #### + +现在 YouTube 视频有不同的分辨率,首先你需要检查指定的 YouTube 视频可用的视频格式。可以使用 “-F” 选项运行 youtube-dl。它会向你显示出可用的格式。 + + youtube-dl -F http://www.youtube.com/watch?v=BlXaGWbFVKY + +它的输出类似于: + + Setting language + BlXaGWbFVKY: Downloading video webpage + BlXaGWbFVKY: Downloading video info webpage + BlXaGWbFVKY: Extracting video information + Available formats: + 37 : mp4 [1080×1920] + 46 : webm [1080×1920] + 22 : mp4 [720×1280] + 45 : webm [720×1280] + 35 : flv [480×854] + 44 : webm [480×854] + 34 : flv [360×640] + 18 : mp4 [360×640] + 43 : webm [360×640] + 5 : flv [240×400] + 17 : mp4 [144×176] + +在可用的视频格式中,选择你需要的一种。例如,如果你想下载 MP4 格式的,你可以: + + youtube-dl -f 17 http://www.youtube.com/watch?v=BlXaGWbFVKY + +#### 使用 youtube-dl 下载视频字幕 #### + +首先检查是否有可用的视频字幕。使用下面的命令列出视频所有可用的字幕: + + youtube-dl --list-subs https://www.youtube.com/watch?v=Ye8mB6VsUHw + +下载所有字幕,但不包括视频: + + youtube-dl --all-subs --skip-download https://www.youtube.com/watch?v=Ye8mB6VsUHw + +#### 下载整个播放列表 #### + +运行下面的命令下载整个播放列表。其中 “playlist_url” 是你希望下载的播放列表的 url。 + + youtube-dl -cit playlist_url + +youtube-dl 是一个多功能的命令行工具,它提供了很多功能。难怪这个命令行工具这么流行。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/download-youtube-linux/ + +作者:[alimiracle][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/ali/ +[1]:http://itsfoss.com/download-youtube-videos-ubuntu/ +[2]:https://rg3.github.io/youtube-dl/ +[3]:https://linux.cn/article-6209-1.html \ No newline at end of file diff --git a/published/201510/20151007 Open Source Media Player MPlayer 1.2 Released.md b/published/201510/20151007 Open Source Media Player MPlayer 1.2 Released.md new file mode 100644 index 0000000000..95a777e6f1 --- /dev/null +++ b/published/201510/20151007 Open Source Media Player MPlayer 1.2 Released.md @@ -0,0 +1,57 @@ +开源媒体播放器 MPlayer 1.2 发布 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/MPlayer-1.2.jpg) + +在 [MPlayer][1] 1.1 发布将近3年后,新版 MPlayer 终于在上周发布了。在新版本 MPlayer 1.2 中带来了对许多新编码的解码支持。 + +MPlayer 是一款跨平台的开源媒体播放器。它的名字是“Movie Player”的缩写。MPlayer 是 Linux 上最老牌的媒体播放器之一,在过去的15年里,它还带动出现了许多其他媒体播放器。著名的基于 MPlayer 的媒体播放器有: + +- [MPV][2] +- SMPlayer +- KPlayer +- GNOME MPlayer +- Deepin Player(深度影音) + +#### MPlayer 1.2 更新了些什么? #### + +- 兼容 FFmpeg 2.8 +- 对 H.265/HEVC 的 VDPAU 硬件加速 +- 通过 FFmpeg 支持一些新的编码解码 +- 改善电视与数字视频广播支持 +- 界面优化 +- libdvdcss/libdvdnav 包外部依赖 + +#### 在 Linux 安装 MPlayer 1.2 #### + +大多数 Linux 发行版仓库中还是 MPlayer 1.1 版本。如果你想使用新的 MPlayer 1.2 版本,你需要从源码手动编译,这对新手来说可能有点棘手。 + +我是在 Ubuntu 15.04 上安装的 MPlayer 1.2。除了需要安装 yasm 的地方以外,对所有 Linux 发行版来说安装说明都是一样的。 + +打开一个终端,运行下列命令: + + wget http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.2.tar.xz + tar xvf MPlayer-1.1.1.tar.xz + cd MPlayer-1.2 + sudo apt-get install yasm + ./configure + +在你运行 make 的时候,在你的终端屏幕上会显示一些东西,并且你需要一些时间来编译它。保持耐心。 + + make + sudo make install + +如果你觉得从源码编译不大习惯的话,我建议你等待 MPlayer 1.2 提交到你的 Linux 发行版仓库中,或者用其它的播放器替代,比如 MPV。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/mplayer-1-2-released/ + +作者:[Abhishek][a] +译者:[alim0x](https://github.com/alim0x) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:https://www.mplayerhq.hu/ +[2]:http://mpv.io/ diff --git a/published/201510/20151007 Productivity Tools And Tips For Linux.md b/published/201510/20151007 Productivity Tools And Tips For Linux.md new file mode 100644 index 0000000000..3bc56cc9f6 --- /dev/null +++ b/published/201510/20151007 Productivity Tools And Tips For Linux.md @@ -0,0 +1,77 @@ +Linux 产能工具及其使用技巧 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Productivity-Tips-Linux.jpg) + +由于生产力本身是一个主观术语,我不打算详细解释我这里要讲到的“生产力”是什么。我打算给你们展示一些工具及其使用技巧,希望这会帮助你在Linux中工作时能更专注、更高效,并且能节省时间。 + +### Linux产能工具及其使用技巧 ### + +再次说明,我在写下本文时正在使用的是Ubuntu。但是,我将要在这里展示给大家产能工具及其使用技巧却适用于市面上的大多数Linux发行版。 + +#### 外界的音乐 #### + +[音乐影响生产力][1],这已经是一个公开的秘密了。从心理学家到管理大师,他们都一直在建议使用外界的杂音来让自己放松并专注于工作。我不打算就此进行辩论,因为这对于我确实有效。我戴上耳机,然后倾听着鸟叫声和风声,这确实让我很放松。 + +在Linux中,我使用ANoise播放器来播放外界的杂音。多亏了官方提供的PPA,你可以很容易地[安装Ambient Noise播放器到Ubuntu中][2],以及其它基于Ubuntu的Linux发行版中。安装它,也可以让它离线播放外界的音乐。 + +另外,你也总可以在线听外界杂音。我最喜欢的在线外界音乐站点是[Noisli][3]。强烈推荐你试试这个。 + +#### 任务管理应用 #### + +一个良好的生产习惯,就是制订一个任务列表。如果你将它和[番茄工作法][4]组合使用,那就可能创造奇迹了。这里我所说的是,创建一个任务列表,如果可能,将这些任务分配到特定的某个时间。这将会帮助你跟踪一天中计划好的任务。 + +对于此,我推荐[Go For It!][5]应用。你可以将它安装到所有主流Linux发行版中,由于它基于[ToDo.txt][6],你也可以很容易地同步到你的智能手机中。我已经为此写了一个详尽的指南[如何使用Go For It!][7]。 + +此外,你可以使用[Sticky Notes][8]或者[Google Keep][9]。如果你需要某些更类似[Evernote][10]的功能,你可以使用这些[Evernote的开源替代品][11]。 + +#### 剪贴板管理器 #### + +Ctrl+ C和Ctrl+V是我们日常计算机生活中不可缺少的一部分,它们唯一的不足之处在于,这些重要的活动不会被记住(默认情况下)。假如你拷贝了一些重要的东西,然后你意外地又拷贝了一些其它东西,你将丢失先前拷贝的东西。 + +剪贴板管理器在这种情况下会派上用场,它可以显示你最近拷贝(到剪贴板的)内容的历史记录,你可以从它这里将文本拷贝回到剪贴板中。 + +对于该目的,我更偏好[Diodon剪贴板管理器][12]。它处于活跃开发中,并且在Ubuntu的仓库中可以得到它。 + +#### 最近通知 #### + +如果你正忙着处理其它事情,而此时一个桌面通知闪了出来又逐渐消失了,你会怎么做?你会想要看看通知都说了什么,不是吗?最近通知指示器就是用于处理此项工作,它会保留一个最近所有通知的历史记录。这样,你就永远不会错过桌面通知了。 + +你可以在此阅读[最近通知指示器][13]。 + +#### 终端技巧 #### + +不,我不打算给你们展示所有那些Linux命令技巧和快捷方法,那会写满整个博客了。我打算给你们展示一些终端黑技巧,你可以用它们来提高你的生产力。 + +- **修改**sudo**密码超时**:默认情况下,sudo命令要求你在15分钟后再次输入密码,这真是让人讨厌。实际上,你可以修改默认的sudo密码超时。[此教程][14]会给你展示如何来实现。 +- **获取命令完成的桌面通知**:这是IT朋友们之间的一个常见的玩笑——开发者们花费大量时间来等待程序编译完成——然而这不完全是正确的。但是,它确实影响到了生产力,因为在你等待程序编译完成时,你可以做其它事情,并忘了你在终端中运行的命令。一个更好的途径,就是在一个命令完成时,让它显示桌面通知。这样,你就不会长时间被打断,并且可以回到之前想要做的事情上。请阅读[如何获取命令完成的桌面通知][15]。 + +我知道,这不是一篇全面涵盖了**提升生产力**的文章。但是,这些小应用和小技巧可以在实际生活中帮助你在你宝贵的时间中做得更多。 + +现在,该轮到你们了。在Linux中,你使用了什么程序或者技巧来提高生产力呢?有哪些东西你想要和社区分享呢? + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/productivity-tips-ubuntu/ + +作者:[Abhishek][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://www.helpscout.net/blog/music-productivity/ +[2]:https://linux.cn/article-5233-1.html +[3]:http://www.noisli.com/ +[4]:https://en.wikipedia.org/wiki/Pomodoro_Technique +[5]:http://manuel-kehl.de/projects/go-for-it/ +[6]:http://todotxt.com/ +[7]:https://linux.cn/article-5337-1.html +[8]:http://itsfoss.com/indicator-stickynotes-windows-like-sticky-note-app-for-ubuntu/ +[9]:https://linux.cn/article-2634-1.html +[10]:https://evernote.com/ +[11]:http://itsfoss.com/5-evernote-alternatives-linux/ +[12]:https://esite.ch/tag/diodon/ +[13]:http://itsfoss.com/7-best-indicator-applets-for-ubuntu-13-10/ +[14]:http://itsfoss.com/change-sudo-password-timeout-ubuntu/ +[15]:http://itsfoss.com/notification-terminal-command-completion-ubuntu/ diff --git a/published/201510/20151012 10 Useful Utilities For Linux Users.md b/published/201510/20151012 10 Useful Utilities For Linux Users.md new file mode 100644 index 0000000000..99bfe6869a --- /dev/null +++ b/published/201510/20151012 10 Useful Utilities For Linux Users.md @@ -0,0 +1,263 @@ + 10 个给 Linux 用户的有用工具 +================================================================================ +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2014/09/linux-656x445.png) + +### 引言 ### + +在本教程中,我已经收集了10个给 Linux 用户的有用工具,其中包括各种网络监控,系统审计和一些其它实用的命令,它可以帮助用户提高工作效率。我希望你会喜欢他们。 + +#### 1. w #### + +显示谁登录了系统并执行了哪些程序。 + + $w + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_023.png) + +不显示头部信息(LCTT译注:原文此处有误) + + $w -h + +显示指定用户的信息 + + $w + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_024.png) + +#### 2. nmon #### + +Nmon(nigel’s monitor 的简写)是一个显示系统性能信息的工具。 + + $ sudo apt-get install nmon + +---------- + + $ nmon + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_001.png) + +nmon 可以显示与 netwrok,cpu, memory 和磁盘使用情况的信息。 + +**nmon 显示 cpu 信息 (按 c)** + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_002.png) + +**nmon 显示 network 信息 (按 n)** + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_003.png) + +**nman 显示 disk 信息 (按 d)** + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_004.png) + +#### 3. ncdu #### + +是一个支持光标的`du`程序,这个命令是用来分析各种目录占用的磁盘空间。 + + $apt-get install ncdu + +---------- + + $ncdu / + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_006.png) + +最终的输出: + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_007.png) + +按 n 则通过文件名来排序,按 s 则按文件大小来排序(默认的)。 + +#### 4. slurm #### + +一个基于网络接口的带宽监控命令行程序,它会用字符来显示文本图形。 + + $ apt-get install slurm + +例如: + + $ slurm -i + +---------- + + $ slurm -i eth1 + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0091.png) + +**选项** + +- 按 **l** 显示 lx/tx 指示灯. +- 按 **c** 切换到经典模式. +- 按 **r** 刷新屏幕. +- 按 **q** 退出. + +#### 5.findmnt #### + +Findmnt 命令用于查找挂载的文件系统。它用来列出安装设备,当需要时也可以挂载或卸载设备,它是 util-linux 软件包的一部分。 + +例子: + + $findmnt + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0101.png) + +以列表格式输出。 + + $ findmnt -l + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0111.png) + +列出在 fstab 中挂载的文件系统。 + + $ findmnt -s + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0122.png) + +按文件类型列出已挂载的文件系统。 + + $ findmnt -t ext4 + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0131.png) + +#### 6. dstat #### + +一种灵活的组合工具,它可用于监控内存,进程,网络和磁盘性能,它可以用来取代 ifstat, iostat, dmstat 等。 + + $apt-get install dstat + +例如: + +查看有关 cpu,硬盘和网络的详细信息。 + + $ dstat + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0141.png) + +**-c** cpu + + $ dstat -c + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0151.png) + +**-d** 磁盘 + + $ dstat -d + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0161.png) + +显示 cpu、磁盘等的详细信息。 + + $ dstat -cdl -D sda1 + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_017.png) + +#### 7. saidar #### + +另一种基于命令行的系统统计数据监控工具,提供了有关磁盘使用,网络,内存,交换分区等信息。 + + $ sudo apt-get install saidar + +例如: + + $ saidar + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0181.png) + +启用彩色输出 + + $ saider -c + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0191.png) + +#### 8. ss #### + +ss(socket statistics)是一个很好的替代 netstat 的选择,它从内核空间收集信息,比 netstat 的性能更好。 + +例如: + +列出所有的连接 + + $ ss |less + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0201.png) + +列出 tcp 流量 + + $ ss -A tcp + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0211.png) + +列出进程名和 pid + + $ ss -ltp + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0221.png) + +#### 9. ccze #### + +一个美化日志显示的工具 :). + + $ apt-get install ccze + +例如: + + $ tailf /var/log/syslog | ccze + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0231.png) + +列出 ccze 模块: + + $ ccze -l + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_0241.png) + +将日志保存为 html 文件。 + + tailf /var/log/syslog | ccze -h > /home/tux/Desktop/rajneesh.html + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_025.png) + +#### 10. ranwhen.py #### + +一种基于 Python 的终端工具,它可以用来以图形方式显示系统活动状态。详细信息以一个丰富多彩的柱状图来展示。 + +安装 python(LCTT 译注:一般来说,你应该已经有了 python,不需要此步): + + $ sudo apt-add-repository ppa:fkrull/deadsnakes + +更新系统: + + $ sudo apt-get update + +下载 python: + + $ sudo apt-get install python3.2 + +[点此下载 ranwhen.py][1] + + $ unzip ranwhen-master.zip && cd ranwhen-master + +运行工具。 + + $ python3.2 ranwhen.py + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Selection_026.png) + +### 结论 ### + +这都是些不常见但重要的 Linux 管理工具。他们可以在日常生活中帮助用户。在我们即将发表的文章中,我们会尽量多带来些管理员/用户工具。 + +玩得愉快! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/10-useful-utilities-linux-users/ + +作者:[Rajneesh Upadhyay][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/rajneesh/ +[1]:https://github.com/p-e-w/ranwhen/archive/master.zip diff --git a/published/201510/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md b/published/201510/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md new file mode 100644 index 0000000000..051a15638f --- /dev/null +++ b/published/201510/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md @@ -0,0 +1,53 @@ +Linux 有问必答:如何在 Linux 中永久修改 USB 设备权限 +================================================================================ +> **提问**:当我尝试在 Linux 中运行 USB GPS 接收器时我遇到了下面来自 gpsd 的错误。 +> +> gpsd[377]: gpsd:ERROR: read-only device open failed: Permission denied +> gpsd[377]: gpsd:ERROR: /dev/ttyUSB0: device activation failed. +> gpsd[377]: gpsd:ERROR: device open failed: Permission denied - retrying read-only +> +> 看上去 gpsd 没有权限访问 USB 设备(/dev/ttyUSB0)。我该如何永久修改它在Linux上的权限? + +当你在运行一个会读取或者写入USB设备的进程时,进程的用户/组必须有权限这么做才行。当然你可以手动用`chmod`命令改变 USB 设备的权限,但是手动的权限改变只是暂时的。USB 设备会在下次重启时恢复它的默认权限。 + +![](https://farm6.staticflickr.com/5741/20848677843_202ff53303_c.jpg) + +作为一个永久的方式,你可以创建一个基于 udev 的 USB 权限规则,它可以根据你的选择分配任何权限模式。下面是该如何做。 + +首先,你需要找出 USB 设备的 vendorID 和 productID。使用`lsusb`命令。 + + $ lsusb -vvv + +![](https://farm1.staticflickr.com/731/20848677743_39f76eb403_c.jpg) + +上面`lsusb`的输出中,找出你的 USB 设备,并找出"idVendor"和"idProduct"字段。本例中,我们的结果是`idVendor (0x067b)`和 `idProduct (0x2303)` + +下面创建一个新的udev规则。 + + $ sudo vi /etc/udev/rules.d/50-myusb.rules + +---------- + + SUBSYSTEMS=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GROUP="users", MODE="0666" + +用你自己的"idVendor"和"idProduct"来替换。**MODE="0666"**表示USB设备的权限。 + +现在重启电脑并重新加载 udev 规则: + + $ sudo udevadm control --reload + +接着验证下 USB 设备的权限。 + +![](https://farm1.staticflickr.com/744/21282872179_9a4a05d768_b.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/change-usb-device-permission-linux.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/published/201510/20151012 Linux FAQs with Answers--How to force password change at the next login on Linux.md b/published/201510/20151012 Linux FAQs with Answers--How to force password change at the next login on Linux.md new file mode 100644 index 0000000000..22c298c047 --- /dev/null +++ b/published/201510/20151012 Linux FAQs with Answers--How to force password change at the next login on Linux.md @@ -0,0 +1,54 @@ +Linux有问必答:如何强制在下次登录Linux时更换密码 +================================================================================ +> **提问**:我管理着一台多人共享的Linux服务器。我刚使用默认密码创建了一个新用户,但是我想用户在第一次登录时更换密码。有没有什么方法可以让他/她在下次登录时修改密码呢? + +在多用户Linux环境中,标准实践是使用一个默认的随机密码创建一个用户账户。成功登录后,新用户自己改变默认密码。出于安全考虑,经常建议“强制”用户在第一次登录时修改密码来确保这个一次性使用的密码不会再被使用。 + +下面是**如何强制用户在下次登录时修改他/她的密码**。 + +每个Linux用户都关联这不同的密码相关配置和信息。比如,记录着上次密码更改的日期、最小/最大的修改密码的天数、密码何时过期等等。 + +一个叫chage的命令行工具可以访问并调整密码过期相关配置。你可以使用这个工具来强制用户在下次登录修改密码、 + +要查看特定用户的过期信息(比如:alice),运行下面的命令。注意的是除了你自己之外查看其他任何用户的密码信息都需要root权限。 + + $ sudo chage -l alice + +![](https://c1.staticflickr.com/1/727/21955581605_5471e61ee0_c.jpg) + +### 强制用户修改密码 ### + +如果你想要强制用户去修改他/她的密码,使用下面的命令。 + + $ sudo chage -d0 + +原本“-d ”参数是用来设置密码的“年龄”(也就是上次修改密码起到1970/1/1起的天数)。因此“-d0”的意思是上次密码修改的时间是1970/1/1,这就让当前的密码过期了,也就强制让他在下次登录的时候修改密码了。 + +另外一个过期当前密码的方式是用passwd命令。 + + $ sudo passwd -e + +上面的命令和“chage -d0”作用一样,让当前用户的密码立即过期。 + +现在检查用户的信息,你会发现: + +![](https://c2.staticflickr.com/6/5770/21767501480_ba88f00d80_c.jpg) + +当你再次登录时候,你会被要求修改密码。你会在修改前被要求再验证一次当前密码。 + +![](https://c2.staticflickr.com/6/5835/21929638636_eed4d69cb9_c.jpg) + +要设置更全面的密码策略(如密码复杂性,防止重复使用),则可以使用PAM。参见[这篇文章][1]了解更多详情。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/force-password-change-next-login-linux.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://xmodulo.com/set-password-policy-linux.html diff --git a/published/201510/20151013 Mytodo--A ToDo List Manager For DIY Lovers.md b/published/201510/20151013 Mytodo--A ToDo List Manager For DIY Lovers.md new file mode 100644 index 0000000000..84ebd749f4 --- /dev/null +++ b/published/201510/20151013 Mytodo--A ToDo List Manager For DIY Lovers.md @@ -0,0 +1,55 @@ +Mytodo:为 DIY 爱好者准备的待办事项管理软件 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Mytodo-Linux.jpg) + +通常我关注的软件都是那些不用折腾并且易用的(对图形界面而言)。这就是我把 [Go For It][1] 待办事项程序归到 [Linux 产能工具][2] 列表的原因。今天,我要向你们展示另一款待办事项列表应用,和其它的待办事项软件有点不一样。 + +[Mytodo][3] 是个开源的待办事项列表程序,让你能够掌管一切。与其它类似的程序不同的是,Mytodo 更加面向 DIY 爱好者,因为它允许你配置服务器(如果你想在多台电脑上使用的话),除了主要的功能外还提供一个命令行界面。 + +它是用 Python 编写的,因此可以在所有 Linux 发行版以及其它操作系统,比如 Windows 上使用。 + +Mytodo 的一些主要特性: + +- 同时拥有图形界面和命令行界面 +- 配置你自己的服务器 +- 添加用户/密码 +- Python 编写 +- 可根据标签搜索 +- 待办事项可以在 [Conky][4] 显示 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Mytodo-list.jpeg) + +*图形界面* + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Mytodo-list-cli.jpeg) + +*命令行* + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Mytodo-list-conky.jpeg) + +*Conky 显示着待办事项* + +你可以在下面的 Github 链接里找到源码和配置介绍: + +- [下载和配置 Mytodo ][5] + +尽管有些人可能不大喜欢命令行和配置部分的内容,但它自然有它的乐趣所在。我建议你自己尝试一下,看看 Mytodo 是否符合我们的需求和口味。 + +图片致谢: https://pixabay.com/en/to-do-list-task-list-notes-written-734587 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/mytodo-list-manager/ + +作者:[Abhishek][a] +译者:[alim0x](https://github.com/alim0x) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/go-for-it-to-do-app-in-linux/ +[2]:https://linux.cn/article-6425-1.html +[3]:https://github.com/mohamed-aziz/mytodo +[4]:http://itsfoss.com/conky-gui-ubuntu-1304/ +[5]:https://github.com/mohamed-aziz/mytodo diff --git a/published/201510/20151015 New Collaborative Group to Speed Real-Time Linux.md b/published/201510/20151015 New Collaborative Group to Speed Real-Time Linux.md new file mode 100644 index 0000000000..34d14e2253 --- /dev/null +++ b/published/201510/20151015 New Collaborative Group to Speed Real-Time Linux.md @@ -0,0 +1,78 @@ +新的 RTL 协作组将加速实时 Linux 的发展 +================================================================================ +![](http://www.linux.com/images/stories/66866/Tux-150.png) + +在本周的 Linux 大会活动(LinuxCon)上 Linux 基金会(Linux Foundation)[宣称][1],实时Linux操作系统项目(RTL,Real-Time Linux)得到了新的资金支持,并预期这将促进该项目,使其自成立15年来第一次有机会在实时操作性上和其他的实时操作系统(RTOS,Real Time Operation System)一较高下。Linux 基金会将 RTL 组重组为一个新的项目,并命名为RTL协作组(Real-Time Linux Collaborative Project),该项目将获得更有力的资金支持,更多的开发人员将投入其中,并更加紧密地集成到 Linux 内核主线开发中。 + +根据 Linux 基金会的说法,RTL 项目并入 Linux基金会旗下后,“在研发方面将为业界节省数百万美元的费用。”同时此举也将“通过强有力的上游内核测试体系而改善本项目的代码质量”。 + +在过去的十几年中,RTL 项目的开发管理和经费资助主要由[开源自动化开发实验室] [2](OSADL,Open Source Automation Development Lab)承担,OSADL 将继续作为新合作项目的金牌成员之一,但其原来承担的资金资助工作将会在一月份移交给 Linux 基金会。RTL 项目和 [OSADL][3] 长久以来一直负责维护[内核的实时抢占(RT-Preempt 或 Preempt-RT)][4]补丁,并定期将其更新到 Linux 内核的主线上。 + +据长期以来一直担任 OSADL 总经理的 Carsten Emde 博士介绍,支持内核实时特性的工作已经完成了将近 90%。 “这就像盖房子,”他解释说。 “主要的部件,如墙壁,窗户和门都已经安装到位,就实时内核来说,类似的主要部件包括:高精度定时器(high-resolution timers),中断线程化机制(interrupt threads)和优先级可继承的互斥量(priority-inheritance mutexes)等。然后所剩下的就是需要一些边边角角的工作,就如同装修房子过程中还剩下铺设如地毯和墙纸等来完成最终的工程。” + +以 Emde 观点来看,从技术的角度来说,实时 Linux 的性能已经可以媲美绝大多数其他的实时操作系统 - 但前提是你要不厌其烦地把所有的补丁都打上。 Emde 的原话如下:“该项目(LCTT 译注,指RTL)的唯一目标就是提供一个满足实时性要求的 Linux 系统,使其无论运行状况如何恶劣都可以保证在确定的、可以预先定义的时间期限内对外界处理做出响应。这个目标已经实现,但需要你手动地将 RTL 提供的补丁添加到 Linux 内核主线的版本代码上,但将来的不用打补丁的实时 Linux 内核也能实现这个目标。唯一的,当然也是最重要的区别就是相应的维护工作将少得多,因为我们再也不用一次又一次移植那些独立于内核主线的补丁代码了。” + +新的 RTL 协作组将继续在 Thomas Gleixner 的指导下工作,Thomas Gleixner 在过去的十多年里一直是 RTL 的核心维护人员。本周,Gleixner 被任命为 Linux 基金会成员,并加入了一个特别的小组,小组成员包括 Linux 稳定内核维护者Greg Kroah-Hartman,Yocto 项目维护者 Richard Purdie 和 Linus Torvalds 本人。 + +据 Emde 介绍,RTL 的第二维护人 Steven Rostedt 来自 Red Hat 公司,他负责“维护旧的,但尚保持维护的内核版本”,他将和同样来自 Red Hat 的 Ingo Molnàr 继续参与该项目,Ingo 是 RTL 的关键开发人员,但近年来更多地从事咨询方面的工作。有些令人惊讶的是,Red Hat 竟然不是 RTL 协作组的成员之一。相反,谷歌作为唯一的白金会员占据了头把交椅,其他黄金会员包括国家仪器公司(NI,National Instruments),OSADL 和德州仪器(TI)。银卡会员包括Altera 公司,ARM,Intel 和 IBM。 + +###走向实时内核的漫长道路### + +当15年前 Linux 第一次出现在嵌入式设备上的时候,它所面临的嵌入式计算市场已经被其他的实时操作系统,譬如风河公司(WindRiver)的 VxWorks,所牢牢占据。VxWorks 从那时起到现在,一直在为众多的工控设备、航空电子设备以及交通运输应用提供着工业级别的高确定性的,硬实时的内核。微软后来也提供了一个支持实时性的操作系统版本- Windows CE,当时的 Linux 所面临的是来自潜在工业客户的公开嘲讽和层层阻力。他们认为那些从桌面系统改进来的 Linux 发行版本顶多适合要求不高的轻量级消费类电子产品,而不适合那些对硬实时要求更高的设备。 + +对于嵌入式 Linux 的先行者如 [MontaVista 公司][6]来说,其[早期的目标][5]很明确就是要改进 Linux 的实时能力。多年以来,对 Linux 的实时性能开发发展迅速,得到各种组织的支持,如[成立于2006年][7]的 OSADL,以及实时 Linux 基金会(RTLF,Real-Time Linux Foundation)。在2009年 [OSADL 与 RTLF 合并][8],OSADL 及其 RTL 组承担了所有的抢占式实时内核(Preempt-RT)补丁的维护工作和将补丁提交到上游内核主线的工作。除此之外 OSADL 还负责监管其他自动化相关的项目,例如[高可靠性 Linux][9](Safety Critical Linux)(译者注:指研究如何在关键系统上可靠安全地运行Linux)。 + +OSADL 对 RTL 的支持经历了三个阶段:拥护和推广,测试和质量评估,以及最后的资金支持。Emde 表示,在早期,OSADL 的角色仅限于写写推广的文章,制作专题报告,组织相关培训,以及“宣传” RTL 的优点。他说:“要让一个相当保守的工控行业接受象 Linux 之类的新技术及其基于社区的那种开发模式,首先就需要建立其对新事物的信任。从使用专有的实时操作系统转向改用 Linux 对公司意味着必须引入新的战略和流程,才能与社区进行互动。” + +后来,OSADL 改而提供技术性能数据,建立[质量评估和测试中心][10],并在和开源相关的法律事务问题和安全认证方面向行业成员提供帮助。 + +当 RTL 在实时性上变得愈加成熟的同时,相反地 Windows CE 却是江河日下,[其市场份额正在快速地被 RTL 所蚕食][11],一些与 RTL 竞争的实时 Linux 项目,主要是 [Xenomai][12] 也已开始集成 RTL。 + +“伴随 RTL 补丁的成功,以及明确的预期其最终会被完整集成到 Linux 内核主线代码中,导致 Xenomai 关注的重心发生了变化,”Emde 说。 “Xenomai 3.0 可与 RT 补丁结合起来使用,并提供了所谓的‘皮肤’,(LCTT 译注:一个封装层),使我们可以复用为其他系统编写的代码。不过,它们还没有完全统一起来,因为 Xenomai 使用了双内核方法,而RT 补丁只适用于单一的 Linux 内核。“ + +近些年来,RTL 组的资助来源越来越少,所以最终 OSADL 接过了这个重任。Emde 说:“当最近开发工作因缺少资金而陷入停滞时,OSADL 对 RTL 的支持进入到第三个重大阶段:开始直接资助 Thomas Gleixner 的工作。” + +正如 Emde 在其[10月5日的一篇博文][13]中所描述的那样,实时 Linux 的应用领域正在日益扩大,由其原来主要服务的工业控制扩大到了汽车行业和电信业等领域,这表明资助的来源也应该得到拓宽。Emde 原文写道:“仅仅靠来自工控行业的资金来支撑全部的工作是不合理的,因为电信等其他行业也在享用实时 Linux 内核。” + +当 Linux 基金会表明有兴趣提供资金支持时,OSADL 认为“单一的资助和控制渠道要有效得多”(LCTT 译注:指最终由Linux 基金会全盘接手了 RTL 项目),Emde 如是说。不过,他补充说,作为黄金级成员,OSADL 仍参与监管项目的工作,会继续从事其宣传和质量保证方面的活动。 + +###汽车行业期待 RTL 的崛起### + +Emde 表示,RTL 会继续在工业应用领域飞速发展并逐渐取代其他实时操作系统。而且,他补充说,RTL 在汽车行业发展也很迅猛,以后会扩大并应用到铁路和航空电子设备上。 + +的确,Linux 在汽车行业将扮演越来越重要的角色,这也是 Linux 基金对 RTL 所寄予厚望的原因之所在。RTL 工作组可能会与 Linux 基金会旗下的[车载Linux][14](AGL,Automotive Grade Linux)工作组展开合作。Emde 猜测,Google 高调参与的主要动因可能也是希望将 RTL 用于汽车控制。此外,德州仪器(TI)也非常期望将其 Jacinto 处理器应用于汽车行业。 + +面向车载 Linux 的项目(比如AGL)的目标是要扩大 Linux 在车载设备上的应用范围,其应用不是仅限于车载信息娱乐(IVI,In-Vehicle Infotainment),而是要进入到譬如集群控制和车载通讯领域,而这些领域目前主要使用的是 QNX 之类的实时操作系统。无人驾驶汽车在实时性上对操作系统也有很高的要求。 + +Emde 特别指出,OSADL 的 [SIL2LinuxMP][15] 项目可能会在将 RTL 引入到汽车工业领域上扮演重要的角色。SIL2LinuxMP 并不是专门针对汽车工业的项目,但随着 BMW 公司参与其中,汽车行业成为其很重要的应用领域之一。该项目的目标在于验证 RTL 在采用单核或多核 CPU 的标准化商用(COTS,Commercial Off-The-Shelf)板卡上运行所需的基本组件。它定义了引导程序、根文件系统、Linux 内核以及对应支持 RTL 的 C 库。 + +无人机和机器人使用实时 Linux 的时机也已成熟,Xenomai 系统早已用在许多机器人以及一些无人机中。不过,在更广泛的嵌入式 Linux 世界,包括了消费电子产品和物联网应用中,RTL 可以扮演的角色很有限。主要的障碍在于,无线通信和互联网本身会带来延迟。 + +Emde 说:“目前实时 Linux 主要还是应用于系统内部控制以及系统与周边外设之间的控制,在远程控制机器上作用不大。企图通过互联网实现实时控制恐怕不是一件可行的事情。” + +-------------------------------------------------------------------------------- + +via: http://www.linux.com/news/software/applications/858828-new-collaborative-group-to-speed-real-time-linux + +作者:[Eric Brown][a] +译者:[unicornx](https://github.com/unicornx) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linux.com/community/forums/person/42808 +[1]:http://www.linuxfoundation.org/news-media/announcements/2015/10/linux-foundation-announces-project-advance-real-time-linux +[2]:http://archive.linuxgizmos.com/celebrating-the-open-source-automation-development-labs-first-birthday/ +[3]:https://www.osadl.org/ +[4]:http://linuxgizmos.com/adding-real-time-to-linux-with-preempt-rt/ +[5]:http://archive.linuxgizmos.com/real-time-linux-what-is-it-why-do-you-want-it-how-do-you-do-it-a/ +[6]:http://www.linux.com/news/embedded-mobile/mobile-linux/841651-embedded-linux-pioneer-montavista-spins-iot-linux-distribution +[7]:http://archive.linuxgizmos.com/industry-group-aims-linux-at-automation-apps/ +[8]:http://archive.linuxgizmos.com/industrial-linux-groups-merge/ +[9]:https://www.osadl.org/Safety-Critical-Linux.safety-critical-linux.0.html +[10]:http://www.osadl.org/QA-Farm-Realtime.qa-farm-about.0.html +[11]:http://www.linux.com/news/embedded-mobile/mobile-linux/818011-embedded-linux-keeps-growing-amid-iot-disruption-says-study +[12]:http://xenomai.org/ +[13]:https://www.osadl.org/Single-View.111+M5dee6946dab.0.html +[14]:http://www.linux.com/news/embedded-mobile/mobile-linux/833358-first-open-automotive-grade-linux-spec-released +[15]:http://www.osadl.org/SIL2LinuxMP.sil2-linux-project.0.html \ No newline at end of file diff --git a/published/201510/20151019 10 passwd command examples in Linux.md b/published/201510/20151019 10 passwd command examples in Linux.md new file mode 100644 index 0000000000..6e19bef6b2 --- /dev/null +++ b/published/201510/20151019 10 passwd command examples in Linux.md @@ -0,0 +1,149 @@ +10 个 Linux 中的 passwd 命令示例 +================================================================================ + +正如 **passwd** 命令的名称所示,其用于改变系统用户的密码。如果 passwd 命令由非 root 用户执行,那么它会询问当前用户的密码,然后设置调用该命令的用户的新密码。当此命令由超级用户 root 执行的话,就可以重新设置任何用户的密码,包括不知道当前密码的用户。 + +在这篇文章中,我们将用实例来介绍 passwd 命令。 + +#### 语法 : #### + + # passwd {options} {user_name} + +可以在 passwd 命令使用不同的选项,列表如下: + +![](http://www.linuxtechi.com/wp-content/uploads/2015/09/passwd-command-options.jpg) + +### 例1:更改系统用户的密码 ### + +当你使用非 root 用户登录时,比如我使用 ‘linuxtechi’ 登录的情况下,运行 passwd 命令它会重置当前登录用户的密码。 + + [linuxtechi@linuxworld ~]$ passwd + Changing password for user linuxtechi. + Changing password for linuxtechi. + (current) UNIX password: + New password: + Retype new password: + passwd: all authentication tokens updated successfully. + [linuxtechi@linuxworld ~]$ + +当你作为 root 用户登录后并运行 **passwd** 命令时,它默认情况下会重新设置 root 的密码,如果你在 passwd 命令后指定了用户名,它会重置该用户的密码。 + + [root@linuxworld ~]# passwd + [root@linuxworld ~]# passwd linuxtechi + +![](http://www.linuxtechi.com/wp-content/uploads/2015/09/passwd-command.jpg) + +**注意** : 系统用户的密码以加密的形式保存在 /etc/shadow 文件中。 + +### 例2:显示密码状态信息 ### + +要显示用户密码的状态信息,请在 passwd 命令后使用 **-S** 选项。 + + [root@linuxworld ~]# passwd -S linuxtechi + linuxtechi PS 2015-09-20 0 99999 7 -1 (Password set, SHA512 crypt.) + [root@linuxworld ~]# + +在上面的输出中,第一个字段显示的用户名,第二个字段显示密码状态(**PS = 密码设置,LK = 密码锁定,NP = 无密码**),第三个字段显示了上次修改密码的时间,后面四个字段分别显示了密码能更改的最小期限和最大期限,警告期限和没有使用该口令的时长。 + +### 例3:显示所有账号的密码状态信息 ### + +为了显示所有用户密码的状态信息需要使用 “**-aS**”选项在passwd 命令中,示例如下所示: + + root@localhost:~# passwd -Sa + +![](http://www.linuxtechi.com/wp-content/uploads/2015/09/passwd-sa.jpg) + +(LCTT译注:不同发行版/passwd 的行为不同。CentOS6.6 没有测试成功,但 Ubuntu 可以。) + +### 例4:使用 -d 选项删除用户的密码 ### + +用我做例子,删除 ‘**linuxtechi**‘ 用户的密码。 + + [root@linuxworld ~]# passwd -d linuxtechi + Removing password for user linuxtechi. + passwd: Success + [root@linuxworld ~]# + [root@linuxworld ~]# passwd -S linuxtechi + linuxtechi NP 2015-09-20 0 99999 7 -1 (Empty password.) + [root@linuxworld ~]# + +“**-d**” 选项将清空用户密码,并禁用用户登录。 + +### 例5:设置密码立即过期 ### + +在 passwd 命令中使用 '-e' 选项会立即使用户的密码过期,这将强制用户在下次登录时更改密码。 + + [root@linuxworld ~]# passwd -e linuxtechi + Expiring password for user linuxtechi. + passwd: Success + [root@linuxworld ~]# passwd -S linuxtechi + linuxtechi PS 1970-01-01 0 99999 7 -1 (Password set, SHA512 crypt.) + [root@linuxworld ~]# + +现在尝试用 linuxtechi 用户 SSH 连接到主机。 + +![](http://www.linuxtechi.com/wp-content/uploads/2015/09/passwd-expiry.jpg) + +### 例6:锁定系统用户的密码 ### + +在 passwd 命令中使用 ‘**-l**‘ 选项能锁定用户的密码,它会在密码的起始位置加上“!”。当他/她的密码被锁定时,用户将不能更改它的密码。 + + [root@linuxworld ~]# passwd -l linuxtechi + Locking password for user linuxtechi. + passwd: Success + [root@linuxworld ~]# passwd -S linuxtechi + linuxtechi LK 2015-09-20 0 99999 7 -1 (Password locked.) + [root@linuxworld ~]# + +### 例7:使用 -u 选项解锁用户密码 ### + + [root@linuxworld ~]# passwd -u linuxtechi + Unlocking password for user linuxtechi. + passwd: Success + [root@linuxworld ~]# + +### 例8:使用 -i 选项设置非活动时间 ### + +在 passwd 命令中使用 -i 选项用于设系统用户的非活动时间。当用户(我使用的是linuxtechi用户)密码过期后,用户再经过 ‘**n**‘ 天后(在我的情况下是10天)没有更改其密码,用户将不能登录。 + + [root@linuxworld ~]# passwd -i 10 linuxtechi + Adjusting aging data for user linuxtechi. + passwd: Success + [root@linuxworld ~]# + [root@linuxworld ~]# passwd -S linuxtechi + linuxtechi PS 2015-09-20 0 99999 7 10 (Password set, SHA512 crypt.) + [root@linuxworld ~]# + +### 例9:使用 -n 选项设置密码更改的最短时间 ### + +在下面的例子中,linuxtechi用户必须在90天内更改密码。0表示用户可以在任何时候更改它的密码。 + + [root@linuxworld ~]# passwd -n 90 linuxtechi + Adjusting aging data for user linuxtechi. + passwd: Success + [root@linuxworld ~]# passwd -S linuxtechi + linuxtechi PS 2015-09-20 90 99999 7 10 (Password set, SHA512 crypt.) + [root@linuxworld ~]# + +### 例10:使用 -w 选项设置密码过期前的警告期限 ### + +‘**-w**’ 选项在 passwd 命令中用于设置用户的警告期限。这意味着,n天之后,他/她的密码将过期。 + + [root@linuxworld ~]# passwd -w 12 linuxtechi + Adjusting aging data for user linuxtechi. + passwd: Success + [root@linuxworld ~]# passwd -S linuxtechi + linuxtechi PS 2015-09-20 90 99999 12 10 (Password set, SHA512 crypt.) + [root@linuxworld ~]# + +-------------------------------------------------------------------------------- + +via: http://www.linuxtechi.com/10-passwd-command-examples-in-linux/ + +作者:[Pradeep Kumar][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxtechi.com/author/pradeep/ diff --git a/published/201510/20151019 11 df command examples in Linux.md b/published/201510/20151019 11 df command examples in Linux.md new file mode 100644 index 0000000000..a5e3c827ba --- /dev/null +++ b/published/201510/20151019 11 df command examples in Linux.md @@ -0,0 +1,259 @@ + Linux 中 df 命令的11个例子 +================================================================================ + +df 即“可用磁盘”(disk free),用于显示文件系统的磁盘使用情况。默认情况下 df 命令将以每块 1K 的单位进行显示所有当前已挂载的文件系统,如果你想以人类易读的格式显示 df 命令的输出,像这样“df -h”使用 -h 选项。 + +在这篇文章中,我们将讨论 `df` 命令在 Linux 下11种不同的实例。 + +在 Linux 下 df 命令的基本格式为: + + # df {options} {mount_point_of_filesystem} + +在 df 命令中可用的选项有: + +![](http://www.linuxtechi.com/wp-content/uploads/2015/10/df-command-options.jpg) + +df 的样例输出 : + + [root@linux-world ~]# df + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/vg00-root 17003304 804668 15311852 5% / + devtmpfs 771876 0 771876 0% /dev + tmpfs 777928 0 777928 0% /dev/shm + tmpfs 777928 8532 769396 2% /run + tmpfs 777928 0 777928 0% /sys/fs/cgroup + /dev/mapper/vg00-home 14987616 41000 14162232 1% /home + /dev/sda1 487652 62593 395363 14% /boot + /dev/mapper/vg00-var 9948012 48692 9370936 1% /var + /dev/mapper/vg00-sap 14987656 37636 14165636 1% /sap + [root@linux-world ~]# + +### 例1:使用 -a 选项列出所有文件系统的磁盘使用量 ### + +当我们在 df 命令中使用 `-a` 选项时,它会显示所有文件系统的磁盘使用情况。 + + [root@linux-world ~]# df -a + Filesystem 1K-blocks Used Available Use% Mounted on + rootfs 17003304 804668 15311852 5% / + proc 0 0 0 - /proc + sysfs 0 0 0 - /sys + devtmpfs 771876 0 771876 0% /dev + securityfs 0 0 0 - /sys/kernel/security + tmpfs 777928 0 777928 0% /dev/shm + devpts 0 0 0 - /dev/pts + tmpfs 777928 8532 769396 2% /run + tmpfs 777928 0 777928 0% /sys/fs/cgroup + cgroup 0 0 0 - /sys/fs/cgroup/systemd + pstore 0 0 0 - /sys/fs/pstore + cgroup 0 0 0 - /sys/fs/cgroup/cpuset + cgroup 0 0 0 - /sys/fs/cgroup/cpu,cpuacct + cgroup 0 0 0 - /sys/fs/cgroup/memory + cgroup 0 0 0 - /sys/fs/cgroup/devices + cgroup 0 0 0 - /sys/fs/cgroup/freezer + cgroup 0 0 0 - /sys/fs/cgroup/net_cls + cgroup 0 0 0 - /sys/fs/cgroup/blkio + cgroup 0 0 0 - /sys/fs/cgroup/perf_event + cgroup 0 0 0 - /sys/fs/cgroup/hugetlb + configfs 0 0 0 - /sys/kernel/config + /dev/mapper/vg00-root 17003304 804668 15311852 5% / + selinuxfs 0 0 0 - /sys/fs/selinux + systemd-1 0 0 0 - /proc/sys/fs/binfmt_misc + debugfs 0 0 0 - /sys/kernel/debug + hugetlbfs 0 0 0 - /dev/hugepages + mqueue 0 0 0 - /dev/mqueue + /dev/mapper/vg00-home 14987616 41000 14162232 1% /home + /dev/sda1 487652 62593 395363 14% /boot + /dev/mapper/vg00-var 9948012 48692 9370936 1% /var + /dev/mapper/vg00-sap 14987656 37636 14165636 1% /sap + [root@linux-world ~]# + +### 例2:以人类易读的格式显示 df 命令的输出 ### + +在 df 命令中使用`-h`选项,以人类易读的格式输出(例如,5K,500M 及 5G) + + [root@linux-world ~]# df -h + Filesystem Size Used Avail Use% Mounted on + /dev/mapper/vg00-root 17G 786M 15G 5% / + devtmpfs 754M 0 754M 0% /dev + tmpfs 760M 0 760M 0% /dev/shm + tmpfs 760M 8.4M 752M 2% /run + tmpfs 760M 0 760M 0% /sys/fs/cgroup + /dev/mapper/vg00-home 15G 41M 14G 1% /home + /dev/sda1 477M 62M 387M 14% /boot + /dev/mapper/vg00-var 9.5G 48M 9.0G 1% /var + /dev/mapper/vg00-sap 15G 37M 14G 1% /sap + [root@linux-world ~]# + +### 例3:显示特定文件系统已使用的空间 ### + +假如我们想显示 /sap 文件系统空间的使用情况。 + + [root@linux-world ~]# df -h /sap/ + Filesystem Size Used Avail Use% Mounted on + /dev/mapper/vg00-sap 15G 37M 14G 1% /sap + [root@linux-world ~]# + +### 例4:输出所有已挂载文件系统的类型 ### + +`-T` 选项用在 df 命令中用来显示文件系统的类型。 + + [root@linux-world ~]# df -T + Filesystem Type 1K-blocks Used Available Use% Mounted on + /dev/mapper/vg00-root ext4 17003304 804668 15311852 5% / + devtmpfs devtmpfs 771876 0 771876 0% /dev + tmpfs tmpfs 777928 0 777928 0% /dev/shm + tmpfs tmpfs 777928 8532 769396 2% /run + tmpfs tmpfs 777928 0 777928 0% /sys/fs/cgroup + /dev/mapper/vg00-home ext4 14987616 41000 14162232 1% /home + /dev/sda1 ext3 487652 62593 395363 14% /boot + /dev/mapper/vg00-var ext3 9948012 48696 9370932 1% /var + /dev/mapper/vg00-sap ext3 14987656 37636 14165636 1% /sap + [root@linux-world ~]# + +### 例5:按块大小输出文件系统磁盘使用情况 ### + + [root@linux-world ~]# df -k + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/vg00-root 17003304 804668 15311852 5% / + devtmpfs 771876 0 771876 0% /dev + tmpfs 777928 0 777928 0% /dev/shm + tmpfs 777928 8532 769396 2% /run + tmpfs 777928 0 777928 0% /sys/fs/cgroup + /dev/mapper/vg00-home 14987616 41000 14162232 1% /home + /dev/sda1 487652 62593 395363 14% /boot + /dev/mapper/vg00-var 9948012 48696 9370932 1% /var + /dev/mapper/vg00-sap 14987656 37636 14165636 1% /sap + [root@linux-world ~]# + +### 例6:输出文件系统的 inode 信息 ### + +`-i` 选项用在 df 命令用于显示文件系统的 inode 信息。 + +所有文件系统的 inode 信息: + + [root@linux-world ~]# df -i + Filesystem Inodes IUsed IFree IUse% Mounted on + /dev/mapper/vg00-root 1089536 22031 1067505 3% / + devtmpfs 192969 357 192612 1% /dev + tmpfs 194482 1 194481 1% /dev/shm + tmpfs 194482 420 194062 1% /run + tmpfs 194482 13 194469 1% /sys/fs/cgroup + /dev/mapper/vg00-home 960992 15 960977 1% /home + /dev/sda1 128016 337 127679 1% /boot + /dev/mapper/vg00-var 640848 1235 639613 1% /var + /dev/mapper/vg00-sap 960992 11 960981 1% /sap + [root@linux-world ~]# + +特定文件系统的 inode 信息: + + [root@linux-world ~]# df -i /sap/ + Filesystem Inodes IUsed IFree IUse% Mounted on + /dev/mapper/vg00-sap 960992 11 960981 1% /sap + [root@linux-world ~]# + +### 例7:输出所有文件系统使用情况汇总 ### + +`-total` 选项在 df 命令中用于显示所有文件系统的磁盘使用情况汇总。 + + [root@linux-world ~]# df -h --total + Filesystem Size Used Avail Use% Mounted on + /dev/mapper/vg00-root 17G 786M 15G 5% / + devtmpfs 754M 0 754M 0% /dev + tmpfs 760M 0 760M 0% /dev/shm + tmpfs 760M 8.4M 752M 2% /run + tmpfs 760M 0 760M 0% /sys/fs/cgroup + /dev/mapper/vg00-home 15G 41M 14G 1% /home + /dev/sda1 477M 62M 387M 14% /boot + /dev/mapper/vg00-var 9.5G 48M 9.0G 1% /var + /dev/mapper/vg00-sap 15G 37M 14G 1% /sap + total 58G 980M 54G 2% - + [root@linux-world ~]# + +### 例8:只打印本地文件系统磁盘的使用情况 ### + +假设网络文件系统也挂载在 Linux 上,但我们只想显示本地文件系统的信息,这可以通过使用 df 命令的 `-l` 选项来实现。 + +![](http://www.linuxtechi.com/wp-content/uploads/2015/10/nfs4-fs-mount.jpg) + +只打印本地文件系统: + + [root@linux-world ~]# df -Thl + Filesystem Type Size Used Avail Use% Mounted on + /dev/mapper/vg00-root ext4 17G 791M 15G 6% / + devtmpfs devtmpfs 754M 0 754M 0% /dev + tmpfs tmpfs 760M 0 760M 0% /dev/shm + tmpfs tmpfs 760M 8.4M 752M 2% /run + tmpfs tmpfs 760M 0 760M 0% /sys/fs/cgroup + /dev/mapper/vg00-home ext4 15G 41M 14G 1% /home + /dev/sda1 ext3 477M 62M 387M 14% /boot + /dev/mapper/vg00-var ext3 9.5G 105M 8.9G 2% /var + /dev/mapper/vg00-sap ext3 15G 37M 14G 1% /sap + [root@linux-world ~]# + +### 例9:打印特定文件系统类型的磁盘使用情况 ### + +`-t` 选项在 df 命令中用来打印特定文件系统类型的信息,用 `-t` 指定文件系统的类型,如下所示: + +对于 ext4 : + + [root@linux-world ~]# df -t ext4 + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/vg00-root 17003304 809492 15307028 6% / + /dev/mapper/vg00-home 14987616 41000 14162232 1% /home + [root@linux-world ~]# + +对于 nfs4 : + + [root@linux-world ~]# df -t nfs4 + Filesystem 1K-blocks Used Available Use% Mounted on + 192.168.1.5:/opensuse 301545472 266833920 19371008 94% /data + [root@linux-world ~]# + +### 例10:使用 -x 选项排除特定的文件系统类型 ### + +`-x` 或 `–exclude-type` 在 df 命令中用来在输出中排出某些文件系统类型。 + +假设我们想打印除 ext3 外所有的文件系统。 + + [root@linux-world ~]# df -x ext3 + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/vg00-root 17003304 809492 15307028 6% / + devtmpfs 771876 0 771876 0% /dev + tmpfs 777928 0 777928 0% /dev/shm + tmpfs 777928 8540 769388 2% /run + tmpfs 777928 0 777928 0% /sys/fs/cgroup + /dev/mapper/vg00-home 14987616 41000 14162232 1% /home + 192.168.1.5:/opensuse 301545472 266834944 19369984 94% /data + [root@linux-world ~]# + +### 例11:在 df 命令的输出中只打印特定的字段 ### + +`-output={field_name1,field_name2...}` 选项用于显示 df 命令某些字段的输出。 + +可用的字段名有: `source`, `fstype`, `itotal`, `iused`, `iavail`, `ipcent`, `size`, `used`, `avail`, `pcent` 和 `target` + + [root@linux-world ~]# df --output=fstype,size,iused + Type 1K-blocks IUsed + ext4 17003304 22275 + devtmpfs 771876 357 + tmpfs 777928 1 + tmpfs 777928 423 + tmpfs 777928 13 + ext4 14987616 15 + ext3 487652 337 + ext3 9948012 1373 + ext3 14987656 11 + nfs4 301545472 451099 + [root@linux-world ~]# + +-------------------------------------------------------------------------------- + +via: http://www.linuxtechi.com/11-df-command-examples-in-linux/ + +作者:[Pradeep Kumar][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxtechi.com/author/pradeep/ diff --git a/published/201510/20151019 How-To--Compile the Latest Wine 32-bit on 64-bit Ubuntu (15.10).md b/published/201510/20151019 How-To--Compile the Latest Wine 32-bit on 64-bit Ubuntu (15.10).md new file mode 100644 index 0000000000..06e28304c3 --- /dev/null +++ b/published/201510/20151019 How-To--Compile the Latest Wine 32-bit on 64-bit Ubuntu (15.10).md @@ -0,0 +1,39 @@ +如何在 64 位 Ubuntu 15.10 中编译最新版 32 位 Wine +================================================================================ +Wine 发布了最新的1.7.53版本。此版本带来的大量性能提升,包括**XAudio**,**Direct3D**代码清理,改善**OLE对象嵌入**技术,更好的** Web Services dll**的实现,还有其他大量更新。 + +![](http://www.tuxarena.com/wp-content/uploads/2015/10/wine1753a.jpg) + +虽然有一个官方 [Wine][1] PPA,但目前只提供1.7.44版本,所以安装最新版本可以从源码编译安装。 + +[下载源码包][2]([直接下载地址在此][3])并解压 `tar -xf wine-1.7.53`。然后,安装如下依赖。 + + sudo apt-get install build-essential gcc-multilib libx11-dev:i386 libfreetype6-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libxshmfence-dev:i386 libxxf86vm-dev:i386 libxrandr-dev:i386 libxinerama-dev:i386 libxcomposite-dev:i386 libglu1-mesa-dev:i386 libosmesa6-dev:i386 libpcap0.8-dev:i386 libdbus-1-dev:i386 libncurses5-dev:i386 libsane-dev:i386 libv4l-dev:i386 libgphoto2-dev:i386 liblcms2-dev:i386 gstreamer0.10-plugins-base:i386 libcapi20-dev:i386 libcups2-dev:i386 libfontconfig1-dev:i386 libgsm1-dev:i386 libtiff5-dev:i386 libmpg123-dev:i386 libopenal-dev:i386 libldap2-dev:i386 libgnutls-dev:i386 libjpeg-dev:i386 + +现在切换到 wine-1.7.53 解压后的文件夹,并输入: + + ./configure + make + sudo make install + +同样地,你也可以给配置脚本指定 prefix 参数。以普通用户安装 wine: + + ./configure --prefix=$HOME/usr/bin + make + make install + +这种情况下,Wine 将会安装在`$HOME/usr/bin/wine`,所以请检查`$HOME/usr/bin`在你的`PATH`变量中。 + +-------------------------------------------------------------------------------- + +via: http://www.tuxarena.com/2015/10/how-to-compile-latest-wine-32-bit-on-64-bit-ubuntu-15-10/ + +作者:Craciun Dan +译者:[VicYu/Vic020](http://vicyu.net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://launchpad.net/~ubuntu-wine/+archive/ubuntu/ppa +[2]:https://www.winehq.org/announce/1.7.53 +[3]:http://prdownloads.sourceforge.net/wine/wine-1.7.53.tar.bz2 diff --git a/published/201510/20151020 Five Years of LibreOffice Evolution (2010-2015).md b/published/201510/20151020 Five Years of LibreOffice Evolution (2010-2015).md new file mode 100644 index 0000000000..e21ebc06e9 --- /dev/null +++ b/published/201510/20151020 Five Years of LibreOffice Evolution (2010-2015).md @@ -0,0 +1,83 @@ +LibreOffice 这五年(2010-2015) +================================================================================ +注:youtube 视频 + + + +[LibreOffice][1],来自文档基金会(The Document Foundation)一个自由开源的令人惊叹的办公套件。LO (LibreOffice)在2010年9月28日由 [OpenOffice.org][2] 分支出来;而 OOo (OpenOffice.org)则是早期的 [StarOffice][3] 开源版本。LibreOffice 支持文字处理,创建与编辑电子表格,幻灯片,图表和图形,数据库,数学公式的创建和编辑等。 + +### 核心应用: ### + +- **Writer** – 文字处理器 +- **Calc** – 电子表格应用程序,类似于 Excel +- **Impress** – 应用演示,支持 Microsoft PowerPoint 的格式 +- **Draw** – 矢量图形编辑器 +- **Math** – 用于编写和​​编辑数学公式的特殊应用 +- **Base** – 数据库管理 + +![LibreOffice 3.3, 2011](https://github.com/paulcarroty/Articles/raw/master/LO_History/3.3/Help-License-Info.png) + +*LibreOffice 3.3, 2011* + +这是LibreOffice 的第一个版本 - 分支自 OpenOffice.org + +![LibreOffice 3.4](https://github.com/paulcarroty/Articles/raw/master/LO_History/3.4/1cc80d1cada204a061402785b2048f7clibreoffice-3.4.3.png) + +*LibreOffice 3.4* + +![LibreOffice 3.5](https://raw.githubusercontent.com/paulcarroty/Articles/master/LO_History/3.5/libreoffice35-large_001.jpg) + +*LibreOffice 3.5* + +![LibreOffice 3.6](https://github.com/paulcarroty/Articles/raw/master/LO_History/3.6/libreoffice-3.6.0.png) + +*LibreOffice 3.6* + +![Libre Office 4.0](https://github.com/paulcarroty/Articles/raw/master/LO_History/4.0/libreoffice-writer.png) + +*LibreOffice 4.0* + +![Libre Office 4.1](https://github.com/paulcarroty/Articles/raw/master/LO_History/4.1/Writer1.png) + +*LibreOffice 4.1* + +![Libre Office 4.2](https://github.com/paulcarroty/Articles/raw/master/LO_History/4.2/libreoffice-4.2.png) + +*Libre Office 4.2* + +![LibreOffice 4.3](https://github.com/paulcarroty/Articles/raw/master/LO_History/4.3/libreoffice.jpg) + +*LibreOffice 4.3* + +![LibreOffice 4.4](https://github.com/paulcarroty/Articles/raw/master/LO_History/4.4/LibreOffice_Writer_4_4_2.png) + +*LibreOffice 4.4* + +![Libre Office 5.0](https://github.com/paulcarroty/Articles/raw/master/LO_History/5.0/LibreOffice_Writer_5.0.png) + +*LibreOffice 5.0* + +### Libre Office 的发展,出自 Wikipedia ### + +![StarOffice major derivatives](https://commons.wikimedia.org/wiki/File%3AStarOffice_major_derivatives.svg) + +### LibreOffice 5.0 预览 ### + +注:youtube 视频 + + + +-------------------------------------------------------------------------------- + +via: https://tlhp.cf/libreoffice-5years-evolution/ + +作者:[Pavlo Rudyi][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://tlhp.cf/author/paul/ +[1]:http://www.libreoffice.org/ +[2]:https://www.openoffice.org/ +[3]:http://www.staroffice.org/ diff --git a/published/201510/20151020 Linux History--24 Years Step by Step.md b/published/201510/20151020 Linux History--24 Years Step by Step.md new file mode 100644 index 0000000000..71a82faf8c --- /dev/null +++ b/published/201510/20151020 Linux History--24 Years Step by Step.md @@ -0,0 +1,299 @@ +Linux 的历史:24 年,一步一个脚印 +================================================================================ +注:youtube 视频 + + + +### 史前 ### + +没有 [C 编程语言][1] 和 [GNU 项目][2] 构成 Linux 环境,也就不可能有 Linux 的成功。 + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/00-1.jpg) + +*Ken Thompson 和 Dennis Ritchie* + +[Ken Thompson][1] 和 [Dennis Ritchie][2] 在 1969-1970 创造了 Unix 操作系统。之后发布了新的 [C 编程语言][3],它是一种高级的、可移植的编程语言。 Linux 内核用 C 和一些汇编代码写成。 + +![Richard Matthew Stallman](https://github.com/paulcarroty/Articles/raw/master/Linux_24/00-2.jpg) + +*Richard Matthew Stallman* + +[Richard Matthew Stallman][4] 在 1984 年启动了 [GNU 项目][5]。最大的一个目标 - 完全自由的类-Unix 操作系统。 + +### 1991 – 元年 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/1991-1.jpg) + +*Linus Torvalds, 1991* + +[Linus Torvalds][5] 在芬兰赫尔辛基开始了 Linux 内核开发,他是为他的硬件 - Intel 30386 CPU 编写的程序。他也使用 Minix 和 GNU C 编译器。下面是 Linus Torvalds 给 Minix 新闻组的历史消息: + +> From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds) +> Newsgroups: comp.os.minix +> Subject: What would you like to see most in minix? +> Summary: small poll for my new operating system +> Message-ID: +> Date: 25 Aug 91 20:57:08 GMT +> Organization: University of Helsinki +> +> +> Hello everybody out there using minix - +> +> I'm doing a (free) operating system (just a hobby, won't be big and +> professional like gnu) for 386(486) AT clones. This has been brewing +> since april, and is starting to get ready. I'd like any feedback on +> things people like/dislike in minix, as my OS resembles it somewhat +> (same physical layout of the file-system (due to practical reasons) +> among other things). +> +> I've currently ported bash(1.08) and gcc(1.40), and things seem to work. +> This implies that I'll get something practical within a few months, and +> I'd like to know what features most people would want. Any suggestions +> are welcome, but I won't promise I'll implement them :-) +> +> Linus (torvalds@kruuna.helsinki.fi) + +从此之后,Linux 开始得到了世界范围志愿者和专业专家的支持。Linus 的同事 Ari Lemmke 把它命名为 “Linux” - 这其实是他们的大学 ftp 服务器上的项目目录名称。 + +### 1992 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/1992-1.jpg) + +在 GPLv2 协议下发布了 0.12 版 Linux 内核。 + +### 1993 ### + +![Slackware 1.0 ](https://github.com/paulcarroty/Articles/raw/master/Linux_24/1993-1.png) + +Slackware 首次发布(LCTT 译注:Slackware Linux 是一个高度技术性的、干净的发行版,只有少量非常有限的个人设置) – 最早的 Linux 发行版,其领导者 Patrick Volkerding 也是最早的。其时,Linux 内核有 100 多个开发者。 + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/1993-2.png) + +*Debian* + +Debian – 最大的 Linux 社区之一也创立于 1991 年。 + +### 1994 ### + +Linux 1.0 发布了,多亏了 XFree 86 项目,第一次有了 GUI。 + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/1994-1.png) + +*Red Hat Linux* + +发布了 Red Hat Linux 1.0 + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/1994-2.png) + +*S.u.S.E Linux* + +和 [S.u.S.E. Linux][6] 1.0。 + +### 1995 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/1995-1.png) + +*Red Hat Inc.* + +Bob Young 和 Marc Ewing 合并他们的本地业务为 [Red Hat Software][7]。Linux 移植到了很多硬件平台。 + +### 1996 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/1996-1.png) + +*Tux* + +企鹅 Tux 是 Linux 官方吉祥物,Linus Torvalds 参观了堪培拉国家动物园和水族馆之后有了这个想法。发布了 Linux 2.0,支持对称多处理器。开始开发 KDE。 + +### 1997 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/1997-1.jpg) + +*Miguel de Icaza* + +Miguel de Icaza 和 Federico Mena 开始开发 GNOME - 自由桌面环境和应用程序。Linus Torvalds 赢得了 Linux 商标冲突官司,Linux 成为了 Linus Torvalds 的注册商标。 + +### 1998 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/1998-1.jpg) + +*大教堂和集市* + +Eric S. Raymond 出版了文章 [The Cathedral and the Bazaar(大教堂和集市)][8] - 高度推荐阅读。Linux 得到了大公司的支持: IBM、Oracle、康柏。 + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/1998-2.png) + +*Mandrake Linux* + +Mandrake Linux 首次发布 - 基于红帽 Linux 的发行版,带有 KDE 桌面环境。 + +### 1999 ### + +![](https://upload.wikimedia.org/wikipedia/commons/4/4f/KDE_1.1.jpg) + +第一个主要的 KDE 版本。 + +### 2000 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2000-1.jpg) + +Dell 支持 Linux - 这是第一个支持的大硬件供应商。 + +### 2001 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2001-1.jpg) + +*Revolution OS* + +纪录片 “Revolution OS(操作系统革命)” - GNU、Linux、开源、自由软件的 20 年历史,以及对 Linux 和开源界顶级黑客的采访。 + +### 2002 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2002-1.jpg) + +*BitKeeper* + +Linux 开始使用 BitKeeper,这是一种商业版的分布式版本控制软件。 + +### 2003 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2003-1.png) + +*SUSE* + +Novell 用 2.1 亿美元购买了 SUSE Linux AG。同年 SCO 集团 也开始了同 IBM 以及 Linux 社区关于 Unix 版权的艰难的法律诉讼。 + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2003-2.png) + +*Fedora* + +红帽和 Linux 社区首次发布了 Fedora Linux。 + +### 2004 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2004-1.png) + +*X.ORG 基金会* + +XFree86 解散了并加入到 [X.Org 基金会][9], X 的开发更快了。 + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2004-2.jpg) + +Ubuntu 4.10 – Ubuntu 首次发布 + +### 2005 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2005-1.png) + +*openSUSE* + +[openSUSE][10] 开始了,这是企业版 Novell’s OS 的免费版本。OpenOffice.org 开始支持 OpenDocument 标准。 + +### 2006 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2006-1.png) + +一个新的 Linux 发行版,基于红帽企业版 Linux 的 Oracle Linux。微软和 Novell 开始在 IT 和专利保护方面进行合作。 + +### 2007 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2007-1.jpg) + +*Dell Linux 笔记本* + +Dell 发布了第一个预装 Linux 的笔记本。 + +### 2008 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2008-1.jpg) + +*KDE 4.0* + +KDE 4 发布了,但是不稳定,很多用户开始迁移到 GNOME。 + +### 2009 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2009-1.jpg) + +*Red Hat* + +红帽 Linux 取得了成功 - 市值达 26亿2千万美元。 + +2009 年微软在 GPLv2 协议下向 Linux 内核提交了第一个补丁。 + +### 2010 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2010-1.png) + +*Novell -> Attachmate* + +Novell 已 22亿美元卖给了 Attachmate Group, Inc。SUSE 和 Novell 成为了新公司的两款独立的产品。 + +[systemd][11] 首次发布,开始了 Linux 系统的革命。 + +### 2011 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2011-1.png) + +*Unity 桌面,2011* + +Ubuntu Unity 发布,遭到很多用户的批评。 + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2011-2.png) + +*GNOME 3.0,2011* + +GNOME 3.0 发布, Linus Torvalds 评论为 “unholy mess” ,有很多负面评论。Linux 内核 3.0 发布。 + +### 2012 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2012-1.png) + +*1500 万行代码* + +Linux 内核达到 1500 万行代码。微软成为主要贡献者之一。 + +### 2013 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2013-1.png) + +Kali Linux 1.0 发布, 用于渗透测试和数字取证,基于 Debian 的 Linux 发行版。2014 年 CentOS 及其代码开发者加入到了红帽公司。 + +### 2014 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2014-1.jpg) + +*Lennart Poettering 和 Kay Sievers* + +systemd 成为 Ubuntu 和所有主流 Linux 发行版的默认初始化程序。Ubuntu 有 2200 万用户。安卓的大进步 - 占了所有移动设备的 75% 份额。 + +### 2015 ### + +![](https://github.com/paulcarroty/Articles/raw/master/Linux_24/2015-1.jpg) + +发布了 Linux 4.0。Mandriva 公司清算,但还有很多分支,其中最流行的一个是 Mageia。 + +带着对 Linux 的热爱而执笔。 + +-------------------------------------------------------------------------------- + +via: https://tlhp.cf/linux-history/ + +作者:[Pavlo Rudyi][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://tlhp.cf/author/paul/ +[1]:https://en.wikipedia.org/wiki/C_(programming_language) +[2]:https://en.wikipedia.org/wiki/GNU_Project +[3]:https://en.wikipedia.org/wiki/Ken_Thompson +[4]:https://en.wikipedia.org/wiki/Dennis_Ritchie +[5]:https://en.wikipedia.org/wiki/Linus_Torvalds +[6]:https://en.wikipedia.org/wiki/SUSE_Linux_distributions +[7]:https://en.wikipedia.org/wiki/Red_Hat +[8]:https://en.wikipedia.org/wiki/The_Cathedral_and_the_Bazaar +[9]:http://www.x.org/ +[10]:https://en.opensuse.org/Main_Page +[11]:https://en.wikipedia.org/wiki/Systemd \ No newline at end of file diff --git a/published/20151019 Gaming On Linux--All You Need To Know.md b/published/20151019 Gaming On Linux--All You Need To Know.md new file mode 100644 index 0000000000..a7e3e9b91b --- /dev/null +++ b/published/20151019 Gaming On Linux--All You Need To Know.md @@ -0,0 +1,200 @@ +Linux上的游戏:所有你需要知道的 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Gaming-on-Linux.jpeg) + +**我能在 Linux 上玩游戏吗 ?** + +这是打算[投奔 Linux 阵营][1]的人最经常问的问题之一。毕竟,在 Linux 上面玩游戏经常被认为有点难以实现。事实上,一些人甚至考虑他们能不能在 Linux 上看电影或者听音乐。考虑到这些,关于 Linux 的平台的游戏的问题是很现实的。 + +在本文中,我将解答大多数 Linux 新手关于在 Linux 中打游戏的问题。例如 Linux 下能不能玩游戏,如果能的话,在哪里**下载游戏**或者如何获取有关游戏的信息。 + +但是在此之前,我需要说明一下。我不是一个 PC 上的玩家或者说我不认为我是一个在 Linux 桌面游戏玩家。我更喜欢在 PS4 上玩游戏并且我不关心 PC 上的游戏甚至也不关心手机上的游戏(我没有给我的任何一个朋友安利糖果传奇)。这也就是你很少能在 It's FOSS 上很少看见关于 [Linux 上的游戏][2]的原因。 + +所以我为什么要提到这个主题? + +因为别人问过我几次有关 Linux 上的游戏的问题并且我想要写出来一个能解答这些问题的 Linux 游戏指南。注意,在这里我不只是讨论在 Ubuntu 上玩游戏。我讨论的是在所有的 Linux 上的游戏。 + +### 我能在 Linux 上玩游戏吗 ? ### + +是,但不是完全是。 + +“是”,是指你能在Linux上玩游戏;“不完全是”,是指你不能在 Linux 上玩 ‘所有的游戏’。 + +感到迷惑了吗?不必这样。我的意思是你能在 Linux 上玩很多流行的游戏,比如[反恐精英以及地铁:最后的曙光][3]等。但是你可能不能玩到所有在 Windows 上流行的最新游戏,比如[实况足球 2015 ][4]。 + +在我看来,造成这种情况的原因是 Linux 在桌面系统中仅占不到 2%,这样的占比使得大多数开发者没有开发其游戏的 Linux 版的动力。 + +这就意味指大多数近年来被提及的比较多的游戏很有可能不能在 Linux 上玩。不要灰心。还有别的方式在 Linux 上玩这些游戏,我们将在下面的章节中讨论这些方法。但是,在此之前,让我们看看在 Linux 上能玩的游戏的种类。 + +要我说的话,我会把那些游戏分为四类: + +1. Linux 原生游戏 +2. Linux 上的 Windows 游戏 +3. 浏览器里的游戏 +4. 终端里的游戏 + +让我们以最重要的一类, Linux 的原生游戏开始。 + +--------- + +### 1. 在哪里去找 Llinux 原生游戏 ?### + +原生游戏指的是官方支持 Linux 的游戏。这些游戏有原生的 Linux 客户端并且能像在 Linux 上的其他软件一样不需要附加的步骤就能安装在 Linux 上面(我们将在下一节讨论)。 + +所以,如你所见,有一些为 Linux 开发的游戏,下一个问题就是在哪能找到这些游戏以及如何安装。我将列出一些让你玩到游戏的渠道。 + +#### Steam #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Install-Steam-Ubuntu-11.jpeg) + +“[Steam][5] 是一个游戏的分发平台。就如同 Kindle 是电子书的分发平台, iTunes 是音乐的分发平台一样, Steam 也具有那样的功能。它提供购买和安装游戏,玩多人游戏以及在它的平台上关注其他游戏的选项。其上的游戏被[ DRM ][6]所保护。” + +两年以前,游戏平台 Steam 宣布支持 Linux ,这在当时是一个大新闻。这是 Linux 上玩游戏被严肃对待的一个迹象。尽管这个决定更多地影响了他们自己的基于 Linux 游戏平台以及一个独立 Linux 发行版[ Steam OS][7] ,这仍然是令人欣慰的事情,因为它给 Linux 带来了一大堆游戏。 + +我已经写了一篇详细的关于安装以及使用 Steam 的文章。如果你想开始使用 Steam 的话,读读那篇文章。 + +- [在 Linux 上安装以及使用 Steam ][8] + +#### GOG.com #### + +[GOG.com][9] 是另一个与 Steam 类似的平台。与 Steam 一样,你能在这上面找到数以百计的 Linux 游戏,并购买和安装它们。如果游戏支持好几个平台,你可以在多个操作系统上安装他们。你可以随时游玩使用你的账户购买的游戏。你也可以在任何时间下载。 + +GOG.com 与 Steam 不同的是前者仅提供没有 DRM 保护的游戏以及电影。而且,GOG.com 完全是基于网页的,所以你不需要安装类似 Steam 的客户端。你只需要用浏览器下载游戏然后安装到你的系统上。 + +#### Portable Linux Games #### + +[Portable Linux Games][10] 是一个集聚了不少 Linux 游戏的网站。这家网站最特别以及最好的点就是你能离线安装这些游戏。 + +你下载到的文件包含所有的依赖(仅需 Wine 以及 Perl)并且他们也是与平台无关的。你所需要的仅仅是下载文件并且双击来启动安装程序。你也可以把文件储存起来以用于将来的安装。如果你网速不够快的话,我很推荐你这样做。 + +#### Game Drift 游戏商店 #### + +[Game Drift][11] 是一个只专注于游戏的基于 Ubuntu 的 Linux 发行版。但是如果你不想只为游戏就去安装这个发行版的话,你也可以经常去它的在线游戏商店去看哪个游戏可以在 Linux 上运行并且安装他们。 + +#### Linux Game Database #### + +如其名字所示,[Linux Game Database][12]是一个收集了很多 Linux 游戏的网站。你能在这里浏览诸多类型的游戏并从游戏开发者的网站下载/安装这些游戏。作为这家网站的会员,你甚至可以为游戏打分。 LGDB 有点像 Linux 游戏界的 IMDB 或者 IGN. + +#### Penguspy #### + +此网站由一个不想用 Windows 玩游戏的玩家创立。[Penguspy][13] 聚集了一些 Linux 下最好的游戏。在这里你也能分类浏览游戏,如果你喜欢这个游戏的话,你可以跳转到游戏开发者的网站去下载安装。 + +#### 软件源 #### + +看看你自己的发行版的软件源。其中可能有一些游戏。如果你用 Ubuntu 的话,它的软件中心里有一个游戏的分类。在一些其他的发行版里也有,比如 Linux Mint 等。 + +---------- + +### 2. 如何在 Linux 上玩 Windows 的游戏 ?### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Wine-Linux.png) + +到现在为止,我们一直在讨论 Linux 的原生游戏。但是并没有很多 Linux 上的原生游戏,或者更准确地说,火的不要不要的游戏大多不支持 Linux,但是都支持 Windows PC 。所以,如何在 Linux 上玩 Windows 的游戏? + +幸好,由于我们有 Wine 、 PlayOnLinux 和 CrossOver 等工具,我们能在 Linux 上玩不少的 Windows 游戏。 + +#### Wine #### + +Wine 是一个能使 Windows 应用在类似 Linux , BSD 和 OS X 上运行的兼容层。在 Wine 的帮助下,你可以在 Linux 下安装以及使用很多 Windows 下的应用。 + +[在 Ubuntu 上安装 Wine][14]或者在其他 Linux 上安装 Wine 是很简单的,因为大多数发行版的软件源里都有它。这里也有一个很大的[ Wine 支持的应用的数据库][15]供您浏览。 + +#### CrossOver #### + +[CrossOver][16] 是 Wine 的增强版,它给 Wine 提供了专业的技术上的支持。但是与 Wine 不同, CrossOver 不是免费的。你需要购买许可。好消息是它会把更新也贡献到 Wine 的开发者那里并且事实上加速了 Wine 的开发使得 Wine 能支持更多的 Windows 上的游戏和应用。如果你可以接受每年支付 48 美元,你可以购买 CrossOver 并得到他们提供的技术支持。 + +### PlayOnLinux ### + +PlayOnLinux 也基于 Wine 但是执行程序的方式略有不同。它有着更好用的,不同的界面。与 Wine 一样,PlayOnLinux 也是免费使用。你可以在[开发者自己的数据库里查看它支持的应用以及游戏][17]。 + +---------- + +### 3. 网页游戏 ### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Chrome-Web-Store.jpeg) + +不必说你也应该知道有非常多的基于网页的游戏,这些游戏都可以在任何操作系统里运行,无论是 Windows ,Linux ,还是 OS X 。大多数让人上瘾的手机游戏,比如[帝国之战][18]就有官方的网页版。 + +除了这些,还有 [Google Chrome 在线商店][19],你可以在 Linux 上玩更多的这些游戏。这些 Chrome 上的游戏可以像一个单独的应用一样安装并从应用菜单中打开,一些游戏就算是离线也能运行。 + +---------- + +### 4. 终端游戏 ### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/03/nSnake_Linux_terminal_game.jpeg) + +使用 Linux 的一个附加优势就是可以使用命令行终端玩游戏。我知道这不是最好的玩游戏的方法,但是在终端里玩[贪吃蛇][20]或者 [2048][21] 很有趣。在[这个博客][21]中有一些好玩的的终端游戏。你可以浏览并安装你喜欢的游戏。 + +---------- + +### 如何保证游戏的版本是最新的 ?### + +当你了解了不少的在 Linux 上你可以玩到的游戏以及你如何使用他们,下一个问题就是如何保持游戏的版本是最新的。对于这件事,我建议你看看下面的博客,这些博客能告诉你 Linux 游戏世界的最新消息: + +- [Gaming on Linux][23]:我认为我把它叫做 Linux 游戏专业门户并没有错误。在这你可以得到关于 Linux 的游戏的最新的传言以及新闻。它经常更新, 还有由 Linux 游戏爱好者组成的优秀社区。 +- [Free Gamer][24]:一个专注于免费开源的游戏的博客。 +- [Linux Game News][25]:一个提供很多的 Linux 游戏的升级的 Tumbler 博客。 + +#### 还有别的要说的吗? #### + +我认为让你知道如何开始在 Linux 上的游戏人生是一个好事。如果你仍然不能被说服,我推荐你做个[双系统][26],把 Linux 作为你的主要桌面系统,当你想玩游戏时,重启到 Windows。这是一个对游戏妥协的解决办法。 + +现在,这里是你说出你自己的想法的时候了。你在 Linux 上玩游戏吗?你最喜欢什么游戏?你关注了哪些游戏博客? + + +投票项目: +你怎样在 Linux 上玩游戏? + +- 我玩原生 Linux 游戏,也用 Wine 以及 PlayOnLinux 运行 Windows 游戏 +- 我喜欢网页游戏 +- 我喜欢终端游戏 +- 我只玩原生 Linux 游戏 +- 我用 Steam +- 我用双系统,要玩游戏时就换到 Windows +- 我不玩游戏 + +注:投票代码 +
+
+ + + +注,发布时根据情况看怎么处理 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/linux-gaming-guide/ + +作者:[Abhishek][a] +译者:[name1e5s](https://github.com/name1e5s) +校对:[PurlingNayuki](https://github.com/PurlingNayuki) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/reasons-switch-linux-windows-xp/ +[2]:http://itsfoss.com/category/games/ +[3]:http://blog.counter-strike.net/ +[4]:https://pes.konami.com/tag/pes-2015/ +[5]:http://store.steampowered.com/ +[6]:https://en.wikipedia.org/wiki/Digital_rights_management +[7]:http://itsfoss.com/valve-annouces-linux-based-gaming-operating-system-steamos/ +[8]:http://itsfoss.com/install-steam-ubuntu-linux/ +[9]:http://www.gog.com/ +[10]:http://www.portablelinuxgames.org/ +[11]:http://gamedrift.org/GameStore.html +[12]:http://www.lgdb.org/ +[13]:http://www.penguspy.com/ +[14]:http://itsfoss.com/wine-1-5-11-released-ppa-available-to-download/ +[15]:https://appdb.winehq.org/ +[16]:https://www.codeweavers.com/products/ +[17]:https://www.playonlinux.com/en/supported_apps.html +[18]:http://empire.goodgamestudios.com/ +[19]:https://chrome.google.com/webstore/category/apps +[20]:http://itsfoss.com/nsnake-play-classic-snake-game-linux-terminal/ +[21]:http://itsfoss.com/play-2048-linux-terminal/ +[22]:https://ttygames.wordpress.com/ +[23]:https://www.gamingonlinux.com/ +[24]:http://freegamer.blogspot.fr/ +[25]:http://linuxgamenews.com/ +[26]:http://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/ diff --git a/published/201511/20150823 How learning data structures and algorithms make you a better developer.md b/published/201511/20150823 How learning data structures and algorithms make you a better developer.md new file mode 100644 index 0000000000..27973b2f42 --- /dev/null +++ b/published/201511/20150823 How learning data structures and algorithms make you a better developer.md @@ -0,0 +1,126 @@ +学习数据结构与算法分析如何帮助您成为更优秀的开发人员 +================================================================================ + +> "相较于其它方式,我一直热衷于推崇围绕数据设计代码,我想这也是Git能够如此成功的一大原因[…]在我看来,区别程序员优劣的一大标准就在于他是否认为自己设计的代码还是数据结构更为重要。" +-- Linus Torvalds + +--- + +> "优秀的数据结构与简陋的代码组合远比反之的组合更好。" +-- Eric S. Raymond, The Cathedral and The Bazaar + +学习数据结构与算法分析会让您成为一名出色的程序员。 + +**数据结构与算法分析是一种解决问题的思维模式。** 在您的个人知识库中,数据结构与算法分析的相关知识储备越多,您将越多具备应对并解决各类繁杂问题的能力。掌握了这种思维模式,您还将有能力针对新问题提出更多以前想不到的漂亮的解决方案。 + +您将*更深入地*了解,计算机如何完成各项操作。无论您是否是直接使用给定的算法,它都影响着您作出的各种技术决定。从计算机操作系统的内存分配到RDBMS的内在工作机制,以及网络协议如何实现将数据从地球的一个角落发送至另一个角落,这些大大小小的工作的完成,都离不开基础的数据结构与算法,理解并掌握它将会让您更了解计算机的运作机理。 + +对算法广泛深入的学习能为您储备解决方案来应对大体系的问题。之前建模困难时遇到的问题如今通常都能融合进经典的数据结构中得到很好地解决。即使是最基础的数据结构,只要对它进行足够深入的钻研,您将会发现在每天的编程任务中都能经常用到这些知识。 + +有了这种思维模式,在遇到磨棱两可的问题时,您将能够想出新奇的解决方案。即使最初并没有打算用数据结构与算法解决相应问题的情况,当真正用它们解决这些问题时您会发现它们将非常有用。要意识到这一点,您至少要对数据结构与算法分析的基础知识有深入直观的认识。 + +理论认识就讲到这里,让我们一起看看下面几个例子。 + +###最短路径问题### + +我们想要开发一个软件来计算从一个国际机场出发到另一个国际机场的最短距离。假设我们受限于以下路线: + +![](http://www.happybearsoftware.com/assets/posts/how-learning-data-structures-and-algorithms-makes-you-a-better-developer/airport-graph-d2e32b3344b708383e405d67a80c29ea.svg) + +从这张画出机场各自之间的距离以及目的地的图中,我们如何才能找到最短距离,比方说从赫尔辛基到伦敦?**[Dijkstra算法][3]**是能让我们在最短的时间得到正确答案的适用算法。 + +在所有可能的解法中,如果您曾经遇到过这类问题,知道可以用Dijkstra算法求解,您大可不必从零开始实现它,只需***知道***该算法的代码库能帮助您解决相关的实现问题。 + +如果你深入到该算法的实现中,您将深入理解一项著名的重要图论算法。您会发现实际上该算法比较消耗资源,因此名为[A*][4]的扩展经常用于代替该算法。这个算法应用广泛,从机器人寻路的功能实现到TCP数据包路由,以及GPS寻径问题都能应用到这个算法。 + +###先后排序问题### + +您想要在开放式在线课程(MOOC,Massive Open Online Courses)平台上(如Udemy或Khan学院)学习某课程,有些课程之间彼此依赖。例如,用户学习牛顿力学(Newtonian Mechanics)课程前必须先修微积分(Calculus)课程,课程之间可以有多种依赖关系。用YAML表述举例如下: + + # Mapping from course name to requirements + # + # If you're a physcist or a mathematicisn and you're reading this, sincere + # apologies for the completely made-up dependency tree :) + courses: + arithmetic: [] + algebra: [arithmetic] + trigonometry: [algebra] + calculus: [algebra, trigonometry] + geometry: [algebra] + mechanics: [calculus, trigonometry] + atomic_physics: [mechanics, calculus] + electromagnetism: [calculus, atomic_physics] + radioactivity: [algebra, atomic_physics] + astrophysics: [radioactivity, calculus] + quantumn_mechanics: [atomic_physics, radioactivity, calculus] + +鉴于以上这些依赖关系,作为一名用户,我希望系统能帮我列出必修课列表,让我在之后可以选择任意一门课程学习。如果我选择了微积分(calculus)课程,我希望系统能返回以下列表: + + arithmetic -> algebra -> trigonometry -> calculus + +这里有两个潜在的重要约束条件: + + - 返回的必修课列表中,每门课都与下一门课存在依赖关系 + - 我们不希望列表中有任何重复课程 + +这是解决数据间依赖关系的例子,解决该问题的排序算法称作拓扑排序算法(tsort,topological sort)。它适用于解决上述我们用YAML列出的依赖关系图的情况,以下是在图中显示的相关结果(其中箭头代表`需要先修的课程`): + +![](http://www.happybearsoftware.com/assets/posts/how-learning-data-structures-and-algorithms-makes-you-a-better-developer/course-graph-2f60f42bb0dc95319954ce34c02705a2.svg) + +拓扑排序算法的实现就是从如上所示的图中找到满足各层次要求的依赖关系。因此如果我们只列出包含`radioactivity`和与它有依赖关系的子图,运行tsort排序,会得到如下的顺序表: + + arithmetic + algebra + trigonometry + calculus + mechanics + atomic_physics + radioactivity + +这符合我们上面描述的需求,用户只需选出`radioactivity`,就能得到在此之前所有必修课程的有序列表。 + +在运用该排序算法之前,我们甚至不需要深入了解算法的实现细节。一般来说,你可能选择的各种编程语言在其标准库中都会有相应的算法实现。即使最坏的情况,Unix也会默认安装`tsort`程序,运行`man tsort` 来了解该程序。 + +###其它拓扑排序适用场合### + + - **类似`make`的工具** 可以让您声明任务之间的依赖关系,这里拓扑排序算法将从底层实现具有依赖关系的任务顺序执行的功能。 + - **具有`require`指令的编程语言**适用于要运行当前文件需先运行另一个文件的情况。这里拓扑排序用于识别文件运行顺序以保证每个文件只加载一次,且满足所有文件间的依赖关系要求。 + - **带有甘特图的项目管理工具**。甘特图能直观列出给定任务的所有依赖关系,在这些依赖关系之上能提供给用户任务完成的预估时间。我不常用到甘特图,但这些绘制甘特图的工具很可能会用到拓扑排序算法。 + +###霍夫曼编码实现数据压缩### + +[霍夫曼编码][5](Huffman coding)是一种用于无损数据压缩的编码算法。它的工作原理是先分析要压缩的数据,再为每个字符创建一个二进制编码。字符出现的越频繁,编码赋值越小。因此在一个数据集中`e`可能会编码为`111`,而`x`会编码为`10010`。创建了这种编码模式,就可以串联无定界符,也能正确地进行解码。 + +在gzip中使用的DEFLATE算法就结合了霍夫曼编码与LZ77一同用于实现数据压缩功能。gzip应用领域很广,特别适用于文件压缩(以`.gz`为扩展名的文件)以及用于数据传输中的http请求与应答。 + +学会实现并使用霍夫曼编码有如下益处: + + - 您会理解为什么较大的压缩文件会获得较好的整体压缩效果(如压缩的越多,压缩率也越高)。这也是SPDY协议得以推崇的原因之一:在复杂的HTTP请求/响应过程数据有更好的压缩效果。 + - 您会了解数据传输过程中如果想要压缩JavaScript/CSS文件,运行压缩软件是完全没有意义的。PNG文件也是类似,因为它们已经使用DEFLATE算法完成了压缩。 + - 如果您试图强行破译加密的信息,您可能会发现由于重复数据压缩质量更好,密文给定位的数据压缩率将帮助您确定相关的[分组密码工作模式][6](block cipher mode of operation.)。 + +###下一步选择学习什么是困难的### + +作为一名程序员应当做好持续学习的准备。为了成为一名web开发人员,您需要了解标记语言以及Ruby/Python、正则表达式、SQL、JavaScript等高级编程语言,还需要了解HTTP的工作原理,如何运行UNIX终端以及面向对象的编程艺术。您很难有效地预览到未来的职业全景,因此选择下一步要学习哪些知识是困难的。 + +我没有快速学习的能力,因此我不得不在时间花费上非常谨慎。我希望尽可能地学习到有持久生命力的技能,即不会在几年内就过时的技术。这意味着我也会犹豫这周是要学习JavaScript框架还是那些新的编程语言。 + +只要占主导地位的计算模型体系不变,我们如今使用的数据结构与算法在未来也必定会以另外的形式继续适用。您可以放心地将时间投入到深入掌握数据结构与算法知识中,它们将会成为您作为一名程序员的职业生涯中一笔长期巨大的财富。 + +-------------------------------------------------------------------------------- + +via: http://www.happybearsoftware.com/how-learning-data-structures-and-algorithms-makes-you-a-better-developer + +作者:[Happy Bear][a] +译者:[icybreaker](https://github.com/icybreaker) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.happybearsoftware.com/ +[1]:http://en.wikipedia.org/wiki/Huffman_coding +[2]:http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation +[3]:http://en.wikipedia.org/wiki/Dijkstra's_algorithm +[4]:http://en.wikipedia.org/wiki/A*_search_algorithm +[5]:http://en.wikipedia.org/wiki/Huffman_coding +[6]:http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation diff --git a/published/201511/20150827 The Strangest Most Unique Linux Distros.md b/published/201511/20150827 The Strangest Most Unique Linux Distros.md new file mode 100644 index 0000000000..a7dff335a4 --- /dev/null +++ b/published/201511/20150827 The Strangest Most Unique Linux Distros.md @@ -0,0 +1,88 @@ +那些奇特的 Linux 发行版本 +================================================================================ +从大多数消费者所关注的诸如 Ubuntu,Fedora,Mint 或 elementary OS 到更加复杂、轻量级和企业级的诸如 Slackware,Arch Linux 或 RHEL,这些发行版本我都已经见识过了。除了这些,难道没有其他别的了吗?其实 Linux 的生态系统是非常多样化的,对每个人来说,总有一款适合你。下面就让我们讨论一些稀奇古怪的小众 Linux 发行版本吧,它们代表着开源平台真正的多样性。 + +### Puppy Linux + +![strangest linux distros](http://2.bp.blogspot.com/--cSL2-6rIgA/VcwNc5hFebI/AAAAAAAAJzk/AgB55mVtJVQ/s1600/Puppy-Linux.png) + +它是一个仅有一个普通 DVD 光盘容量十分之一大小的操作系统,这就是 Puppy Linux。整个操作系统仅有 100MB 大小!并且它还可以从内存中运行,这使得它运行极快,即便是在老式的 PC 机上。 在操作系统启动后,你甚至可以移除启动介质!还有什么比这个更好的吗? 系统所需的资源极小,大多数的硬件都会被自动检测到,并且它预装了能够满足你基本需求的软件。[在这里体验 Puppy Linux 吧][1]. + +### Suicide Linux(自杀 Linux) + +![suicide linux](http://3.bp.blogspot.com/-dfeehRIQKpo/VdMgRVQqIJI/AAAAAAAAJz0/TmBs-n2K9J8/s1600/suicide-linux.jpg) + +这个名字吓到你了吗?我想应该是。 ‘任何时候 -注意是任何时候-一旦你远程输入不正确的命令,解释器都会创造性地将它重定向为 `rm -rf /` 命令,然后擦除你的硬盘’。它就是这么简单。我真的很想知道谁自信到将[Suicide Linux][2] 安装到生产机上。 **警告:千万不要在生产机上尝试这个!** 假如你感兴趣的话,现在可以通过一个简洁的[DEB 包][3]来获取到它。 + +### PapyrOS + +![top 10 strangest linux distros](http://3.bp.blogspot.com/-Q0hlEMCD9-o/VdMieAiXY1I/AAAAAAAAJ0M/iS_ZjVaZAk8/s1600/papyros.png) + +它的 “奇怪”是好的方面。PapyrOS 正尝试着将 Android 的 material design 设计语言引入到新的 Linux 发行版本上。尽管这个项目还处于早期阶段,看起来它已经很有前景。该项目的网页上说该系统已经完成了 80%,随后人们可以期待它的第一个 Alpha 发行版本。在该项目被宣告提出时,我们做了 [PapyrOS][4] 的小幅报道,从它的外观上看,它甚至可能会引领潮流。假如你感兴趣的话,可在 [Google+][5] 上关注该项目并可通过 [BountySource][6] 来贡献出你的力量。 + +### Qubes OS + +![10 most unique linux distros](http://3.bp.blogspot.com/-8aOtnTp3Yxk/VdMo_KWs4sI/AAAAAAAAJ0o/3NTqhaw60jM/s1600/qubes-linux.png) + +Qubes 是一个开源的操作系统,其设计通过使用[安全分级(Security by Compartmentalization)][14]的方法,来提供强安全性。其前提假设是不存在完美的没有 bug 的桌面环境。并通过实现一个‘安全隔离(Security by Isolation)’ 的方法,[Qubes Linux][7]试图去解决这些问题。Qubes 基于 Xen、X 视窗系统和 Linux,并可运行大多数的 Linux 应用,支持大多数的 Linux 驱动。Qubes 入选了 Access Innovation Prize 2014 for Endpoint Security Solution 决赛名单。 + +### Ubuntu Satanic Edition + +![top10 linux distros](http://3.bp.blogspot.com/-2Sqvb_lilC0/VdMq_ceoXnI/AAAAAAAAJ00/kot20ugVJFk/s1600/ubuntu-satanic.jpg) + +Ubuntu SE 是一个基于 Ubuntu 的发行版本。通过一个含有主题、壁纸甚至来源于某些天才新晋艺术家的重金属音乐的综合软件包,“它同时带来了最好的自由软件和免费的金属音乐” 。尽管这个项目看起来不再积极开发了, Ubuntu Satanic Edition 甚至在其名字上都显得奇异。 [Ubuntu SE (Slightly NSFW)][8]。 + +### Tiny Core Linux + +![10 strange linux distros](http://2.bp.blogspot.com/-ZtIVjGMqdx0/VdMv136Pz1I/AAAAAAAAJ1E/-q34j-TXyUY/s1600/tiny-core-linux.png) + +Puppy Linux 还不够小?试试这个吧。 Tiny Core Linux 是一个 12MB 大小的图形化 Linux 桌面!是的,你没有看错。一个主要的补充说明:它不是一个完整的桌面,也并不完全支持所有的硬件。它只含有能够启动进入一个非常小巧的 X 桌面,支持有线网络连接的核心部件。它甚至还有一个名为 Micro Core Linux 的没有 GUI 的版本,仅有 9MB 大小。[Tiny Core Linux][9]。 + +### NixOS + +![top 10 unique and special linux distros](http://4.bp.blogspot.com/-idmCvIxtxeo/VdcqcggBk1I/AAAAAAAAJ1U/DTQCkiLqlLk/s1600/nixos.png) + +它是一个资深用户所关注的 Linux 发行版本,有着独特的打包和配置管理方式。在其他的发行版本中,诸如升级的操作可能是非常危险的。升级一个软件包可能会引起其他包无法使用,而升级整个系统感觉还不如重新安装一个。在那些你不能安全地测试由一个配置的改变所带来的结果的更改之上,它们通常没有“重来”这个选项。在 NixOS 中,整个系统由 Nix 包管理器按照一个纯功能性的构建语言的描述来构建。这意味着构建一个新的配置并不会重写先前的配置。大多数其他的特色功能也遵循着这个模式。Nix 相互隔离地存储所有的软件包。有关 NixOS 的更多内容请看[这里][10]。 + +### GoboLinux + +![strangest linux distros](http://4.bp.blogspot.com/-rOYfBXg-UiU/VddCF7w_xuI/AAAAAAAAJ1w/Nf11bOheOwM/s1600/gobolinux.jpg) + +这是另一个非常奇特的 Linux 发行版本。它与其他系统如此不同的原因是它有着独特的重新整理的文件系统。它有着自己独特的子目录树,其中存储着所有的文件和程序。GoboLinux 没有专门的包数据库,因为其文件系统就是它的数据库。在某些方面,这类重整有些类似于 OS X 上所看到的功能。 + +### Hannah Montana Linux + +![strangest linux distros](http://1.bp.blogspot.com/-3P22pYfih6Y/VdcucPOv4LI/AAAAAAAAJ1g/PszZDbe83sQ/s1600/hannah-montana-linux.jpg) + +它是一个基于 Kubuntu 的 Linux 发行版本,它有着汉娜·蒙塔娜( Hannah Montana) 主题的开机启动界面、KDM(KDE Display Manager)、图标集、ksplash、plasma、颜色主题和壁纸(I'm so sorry)。[这是它的链接][12]。这个项目现在不再活跃了。 + +### RLSD Linux + +它是一个极其精简、小巧、轻量和安全可靠的,基于 Linux 文本的操作系统。开发者称 “它是一个独特的发行版本,提供一系列的控制台应用和自带的安全特性,对黑客或许有吸引力。” [RLSD Linux][13]. + +我们还错过了某些更加奇特的发行版本吗?请让我们知晓吧。 + +-------------------------------------------------------------------------------- + +via: http://www.techdrivein.com/2015/08/the-strangest-most-unique-linux-distros.html + +作者:Manuel Jose +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://puppylinux.org/main/Overview%20and%20Getting%20Started.htm +[2]:http://qntm.org/suicide +[3]:http://sourceforge.net/projects/suicide-linux/files/ +[4]:http://www.techdrivein.com/2015/02/papyros-material-design-linux-coming-soon.html +[5]:https://plus.google.com/communities/109966288908859324845/stream/3262a3d3-0797-4344-bbe0-56c3adaacb69 +[6]:https://www.bountysource.com/teams/papyros +[7]:https://www.qubes-os.org/ +[8]:http://ubuntusatanic.org/ +[9]:http://tinycorelinux.net/ +[10]:https://nixos.org/ +[11]:http://www.gobolinux.org/ +[12]:http://hannahmontana.sourceforge.net/ +[13]:http://rlsd2.dimakrasner.com/ +[14]:https://en.wikipedia.org/wiki/Compartmentalization_(information_security) \ No newline at end of file diff --git a/published/201511/20150831 How to switch from NetworkManager to systemd-networkd on Linux.md b/published/201511/20150831 How to switch from NetworkManager to systemd-networkd on Linux.md new file mode 100644 index 0000000000..658d6c033d --- /dev/null +++ b/published/201511/20150831 How to switch from NetworkManager to systemd-networkd on Linux.md @@ -0,0 +1,165 @@ +如何在 Linux 上从 NetworkManager 切换为 systemd-network +================================================================================ +在 Linux 世界里,对 [systemd][1] 的采用一直是激烈争论的主题,它的支持者和反对者之间的战火仍然在燃烧。到了今天,大部分主流 Linux 发行版都已经采用了 systemd 作为默认的初始化(init)系统。 + +正如其作者所说,作为一个 “从未完成、从未完善、但一直追随技术进步” 的系统,systemd 已经不只是一个初始化进程,它被设计为一个更广泛的系统以及服务管理平台,这个平台是一个包含了不断增长的核心系统进程、库和工具的生态系统。 + +**systemd** 的其中一部分是 **systemd-networkd**,它负责 systemd 生态中的网络配置。使用 systemd-networkd,你可以为网络设备配置基础的 DHCP/静态 IP 网络。它还可以配置虚拟网络功能,例如网桥、隧道和 VLAN。systemd-networkd 目前还不能直接支持无线网络,但你可以使用 wpa_supplicant 服务配置无线适配器,然后把它和 **systemd-networkd** 联系起来。 + +在很多 Linux 发行版中,NetworkManager 仍然作为默认的网络配置管理器。和 NetworkManager 相比,**systemd-networkd** 仍处于积极的开发状态,还缺少一些功能。例如,它还不能像 NetworkManager 那样能让你的计算机在任何时候通过多种接口保持连接。它还没有为更高层面的脚本编程提供 ifup/ifdown 钩子函数。但是,systemd-networkd 和其它 systemd 组件(例如用于域名解析的 **resolved**、NTP 的**timesyncd**,用于命名的 udevd)结合的非常好。随着时间增长,**systemd-networkd**只会在 systemd 环境中扮演越来越重要的角色。 + +如果你对 **systemd-networkd** 的进步感到高兴,从 NetworkManager 切换到 systemd-networkd 是值得你考虑的一件事。如果你强烈反对 systemd,对 NetworkManager 或[基础网络服务][2]感到很满意,那也很好。 + +但对于那些想尝试 systemd-networkd 的人,可以继续看下去,在这篇指南中学会在 Linux 中怎么从 NetworkManager 切换到 systemd-networkd。 + +### 需求 ### + +systemd 210 及其更高版本提供了 systemd-networkd。因此诸如 Debian 8 "Jessie" (systemd 215)、 Fedora 21 (systemd 217)、 Ubuntu 15.04 (systemd 219) 或更高版本的 Linux 发行版和 systemd-networkd 兼容。 + +对于其它发行版,在开始下一步之前先检查一下你的 systemd 版本。 + + $ systemctl --version + +### 从 NetworkManager 切换到 Systemd-networkd ### + +从 NetworkManager 切换到 systemd-networkd 其实非常简答(反过来也一样)。 + +首先,按照下面这样先停用 NetworkManager 服务,然后启用 systemd-networkd。 + + $ sudo systemctl disable NetworkManager + $ sudo systemctl enable systemd-networkd + +你还要启用 **systemd-resolved** 服务,systemd-networkd用它来进行域名解析。该服务还实现了一个缓存式 DNS 服务器。 + + $ sudo systemctl enable systemd-resolved + $ sudo systemctl start systemd-resolved + +当启动后,**systemd-resolved** 就会在 /run/systemd 目录下某个地方创建它自己的 resolv.conf。但是,把 DNS 解析信息存放在 /etc/resolv.conf 是更普遍的做法,很多应用程序也会依赖于 /etc/resolv.conf。因此为了兼容性,按照下面的方式创建一个到 /etc/resolv.conf 的符号链接。 + + $ sudo rm /etc/resolv.conf + $ sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf + +### 用 systemd-networkd 配置网络连接 ### + +要用 systemd-networkd 配置网络服务,你必须指定带.network 扩展名的配置信息文本文件。这些网络配置文件保存到 /etc/systemd/network 并从这里加载。当有多个文件时,systemd-networkd 会按照字母顺序一个个加载并处理。 + +首先创建 /etc/systemd/network 目录。 + + $ sudo mkdir /etc/systemd/network + +#### DHCP 网络 #### + +首先来配置 DHCP 网络。对于此,先要创建下面的配置文件。文件名可以任意,但记住文件是按照字母顺序处理的。 + + $ sudo vi /etc/systemd/network/20-dhcp.network + +---------- + + [Match] + Name=enp3* + + [Network] + DHCP=yes + +正如你上面看到的,每个网络配置文件包括了一个或多个 “sections”,每个 “section”都用 [XXX] 开头。每个 section 包括了一个或多个键值对。`[Match]` 部分决定这个配置文件配置哪个(些)网络设备。例如,这个文件匹配所有名称以 ens3 开头的网络设备(例如 enp3s0、 enp3s1、 enp3s2 等等)对于匹配的接口,然后启用 [Network] 部分指定的 DHCP 网络配置。 + +### 静态 IP 网络 ### + +如果你想给网络设备分配一个静态 IP 地址,那就新建下面的配置文件。 + + $ sudo vi /etc/systemd/network/10-static-enp3s0.network + +---------- + + [Match] + Name=enp3s0 + + [Network] + Address=192.168.10.50/24 + Gateway=192.168.10.1 + DNS=8.8.8.8 + +正如你猜测的, enp3s0 接口地址会被指定为 192.168.10.50/24,默认网关是 192.168.10.1, DNS 服务器是 8.8.8.8。这里微妙的一点是,接口名 enp3s0 事实上也匹配了之前 DHCP 配置中定义的模式规则。但是,根据词汇顺序,文件 "10-static-enp3s0.network" 在 "20-dhcp.network" 之前被处理,对于 enp3s0 接口静态配置比 DHCP 配置有更高的优先级。 + +一旦你完成了创建配置文件,重启 systemd-networkd 服务或者重启机器。 + + $ sudo systemctl restart systemd-networkd + +运行以下命令检查服务状态: + + $ systemctl status systemd-networkd + $ systemctl status systemd-resolved + +![](https://farm1.staticflickr.com/719/21010813392_76abe123ed_c.jpg) + +### 用 systemd-networkd 配置虚拟网络设备 ### + +**systemd-networkd** 同样允许你配置虚拟网络设备,例如网桥、VLAN、隧道、VXLAN、绑定等。你必须在用 .netdev 作为扩展名的文件中配置这些虚拟设备。 + +这里我展示了如何配置一个桥接接口。 + +#### Linux 网桥 #### + +如果你想创建一个 Linux 网桥(br0) 并把物理接口(eth1) 添加到网桥,你可以新建下面的配置。 + + $ sudo vi /etc/systemd/network/bridge-br0.netdev + +---------- + + [NetDev] + Name=br0 + Kind=bridge + +然后按照下面这样用 .network 文件配置网桥接口 br0 和从接口 eth1。 + + $ sudo vi /etc/systemd/network/bridge-br0-slave.network + +---------- + + [Match] + Name=eth1 + + [Network] + Bridge=br0 + +---------- + + $ sudo vi /etc/systemd/network/bridge-br0.network + +---------- + + [Match] + Name=br0 + + [Network] + Address=192.168.10.100/24 + Gateway=192.168.10.1 + DNS=8.8.8.8 + +最后,重启 systemd-networkd。 + + $ sudo systemctl restart systemd-networkd + +你可以用 [brctl 工具][3] 来验证是否创建好了网桥 br0。 + +### 总结 ### + +当 systemd 誓言成为 Linux 的系统管理器时,有类似 systemd-networkd 的东西来管理网络配置也就不足为奇。但是在现阶段,systemd-networkd 看起来更适合于网络配置相对稳定的服务器环境。对于桌面/笔记本环境,它们有多种临时有线/无线接口,NetworkManager 仍然是比较好的选择。 + +对于想进一步了解 systemd-networkd 的人,可以参考官方[man 手册][4]了解完整的支持列表和关键点。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/switch-from-networkmanager-to-systemd-networkd.html + +作者:[Dan Nanni][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://xmodulo.com/use-systemd-system-administration-debian.html +[2]:http://xmodulo.com/disable-network-manager-linux.html +[3]:http://xmodulo.com/how-to-configure-linux-bridge-interface.html +[4]:http://www.freedesktop.org/software/systemd/man/systemd.network.html diff --git a/published/201511/20150909 Superclass--15 of the world's best living programmers.md b/published/201511/20150909 Superclass--15 of the world's best living programmers.md new file mode 100644 index 0000000000..89a42d29d7 --- /dev/null +++ b/published/201511/20150909 Superclass--15 of the world's best living programmers.md @@ -0,0 +1,427 @@ +超神们:15 位健在的世界级程序员! +================================================================================ + +当开发人员说起世界顶级程序员时,他们的名字往往会被提及。 + +好像现在程序员有很多,其中不乏有许多优秀的程序员。但是哪些程序员更好呢? + +虽然这很难客观评价,不过在这个话题确实是开发者们津津乐道的。ITworld 深入程序员社区,避开四溅的争执口水,试图找出可能存在的所谓共识。事实证明,屈指可数的某些名字经常是讨论的焦点。 + +![](http://images.techhive.com/images/article/2015/09/superman-620x465-100611650-orig.jpg) + +*图片来源: [tom_bullock CC BY 2.0][1]* + +下面就让我们来看看这些世界顶级的程序员吧! + +### 玛格丽特·汉密尔顿(Margaret Hamilton) ### + +![](http://images.techhive.com/images/article/2015/09/margaret_hamilton-620x465-100611764-orig.jpg) + +*图片来源: [NASA][2]* + +**成就: 阿波罗飞行控制软件背后的大脑** + +生平: 查尔斯·斯塔克·德雷珀实验室(Charles Stark Draper Laboratory)软件工程部的主任,以她为首的团队负责设计和打造 NASA 的阿波罗的舰载飞行控制器软件和空间实验室(Skylab)的任务。基于阿波罗这段的工作经历,她又后续开发了[通用系统语言(Universal Systems Language)][5]和[开发先于事实( Development Before the Fact)][6]的范例。开创了[异步软件、优先调度和超可靠的软件设计][7]理念。被认为发明了“[软件工程( software engineering)][8]”一词。1986年获[奥古斯塔·埃达·洛夫莱斯奖(Augusta Ada Lovelace Award)][9],2003年获 [NASA 杰出太空行动奖(Exceptional Space Act Award)][10]。 + +评论: + +> “汉密尔顿发明了测试,使美国计算机工程规范了很多” —— [ford_beeblebrox][11] + +> “我认为在她之前(不敬地说,包括高德纳(Knuth)在内的)计算机编程是(另一种形式上留存的)数学分支。然而这个宇宙飞船的飞行控制系统明确地将编程带入了一个崭新的领域。” —— [Dan Allen][12] + +> “... 她引入了‘软件工程’这个术语 — 并作出了最好的示范。” —— [David Hamilton][13] + +> “真是个坏家伙” [Drukered][14] + + +### 唐纳德·克努斯(Donald Knuth),即 高德纳 ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_donald_knuth-620x465-100502872-orig.jpg) + +*图片来源: [vonguard CC BY-SA 2.0][15]* + +**成就: 《计算机程序设计艺术(The Art of Computer Programming,TAOCP)》 作者** + +生平: 撰写了[编程理论的权威书籍][16]。发明了数字排版系统 Tex。1971年,[ACM(美国计算机协会)葛丽丝·穆雷·霍普奖(Grace Murray Hopper Award)][17] 的首位获奖者。1974年获 ACM [图灵奖(A. M. Turing)][18],1979年获[美国国家科学奖章(National Medal of Science)][19],1995年获IEEE[约翰·冯·诺依曼奖章(John von Neumann Medal)][20]。1998年入选[计算机历史博物馆(Computer History Museum)名人录(Hall of Fellows)][21]。 + +评论: + +> “... 写的计算机编程艺术(The Art of Computer Programming,TAOCP)可能是有史以来计算机编程方面最大的贡献。”—— [佚名][22] + +> “唐·克努斯的 TeX 是我所用过的计算机程序中唯一一个几乎没有 bug 的。真是让人印象深刻!”—— [Jaap Weel][23] + +> “如果你要问我的话,我只能说太棒了!” —— [Mitch Rees-Jones][24] + +### 肯·汤普逊(Ken Thompson) ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_ken-thompson-620x465-100502874-orig.jpg) + +*图片来源: [Association for Computing Machinery][25]* + +**成就: Unix 之父** + +生平:与[丹尼斯·里奇(Dennis Ritchie)][26]共同创造了 Unix。创造了 [B 语言][27]、[UTF-8 字符编码方案][28]、[ed 文本编辑器][29],同时也是 Go 语言的共同开发者。(和里奇)共同获得1983年的[图灵奖(A.M. Turing Award )][30],1994年获 [IEEE 计算机先驱奖( IEEE Computer Pioneer Award)][31],1998年获颁[美国国家科技奖章( National Medal of Technology )][32]。在1997年入选[计算机历史博物馆(Computer History Museum)名人录(Hall of Fellows)][33]。 + +评论: + +> “... 可能是有史以来最能成事的程序员了。Unix 内核,Unix 工具,国际象棋程序世界冠军 Belle,Plan 9,Go 语言。” —— [Pete Prokopowicz][34] + +> “肯所做出的贡献,据我所知无人能及,是如此的根本、实用、经得住时间的考验,时至今日仍在使用。” —— [Jan Jannink][35] + + +### 理查德·斯托曼(Richard Stallman) ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_richard_stallman-620x465-100502868-orig.jpg) + +*图片来源: [Jiel Beaumadier CC BY-SA 3.0][135]* + +**成就: Emacs 和 GCC 缔造者** + +生平: 成立了 [GNU 工程(GNU Project)] [36],并创造了它的许多核心工具,如 [Emacs、GCC、GDB][37] 和 [GNU Make][38]。还创办了[自由软件基金会(Free Software Foundation)] [39]。1990年荣获 ACM 的[葛丽丝·穆雷·霍普奖( Grace Murray Hopper Award)][40],1998年获 [EFF 先驱奖(Pioneer Award)][41]. + +评论: + +> “... 在 Symbolics 对阵 LMI 的战斗中,独自一人与一众 Lisp 黑客好手对码。” —— [Srinivasan Krishnan][42] + +> “通过他在编程上的精湛造诣与强大信念,开辟了一整套编程与计算机的亚文化。” —— [Dan Dunay][43] + +> “我可以不赞同这位伟人的很多方面,不必盖棺论定,他不可否认都已经是一位伟大的程序员了。” —— [Marko Poutiainen][44] + +> “试想 Linux 如果没有 GNU 工程的前期工作会怎么样。(多亏了)斯托曼的炸弹!” —— [John Burnette][45] + +### 安德斯·海尔斯伯格(Anders Hejlsberg) ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_anders_hejlsberg-620x465-100502873-orig.jpg) + +*图片来源: [D.Begley CC BY 2.0][46]* + +**成就: 创造了Turbo Pascal** + +生平: [Turbo Pascal 的原作者][47],是最流行的 Pascal 编译器和第一个集成开发环境。而后,[领导了 Turbo Pascal 的继任者 Delphi][48] 的构建。[C# 的主要设计师和架构师][49]。2001年荣获[ Dr. Dobb 的杰出编程奖(Dr. Dobb's Excellence in Programming Award )][50]。 + +评论: + +> “他用汇编语言为当时两个主流的 PC 操作系统(DOS 和 CPM)编写了 [Pascal] 编译器。用它来编译、链接并运行仅需几秒钟而不是几分钟。” —— [Steve Wood][51] + +> “我佩服他 - 他创造了我最喜欢的开发工具,陪伴着我度过了三个关键的时期直至我成为一位专业的软件工程师。” —— [Stefan Kiryazov][52] + +### Doug Cutting ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_doug_cutting-620x465-100502871-orig.jpg) + +图片来源: [vonguard CC BY-SA 2.0][53] + +**成就: 创造了 Lucene** + +生平: [开发了 Lucene 搜索引擎以及 Web 爬虫 Nutch][54] 和用于大型数据集的分布式处理套件 [Hadoop][55]。一位强有力的开源支持者(Lucene、Nutch 以及 Hadoop 都是开源的)。前 [Apache 软件基金(Apache Software Foundation)的理事][56]。 + +评论: + + +> “...他就是那个既写出了优秀搜索框架(lucene/solr),又为世界开启大数据之门(hadoop)的男人。” —— [Rajesh Rao][57] + +> “他在 Lucene 和 Hadoop(及其它工程)的创造/工作中为世界创造了巨大的财富和就业...” —— [Amit Nithianandan][58] + +### Sanjay Ghemawat ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_sanjay_ghemawat-620x465-100502876-orig.jpg) + +*图片来源: [Association for Computing Machinery][59]* + +**成就: 谷歌核心架构师** + +生平: [协助设计和实现了一些谷歌大型分布式系统的功能][60],包括 MapReduce、BigTable、Spanner 和谷歌文件系统(Google File System)。[创造了 Unix 的 ical ][61]日历系统。2009年入选[美国国家工程院(National Academy of Engineering)][62]。2012年荣获 [ACM-Infosys 基金计算机科学奖( ACM-Infosys Foundation Award in the Computing Sciences)][63]。 + +评论: + + +> “Jeff Dean的僚机。” —— [Ahmet Alp Balkan][64] + +### Jeff Dean ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_jeff_dean-620x465-100502866-orig.jpg) + +*图片来源: [Google][65]* + +**成就: 谷歌搜索索引背后的大脑** + +生平:协助设计和实现了[许多谷歌大型分布式系统的功能][66],包括网页爬虫,索引搜索,AdSense,MapReduce,BigTable 和 Spanner。2009年入选[美国国家工程院( National Academy of Engineering)][67]。2012年荣获ACM 的[SIGOPS 马克·维瑟奖( SIGOPS Mark Weiser Award)][68]及[ACM-Infosys基金计算机科学奖( ACM-Infosys Foundation Award in the Computing Sciences)][69]。 + +评论: + +> “... 带来了在数据挖掘(GFS、MapReduce、BigTable)上的突破。” —— [Natu Lauchande][70] + +> “... 设计、构建并部署 MapReduce 和 BigTable,和以及数不清的其它东西” —— [Erik Goldman][71] + +### 林纳斯·托瓦兹(Linus Torvalds) ### + +![](http://images.techhive.com/images/article/2015/09/linus_torvalds-620x465-100611765-orig.jpg) + +*图片来源: [Krd CC BY-SA 4.0][72]* + +**成就: Linux缔造者** + +生平:创造了 [Linux 内核][73]与[开源的版本控制系统 Git][74]。收获了许多奖项和荣誉,包括有1998年的 [EFF 先驱奖(EFF Pioneer Award)][75],2000年荣获[英国电脑学会(British Computer Society)授予的洛夫莱斯勋章(Lovelace Medal)][76],2012年荣获[千禧技术奖(Millenium Technology Prize)][77]还有2014年[IEEE计算机学会( IEEE Computer Society)授予的计算机先驱奖(Computer Pioneer Award)][78]。同样入选了2008年的[计算机历史博物馆( Computer History Museum)名人录(Hall of Fellows)][79]与2012年的[互联网名人堂(Internet Hall of Fame )][80]。 + +评论: + +> “他只用了几年的时间就写出了 Linux 内核,而 GNU Hurd(GNU 开发的内核)历经25年的开发却丝毫没有准备发布的意思。他的成就就是带来了希望。” —— [Erich Ficker][81] + +> “托沃兹可能是程序员的程序员。” —— [Dan Allen][82] + +> “他真的很棒。” —— [Alok Tripathy][83] + +### 约翰·卡马克(John Carmack) ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_john_carmack-620x465-100502867-orig.jpg) + +*图片来源: [QuakeCon CC BY 2.0][84]* + +**成就: 毁灭战士的缔造者** + +生平: ID 社联合创始人,打造了德军总部3D(Wolfenstein 3D)、毁灭战士(Doom)和雷神之锤(Quake)等所谓的即时 FPS 游戏。引领了[切片适配刷新(adaptive tile refresh)][86], [二叉空间分割(binary space partitioning)][87],表面缓存(surface caching)等开创性的计算机图像技术。2001年入选[互动艺术与科学学会名人堂(Academy of Interactive Arts and Sciences Hall of Fame)][88],2007年和2008年荣获工程技术类[艾美奖(Emmy awards)][89]并于2010年由[游戏开发者甄选奖( Game Developers Choice Awards)][90]授予终生成就奖。 + +评论: + +> “他在写第一个渲染引擎的时候不到20岁。这家伙这是个天才。我若有他四分之一的天赋便心满意足了。” —— [Alex Dolinsky][91] + +> “... 德军总部3D(Wolfenstein 3D)、毁灭战士(Doom)还有雷神之锤(Quake)在那时都是革命性的,影响了一代游戏设计师。” —— [dniblock][92] + +> “一个周末他几乎可以写出任何东西....” —— [Greg Naughton][93] + +> “他是编程界的莫扎特... ” —— [Chris Morris][94] + +### 法布里斯·贝拉(Fabrice Bellard) ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_fabrice_bellard-620x465-100502870-orig.jpg) + +*图片来源: [Duff][95]* + +**成就: 创造了 QEMU** + +生平: 创造了[一系列耳熟能详的开源软件][96],其中包括硬件模拟和虚拟化的平台 QEMU,用于处理多媒体数据的 FFmpeg,微型C编译器(Tiny C Compiler)和 一个可执行文件压缩软件 LZEXE。2000年和2001年[C语言混乱代码大赛(Obfuscated C Code Contest)的获胜者][97]并在2011年荣获[Google-O'Reilly 开源奖(Google-O'Reilly Open Source Award )][98]。[计算 Pi 最多位数][99]的前世界纪录保持着。 + +评论: + + +> “我觉得法布里斯·贝拉做的每一件事都是那么显著而又震撼。” —— [raphinou][100] + +> “法布里斯·贝拉是世界上最高产的程序员...” —— [Pavan Yara][101] + +> “他就像软件工程界的尼古拉·特斯拉(Nikola Tesla)。” —— [Michael Valladolid][102] + +> “自80年代以来,他一直高产出一系列的成功作品。” —— [Michael Biggins][103] + +### Jon Skeet ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_jon_skeet-620x465-100502863-orig.jpg) + +*图片来源: [Craig Murphy CC BY 2.0][104]* + +**成就: Stack Overflow 的传说级贡献者** + +生平: Google 工程师,[深入解析C#(C# in Depth)][105]的作者。保持着[有史以来在 Stack Overflow 上最高的声誉][106],平均每月解答390个问题。 + +评论: + + +> “他根本不需要调试器,只要他盯一下代码,错误之处自会原形毕露。” —— [Steven A. Lowe][107] + +> “如果他的代码没有通过编译,那编译器应该道歉。” —— [Dan Dyer][108] + +> “他根本不需要什么编程规范,他的代码就是编程规范。” —— [佚名][109] + +### 亚当·安捷罗(Adam D'Angelo) ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_image_adam_dangelo-620x465-100502875-orig.jpg) + +*图片来源: [Philip Neustrom CC BY 2.0][110]* + +**成就: Quora 的创办人之一** + +生平: 还是 Facebook 工程师时,[为其搭建了 news feed 功能的基础][111]。直至其离开并联合创始了 Quora,已经成为了 Facebook 的CTO和工程 VP。2001年以高中生的身份在[美国计算机奥林匹克(USA Computing Olympiad)上第八位完成比赛][112]。2004年ACM国际大学生编程大赛(International Collegiate Programming Contest)[获得银牌的团队 - 加利福尼亚技术研究所( California Institute of Technology)][113]的成员。2005年入围 Topcoder 大学生[算法编程挑战赛(Algorithm Coding Competition)][114]。 + +评论: + +> “一位程序设计全才。” —— [佚名][115] + +> "我做的每个好东西,他都已有了六个。" —— [马克.扎克伯格(Mark Zuckerberg)][116] + +### Petr Mitrechev ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_petr_mitrichev-620x465-100502869-orig.jpg) + +*图片来源: [Facebook][117]* + +**成就: 有史以来最具竞技能力的程序员之一** + +生平: 在国际信息学奥林匹克(International Olympiad in Informatics)中[两次获得金牌][118](2000,2002)。在2006,[赢得 Google Code Jam][119] 同时也是[TopCoder Open 算法大赛冠军][120]。也同样,两次赢得 Facebook黑客杯(Facebook Hacker Cup)([2011][121],[2013][122])。写这篇文章的时候,[TopCoder 榜中排第二][123] (即:Petr)、在 [Codeforces 榜同样排第二][124]。 + +评论: + +> “他是竞技程序员的偶像,即使在印度也是如此...” —— [Kavish Dwivedi][125] + +### Gennady Korotkevich ### + +![](http://images.techhive.com/images/idge/imported/imageapi/2014/10/08/17/slide_gennady_korot-620x465-100502864-orig.jpg) + +*图片来源: [Ishandutta2007 CC BY-SA 3.0][126]* + +**成就: 竞技编程小神童** + +生平: 国际信息学奥林匹克(International Olympiad in Informatics)中最小参赛者(11岁),[6次获得金牌][127] (2007-2012)。2013年 ACM 国际大学生编程大赛(International Collegiate Programming Contest)[获胜队伍][128]成员及[2014 Facebook 黑客杯(Facebook Hacker Cup)][129]获胜者。写这篇文章的时候,[Codeforces 榜排名第一][130] (即:Tourist)、[TopCoder榜第一][131]。 + +评论: + +> “一个编程神童!” —— [Prateek Joshi][132] + +> “Gennady 真是棒,也是为什么我在白俄罗斯拥有一个强大开发团队的例证。” —— [Chris Howard][133] + +> “Tourist 真是天才” —— [Nuka Shrinivas Rao][134] + +-------------------------------------------------------------------------------- + +via: http://www.itworld.com/article/2823547/enterprise-software/158256-superclass-14-of-the-world-s-best-living-programmers.html#slide1 + +作者:[Phil Johnson][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.itworld.com/author/Phil-Johnson/ +[1]:https://www.flickr.com/photos/tombullock/15713223772 +[2]:https://commons.wikimedia.org/wiki/File:Margaret_Hamilton_in_action.jpg +[3]:http://klabs.org/home_page/hamilton.htm +[4]:https://www.youtube.com/watch?v=DWcITjqZtpU&feature=youtu.be&t=3m12s +[5]:http://www.htius.com/Articles/r12ham.pdf +[6]:http://www.htius.com/Articles/Inside_DBTF.htm +[7]:http://www.nasa.gov/home/hqnews/2003/sep/HQ_03281_Hamilton_Honor.html +[8]:http://www.nasa.gov/50th/50th_magazine/scientists.html +[9]:https://books.google.com/books?id=JcmV0wfQEoYC&pg=PA321&lpg=PA321&dq=ada+lovelace+award+1986&source=bl&ots=qGdBKsUa3G&sig=bkTftPAhM1vZ_3VgPcv-38ggSNo&hl=en&sa=X&ved=0CDkQ6AEwBGoVChMI3paoxJHWxwIVA3I-Ch1whwPn#v=onepage&q=ada%20lovelace%20award%201986&f=false +[10]:http://history.nasa.gov/alsj/a11/a11Hamilton.html +[11]:https://www.reddit.com/r/pics/comments/2oyd1y/margaret_hamilton_with_her_code_lead_software/cmrswof +[12]:http://qr.ae/RFEZLk +[13]:http://qr.ae/RFEZUn +[14]:https://www.reddit.com/r/pics/comments/2oyd1y/margaret_hamilton_with_her_code_lead_software/cmrv9u9 +[15]:https://www.flickr.com/photos/44451574@N00/5347112697 +[16]:http://cs.stanford.edu/~uno/taocp.html +[17]:http://awards.acm.org/award_winners/knuth_1013846.cfm +[18]:http://amturing.acm.org/award_winners/knuth_1013846.cfm +[19]:http://www.nsf.gov/od/nms/recip_details.jsp?recip_id=198 +[20]:http://www.ieee.org/documents/von_neumann_rl.pdf +[21]:http://www.computerhistory.org/fellowawards/hall/bios/Donald,Knuth/ +[22]:http://www.quora.com/Who-are-the-best-programmers-in-Silicon-Valley-and-why/answers/3063 +[23]:http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Jaap-Weel +[24]:http://qr.ae/RFE94x +[25]:http://amturing.acm.org/photo/thompson_4588371.cfm +[26]:https://www.youtube.com/watch?v=JoVQTPbD6UY +[27]:https://www.bell-labs.com/usr/dmr/www/bintro.html +[28]:http://doc.cat-v.org/bell_labs/utf-8_history +[29]:http://c2.com/cgi/wiki?EdIsTheStandardTextEditor +[30]:http://amturing.acm.org/award_winners/thompson_4588371.cfm +[31]:http://www.computer.org/portal/web/awards/cp-thompson +[32]:http://www.uspto.gov/about/nmti/recipients/1998.jsp +[33]:http://www.computerhistory.org/fellowawards/hall/bios/Ken,Thompson/ +[34]:http://www.quora.com/Computer-Programming/Who-is-the-best-programmer-in-the-world-right-now/answer/Pete-Prokopowicz-1 +[35]:http://qr.ae/RFEWBY +[36]:https://groups.google.com/forum/#!msg/net.unix-wizards/8twfRPM79u0/1xlglzrWrU0J +[37]:http://www.emacswiki.org/emacs/RichardStallman +[38]:https://www.gnu.org/gnu/thegnuproject.html +[39]:http://www.emacswiki.org/emacs/FreeSoftwareFoundation +[40]:http://awards.acm.org/award_winners/stallman_9380313.cfm +[41]:https://w2.eff.org/awards/pioneer/1998.php +[42]:http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Greg-Naughton/comment/4146397 +[43]:http://qr.ae/RFEaib +[44]:http://www.quora.com/Software-Engineering/Who-are-some-of-the-greatest-currently-active-software-architects-in-the-world/answer/Marko-Poutiainen +[45]:http://qr.ae/RFEUqp +[46]:https://www.flickr.com/photos/begley/2979906130 +[47]:http://www.taoyue.com/tutorials/pascal/history.html +[48]:http://c2.com/cgi/wiki?AndersHejlsberg +[49]:http://www.microsoft.com/about/technicalrecognition/anders-hejlsberg.aspx +[50]:http://www.drdobbs.com/windows/dr-dobbs-excellence-in-programming-award/184404602 +[51]:http://qr.ae/RFEZrv +[52]:http://www.quora.com/Software-Engineering/Who-are-some-of-the-greatest-currently-active-software-architects-in-the-world/answer/Stefan-Kiryazov +[53]:https://www.flickr.com/photos/vonguard/4076389963/ +[54]:http://www.wizards-of-os.org/archiv/sprecher/a_c/doug_cutting.html +[55]:http://hadoop.apache.org/ +[56]:https://www.linkedin.com/in/cutting +[57]:http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Shalin-Shekhar-Mangar/comment/2293071 +[58]:http://www.quora.com/Who-are-the-best-programmers-in-Silicon-Valley-and-why/answer/Amit-Nithianandan +[59]:http://awards.acm.org/award_winners/ghemawat_1482280.cfm +[60]:http://research.google.com/pubs/SanjayGhemawat.html +[61]:http://www.quora.com/Google/Who-is-Sanjay-Ghemawat +[62]:http://www8.nationalacademies.org/onpinews/newsitem.aspx?RecordID=02062009 +[63]:http://awards.acm.org/award_winners/ghemawat_1482280.cfm +[64]:http://www.quora.com/Google/Who-is-Sanjay-Ghemawat/answer/Ahmet-Alp-Balkan +[65]:http://research.google.com/people/jeff/index.html +[66]:http://research.google.com/people/jeff/index.html +[67]:http://www8.nationalacademies.org/onpinews/newsitem.aspx?RecordID=02062009 +[68]:http://news.cs.washington.edu/2012/10/10/uw-cse-ph-d-alum-jeff-dean-wins-2012-sigops-mark-weiser-award/ +[69]:http://awards.acm.org/award_winners/dean_2879385.cfm +[70]:http://www.quora.com/Computer-Programming/Who-is-the-best-programmer-in-the-world-right-now/answer/Natu-Lauchande +[71]:http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Cosmin-Negruseri/comment/28399 +[72]:https://commons.wikimedia.org/wiki/File:LinuxCon_Europe_Linus_Torvalds_05.jpg +[73]:http://www.linuxfoundation.org/about/staff#torvalds +[74]:http://git-scm.com/book/en/Getting-Started-A-Short-History-of-Git +[75]:https://w2.eff.org/awards/pioneer/1998.php +[76]:http://www.bcs.org/content/ConWebDoc/14769 +[77]:http://www.zdnet.com/blog/open-source/linus-torvalds-wins-the-tech-equivalent-of-a-nobel-prize-the-millennium-technology-prize/10789 +[78]:http://www.computer.org/portal/web/pressroom/Linus-Torvalds-Named-Recipient-of-the-2014-IEEE-Computer-Society-Computer-Pioneer-Award +[79]:http://www.computerhistory.org/fellowawards/hall/bios/Linus,Torvalds/ +[80]:http://www.internethalloffame.org/inductees/linus-torvalds +[81]:http://qr.ae/RFEeeo +[82]:http://qr.ae/RFEZLk +[83]:http://www.quora.com/Software-Engineering/Who-are-some-of-the-greatest-currently-active-software-architects-in-the-world/answer/Alok-Tripathy-1 +[84]:https://www.flickr.com/photos/quakecon/9434713998 +[85]:http://doom.wikia.com/wiki/John_Carmack +[86]:http://thegamershub.net/2012/04/gaming-gods-john-carmack/ +[87]:http://www.shamusyoung.com/twentysidedtale/?p=4759 +[88]:http://www.interactive.org/special_awards/details.asp?idSpecialAwards=6 +[89]:http://www.itworld.com/article/2951105/it-management/a-fly-named-for-bill-gates-and-9-other-unusual-honors-for-tech-s-elite.html#slide8 +[90]:http://www.gamechoiceawards.com/archive/lifetime.html +[91]:http://qr.ae/RFEEgr +[92]:http://www.itworld.com/answers/topic/software/question/whos-best-living-programmer#comment-424562 +[93]:http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Greg-Naughton +[94]:http://money.cnn.com/2003/08/21/commentary/game_over/column_gaming/ +[95]:http://dufoli.wordpress.com/2007/06/23/ammmmaaaazing-night/ +[96]:http://bellard.org/ +[97]:http://www.ioccc.org/winners.html#B +[98]:http://www.oscon.com/oscon2011/public/schedule/detail/21161 +[99]:http://bellard.org/pi/pi2700e9/ +[100]:https://news.ycombinator.com/item?id=7850797 +[101]:http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Erik-Frey/comment/1718701 +[102]:http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Erik-Frey/comment/2454450 +[103]:http://qr.ae/RFEjhZ +[104]:https://www.flickr.com/photos/craigmurphy/4325516497 +[105]:http://www.amazon.co.uk/gp/product/1935182471?ie=UTF8&tag=developetutor-21&linkCode=as2&camp=1634&creative=19450&creativeASIN=1935182471 +[106]:http://stackexchange.com/leagues/1/alltime/stackoverflow +[107]:http://meta.stackexchange.com/a/9156 +[108]:http://meta.stackexchange.com/a/9138 +[109]:http://meta.stackexchange.com/a/9182 +[110]:https://www.flickr.com/photos/philipn/5326344032 +[111]:http://www.crunchbase.com/person/adam-d-angelo +[112]:http://www.exeter.edu/documents/Exeter_Bulletin/fall_01/oncampus.html +[113]:http://icpc.baylor.edu/community/results-2004 +[114]:https://www.topcoder.com/tc?module=Static&d1=pressroom&d2=pr_022205 +[115]:http://qr.ae/RFfOfe +[116]:http://www.businessinsider.com/in-new-alleged-ims-mark-zuckerberg-talks-about-adam-dangelo-2012-9#ixzz369FcQoLB +[117]:https://www.facebook.com/hackercup/photos/a.329665040399024.91563.133954286636768/553381194694073/?type=1 +[118]:http://stats.ioinformatics.org/people/1849 +[119]:http://googlepress.blogspot.com/2006/10/google-announces-winner-of-global-code_27.html +[120]:http://community.topcoder.com/tc?module=SimpleStats&c=coder_achievements&d1=statistics&d2=coderAchievements&cr=10574855 +[121]:https://www.facebook.com/notes/facebook-hacker-cup/facebook-hacker-cup-finals/208549245827651 +[122]:https://www.facebook.com/hackercup/photos/a.329665040399024.91563.133954286636768/553381194694073/?type=1 +[123]:http://community.topcoder.com/tc?module=AlgoRank +[124]:http://codeforces.com/ratings +[125]:http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Venkateswaran-Vicky/comment/1960855 +[126]:http://commons.wikimedia.org/wiki/File:Gennady_Korot.jpg +[127]:http://stats.ioinformatics.org/people/804 +[128]:http://icpc.baylor.edu/regionals/finder/world-finals-2013/standings +[129]:https://www.facebook.com/hackercup/posts/10152022955628845 +[130]:http://codeforces.com/ratings +[131]:http://community.topcoder.com/tc?module=AlgoRank +[132]:http://www.quora.com/Computer-Programming/Who-is-the-best-programmer-in-the-world-right-now/answer/Prateek-Joshi +[133]:http://www.quora.com/Computer-Programming/Who-is-the-best-programmer-in-the-world-right-now/answer/Prateek-Joshi/comment/4720779 +[134]:http://www.quora.com/Computer-Programming/Who-is-the-best-programmer-in-the-world-right-now/answer/Prateek-Joshi/comment/4880549 +[135]:http://commons.wikimedia.org/wiki/File:Jielbeaumadier_richard_stallman_2010.jpg \ No newline at end of file diff --git a/published/201511/20150914 Display Awesome Linux Logo With Basic Hardware Info Using screenfetch and linux_logo Tools.md b/published/201511/20150914 Display Awesome Linux Logo With Basic Hardware Info Using screenfetch and linux_logo Tools.md new file mode 100644 index 0000000000..564fb33e1e --- /dev/null +++ b/published/201511/20150914 Display Awesome Linux Logo With Basic Hardware Info Using screenfetch and linux_logo Tools.md @@ -0,0 +1,227 @@ +用 screenfetch 和 linux_logo 显示带有酷炫 Linux 标志的基本硬件信息 +================================================================================ +想在屏幕上显示出你的 Linux 发行版的酷炫标志和基本硬件信息吗?不用找了,来试试超赞的 screenfetch 和 linux_logo 工具。 + +### 来看看 screenfetch 吧 ### + +screenFetch 是一个能够在截屏中显示系统/主题信息的命令行脚本。它可以在 Linux,OS X,FreeBSD 以及其它的许多类Unix系统上使用。来自 man 手册的说明: + +> 这个方便的 Bash 脚本可以用来生成那些漂亮的终端主题信息和用 ASCII 构成的发行版标志,就像如今你在别人的截屏里看到的那样。它会自动检测你的发行版并显示 ASCII 版的发行版标志,并且在右边显示一些有价值的信息。 + +#### 在 Linux 上安装 screenfetch #### + +打开终端应用。在基于 Debian 或 Ubuntu 或 Mint 的系统上只需要输入下列 [apt-get 命令][1]: + + $ sudo apt-get install screenfetch + +![](http://s0.cyberciti.org/uploads/cms/2015/09/ubuntu-debian-linux-apt-get-install-screenfetch.jpg) + +*图一:用 apt-get 安装 screenfetch* + +#### 在 Mac OS X 上安装 screenfetch #### + +输入下列命令: + + $ brew install screenfetch + +![](http://s0.cyberciti.org/uploads/cms/2015/09/apple-mac-osx-install-screenfetch.jpg) + +*图二:用 brew 命令安装 screenfetch* + +#### 在 FreeBSD 上安装 screenfetch #### + +输入下列 pkg 命令: + + $ sudo pkg install sysutils/screenfetch + +![](http://s0.cyberciti.org/uploads/cms/2015/09/freebsd-install-pkg-screenfetch.jpg) + +*图三:在 FreeBSD 用 pkg 安装 screenfetch* + +#### 在 Fedora 上安装 screenfetch #### + +输入下列 dnf 命令: + + $ sudo dnf install screenfetch + +![](http://s0.cyberciti.org/uploads/cms/2015/09/fedora-dnf-install-screenfetch.jpg) + +*图四:在 Fedora 22 用 dnf 安装 screenfetch* + +#### 我该怎么使用 screefetch 工具? #### + +只需输入以下命令: + + $ screenfetch + +这是不同系统的输出: + +![](http://s0.cyberciti.org/uploads/cms/2015/09/fedora-screenfetch.jpg) + +*Fedora 上的 Screenfetch* + +![](http://s0.cyberciti.org/uploads/cms/2015/09/screenfetch-osx.jpg) + +*OS X 上的 Screenfetch* + +![](http://s0.cyberciti.org/uploads/cms/2015/09/screenfetch-freebsd.jpg) + +*FreeBSD 上的 Screenfetch* + +![](http://s0.cyberciti.org/uploads/cms/2015/09/debian-ubutnu-screenfetch-outputs.jpg) + +*Debian 上的 Screenfetch* + +#### 获取截屏 #### + +要获取截屏并保存成文件,输入: + + $ screenfetch -s + +你会看到一个文件 ~/Desktop/screenFetch-*.jpg。获取截屏并直接上传到 imgur,输入: + + $ screenfetch -su imgur + +**输出示例:** + + -/+:. veryv@Viveks-MacBook-Pro + :++++. OS: 64bit Mac OS X 10.10.5 14F27 + /+++/. Kernel: x86_64 Darwin 14.5.0 + .:-::- .+/:-``.::- Uptime: 3d 1h 36m + .:/++++++/::::/++++++/:` Packages: 56 + .:///////////////////////:` Shell: bash 3.2.57 + ////////////////////////` Resolution: 2560x1600 1920x1200 + -+++++++++++++++++++++++` DE: Aqua + /++++++++++++++++++++++/ WM: Quartz Compositor + /sssssssssssssssssssssss. WM Theme: Blue + :ssssssssssssssssssssssss- Font: Not Found + osssssssssssssssssssssssso/` CPU: Intel Core i5-4288U CPU @ 2.60GHz + `syyyyyyyyyyyyyyyyyyyyyyyy+` GPU: Intel Iris + `ossssssssssssssssssssss/ RAM: 6405MB / 8192MB + :ooooooooooooooooooo+. + `:+oo+/:-..-:/+o+/- + + Taking shot in 3.. 2.. 1.. 0. + ==> Uploading your screenshot now...your screenshot can be viewed at http://imgur.com/HKIUznn + +你可以访问 [http://imgur.com/HKIUznn][2] 来查看上传的截屏。 + +### 再来看看 linux_logo ### + +linux_logo 程序生成一个彩色的 ANSI 版企鹅图片,还包含一些来自 /proc 的系统信息。 + +#### 安装 #### + +只需按照你的 Linux 发行版输入对应的命令: + +#### Debian/Ubutnu/Mint #### + + # apt-get install linux_logo + +#### CentOS/RHEL/旧版 Fedora #### + + # yum install linux_logo + +#### Fedora Linux v22+ 或更新版本 #### + + # dnf install linux_logo + +#### 运行它 #### + +只需输入下列命令: + + $ linux_logo + +![](http://s0.cyberciti.org/uploads/cms/2015/09/debian-linux_logo.jpg) + +*运行 linux_logo* + +#### 等等,还有更多! #### + +你可以用这个命令查看内置的标志列表: + + $ linux_logo -f -L list + +**输出示例:** + + Available Built-in Logos: + Num Type Ascii Name Description + 1 Classic Yes aix AIX Logo + 2 Banner Yes bsd_banner FreeBSD Logo + 3 Classic Yes bsd FreeBSD Logo + 4 Classic Yes irix Irix Logo + 5 Banner Yes openbsd_banner OpenBSD Logo + 6 Classic Yes openbsd OpenBSD Logo + 7 Banner Yes solaris The Default Banner Logos + 8 Banner Yes banner The Default Banner Logo + 9 Banner Yes banner-simp Simplified Banner Logo + 10 Classic Yes classic The Default Classic Logo + 11 Classic Yes classic-nodots The Classic Logo, No Periods + 12 Classic Yes classic-simp Classic No Dots Or Letters + 13 Classic Yes core Core Linux Logo + 14 Banner Yes debian_banner_2 Debian Banner 2 + 15 Banner Yes debian_banner Debian Banner (white) + 16 Classic Yes debian Debian Swirl Logos + 17 Classic Yes debian_old Debian Old Penguin Logos + 18 Classic Yes gnu_linux Classic GNU/Linux + 19 Banner Yes mandrake Mandrakelinux(TM) Banner + 20 Banner Yes mandrake_banner Mandrake(TM) Linux Banner + 21 Banner Yes mandriva Mandriva(TM) Linux Banner + 22 Banner Yes pld PLD Linux banner + 23 Classic Yes raspi An ASCII Raspberry Pi logo + 24 Banner Yes redhat RedHat Banner (white) + 25 Banner Yes slackware Slackware Logo + 26 Banner Yes sme SME Server Banner Logo + 27 Banner Yes sourcemage_ban Source Mage GNU/Linux banner + 28 Banner Yes sourcemage Source Mage GNU/Linux large + 29 Banner Yes suse SUSE Logo + 30 Banner Yes ubuntu Ubuntu Logo + + Do "linux_logo -L num" where num is from above to get the appropriate logo. + Remember to also use -a to get ascii version. + +查看 aix 的标志,输入: + + $ linux_logo -f -L aix + +查看 openbsd 的标志: + + $ linux_logo -f -L openbsd + +或者只是随机看看一些 Linux 标志: + + $ linux_logo -f -L random_xy + +你[可以像下面那样结合 bash 的循环来显示不同的标志][3],输入: + +![](http://s0.cyberciti.org/uploads/cms/2015/09/linux-logo-fun.gif) + +*动图1: linux_logo 和 bash 循环,既有趣又能发朋友圈耍酷* + +### 获取帮助 ### + +输入下列命令: + + $ screefetch -h + $ linux_logo -h + +**参考** + +- [screenFetch 主页][4] +- [linux_logo 主页][5] + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/hardware/howto-display-linux-logo-in-bash-terminal-using-screenfetch-linux_logo/ + +作者:Vivek Gite +译者:[alim0x](https://github.com/alim0x) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html +[2]:http://imgur.com/HKIUznn +[3]:http://www.cyberciti.biz/faq/bash-for-loop/ +[4]:https://github.com/KittyKatt/screenFetch +[5]:https://github.com/deater/linux_logo diff --git a/published/201511/20150921 Configure PXE Server In Ubuntu 14.04.md b/published/201511/20150921 Configure PXE Server In Ubuntu 14.04.md new file mode 100644 index 0000000000..8689a180ce --- /dev/null +++ b/published/201511/20150921 Configure PXE Server In Ubuntu 14.04.md @@ -0,0 +1,252 @@ +在 Ubuntu 14.04 中配置 PXE 服务器 +================================================================================ + +![](https://www.maketecheasier.com/assets/uploads/2015/09/pxe-featured.jpg) + +PXE(Preboot Execution Environment--预启动执行环境)服务器允许用户从网络中启动 Linux 发行版并且可以不需要 Linux ISO 镜像就能同时在数百台 PC 中安装。如果你客户端的计算机没有 CD/DVD 或USB 引导盘,或者如果你想在大型企业中同时安装多台计算机,那么 PXE 服务器可以帮你节省时间和金钱。 + +在这篇文章中,我们将告诉你如何在 Ubuntu 14.04 配置 PXE 服务器。 + +### 配置网络 ### + +开始前,你需要先设置 PXE 服务器使用静态 IP。在你的系统中要使用静态 IP 地址,需要编辑 “/etc/network/interfaces” 文件。 + +打开 “/etc/network/interfaces” 文件. + + sudo nano /etc/network/interfaces + +作如下修改: + + # 回环网络接口 + auto lo + iface lo inet loopback + # 主网络接口 + auto eth0 + iface eth0 inet static + address 192.168.1.20 + netmask 255.255.255.0 + gateway 192.168.1.1 + dns-nameservers 8.8.8.8 + +保存文件并退出。这将设置其 IP 地址为“192.168.1.20”。然后重新启动网络服务。 + + sudo /etc/init.d/networking restart + +### 安装 DHCP, TFTP 和 NFS: ### + +DHCP,TFTP 和 NFS 是 PXE 服务器的重要组成部分。首先,需要更新你的系统并安装所有需要的软件包。 + +为此,运行以下命令: + + sudo apt-get update + sudo apt-get install isc-dhcp-Server inetutils-inetd tftpd-hpa syslinux nfs-kernel-Server + +### 配置 DHCP 服务: ### + +DHCP 代表动态主机配置协议(Dynamic Host Configuration Protocol),它主要用于动态分配网络配置参数,如用于接口和服务的 IP 地址。在 PXE 环境中,DHCP 服务器允许客户端请求并自动获得一个 IP 地址来访问网络。 + +1、编辑 “/etc/default/dhcp3-server” 文件. + + sudo nano /etc/default/dhcp3-server + +作如下修改: + + INTERFACES="eth0" + +保存 (Ctrl + o) 并退出 (Ctrl + x) 文件. + +2、编辑 “/etc/dhcp3/dhcpd.conf” 文件: + + sudo nano /etc/dhcp/dhcpd.conf + +作如下修改: + + default-lease-time 600; + max-lease-time 7200; + subnet 192.168.1.0 netmask 255.255.255.0 { + range 192.168.1.21 192.168.1.240; + option subnet-mask 255.255.255.0; + option routers 192.168.1.20; + option broadcast-address 192.168.1.255; + filename "pxelinux.0"; + next-Server 192.168.1.20; + } + +保存文件并退出。 + +3、启动 DHCP 服务. + + sudo /etc/init.d/isc-dhcp-server start + +### 配置 TFTP 服务器: ### + +TFTP 是一种文件传输协议,类似于 FTP,但它不用进行用户认证也不能列出目录。TFTP 服务器总是监听网络上的 PXE 客户端的请求。当它检测到网络中有 PXE 客户端请求 PXE 服务时,它将提供包含引导菜单的网络数据包。 + +1、配置 TFTP 时,需要编辑 “/etc/inetd.conf” 文件. + + sudo nano /etc/inetd.conf + +作如下修改: + + tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot + +保存文件并退出。 + +2、编辑 “/etc/default/tftpd-hpa” 文件。 + + sudo nano /etc/default/tftpd-hpa + +作如下修改: + + TFTP_USERNAME="tftp" + TFTP_DIRECTORY="/var/lib/tftpboot" + TFTP_ADDRESS="[:0.0.0.0:]:69" + TFTP_OPTIONS="--secure" + RUN_DAEMON="yes" + OPTIONS="-l -s /var/lib/tftpboot" + +保存文件并退出。 + +3、 使用 `xinetd` 让 boot 服务在每次系统开机时自动启动,并启动tftpd服务。 + + sudo update-inetd --enable BOOT + sudo service tftpd-hpa start + +4、检查状态。 + + sudo netstat -lu + +它将如下所示: + + Proto Recv-Q Send-Q Local Address Foreign Address State + udp 0 0 *:tftp *:* + +### 配置 PXE 启动文件 ### + +现在,你需要将 PXE 引导文件 “pxelinux.0” 放在 TFTP 根目录下。为 TFTP 创建目录结构,并从 “/usr/lib/syslinux/” 复制 syslinux 提供的所有引导程序文件到 “/var/lib/tftpboot/” 下,操作如下: + + sudo mkdir /var/lib/tftpboot + sudo mkdir /var/lib/tftpboot/pxelinux.cfg + sudo mkdir -p /var/lib/tftpboot/Ubuntu/14.04/amd64/ + sudo cp /usr/lib/syslinux/vesamenu.c32 /var/lib/tftpboot/ + sudo cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/ + +#### 设置 PXELINUX 配置文件 #### + +PXE 配置文件定义了 PXE 客户端启动时显示的菜单,它能引导并与 TFTP 服务器关联。默认情况下,当一个 PXE 客户端启动时,它会使用自己的 MAC 地址指定要读取的配置文件,所以我们需要创建一个包含可引导内核列表的默认文件。 + +编辑 PXE 服务器配置文件,使用有效的安装选项。 + +编辑 “/var/lib/tftpboot/pxelinux.cfg/default”: + + sudo nano /var/lib/tftpboot/pxelinux.cfg/default + +作如下修改: + + DEFAULT vesamenu.c32 + TIMEOUT 100 + PROMPT 0 + MENU INCLUDE pxelinux.cfg/PXE.conf + NOESCAPE 1 + LABEL Try Ubuntu 14.04 Desktop + MENU LABEL Try Ubuntu 14.04 Desktop + kernel Ubuntu/vmlinuz + append boot=casper netboot=nfs nfsroot=192.168.1.20:/var/lib/tftpboot/Ubuntu/14.04/amd64 + initrd=Ubuntu/initrd.lz quiet splash + ENDTEXT + LABEL Install Ubuntu 14.04 Desktop + MENU LABEL Install Ubuntu 14.04 Desktop + kernel Ubuntu/vmlinuz + append boot=casper automatic-ubiquity netboot=nfs nfsroot=192.168.1.20:/var/lib/tftpboot/Ubuntu/14.04/amd64 + initrd=Ubuntu/initrd.lz quiet splash + ENDTEXT + +保存文件并退出。 + +编辑 “/var/lib/tftpboot/pxelinux.cfg/pxe.conf” 文件。 + + sudo nano /var/lib/tftpboot/pxelinux.cfg/pxe.conf + +作如下修改: + + MENU TITLE PXE Server + NOESCAPE 1 + ALLOWOPTIONS 1 + PROMPT 0 + MENU WIDTH 80 + MENU ROWS 14 + MENU TABMSGROW 24 + MENU MARGIN 10 + MENU COLOR border 30;44 #ffffffff #00000000 std + +保存文件并退出。 + +### 为 PXE 服务器添加 Ubuntu 14.04 桌面启动镜像 ### + +对于这一步需要 Ubuntu 内核和 initrd 文件。要获得这些文件,你需要 Ubuntu 14.04 桌面 ISO 镜像。你可以通过以下命令下载 Ubuntu 14.04 ISO 镜像到 /mnt 目录: + + sudo cd /mnt + sudo wget http://releases.ubuntu.com/14.04/ubuntu-14.04.3-desktop-amd64.iso + +**注意**: 下载用的 URL 可能会改变,因为 ISO 镜像会进行更新。如果上面的网址无法访问,看看[这个网站][4],了解最新的下载链接。 + +挂载 ISO 文件,使用以下命令将所有文件复制到 TFTP文件夹中: + + sudo mount -o loop /mnt/ubuntu-14.04.3-desktop-amd64.iso /media/ + sudo cp -r /media/* /var/lib/tftpboot/Ubuntu/14.04/amd64/ + sudo cp -r /media/.disk /var/lib/tftpboot/Ubuntu/14.04/amd64/ + sudo cp /media/casper/initrd.lz /media/casper/vmlinuz /var/lib/tftpboot/Ubuntu/ + +### 将导出的 ISO 目录配置到 NFS 服务器上 ### + +现在,你需要通过 NFS 协议来设置“安装源镜像( Installation Source Mirrors)”。你还可以使用 HTTP 和 FTP 来安装源镜像。在这里,我已经使用 NFS 输出 ISO 内容。 + +要配置 NFS 服务器,你需要编辑 “/etc/exports” 文件。 + + sudo nano /etc/exports + +作如下修改: + + /var/lib/tftpboot/Ubuntu/14.04/amd64 *(ro,async,no_root_squash,no_subtree_check) + +保存文件并退出。为使更改生效,输出并启动 NFS 服务。 + + sudo exportfs -a + sudo /etc/init.d/nfs-kernel-server start + +现在,你的 PXE 服务器已经准备就绪。 + +### 配置网络引导 PXE 客户端 ### + +PXE 客户端可以是任何支持 PXE 网络引导的计算机系统。现在,你的客户端只需要在系统的 BIOS 中设置 “从网络引导(Boot From Network)” 选项就可以启动并安装 Ubuntu 14.04 桌面。 + +现在准备出发吧 - 用网络引导启动你的 PXE 客户端计算机,你现在应该看到一个子菜单,显示了我们创建的 Ubuntu 14.04 桌面的菜单项。 + +![pxe](https://www.maketecheasier.com/assets/uploads/2015/09/pxe.png) + +### 结论 ### + +配置使用 PXE 服务器从网络启动安装能提高效率和节省时间。你可以在本地网络中同时安装数百个客户端。所有你需要的只是一个 PXE 服务器和能启动 PXE 的客户端。试试吧,如果这个对你有用请让我们知道。 + + +参考: +- [PXE Server wiki][1] +- [PXE Server Ubuntu][2] + +图片来源: [fupsol_unl_20][3] + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/configure-pxe-server-ubuntu/ + +作者:[Hitesh Jethva][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/hiteshjethva/ +[1]:https://en.wikipedia.org/wiki/Preboot_Execution_Environment +[2]:https://help.ubuntu.com/community/PXEInstallServer +[3]:https://www.flickr.com/photos/jhcalderon/3681926417/ +[4]:http://releases.ubuntu.com/14.04/ diff --git a/published/201511/20150929 A Developer's Journey into Linux Containers.md b/published/201511/20150929 A Developer's Journey into Linux Containers.md new file mode 100644 index 0000000000..7245883635 --- /dev/null +++ b/published/201511/20150929 A Developer's Journey into Linux Containers.md @@ -0,0 +1,128 @@ +一位开发者的 Linux 容器之旅 +================================================================================ +![](https://deis.com/images/blog-images/dev_journey_0.jpg) + +我告诉你一个秘密:使得我的应用程序进入到全世界的 DevOps 云计算之类的东西对我来说仍然有一点神秘。但随着时间流逝,我意识到理解大规模的机器增减和应用程序部署的来龙去脉对一个开发者来说是非常重要的知识。这类似于成为一个专业的音乐家,当然你肯定需要知道如何使用你的乐器,但是,如果你不知道一个录音棚是如何工作的,或者如何适应一个交响乐团,那么你在这样的环境中工作会变得非常困难。 + +在软件开发的世界里,使你的代码进入我们的更大的世界如同把它编写出来一样重要。DevOps 重要,而且是很重要。 + +因此,为了弥合开发(Dev)和部署(Ops)之间的空隙,我会从头开始介绍容器技术。为什么是容器?因为有强力的证据表明,容器是机器抽象的下一步:使计算机成为场所而不再是一个东西。理解容器是我们共同的旅程。 + +在这篇文章中,我会介绍容器化(containerization)背后的概念。包括容器和虚拟机的区别,以及容器构建背后的逻辑以及它是如何适应应用程序架构的。我会探讨轻量级的 Linux 操作系统是如何适应容器生态系统。我还会讨论使用镜像创建可重用的容器。最后我会介绍容器集群如何使你的应用程序可以快速扩展。 + +在后面的文章中,我会一步一步向你介绍容器化一个示例应用程序的过程,以及如何为你的应用程序容器创建一个托管集群。同时,我会向你展示如何使用 Deis 将你的示例应用程序部署到你本地系统以及多种云供应商的虚拟机上。 + +让我们开始吧。 + +### 虚拟机的好处 ### + +为了理解容器如何适应事物发展,你首先要了解容器的前任:虚拟机。 + +[虚拟机][1] (virtual machine (VM))是运行在物理宿主机上的软件抽象。配置一个虚拟机就像是购买一台计算机:你需要定义你想要的 CPU 数目、RAM 和磁盘存储容量。配置好了机器后,你为它加载操作系统,以及你想让虚拟机支持的任何服务器或者应用程序。 + +虚拟机允许你在一台硬件主机上运行多个模拟计算机。这是一个简单的示意图: + +![](https://deis.com/images/blog-images/dev_journey_1.png) + +虚拟机可以让你能充分利用你的硬件资源。你可以购买一台巨大的、轰隆作响的机器,然后在上面运行多个虚拟机。你可以有一个数据库虚拟机以及很多运行相同版本的定制应用程序的虚拟机所构成的集群。你可以在有限的硬件资源获得很多的扩展能力。如果你觉得你需要更多的虚拟机而且你的宿主硬件还有容量,你可以添加任何你需要的虚拟机。或者,如果你不再需要一个虚拟机,你可以关闭该虚拟机并删除虚拟机镜像。 + +### 虚拟机的局限 ### + +但是,虚拟机确实有局限。 + +如上面所示,假如你在一个主机上创建了三个虚拟机。主机有 12 个 CPU,48 GB 内存和 3TB 的存储空间。每个虚拟机配置为有 4 个 CPU,16 GB 内存和 1TB 存储空间。到现在为止,一切都还好。主机有这个容量。 + +但这里有个缺陷。所有分配给一个虚拟机的资源,无论是什么,都是专有的。每台机器都分配了 16 GB 的内存。但是,如果第一个虚拟机永不会使用超过 1GB 分配的内存,剩余的 15 GB 就会被浪费在那里。如果第三个虚拟机只使用分配的 1TB 存储空间中的 100GB,其余的 900GB 就成为浪费空间。 + +这里没有资源的流动。每台虚拟机拥有分配给它的所有资源。因此,在某种方式上我们又回到了虚拟机之前,把大部分金钱花费在未使用的资源上。 + +虚拟机还有*另一个*缺陷。让它们跑起来需要很长时间。如果你处于基础设施需要快速增长的情形,即使增加虚拟机是自动的,你仍然会发现你的很多时间都浪费在等待机器上线。 + +### 来到:容器 ### + +概念上来说,容器是一个 Linux 进程,Linux 认为它只是一个运行中的进程。该进程只知道它被告知的东西。另外,在容器化方面,该容器进程也分配了它自己的 IP 地址。这点很重要,重要的事情讲三遍,这是第二遍。**在容器化方面,容器进程有它自己的 IP 地址。**一旦给予了一个 IP 地址,该进程就是宿主网络中可识别的资源。然后,你可以在容器管理器上运行命令,使容器 IP 映射到主机中能访问公网的 IP 地址。建立了该映射,无论出于什么意图和目的,容器就是网络上一个可访问的独立机器,从概念上类似于虚拟机。 + +这是第三遍,容器是拥有不同 IP 地址从而使其成为网络上可识别的独立 Linux 进程。下面是一个示意图: + +![](https://deis.com/images/blog-images/dev_journey_2.png) + +容器/进程以动态、合作的方式共享主机上的资源。如果容器只需要 1GB 内存,它就只会使用 1GB。如果它需要 4GB,就会使用 4GB。CPU 和存储空间利用也是如此。CPU、内存和存储空间的分配是动态的,和典型虚拟机的静态方式不同。所有这些资源的共享都由容器管理器来管理。 + +最后,容器能非常快速地启动。 + +因此,容器的好处是:**你获得了虚拟机独立和封装的好处,而抛弃了静态资源专有的缺陷**。另外,由于容器能快速加载到内存,在扩展到多个容器时你能获得更好的性能。 + +### 容器托管、配置和管理 ### + +托管容器的计算机运行着被剥离的只剩下主要部分的某个 Linux 版本。现在,宿主计算机流行的底层操作系统是之前提到的 [CoreOS][2]。当然还有其它,例如 [Red Hat Atomic Host][3] 和 [Ubuntu Snappy][4]。 + +该 Linux 操作系统被所有容器所共享,减少了容器足迹的重复和冗余。每个容器只包括该容器特有的部分。下面是一个示意图: + +![](https://deis.com/images/blog-images/dev_journey_3.png) + +你可以用它所需的组件来配置容器。一个容器组件被称为**层(layer)**。层是一个容器镜像,(你会在后面的部分看到更多关于容器镜像的介绍)。你从一个基本层开始,这通常是你想在容器中使用的操作系统。(容器管理器只提供你所要的操作系统在宿主操作系统中不存在的部分。)当你构建你的容器配置时,你需要添加层,例如你想要添加网络服务器时这个层就是 Apache,如果容器要运行脚本,则需要添加 PHP 或 Python 运行时环境。 + +分层非常灵活。如果应用程序或者服务容器需要 PHP 5.2 版本,你相应地配置该容器即可。如果你有另一个应用程序或者服务需要 PHP 5.6 版本,没问题,你可以使用 PHP 5.6 配置该容器。不像虚拟机,更改一个版本的运行时依赖时你需要经过大量的配置和安装过程;对于容器你只需要在容器配置文件中重新定义层。 + +所有上面描述的容器的各种功能都由一个称为容器管理器(container manager)的软件控制。现在,最流行的容器管理器是 [Docker][5] 和 [Rocket][6]。上面的示意图展示了容器管理器是 Docker,宿主操作系统是 CentOS 的主机情景。 + +### 容器由镜像构成 ### + +当你需要将我们的应用程序构建到容器时,你就要编译镜像。镜像代表了你的容器需要完成其工作的容器模板。(容器里可以在容器里面,如下图)。镜像存储在注册库(registry)中,注册库通过网络访问。 + +从概念上讲,注册库类似于一个使用 Java 的人眼中的 [Maven][7] 仓库、使用 .NET 的人眼中的 [NuGet][8] 服务器。你会创建一个列出了你应用程序所需镜像的容器配置文件。然后你使用容器管理器创建一个包括了你的应用程序代码以及从容器注册库中下载的部分资源。例如,如果你的应用程序包括了一些 PHP 文件,你的容器配置文件会声明你会从注册库中获取 PHP 运行时环境。另外,你还要使用容器配置文件声明需要复制到容器文件系统中的 .php 文件。容器管理器会封装你应用程序的所有东西为一个独立容器,该容器将会在容器管理器的管理下运行在宿主计算机上。 + +这是一个容器创建背后概念的示意图: + +![](https://deis.com/images/blog-images/dev_journey_4.png) + +让我们仔细看看这个示意图。 + +(1)代表一个定义了你容器所需东西以及你容器如何构建的容器配置文件。当你在主机上运行容器时,容器管理器会读取该配置文件,从云上的注册库中获取你需要的容器镜像,(2)将镜像作为层添加到你的容器中。 + +另外,如果组成镜像需要其它镜像,容器管理器也会获取这些镜像并把它们作为层添加进来。(3)容器管理器会将需要的文件复制到容器中。 + +如果你使用了配置(provisioning)服务,例如 [Deis][9],你刚刚创建的应用程序容器做成镜像,(4)配置服务会将它部署到你选择的云供应商上,比如类似 AWS 和 Rackspace 云供应商。 + +### 集群中的容器 ### + +好了。这里有一个很好的例子说明了容器比虚拟机提供了更好的配置灵活性和资源利用率。但是,这并不是全部。 + +容器真正的灵活是在集群中。记住,每个容器有一个独立的 IP 地址。因此,能把它放到负载均衡器后面。将容器放到负载均衡器后面,这就上升了一个层面。 + +你可以在一个负载均衡容器后运行容器集群以获得更高的性能和高可用计算。这是一个例子: + +![](https://deis.com/images/blog-images/dev_journey_5.png) + +假如你开发了一个资源密集型的应用程序,例如图片处理。使用类似 [Deis][9] 的容器配置技术,你可以创建一个包括了你图片处理程序以及你图片处理程序需要的所有资源的容器镜像。然后,你可以部署一个或多个容器镜像到主机上的负载均衡器下。一旦创建了容器镜像,你可以随时使用它。当系统繁忙时可以添加更多的容器实例来满足手中的工作。 + +这里还有更多好消息。每次添加实例到环境中时,你不需要手动配置负载均衡器以便接受你的容器镜像。你可以使用服务发现技术让容器告知均衡器它可用。然后,一旦获知,均衡器就会将流量分发到新的结点。 + +### 全部放在一起 ### + +容器技术完善了虚拟机缺失的部分。类似 CoreOS、RHEL Atomic、和 Ubuntu 的 Snappy 宿主操作系统,和类似 Docker 和 Rocket 的容器管理技术结合起来,使得容器变得日益流行。 + +尽管容器变得更加越来越普遍,掌握它们还是需要一段时间。但是,一旦你懂得了它们的窍门,你可以使用类似 [Deis][9] 这样的配置技术使容器创建和部署变得更加简单。 + +从概念上理解容器和进一步实际使用它们完成工作一样重要。但我认为不实际动手把想法付诸实践,概念也难以理解。因此,我们该系列的下一阶段就是:创建一些容器。 + +-------------------------------------------------------------------------------- + +via: https://deis.com/blog/2015/developer-journey-linux-containers + +作者:[Bob Reselman][a] +译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://deis.com/blog +[1]:https://en.wikipedia.org/wiki/Virtual_machine +[2]:https://coreos.com/using-coreos/ +[3]:http://www.projectatomic.io/ +[4]:https://developer.ubuntu.com/en/snappy/ +[5]:https://www.docker.com/ +[6]:https://coreos.com/blog/rocket/ +[7]:https://en.wikipedia.org/wiki/Apache_Maven +[8]:https://www.nuget.org/ +[9]:http://deis.com/learn \ No newline at end of file diff --git a/published/201511/20151007-Fix-Shell-Script-Opens-In-Text Editor In Ubuntu.md b/published/201511/20151007-Fix-Shell-Script-Opens-In-Text Editor In Ubuntu.md new file mode 100644 index 0000000000..da44814e11 --- /dev/null +++ b/published/201511/20151007-Fix-Shell-Script-Opens-In-Text Editor In Ubuntu.md @@ -0,0 +1,39 @@ +修复 Shell 脚本在 Ubuntu 中的默认打开方式 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Run-Shell-Script-on-Double-Click.jpg) + +当你双击一个脚本(.sh文件)的时候,你想要做的是什么?通常的想法是执行它。但是在Ubuntu下面却不是这样,或者我应该更确切地说是在Files(Nautilus)中。你可能会疯狂地大叫“运行文件,运行文件”,但是文件没有运行而是用Gedit打开了。 + +我知道你也许会说文件有可执行权限么?我会说是的。脚本有可执行权限但是当我双击它的时候,它还是用文本编辑器打开了。我不希望这样,如果你遇到了同样的问题,我想你也许也想要这样。 + +我知道你或许已经被建议在终端下面执行,我知道这个可行,但是这不是一个在GUI下不能运行的借口是么? + +这篇教程中,我们会看到**如何在双击后运行shell脚本。** + +#### 修复在Ubuntu中shell脚本用文本编辑器打开的方式 #### + +shell脚本用文件编辑器打开的原因是Files(Ubuntu中的文件管理器)中的默认行为设置。在更早的版本中,它或许会询问你是否运行文件或者用编辑器打开。默认的行为在新的版本中被修改了。 + +要修复这个,进入文件管理器,并在菜单中点击**选项**: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/execute-shell-program-ubuntu-1.png) + +接下来在**文件选项(Files Preferences)**中进入**行为(Behavior)**标签中,你会看到**可执行的文本文件(Executable Text Files)**选项。 + +默认情况下,它被设置成“在打开时显示文本文件(View executable text files when they are opend)”。我建议你把它改成“每次询问(Ask each time)”,这样你可以选择是执行还是编辑了,当然了你也可以选择“在打开时云可执行文本文件(Run executable text files when they are opend)”。你可以自行选择。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/execute-shell-program-ubuntu-2.png) + +我希望这个贴士可以帮你修复这个小“问题”。欢迎提出问题和建议。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/shell-script-opens-text-editor/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ diff --git a/published/201511/20151012 Curious about Linux Try Linux Desktop on the Cloud.md b/published/201511/20151012 Curious about Linux Try Linux Desktop on the Cloud.md new file mode 100644 index 0000000000..2d2985bc34 --- /dev/null +++ b/published/201511/20151012 Curious about Linux Try Linux Desktop on the Cloud.md @@ -0,0 +1,44 @@ +好奇 Linux?试试云端的 Linux 桌面 +================================================================================ +Linux 在桌面操作系统市场上只占据了非常小的份额,从目前的调查结果来看,估计只有2%的市场份额;对比来看,丰富多变的 Windows 系统占据了接近90%的市场份额。对于 Linux 来说,要挑战 Windows 在桌面操作系统市场的垄断,需要有一个让用户学习不同的操作系统的简单方式。如果你相信传统的 Windows 用户会再买一台机器来使用 Linux,那你就太天真了。我们只能去试想用户重新分区,设置引导程序来使用双系统,或者跳过所有步骤回到一个最简单的方法。 + +![](http://www.linuxlinks.com/portal/content/reviews/Cloud/CloudComputing.png) + +我们实验过一系列让用户试操作 Linux 的无风险的使用方法,不涉及任何分区管理,包括 CD/DVD 光盘、USB 存储棒和桌面虚拟化软件等等。通过实验,我强烈推荐使用 VMware 的 VMware Player 或者 Oracle VirtualBox 虚拟机,对于桌面操作系统或者便携式电脑的用户,这是一种安装运行多操作系统的相对简单而且免费的的方法。每一台虚拟机和其他虚拟机相隔离,但是共享 CPU、内存、网络接口等等。虚拟机仍需要一定的资源来安装运行 Linux,也需要一台相当强劲的主机。但对于一个好奇心不大的人,这样做实在是太麻烦了。 + +要打破用户传统的使用观念是非常困难的。很多 Windows 用户可以尝试使用 Linux 提供的自由软件,但也有太多要学习的 Linux 系统知识。这会花掉他们相当一部分时间才能习惯 Linux 的工作方式。 + +当然了,对于一个第一次在 Linux 上操作的新手,有没有一个更高效的方法呢?答案是肯定的,接着往下看看云实验平台。 + +### LabxNow ### + +![LabxNow](http://www.linuxlinks.com/portal/content/reviews/Cloud/Screenshot-LabxNow.png) + +LabxNow 提供了一个免费服务,方便广大用户通过浏览器来访问远程 Linux 桌面。开发者将其加强为一个用户个人远程实验室(用户可以在系统里运行、开发任何程序),用户可以在任何地方通过互联网登入远程实验室。 + +这项服务现在可以为个人用户提供2核处理器,4GB RAM和10GB的固态硬盘,运行在128G RAM的4 AMD 6272处理器上。 + +#### 配置参数: #### + +- 系统镜像:基于 Ubuntu 14.04 的 Xface 4.10,RHEL 6.5,CentOS(Gnome桌面),Oracle +- 硬件: CPU - 1核或者2核;内存: 512MB, 1GB, 2GB or 4GB +- 超快的网络数据传输 +- 可以运行在所有流行的浏览器上 +- 可以安装任意程序,可以运行任何程序 – 这是一个非常棒的方法,可以随意做实验学习你想学的任何知识,没有 一点风险 +- 添加、删除、管理、制定虚拟机非常方便 +- 支持虚拟机共享,远程桌面 + +你所需要的只是一台有稳定网络的设备。不用担心虚拟专用系统(VPS)、域名、或者硬件带来的高费用。LabxNow提供了一个在 Ubuntu、RHEL 和 CentOS 上实验的非常好的方法。它给 Windows 用户提供一个极好的环境,让他们探索美妙的 Linux 世界。说得深入一点,它可以让用户随时随地在里面工作,而没有了要在每台设备上安装 Linux 的压力。点击下面这个链接进入 [www.labxnow.org/labxweb/][1]。 + +另外还有一些其它服务(大部分是收费服务)可以让用户使用 Linux,包括 Cloudsigma 环境的7天使用权和Icebergs.io (通过HTML5实现root权限)。但是现在,我推荐 LabxNow。 + +-------------------------------------------------------------------------------- + +来自: http://www.linuxlinks.com/article/20151003095334682/LinuxCloud.html + +译者:[sevenot](https://github.com/sevenot) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://www.labxnow.org/labxweb/ diff --git a/published/201511/20151012 How To Use iPhone In Antergos Linux.md b/published/201511/20151012 How To Use iPhone In Antergos Linux.md new file mode 100644 index 0000000000..e9bbca215a --- /dev/null +++ b/published/201511/20151012 How To Use iPhone In Antergos Linux.md @@ -0,0 +1,81 @@ +如何在 Antergos Linux 中使用 iPhone +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/iPhone-Antergos-Arch-Linux.jpg) + +在Arch Linux中使用iPhone遇到麻烦了么?iPhone和Linux从来都没有很好地集成。本教程中,我会向你展示如何在Antergos Linux中使用iPhone,对于同样基于Arch的的Linux发行版如Manjaro也应该同样管用。 + +我最近购买了一台全新的iPhone 6S,当我连接到Antergos Linux中要拷贝一些照片时,它完全没有检测到它。我看见iPhone正在被充电并且我已经允许了iPhone“信任这台电脑”,但是还是完全没有检测到。我尝试运行`dmseg`但是没有关于iPhone或者Apple的信息。有趣的是我当我安装好了[libimobiledevice][1],这个就可以解决[iPhone在Ubuntu中的挂载问题][2]。 + +我会向你展示如何在Antergos中使用运行iOS 9的iPhone 6S。这会有更多的命令行,但是我假设你用的是ArchLinux,并不惧怕使用终端(也不应该惧怕)。 + +### 在Arch Linux中挂载iPhone ### + +**第一步**:如果已经插入,请拔下你的iPhone。 + +**第二步**:现在,打开终端输入下面的命令来安装必要的包。如果它们已经安装过了也没有关系。 + + sudo pacman -Sy ifuse usbmuxd libplist libimobiledevice + +**第三步**: 这些库和程序安装完成后,重启系统。 + + sudo reboot + +**第四步**:创建一个iPhone的挂载目录,我建议在家目录中创建一个iPhone目录。 + + mkdir ~/iPhone + +**第五步**:解锁你的手机并插入,如果询问是否信任该计算机,请允许信任。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/iPhone-mount-Antergos-Linux-2.jpeg) + +**第六步**: 看看这时iPhone是否已经被机器识别了。 + + dmesg | grep -i iphone + +这时就该显示iPhone和Apple的结果了。就像这样: + + [ 31.003392] ipheth 2-1:4.2: Apple iPhone USB Ethernet device attached + [ 40.950883] ipheth 2-1:4.2: Apple iPhone USB Ethernet now disconnected + [ 47.471897] ipheth 2-1:4.2: Apple iPhone USB Ethernet device attached + [ 82.967116] ipheth 2-1:4.2: Apple iPhone USB Ethernet now disconnected + [ 106.735932] ipheth 2-1:4.2: Apple iPhone USB Ethernet device attached + +这意味着这时iPhone已经被Antergos/Arch成功地识别了。 + +**第七步**: 设置完成后是时候挂载iPhone了,使用下面的命令: + + ifuse ~/iPhone + +由于我们在家目录中创建了挂载目录,你不需要root权限就可以在家目录中看见。如果命令成功了,你就不会看见任何输出。 + +回到Files看下iPhone是否已经识别。对于我而言,在Antergos中看上去这样: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/iPhone-mount-Antergos-Linux.jpeg) + +你可以在这个目录中访问文件。从这里复制文件或者复制到里面。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/iPhone-mount-Antergos-Linux-1.jpeg) + +**第八步**: 当你想要卸载的时候,使用这个命令: + + sudo umount ~/iPhone + +### 对你有用么? ### + +我知道这并不是非常方便和理想,iPhone应该像其他USB设备那样工作,但是事情并不总是像人们想的那样。好的是一点小的DIY就能解决这个问题带来了一点成就感(至少对我而言)。我必须要说的是Antergos应该修复这个问题让iPhone可以默认挂载。 + +这个技巧对你有用么?如果你有任何问题或者建议,欢迎留下评论。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/iphone-antergos-linux/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://www.libimobiledevice.org/ +[2]:http://itsfoss.com/mount-iphone-ipad-ios-7-ubuntu-13-10/ diff --git a/published/201511/20151012 How to Monitor Stock Prices from Ubuntu Command Line Using Mop.md b/published/201511/20151012 How to Monitor Stock Prices from Ubuntu Command Line Using Mop.md new file mode 100644 index 0000000000..50e64ca9ad --- /dev/null +++ b/published/201511/20151012 How to Monitor Stock Prices from Ubuntu Command Line Using Mop.md @@ -0,0 +1,92 @@ +命令行下使用 Mop 监视股票价格 +================================================================================ +![](https://www.maketecheasier.com/assets/uploads/2015/09/mop-featured-new.jpg) + +有一份隐性收入通常很不错,特别是当你可以轻松的协调业余和全职工作。如果你的日常工作使用了联网的电脑,交易股票就是一个获取额外收入的很流行的选项。 + +但是目前只有很少的股票监视软件可以运行在 linux 上,其中大多数还是基于图形界面的。如果你是一个 Linux 专家,并且大量的工作时间是在没有图形界面的电脑上呢?你是不是就没办法了?不,还是有一些命令行下的股票追踪工具,包括Mop,也就是本文要聊一聊的工具。 + +### Mop ### + +Mop,如上所述,是一个命令行下连续显示和更新美股和独立股票信息的工具。使用 GO 语言实现的,是 Michael Dvorkin 的智慧结晶。 + +### 下载安装 ### + +因为这个项目使用 GO 实现的,所以你要做的第一步是在你的计算机上安装这种编程语言,下面就是在 Debian 系的系统,比如 Ubuntu 上安装 GO 的步骤: + + sudo apt-get install golang + mkdir ~/workspace + echo 'export GOPATH="$HOME/workspace"' >> ~/.bashrc + source ~/.bashrc + +GO 安装好后的下一步是安装 Mop 工具和配置环境,你要做的是运行下面的命令: + + sudo apt-get install git + go get github.com/michaeldv/mop + cd $GOPATH/src/github.com/michaeldv/mop + make install + export PATH="$PATH:$GOPATH/bin" + +完成之后就可以运行下面的命令执行 Mop: + + cmd + +### 特性 ### + +当你第一次运行 Mop 时,你会看到类似下面的输出信息: + +![](https://www.maketecheasier.com/assets/uploads/2015/09/mop-first-run.jpg) + +如你所见,这些输出信息—— 周期性自动刷新 ——包含了主要几个交易所和个股的信息。 + +### 添加删除股票 ### + +Mop 允许你轻松的从输出列表上添加/删除个股信息。要添加,你全部要做的是按“+”和输入股票名称。举个例子,下图就是添加 Facebook (FB) 到列表里。 + +![](https://www.maketecheasier.com/assets/uploads/2015/09/mop-add-stock.png) + +我按下了“+”键,就出现了包含文本“Add tickers:”的一列,提示我添加股票名称—— 我添加了 FB 然后按下回车。输出列表更新了,我添加的新股票也出现在列表了: + +![](https://www.maketecheasier.com/assets/uploads/2015/09/mop-stock-added.png) + +类似的,你可以使用“-”键和提供股票名称删除一个股票。 + +#### 根据价格分组 #### + +还有一个把股票分组的办法:依据他们的股价升跌,你所要做的就是按下“g”键。接下来,股票会分组显示:升的在一起使用绿色字体显示,而下跌的股票会黑色字体显示。 + +如下所示: + +![](https://www.maketecheasier.com/assets/uploads/2015/09/mop-group-stocks-profit-loss.png) + +#### 列排序 #### + +Mop 同时也允许你根据不同的列类型改变排序规则。这种用法需要你按下“o”(这个命令默认使用第一列的值来排序),然后使用左右键来选择你要排序的列。完成之后按下回车对内容重新排序。 + +举个例子,下面的截图就是根据输出内容的第一列、按照字母表排序之后的结果。 + +![](https://www.maketecheasier.com/assets/uploads/2015/09/mop-change-order.png) + +**注意**: 为了更好的理解,和前面的截屏对比一下。 + +#### 其他选项 #### + +其它的可用选项包括“p”:暂停市场和股票信息更新,“q”或者“esc” 来退出命令行程序,“?”显示帮助页。 + +![](https://www.maketecheasier.com/assets/uploads/2015/09/mop-help.png) + +### 结论 ### + +Mop 是一个基础的股票监控工具,并没有提供太多的特性,只提供了它所声称的功能。很明显,这个工具并不是为专业股票交易者提供的,而仅仅为你在只有命令行的机器上得体的提供了一个跟踪股票信息的选择。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/monitor-stock-prices-ubuntu-command-line/ + +作者:[Himanshu Arora][a] +译者:[oska874](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/himanshu/ diff --git a/published/201511/20151012 How to Setup DockerUI--a Web Interface for Docker.md b/published/201511/20151012 How to Setup DockerUI--a Web Interface for Docker.md new file mode 100644 index 0000000000..10ead7542e --- /dev/null +++ b/published/201511/20151012 How to Setup DockerUI--a Web Interface for Docker.md @@ -0,0 +1,113 @@ +用浏览器管理 Docker +================================================================================ +Docker 越来越流行了。在一个容器里面而不是虚拟机里运行一个完整的操作系统是一种非常棒的技术和想法。docker 已经通过节省工作时间来拯救了成千上万的系统管理员和开发人员。这是一个开源技术,提供一个平台来把应用程序当作容器来打包、分发、共享和运行,而不用关注主机上运行的操作系统是什么。它没有开发语言、框架或打包系统的限制,并且可以在任何时间、任何地点运行,从小型计算机到高端服务器都可以。运行 docker 容器和管理它们可能会花费一点点努力和时间,所以现在有一款基于 web 的应用程序-DockerUI,可以让管理和运行容器变得很简单。DockerUI 是一个对那些不熟悉 Linux 命令行,但又很想运行容器化程序的人很有帮助的工具。DockerUI 是一个开源的基于 web 的应用程序,它最值得称道的是它华丽的设计和用来运行和管理 docker 的简洁的操作界面。 + +下面会介绍如何在 Linux 上安装配置 DockerUI。 + +### 1. 安装 docker ### + +首先,我们需要安装 docker。我们得感谢 docker 的开发者,让我们可以简单的在主流 linux 发行版上安装 docker。为了安装 docker,我们得在对应的发行版上使用下面的命令。 + +#### Ubuntu/Fedora/CentOS/RHEL/Debian #### + +docker 维护者已经写了一个非常棒的脚本,用它可以在 Ubuntu 15.04/14.10/14.04、 CentOS 6.x/7、 Fedora 22、 RHEL 7 和 Debian 8.x 这几个 linux 发行版上安装 docker。这个脚本可以识别出我们的机器上运行的 linux 的发行版本,然后将需要的源库添加到文件系统、并更新本地的安装源目录,最后安装 docker 及其依赖库。要使用这个脚本安装docker,我们需要在 root 用户或者 sudo 权限下运行如下的命令, + + # curl -sSL https://get.docker.com/ | sh + +#### OpenSuse/SUSE Linux 企业版 #### + +要在运行了 OpenSuse 13.1/13.2 或者 SUSE Linux Enterprise Server 12 的机器上安装 docker,我们只需要简单的执行zypper 命令。运行下面的命令就可以安装最新版本的docker: + + # zypper in docker + +#### ArchLinux #### + +docker 在 ArchLinux 的官方源和社区维护的 AUR 库中可以找到。所以在 ArchLinux 上我们有两种方式来安装 docker。使用官方源安装,需要执行下面的 pacman 命令: + + # pacman -S docker + +如果要从社区源 AUR 安装 docker,需要执行下面的命令: + + # yaourt -S docker-git + +### 2. 启动 ### + +安装好 docker 之后,我们需要运行 docker 守护进程,然后才能运行并管理 docker 容器。我们需要使用下列命令来确认 docker 守护进程已经安装并运行了。 + +#### 在 SysVinit 上#### + + # service docker start + +#### 在Systemd 上#### + + # systemctl start docker + +### 3. 安装 DockerUI ### + +安装 DockerUI 比安装 docker 要简单很多。我们仅仅需要从 docker 注册库上拉取 dockerui ,然后在容器里面运行。要完成这些,我们只需要简单的执行下面的命令: + + # docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock dockerui/dockerui + +![Starting DockerUI Container](http://blog.linoxide.com/wp-content/uploads/2015/09/starting-dockerui-container.png) + +在上面的命令里,dockerui 使用的默认端口是9000,我们需要使用`-p` 命令映射默认端口。使用`-v` 标志我们可以指定docker 的 socket。如果主机使用了 SELinux 那么就得使用`--privileged` 标志。 + +执行完上面的命令后,我们要检查 DockerUI 容器是否运行了,或者使用下面的命令检查: + + # docker ps + +![Running Docker Containers](http://blog.linoxide.com/wp-content/uploads/2015/09/running-docker-containers.png) + +### 4. 拉取 docker 镜像 ### + +现在我们还不能直接使用 DockerUI 拉取镜像,所以我们需要在命令行下拉取 docker 镜像。要完成这些我们需要执行下面的命令。 + + # docker pull ubuntu + +![Docker Image Pull](http://blog.linoxide.com/wp-content/uploads/2015/10/docker-image-pull.png) + +上面的命令将会从 docker 官方源 [Docker Hub][1]拉取一个标志为 ubuntu 的镜像。类似的我们可以从 Hub 拉取需要的其它镜像。 + +### 4. 管理 ### + +启动了 DockerUI 容器之后,我们可以用它来执行启动、暂停、终止、删除以及 DockerUI 提供的其它操作 docker 容器的命令。 + +首先,我们需要在 web 浏览器里面打开 dockerui:在浏览器里面输入 http://ip-address:9000 或者 http://mydomain.com:9000,具体要根据你的系统配置。默认情况下登录不需要认证,但是可以配置我们的 web 服务器来要求登录认证。要启动一个容器,我们需要有包含我们要运行的程序的镜像。 + +#### 创建 #### + +创建容器我们需要在 Images 页面里,点击我们想创建的容器的镜像 id。然后点击 `Create` 按钮,接下来我们就会被要求输入创建容器所需要的属性。这些都完成之后,我们需要点击按钮`Create` 完成最终的创建。 + +![Creating Docker Container](http://blog.linoxide.com/wp-content/uploads/2015/10/creating-docker-container.png) + +#### 停止 #### + +要停止一个容器,我们只需要跳转到`Containers` 页面,然后选取要停止的容器。然后在 Action 的子菜单里面按下 Stop 就行了。 + +![Managing Container](http://blog.linoxide.com/wp-content/uploads/2015/10/managing-container.png) + +#### 暂停与恢复 #### + +要暂停一个容器,只需要简单的选取目标容器,然后点击 Pause 就行了。恢复一个容器只需要在 Actions 的子菜单里面点击 Unpause 就行了。 + +#### 删除 #### + +类似于我们上面完成的任务,杀掉或者删除一个容器或镜像也是很简单的。只需要检查、选择容器或镜像,然后点击 Kill 或者 Remove 就行了。 + +### 结论 ### + +DockerUI 使用了 docker 远程 API 提供了一个很棒的管理 docker 容器的 web 界面。它的开发者们完全使用 HTML 和 JS 设计、开发了这个应用。目前这个程序还处于开发中,并且还有大量的工作要完成,所以我们并不推荐将它应用在生产环境。它可以帮助用户简单的完成管理容器和镜像,而且只需要一点点工作。如果想要为 DockerUI 做贡献,可以访问它们的 [Github 仓库][2]。如果有问题、建议、反馈,请写在下面的评论框,这样我们就可以修改或者更新我们的内容。谢谢。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/setup-dockerui-web-interface-docker/ + +作者:[Arun Pyasi][a] +译者:[oska874](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://hub.docker.com/ +[2]:https://github.com/crosbymichael/dockerui/ diff --git a/published/201511/20151012 How to Setup Red Hat Ceph Storage on CentOS 7.0.md b/published/201511/20151012 How to Setup Red Hat Ceph Storage on CentOS 7.0.md new file mode 100644 index 0000000000..4f00be2f90 --- /dev/null +++ b/published/201511/20151012 How to Setup Red Hat Ceph Storage on CentOS 7.0.md @@ -0,0 +1,251 @@ +如何在 CentOS 7.0 上配置 Ceph 存储 +================================================================================ +Ceph 是一个将数据存储在单一分布式计算机集群上的开源软件平台。当你计划构建一个云时,你首先需要决定如何实现你的存储。开源的 Ceph 是红帽原生技术之一,它基于称为 RADOS 的对象存储系统,用一组网关 API 表示块、文件、和对象模式中的数据。由于它自身开源的特性,这种便携存储平台能在公有云和私有云上安装和使用。Ceph 集群的拓扑结构是按照备份和信息分布设计的,这种内在设计能提供数据完整性。它的设计目标就是容错、通过正确配置能运行于商业硬件和一些更高级的系统。 + +Ceph 能在任何 Linux 发行版上安装,但为了能正确运行,它需要最近的内核以及其它最新的库。在这篇指南中,我们会使用最小化安装的 CentOS-7.0。 + +### 系统资源 ### + + **CEPH-STORAGE** + OS: CentOS Linux 7 (Core) + RAM:1 GB + CPU:1 CPU + DISK: 20 + Network: 45.79.136.163 + FQDN: ceph-storage.linoxide.com + + **CEPH-NODE** + OS: CentOS Linux 7 (Core) + RAM:1 GB + CPU:1 CPU + DISK: 20 + Network: 45.79.171.138 + FQDN: ceph-node.linoxide.com + +### 安装前的配置 ### + +在安装 Ceph 存储之前,我们要在每个节点上完成一些步骤。第一件事情就是确保每个节点的网络已经配置好并且能相互访问。 + +**配置 Hosts** + +要在每个节点上配置 hosts 条目,要像下面这样打开默认的 hosts 配置文件(LCTT 译注:或者做相应的 DNS 解析)。 + + # vi /etc/hosts + +---------- + + 45.79.136.163 ceph-storage ceph-storage.linoxide.com + 45.79.171.138 ceph-node ceph-node.linoxide.com + +**安装 VMware 工具** + +工作环境是 VMWare 虚拟环境时,推荐你安装它的 open VM 工具。你可以使用下面的命令安装。 + + #yum install -y open-vm-tools + +**配置防火墙** + +如果你正在使用启用了防火墙的限制性环境,确保在你的 Ceph 存储管理节点和客户端节点中开放了以下的端口。 + + 你必须在你的 Admin Calamari 节点开放 80、2003、以及4505-4506 端口,并且允许通过 80 号端口到 CEPH 或 Calamari 管理节点,以便你网络中的客户端能访问 Calamari web 用户界面。 + +你可以使用下面的命令在 CentOS 7 中启动并启用防火墙。 + + #systemctl start firewalld + #systemctl enable firewalld + +运行以下命令使 Admin Calamari 节点开放上面提到的端口。 + + #firewall-cmd --zone=public --add-port=80/tcp --permanent + #firewall-cmd --zone=public --add-port=2003/tcp --permanent + #firewall-cmd --zone=public --add-port=4505-4506/tcp --permanent + #firewall-cmd --reload + +在 Ceph Monitor 节点,你要在防火墙中允许通过以下端口。 + + #firewall-cmd --zone=public --add-port=6789/tcp --permanent + +然后允许以下默认端口列表,以便能和客户端以及监控节点交互,并发送数据到其它 OSD。 + + #firewall-cmd --zone=public --add-port=6800-7300/tcp --permanent + +如果你工作在非生产环境,建议你停用防火墙以及 SELinux 设置,在我们的测试环境中我们会停用防火墙以及 SELinux。 + + #systemctl stop firewalld + #systemctl disable firewalld + +**系统升级** + +现在升级你的系统并重启使所需更改生效。 + + #yum update + #shutdown -r 0 + +### 设置 Ceph 用户 ### + +现在我们会新建一个单独的 sudo 用户用于在每个节点安装 ceph-deploy工具,并允许该用户无密码访问每个节点,因为它需要在 Ceph 节点上安装软件和配置文件而不会有输入密码提示。 + +运行下面的命令在 ceph-storage 主机上新建有独立 home 目录的新用户。 + + [root@ceph-storage ~]# useradd -d /home/ceph -m ceph + [root@ceph-storage ~]# passwd ceph + +节点中新建的每个用户都要有 sudo 权限,你可以使用下面展示的命令赋予 sudo 权限。 + + [root@ceph-storage ~]# echo "ceph ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/ceph + ceph ALL = (root) NOPASSWD:ALL + + [root@ceph-storage ~]# sudo chmod 0440 /etc/sudoers.d/ceph + +### 设置 SSH 密钥 ### + +现在我们会在 Ceph 管理节点生成 SSH 密钥并把密钥复制到每个 Ceph 集群节点。 + +在 ceph-node 运行下面的命令复制它的 ssh 密钥到 ceph-storage。 + + [root@ceph-node ~]# ssh-keygen + Generating public/private rsa key pair. + Enter file in which to save the key (/root/.ssh/id_rsa): + Created directory '/root/.ssh'. + Enter passphrase (empty for no passphrase): + Enter same passphrase again: + Your identification has been saved in /root/.ssh/id_rsa. + Your public key has been saved in /root/.ssh/id_rsa.pub. + The key fingerprint is: + 5b:*:*:*:*:*:*:*:*:*:c9 root@ceph-node + The key's randomart image is: + +--[ RSA 2048]----+ + +---------- + + [root@ceph-node ~]# ssh-copy-id ceph@ceph-storage + +![SSH key](http://blog.linoxide.com/wp-content/uploads/2015/10/k3.png) + +### 配置 PID 数目 ### + +要配置 PID 数目的值,我们会使用下面的命令检查默认的内核值。默认情况下,是一个小的最大线程数 32768。 + +如下图所示通过编辑系统配置文件配置该值为一个更大的数。 + +![更改 PID 值](http://blog.linoxide.com/wp-content/uploads/2015/10/3-PID-value.png) + +### 配置管理节点服务器 ### + +配置并验证了所有网络后,我们现在使用 ceph 用户安装 ceph-deploy。通过打开文件检查 hosts 条目。 + + #vim /etc/hosts + ceph-storage 45.79.136.163 + ceph-node 45.79.171.138 + +运行下面的命令添加它的库。 + + #rpm -Uhv http://ceph.com/rpm-giant/el7/noarch/ceph-release-1-0.el7.noarch.rpm + +![添加 Ceph 仓仓库](http://blog.linoxide.com/wp-content/uploads/2015/10/k1.png) + +或者创建一个新文件并更新 Ceph 库参数,别忘了替换你当前的 Release 和版本号。 + + [root@ceph-storage ~]# vi /etc/yum.repos.d/ceph.repo + +---------- + + [ceph-noarch] + name=Ceph noarch packages + baseurl=http://ceph.com/rpm-{ceph-release}/{distro}/noarch + enabled=1 + gpgcheck=1 + type=rpm-md + gpgkey=https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc + +之后更新你的系统并安装 ceph-deploy 软件包。 + +### 安装 ceph-deploy 软件包 ### + +我们运行下面的命令以及 ceph-deploy 安装命令来更新系统以及最新的 ceph 库和其它软件包。 + + #yum update -y && yum install ceph-deploy -y + + +### 配置集群 ### + +使用下面的命令在 ceph 管理节点新建一个目录并进入新目录,用于收集所有输出文件和日志。 + + #mkdir ~/ceph-cluster + #cd ~/ceph-cluster + +---------- + + #ceph-deploy new storage + +![设置 ceph 集群](http://blog.linoxide.com/wp-content/uploads/2015/10/k4.png) + +如果成功执行了上面的命令,你会看到它新建了配置文件。 + +现在配置 Ceph 默认的配置文件,用任意编辑器打开它并在会影响你公共网络的 global 参数下面添加以下两行。 + + #vim ceph.conf + osd pool default size = 1 + public network = 45.79.0.0/16 + +### 安装 Ceph ### + +现在我们准备在和 Ceph 集群相关的每个节点上安装 Ceph。我们使用下面的命令在 ceph-storage 和 ceph-node 上安装 Ceph。 + + #ceph-deploy install ceph-node ceph-storage + +![安装 ceph](http://blog.linoxide.com/wp-content/uploads/2015/10/k5.png) + +处理所有所需仓库和安装所需软件包会需要一些时间。 + +当两个节点上的 ceph 安装过程都完成后,我们下一步会通过在相同节点上运行以下命令创建监视器并收集密钥。 + + #ceph-deploy mon create-initial + +![Ceph 初始化监视器](http://blog.linoxide.com/wp-content/uploads/2015/10/k6.png) + +### 设置 OSDs 和 OSD 守护进程 ### + +现在我们会设置磁盘存储,首先运行下面的命令列出你所有可用的磁盘。 + + #ceph-deploy disk list ceph-storage + +结果中会列出你存储节点中使用的磁盘,你会用它们来创建 OSD。让我们运行以下包括你磁盘名称的命令。 + + #ceph-deploy disk zap storage:sda + #ceph-deploy disk zap storage:sdb + +为了最后完成 OSD 配置,运行下面的命令配置日志磁盘以及数据磁盘。 + + #ceph-deploy osd prepare storage:sdb:/dev/sda + #ceph-deploy osd activate storage:/dev/sdb1:/dev/sda1 + +你需要在所有节点上运行相同的命令,它会清除你磁盘上的所有东西。之后为了集群能运转起来,我们需要使用以下命令从 ceph 管理节点复制不同的密钥和配置文件到所有相关节点。 + + #ceph-deploy admin ceph-node ceph-storage + +### 测试 Ceph ### + +我们快完成了 Ceph 集群设置,让我们在 ceph 管理节点上运行下面的命令检查正在运行的 ceph 状态。 + + #ceph status + #ceph health + HEALTH_OK + +如果你在 ceph status 中没有看到任何错误信息,就意味着你成功地在 CentOS 7 上安装了 ceph 存储集群。 + +### 总结 ### + +在这篇详细的文章中我们学习了如何使用两台安装了 CentOS 7 的虚拟机设置 Ceph 存储集群,这能用于备份或者作为用于处理其它虚拟机的本地存储。我们希望这篇文章能对你有所帮助。当你试着安装的时候记得分享你的经验。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/storage/setup-red-hat-ceph-storage-centos-7-0/ + +作者:[Kashif Siddique][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/kashifs/ \ No newline at end of file diff --git a/published/201511/20151012 Linux FAQs with Answers--How to find information about built-in kernel modules on Linux.md b/published/201511/20151012 Linux FAQs with Answers--How to find information about built-in kernel modules on Linux.md new file mode 100644 index 0000000000..ada766b696 --- /dev/null +++ b/published/201511/20151012 Linux FAQs with Answers--How to find information about built-in kernel modules on Linux.md @@ -0,0 +1,53 @@ +Linux有问必答:如何找出Linux中内置模块的信息 +================================================================================ +> **提问**:我想要知道Linux系统中内核内置的模块,以及每个模块有哪些参数。有什么方法可以得到内置模块和设备驱动的列表,以及它们的详细信息呢? + +现代Linux内核正在随着时间变化而迅速增长,以支持大量的硬件、文件系统和网络功能。在此期间,“可加载模块(loadable kernel modules,[LKM])”的引入防止内核变得越来越臃肿,以及在不同的环境中灵活地扩展功能及硬件支持,而不必重新构建内核。 + +最新的Linux发行版的内核只带了相对较小的“内置模块(built-in modules)”,其余的特定硬件驱动或者自定义功能作为“可加载模块”来让你选择地加载或卸载。 + +内置模块被静态地编译进了内核。不像可加载内核模块可以动态地使用`modprobe`、`insmod`、`rmmod`、`modinfo`或者`lsmod`等命令地加载、卸载、查询模块,内置的模块总是在启动时就加载进了内核,不会被这些命令管理。 + +### 找出内置模块列表 ### + +要得到内置模块列表,运行下面的命令。 + + $ cat /lib/modules/$(uname -r)/modules.builtin + +![](https://farm1.staticflickr.com/697/21481933835_ef6b9c71e1_c.jpg) + +你也可以用下面的命令来查看有哪些内置模块: + +![](https://farm6.staticflickr.com/5643/21295025949_57f5849c36_c.jpg) + +### 找出内置模块参数 ### + +每个内核模块无论是内置的还是可加载的都有一系列的参数。对于可加载模块,`modinfo`命令可以显示它们的参数信息。然而这个命令对内置模块没有用。你会得到下面的错误。 + + modinfo: ERROR: Module XXXXXX not found. + +如果你想要查看内置模块的参数,以及它们的值,你可以在 **/sys/module** 下检查它们的内容。 + +在 /sys/module目录下,你可以找到内核模块(包含内置和可加载的)命名的子目录。进入每个模块目录,这里有个“parameters”目录,列出了这个模块所有的参数。 + +比如你要找出tcp_cubic(内核默认的TCP实现)模块的参数。你可以这么做: + + $ ls /sys/module/tcp_cubic/parameters + +接着阅读这个文件查看每个参数的值。 + + $ cat /sys/module/tcp_cubic/parameters/tcp_friendliness + +![](https://farm6.staticflickr.com/5639/21293886250_a199b9c8f7_c.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/find-information-builtin-kernel-modules-linux.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/published/201511/20151012 What is a good IDE for R on Linux.md b/published/201511/20151012 What is a good IDE for R on Linux.md new file mode 100644 index 0000000000..36cd1ecda9 --- /dev/null +++ b/published/201511/20151012 What is a good IDE for R on Linux.md @@ -0,0 +1,62 @@ +Linux 上好用的 R 语言 IDE +================================================================================ + +前一段时间,我已经介绍过 [Linux 上针对 C/C++ 语言的最好 IDE][1]。很显然 C 或 C++ 并不是现存的唯一的编程语言,是时间讨论某些更加特别的语言了。 + +假如你做过一些统计工作,很可能你已经见识过 [R 语言][2] 了。假如你还没有,我真的非常推荐这门专为统计和数据挖掘而生的开源编程语言。若你拥有编程背景,它的语法可能会使你感到有些不适应,但希望它的向量化操作所带来的快速能够吸引到你。简而言之,请尝试使用一下这门语言。而要做到这一点,使用一个好的 IDE 来入门或许会更好。R 作为一门跨平台的语言,有着一大把好用的 IDE,它们使得用 R 语言进行数据分析变得更惬意。假如你非常钟意一个特定的编辑器,这里也有一些好用的插件来将它转变为一个成熟的 R 语言的 IDE。 + +下面就让我们见识一下 Linux 环境下 5 个针对 R 语言的好用 IDE吧。 + +### 1. RStudio ### + +![](https://c1.staticflickr.com/1/603/22093054381_431383ab60_c.jpg) + +就让我们以或许是最为人们喜爱的 R IDE —— [RStudio][3] 来开始我们的介绍吧。除了一般 IDE 所提供的诸如语法高亮、代码补全等功能,RStudio 还因其集成了 R 语言帮助文档、强大的调试器、多视图系统而突出。如果你准备入门 R 语言,我只建议你将 RStudio 作为你的 R 语言控制台,一方面用它来实时测试代码是很完美的,另外对象浏览器可以帮助你理解你正在处理的是哪类数据。最后,真正征服我的是它集成了图形显示器,使得你能够更轻松地将图形输出为图片文件。至于它不好的方面, RStudio 缺乏快捷键和高级设置来使得它成为一个完美的 IDE。然而,它有一个以 AGPL 协议发布的免费版本, Linux 用户没有借口不去试试这个 IDE。 + +### 2. 带有 ESS 插件的 Emacs ### + +![](https://c2.staticflickr.com/6/5824/22056857776_a14a4e7e1b_c.jpg) + +在我的前一个有关 IDE 的文章中,很多朋友对我所给出的清单中没有 Emacs 而感到失望。对于这个,我的主要理由是 Emacs 可以说是 IDE 里面的“通配符”:你可以将它放到任意语言的 IDE 清单中。但对于 [带有 ESS 插件的 R][4] 来说,事情就变得有些不同了。Emacs Speaks Statistics (ESS) 是一个令人惊异的插件,它将完全改变你使用 Emacs 编辑器的方式,真的非常适合 R 编程者的需求。与 RStudio 类似,带有 ESS 的 Emacs 拥有多视图,它有两个面板:一个显示代码,另一个则是一个 R 控制台,使得实时地测试代码和探索数据对象变得更加容易。但 ESS 真正的长处是可以和你已安装的其他 Emacs 插件无缝集成,以及它的高级配置选项。简而言之,如果你喜欢你的 Emacs 快捷键,你将能够在 R 语言开发环境下使用它们。然而,当你在 ESS 中处理大量数据时,我已经听闻并经历了一些效率低下的问题。尽管这个问题不是很重大,但足以让我更偏好 RStudio。 + +### 3. Vim 及 Vim-R-plugin ### + +![](https://c1.staticflickr.com/1/680/22056923916_abe3531bb4_b.jpg) + +在谈论完 Emacs 后,因为我不想去讨论 Emacs 和 Vim 的优劣,所以我尽力给予 Vim 同样的待遇,下面介绍 [Vim R 插件][5]。使用名为 tmux 的终端工具,这个工具使得在开启一个 R 控制台的同时,又书写 R 代码成为可能。但最为重要的是,它还为 Vim 带来了 R 语言的语法高亮和自动补全。你还可以轻易地获取 R 帮助文档和浏览数据对象。但再次强调,这些强大的功能来源于它大量的自定义选项和 Vim 的速度。假如你被这些功能所诱惑,我希望你能够通读有关介绍如何安装这个插件并设置相关环境的[文档][6]。 + +### 4. 带有 RGedit 的 Gedit ### + +![](https://c1.staticflickr.com/1/761/22056923956_1413f60b42_c.jpg) + +若 Emacs 和 Vim 都不是你的菜,而你恰好喜欢默认的 Gnome 编辑器,则 [RGedit][7] 就是专门为你而生的:它是 Gedit 的一个专门编辑 R 代码的插件。Gedit 比你以为的更强大,配上大量的插件,就有可能用它来做许许多多的事情。而 RGedit 恰好就是你编辑 R 代码所需要的那款插件。它支持传统的语法高亮并在屏幕下方集成了 R 控制台,但它还有一大类独特的功能,例如多文件编辑、代码折叠、文件查看器,甚至还有一个 GUI 的向导用来从 snippets 产生代码。尽管我对 Gedit 并不感冒,但我必须承认这些功能比一般插件的功能更好,并且在你花费很长时间去分析数据时它会有很大的帮助。唯一的不足是它的最后一次更新是 2013 年。我真的希望这个项目能够被重新焕发新生。 + +### 5. RKWard ### + +![](https://c2.staticflickr.com/6/5643/21896132829_2ea8f3a320_c.jpg) + +最后的并不意味着最不重要,作为这个清单的最后,[RKWard][8] 是一个 KDE 环境下的 R 语言 IDE。我最喜爱它的一点是它的名称。但说老实话,它的包管理系统和类似电子表格的数据编辑器排在我最喜欢它的理由的第二位。除了这些,它还包含一个简单的用来画图和导入数据的系统,另外它还可以使用插件来扩展功能。假如你不是一个 KDE 迷,或许你有点不喜欢这个,但若你是,我真的建议你考虑使用它。 + +总的来说,无论你是否刚入门 R 语言,这些 IDE 对你或许都有些帮助。假如你更偏好某个软件它自身所代表的东西或者是偏好针对你喜爱的编辑器的插件,这些都没有什么问题,我确信你将感激这些软件所提供的某些功能。同时我还确信我遗漏了很多好的针对 R 语言的 IDE,或许它们值得罗列在这个清单上。鉴于你们在上一篇针对 C/C++ 的最好 IDE 这个话题中陈述了很多非常有用的评论,我也邀请你们在这里做出同样精彩的评论并分享出你的知识。 + +关于 Linux 下针对 R 语言的好用编辑器,你有什么看法呢?请在下面的评论中让我们知晓。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/good-ide-for-r-on-linux.html + +作者:[Adrien Brochard][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/adrien +[1]:http://xmodulo.com/good-ide-for-c-cpp-linux.html +[2]:https://www.r-project.org/ +[3]:https://www.rstudio.com/ +[4]:http://ess.r-project.org/ +[5]:http://www.vim.org/scripts/script.php?script_id=2628 +[6]:http://www.lepem.ufc.br/jaa/r-plugin.html +[7]:http://rgedit.sourceforge.net/ +[8]:https://rkward.kde.org/ diff --git a/published/201511/20151019 Linux FAQs with Answers--How to install Ubuntu desktop behind a proxy.md b/published/201511/20151019 Linux FAQs with Answers--How to install Ubuntu desktop behind a proxy.md new file mode 100644 index 0000000000..80a79534ca --- /dev/null +++ b/published/201511/20151019 Linux FAQs with Answers--How to install Ubuntu desktop behind a proxy.md @@ -0,0 +1,61 @@ +Linux有问必答: 当使用代理服务器连接互联网时如何安装 Ubuntu 桌面版 +================================================================================ +> **提问:** 我的电脑连接到的公司网络是使用HTTP代理连上互联网的。当我想使用CD-ROM安装Ubuntu时,安装在尝试获取文件时被停滞了,可能是由于代理的原因。然而问题是Ubuntu的安装程序从来没有在安装过程中提示我配置代理。我该怎样通过代理服务器安装Ubuntu桌面版? + +不像Ubuntu服务器版,Ubuntu桌面版的安装非常自动化,没有留下太多的自定义空间,就像自定义磁盘分区,手动网络设置,包选择等等。虽然这种简单的,一键安装被认为是用户友好的,但却是那些寻找“高级安装模式”来定制自己的Ubuntu桌面安装的用户不希望的。 + +除此之外,默认的Ubuntu桌面版安装器的一个大问题是缺少代理设置。如果你电脑在代理后面,你会看到Ubuntu在准备下载文件的时候停滞了。 + +![](https://c2.staticflickr.com/6/5683/22195372232_cea81a5e45_c.jpg) + +这篇文章描述了如何解除Ubuntu安装限制以及**如何通过代理服务器安装Ubuntu桌面**。 + +基本的想法是这样的。首先启动到live Ubuntu桌面中而不是直接启动Ubuntu安装器,配置代理设置并且手动在live Ubuntu中启动Ubuntu安装器。下面是步骤。 + +从Ubuntu桌面版CD/DVD或者USB启动后,在欢迎页面点击“Try Ubuntu”。 + +![](https://c1.staticflickr.com/1/586/22195371892_3816ba09c3_c.jpg) + +当你进入live Ubuntu后,点击左边的设置图标。 + +![](https://c1.staticflickr.com/1/723/22020327738_058610c19d_c.jpg) + +进入网络菜单。 + +![](https://c2.staticflickr.com/6/5675/22021212239_ba3901c8bf_c.jpg) + +手动配置代理。 + +![](https://c1.staticflickr.com/1/735/22020025040_59415e0b9a_c.jpg) + +接下来,打开终端。 + +![](https://c2.staticflickr.com/6/5642/21587084823_357b5c48cb_c.jpg) + +输入下面的命令进入root会话。 + + $ sudo su + +最后以root权限输入下面的命令。 + + # ubiquity gtk_ui + +它会启动基于GUI的Ubuntu安装器。 + +![](https://c1.staticflickr.com/1/723/22020025090_cc64848b6c_c.jpg) + +接着完成剩余的安装。 + +![](https://c1.staticflickr.com/1/628/21585344214_447020e9d6_c.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/install-ubuntu-desktop-behind-proxy.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/published/201511/20151019 Nautilus File Search Is About To Get A Big Power Up.md b/published/201511/20151019 Nautilus File Search Is About To Get A Big Power Up.md new file mode 100644 index 0000000000..b38d77c28e --- /dev/null +++ b/published/201511/20151019 Nautilus File Search Is About To Get A Big Power Up.md @@ -0,0 +1,38 @@ +Nautilus 的文件搜索将迎来巨大提升 +================================================================================ +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/10/nautilus-new-search-filters.jpg) + +*在Nautilus中搜索零散文件和文件夹将会将会变得相当简单。* + +[GNOME文件管理器][1]中正在开发一个新的**搜索过滤器**。它大量使用 GNOME 漂亮的弹出式菜单,以通过简单的方法来缩小搜索结果并精确地找到你所需要的。 + +开发者Georges Stavracas正致力于开发新的UI,他[说][2]这个新的界面“更干净、更合理、更直观”。 + +根据他[上传到Youtube][3]的视频来展示的新方式-他还没有嵌入它-他没有错。 + +> 他在他的博客中写到:“ Nautilus 有非常复杂但是强大的内部组成,它允许我们做很多事情。事实上在代码上存在各种可能。那么,为何它曾经看上去这么糟糕?” + +这个问题的部分原因比较令人吃惊:新的搜索过滤器界面向用户展示了“强大的内部组成”。搜索结果可以根据类型、名字或者日期范围来进行过滤。 + +对于像 Nautilus 这类 app 的任何修改有可能让一些用户不安,因此像这样帮助性的、直接的新UI会带来一些争议。 + +虽然对于不满的担心貌似会影响进度(毫无疑问,虽然像[移除输入优先搜索][4]的争议自2014年以来一直在争论)。GNOME 3.18 在[上个月发布了][5],给 Nautilus 引入了新的文件进度对话框,以及远程共享的更好整合,包括 Google Drive。 + +Stavracas 的搜索过滤器还没被合并进 Files 的 trunk 中,但是复刻的搜索 UI 已经初步计划在明年春天的 GNOME 3.20 中实现。 + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/10/new-nautilus-search-filter-ui + +作者:[Joey-Elijah Sneddon][a] +译者:[geekpi](https://github.com/geekpi) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:https://wiki.gnome.org/Apps/Nautilus +[2]:http://feaneron.com/2015/10/12/the-new-search-for-gnome-files-aka-nautilus/ +[3]:https://www.youtube.com/watch?v=X2sPRXDzmUw +[4]:http://www.omgubuntu.co.uk/2014/01/ubuntu-14-04-nautilus-type-ahead-patch +[5]:http://www.omgubuntu.co.uk/2015/09/gnome-3-18-release-new-features diff --git a/published/201511/20151027 How To Install Retro Terminal In Linux.md b/published/201511/20151027 How To Install Retro Terminal In Linux.md new file mode 100644 index 0000000000..3284f0d465 --- /dev/null +++ b/published/201511/20151027 How To Install Retro Terminal In Linux.md @@ -0,0 +1,74 @@ +Linux 下如何安装 Retro Terminal +================================================================================ +![Retro Terminal in Linux](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Retro-Terminal-Linux.jpeg) + +你有怀旧情节?那就试试 **安装复古终端应用** [cool-retro-term][1] 来一瞥过去的时光吧。顾名思义,`cool-retro-term` 是一个兼具酷炫和怀旧的终端。 + +你还记得那段遍地都是 CRT 显示器、终端屏幕闪烁不停的时光吗?现在你并不需要穿越到过去来见证那段时光。假如你观看背景设置在上世纪 90 年代的电影,你就可以看到大量带有绿色或黑底白字的显像管显示器。这种极客光环让它们看起来非常酷! + +若你已经厌倦了你机器中终端的外表,正寻找某些炫酷且‘新奇’的东西,则 `cool-retro-term` 将会带给你一个复古的终端外表,使你可以重温过去。你也可以改变它的颜色、动画类型并添加一些额外的特效。 + +下面是不同外观下 `cool-retro-term` 的一些截图: + +![Retro Terminal](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Retro-Terminal-Linux-1.jpeg) + +![Retro Terminal Linux](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Retro-Terminal-Linux-2.jpeg) + +![Vintage Terminal](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Retro-Terminal-Linux-3.jpeg) + +### 在基于 Ubuntu 的 Linux 发行版本下安装 cool-retro-term ### + +如果想在基于 Ubuntu 的 Linux 发行版本下安装 cool-retro-term,例如 Linux Mint,elementary OS, Linux Lite 等,可以使用下面的 PPA: + + sudo add-apt-repository ppa:noobslab/apps + sudo apt-get update + sudo apt-get install cool-retro-term + +### 在基于 Arch 的 Linux 发行版本下安装 cool-retro-term ### + +若你想在诸如 [Antergos][2] 和 [Manjaro][3] 等基于 Arch 的 Linux 发行版本下安装 cool-retro-term ,则可以使用下面的命令: + + sudo pacman -S cool-retro-term + +### 从源代码安装 cool-retro-term ### + +如果你想从源代码安装这个应用,那么首先你需要安装一些依赖。在基于 Ubuntu 的发行版本中,已知的依赖有: + + sudo apt-get install git build-essential qmlscene qt5-qmake qt5-default qtdeclarative5-dev qtdeclarative5-controls-plugin qtdeclarative5-qtquick2-plugin libqt5qml-graphicaleffects qtdeclarative5-dialogs-plugin qtdeclarative5-localstorage-plugin qtdeclarative5-window-plugin + +对于其他发行版本,已知的依赖可以在 [cool-retro-term 的 github 页面][4] 中找到。 + +现在使用下面的命令来编译这个程序吧: + + git clone https://github.com/Swordfish90/cool-retro-term.git + cd cool-retro-term + qmake && make + +一旦程序编译成功,你就可以使用下面的命令来运行它了: + + ./cool-retro-term + +假如你想把这个应用放在程序菜单中以便快速找到,这样你就不用再每次手动地用命令来启动它,则你可以使用下面的命令: + + sudo cp cool-retro-term.desktop /usr/share/applications + +在这里你可以学到更多的终端技巧。在 Linux 中享受这个复古的终端吧 :) + +稿件来自: [Abhishek Prakash][5] + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/cool-retro-term/ + +作者:[Abhishek Prakash][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:https://github.com/Swordfish90/cool-retro-term +[2]:http://itsfoss.com/tag/antergos/ +[3]:https://manjaro.github.io/ +[4]:https://github.com/Swordfish90/cool-retro-term +[5]:http://itsfoss.com/author/abhishek/ diff --git a/published/201511/20151027 How To Show Desktop In GNOME 3.md b/published/201511/20151027 How To Show Desktop In GNOME 3.md new file mode 100644 index 0000000000..08933c0cb7 --- /dev/null +++ b/published/201511/20151027 How To Show Desktop In GNOME 3.md @@ -0,0 +1,64 @@ +如何在 GNOME 3 中显示桌面 +================================================================================ +![How to show desktop in GNOME 3](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Show-Desktop-in-GNOME-3.jpg) + +你**如何在 GNOME 3 中显示桌面**?GNOME是一个很棒的桌面环境但是它更加专注于在程序间切换。如果你想关闭所有运行中的窗口,仅仅显示桌面呢? + +在Windows中,你可以按下Windows+D。在Ubuntu Unity中,可以用Ctrl+Super+D快捷键。不过由于一些原因,GNOME禁用了显示桌面的快捷键。 + +当你按下Super+D或者Ctrl+Super+D,什么都不会发生。如果你想要看到桌面,你得一个个最小化窗口。如果你有好几个打开的窗口那么这会非常不方便。 + +在本教程中,我将会向你展示在[GNOME 3][1]中添加显示桌面的快捷键。 + +### 在GNOME 3 中添加显示桌面的快捷键 ### + +我在本教程的使用的是带有GNOME 3.18的[Antergos Linux][2],但是这些步骤对于任何GNOME 3版本的Linux发行版都适用。同时,Antergos也使用了[Numix主题][3]作为默认主题。因此你也许不会看到平常的GNOME图标。但是我相信步骤是一目了然的,很容易就能理解。 + +#### 第一步 #### + +进入系统设置。点击右上角,在下拉列表中,点击系统设置图标。 + +![System Settings in GNOME Antergos Linux](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Show-Desktop-GNOME-1.png) + +#### 第二步 #### + +当你在系统设置中时,寻找Keyboard设置。 + +![Keyboard settings in GNOME 3](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Show-Desktop-GNOME-2.png) + +#### 第三步 #### + +在这里,选择**Shortcuts**标签并在左边拦选择**Navigation**。向下滚动一点查找**Hide all normal windows**。你会看见它已经被禁用了。 + +![Shortcut keys in GNOME 3](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Show-Desktop-GNOME-3.jpeg) + +#### 第四步 #### + +在“Hide all normla windows”上面点击一下。你会看到它变成了**New accelerator**。现在无论你按下哪个键,它都会被指定为显示桌面的快捷键。 + +如果你不小心按下了错误的组合键,只要按下退格它就会被禁用。再次点击并使用需要的组合键。 + +![Shortcut key edit in GNOME 3](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Show-Desktop-GNOME-4.jpeg) + +#### 第五步 #### + +一旦设置了组合键,只要关闭系统设置。不用保存设置因为更改是立即生效的。在本例中,我使用Ctrl+Super+D来与我在Ubuntu Unity中的使用习惯保持一致。 + +![Keyboard shortcut edit in GNOME](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Show-Desktop-GNOME-5.jpeg) + +就是这样。享受GNOME 3中的显示桌面快捷键吧。我希望这篇教程对你们有用。有任何问题、建议或者留言都欢迎:) + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/show-desktop-gnome-3/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:https://www.gnome.org/gnome-3/ +[2]:http://itsfoss.com/tag/antergos/ +[3]:https://linux.cn/article-3281-1.html diff --git a/published/201511/20151027 How to Use SSHfs to Mount a Remote Filesystem on Linux.md b/published/201511/20151027 How to Use SSHfs to Mount a Remote Filesystem on Linux.md new file mode 100644 index 0000000000..cd2274071f --- /dev/null +++ b/published/201511/20151027 How to Use SSHfs to Mount a Remote Filesystem on Linux.md @@ -0,0 +1,72 @@ +如何在 Linux 上使用 SSHfs 挂载一个远程文件系统 +================================================================================ +你曾经想过用安全 shell 挂载一个远程文件系统到本地吗?如果有的话,SSHfs 也许就是你所需要的。它通过使用 SSH 和 Fuse(LCTT 译注:Filesystem in Userspace,用户态文件系统,是 Linux 中用于挂载某些网络空间,如 SSH,到本地文件系统的模块) 允许你挂载远程计算机(或者服务器)到本地。 + +**注意**: 这篇文章假设你明白[SSH 如何工作并在你的系统中配置 SSH][1]。 + +### 准备 ### + +在使用 SSHfs 挂载之前,需要进行一些设置 - 在你的系统上安装 SSHfs 以及 fuse 软件包。你还需要为 fuse 创建一个组,添加用户到组,并创建远程文件系统将会驻留的目录。 + +要在 Ubuntu Linux 上安装两个软件包,只需要在终端窗口输入以下命令: + + sudo apt-get install sshfs fuse + +![ubuntu 安装 sshfs-fuse](https://www.maketecheasier.com/assets/uploads/2015/10/sshfs-install-fuse-ubuntu.jpg) + +如果你使用的不是 Ubuntu,那就在你的发行版软件包管理器中搜索软件包名称。最好搜索和 fuse 或 SSHfs 相关的关键字,因为取决于你运行的系统,软件包名称可能稍微有些不同。 + +在你的系统上安装完软件包之后,就该创建好 fuse 组了。在你安装 fuse 的时候,应该会在你的系统上创建一个组。如果没有的话,在终端窗口中输入以下命令以便在你的 Linux 系统中创建组: + + sudo groupadd fuse + +添加了组之后,把你的用户添加到这个组。 + + sudo gpasswd -a "$USER" fuse + +![sshfs 添加用户到组 fuse](https://www.maketecheasier.com/assets/uploads/2015/10/sshfs-add-user-to-fuse-group.png) + +别担心上面命令的 `$USER`。shell 会自动用你自己的用户名替换。处理了和组相关的工作之后,就是时候创建要挂载远程文件的目录了。 + + mkdir ~/remote_folder + +在你的系统上创建了本地目录之后,就可以通过 SSHfs 挂载远程文件系统了。 + +### 挂载远程文件系统 ### + +要在你的机器上挂载远程文件系统,你需要在终端窗口中输入一段较长的命令。 + + sshfs -o idmap=user username@ip.address:/remote/file/system/ ~/remote + +![sshfs 挂载文件系统到本地目录1](https://www.maketecheasier.com/assets/uploads/2015/10/sshfs-mount-file-system-to-local-folder.png) + +**注意**: 也可以通过 SSH 密钥文件挂载 SSHfs 文件系统。只需要在上面的命中用 `sshfs -o IdentityFile=~/.ssh/keyfile`, 替换 `sshfs -o idmap=user` 部分。 + +输入这个命令之后,会提示你输入远程用户的密码。如果登录成功了,你的远程文件系统就会被挂载到之前创建的 `~/remote_folder` 目录。 + +![sshfs挂载文件系统到本地目录2](https://www.maketecheasier.com/assets/uploads/2015/10/sshfs-mount-file-system-to-local-folder-2.jpg) + +使用完了你的远程文件系统,想要卸载它?容易吗?只需要在终端输入下面的命令: + + sudo umount ~/remote_folder + +这个简单的命令会断开远程连接同时清空 remote_folder 目录。 + +### 总结 ### + +在 Linux 上有很多工具可以用于访问远程文件并挂载到本地。但是如之前所说,如果有的话,也只有很少的工具能充分利用 SSH 的强大功能。我希望在这篇指南的帮助下,也能认识到 SSHfs 是一个多么强大的工具。 + +你觉得 SSHfs 怎么样呢?在下面的评论框里告诉我们吧! + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/sshfs-mount-remote-filesystem-linux/ + +作者:[Derrik Diener][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/derrikdiener/ +[1]:https://www.maketecheasier.com/setup-ssh-ubuntu/ \ No newline at end of file diff --git a/published/201511/20151104 How to Create New File Systems or Partitions in the Terminal on Linux.md b/published/201511/20151104 How to Create New File Systems or Partitions in the Terminal on Linux.md new file mode 100644 index 0000000000..cce93c0d02 --- /dev/null +++ b/published/201511/20151104 How to Create New File Systems or Partitions in the Terminal on Linux.md @@ -0,0 +1,87 @@ +如何在 Linux 终端下创建新的文件系统/分区 +================================================================================ +![](https://www.maketecheasier.com/assets/uploads/2015/03/cfdisk-feature-image.png) + +在 Linux 中创建分区或新的文件系统通常意味着一件事:安装 Gnome Parted 分区编辑器(GParted)。对于大多数 Linux 用户而言,这是唯一的办法。不过,你是否考虑过在终端创建这些分区和文件系统?当然可以!以下就是方法! + +### 使用 CFdisk 创建一个基本的 Linux 分区 ### + +以下是如何在命令行中创建一个基本的 Linux 分区的正确方案。要做的第一件事就是先打开你的终端。若你已打开,你需要找到你想要创建分区的磁盘。这可以使用一个简单的命令来找到。 + + lsblk + +![cfdisk-lsblk](https://www.maketecheasier.com/assets/uploads/2015/03/cfdisk-lsblk.png) + +当你运行了 `lsblk`,你应该会看到当前系统上每个磁盘的详细列表。看看这个列表,然后找出你想要使用的磁盘。在本文中,我将使用 `sdb` 来进行演示。 + +在终端输入这个命令。它会显示一个功能强大的基于终端的分区编辑程序。 + + sudo cfdisk /dev/sdb + +![cfdisk-empty-layout](https://www.maketecheasier.com/assets/uploads/2015/03/cfdisk-empty-layout.png) + +**注意**: 使用在 `lsblk` 命令输出的你想要使用的磁盘来替换 `sdb`。 + +当输入此命令后,你将进入分区编辑器中,然后访问你想改变的磁盘。 + +由于磁盘分区的不同,这取决于用户的需求,这部分的指南将在 **如何建立一个分离的 Linux home/root 分区布局**。 + +首先,需要创建根分区。这需要根据磁盘的字节数来进行分割。我测试的磁盘是 32 GB。 + +在 CFdisk 中使用键盘上的方向键选择需要分配的空间。你找到后,请使用箭头键选择 [ NEW ],然后按 Enter 键。 + +![cfdisk-create-root-partition](https://www.maketecheasier.com/assets/uploads/2015/03/cfdisk-create-root-partition.png) + +该程序会要求你输入分区大小。一旦你指定好大小后,按 Enter 键。这将被称为根分区(或 /dev/sdb1)。 + +接下来该创建 home 分区(/dev/sdb2)了。你需要在 CFdisk 中再选择一些空闲分区。使用箭头选择 [ NEW ] 选项,然后按 Enter 键。输入你的 home 分区的大小,然后按 Enter 键来创建它。 + +![cfdisk-create-home-partition](https://www.maketecheasier.com/assets/uploads/2015/03/cfdisk-create-home-partition.png) + +最后,需要创建交换分区。像前两次一样,先找一些空闲分区,并使用箭头选择 [ NEW ] 选项。之后,算下你 Linux 想使用多大的交换分区。 + +**注意**: 交换分区通常和计算机的内存差不多大。 + +![cfdisk-specify-partition-type-swap](https://www.maketecheasier.com/assets/uploads/2015/03/cfdisk-specify-partition-type-swap.png) + +现在,创建了交换分区,该指定其类型。使用上下箭头来选择它。之后,使用左右箭头选择 [ TYPE ] 。找到 Linux swap 选项,然后按 Enter 键。 + +![cfdisk-write-partition-table](https://www.maketecheasier.com/assets/uploads/2015/03/cfdisk-write-partition-table.jpg) + +所有分区创建后。然后就是将其写入到磁盘。使用右箭头键,选择 [ WRITE ] 选项,然后按 Enter 键。这将直接将新创建的分布写入到磁盘中。 + +### 使用 mkfs 创建文件系统 ### + +有时候,你并不需要一个整个重新分区,你只想要创建一个文件系统而已。你可以在终端直接使用 `mkfs` 命令来实现。 + +![cfdisk-mkfs-list-partitions-lsblk](https://www.maketecheasier.com/assets/uploads/2015/10/cfdisk-mkfs-list-partitions-lsblk.png) + +首先,找出你要使用的磁盘。在终端输入 `lsblk` 找出来。它会打印出列表,之后只要找到你想创建文件系统的分区或盘符。 + +在这个例子中,我将使用第二个硬盘的 `/dev/sdb1` 作为第一个分区。可以对 `/dev/sdb` 使用 mkfs(这将会使用整个分区)。 + +![cfdisk-mkfs-make-file-system-ext4](https://www.maketecheasier.com/assets/uploads/2015/10/cfdisk-mkfs-make-file-system-ext4.png) + +要在一个特定的分区上创建新文件系统,只需输入 + + sudo mkfs.ext4 /dev/sdb1 + +在终端。应当指出的是,`mkfs.ext4` 可以换成任何你想要使用的的文件系统。 + +### 结论 ### + +虽然使用图形工具编辑文件系统和分区更容易,但终端可以说是更有效的。终端的加载速度更快,点击几个按钮即可。GParted 和其它工具一样,它也是一个完整的工具。我希望在本教程的帮助下,你会明白如何在终端中高效的编辑文件系统。 + +你是否更喜欢使用基于终端的方法在 Linux 上编辑分区?不管是不是,请在下面告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/create-file-systems-partitions-terminal-linux/ + +作者:[Derrik Diener][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/derrikdiener/ diff --git a/published/201511/20151104 Ubuntu Software Centre To Be Replaced in 16.04 LTS.md b/published/201511/20151104 Ubuntu Software Centre To Be Replaced in 16.04 LTS.md new file mode 100644 index 0000000000..b8b10719bf --- /dev/null +++ b/published/201511/20151104 Ubuntu Software Centre To Be Replaced in 16.04 LTS.md @@ -0,0 +1,53 @@ +Ubuntu 软件中心将在 16.04 LTS 中被替换 +================================================================================ +![The USC Will Be Replaced](http://www.omgubuntu.co.uk/wp-content/uploads/2011/09/usc1.jpg) + +*Ubuntu 软件中心将在 Ubuntu 16.04 LTS 中被替换。* + +Ubuntu Xenial Xerus 桌面用户将会发现,这个熟悉的(并有些繁琐的)Ubuntu 软件中心将不再可用。 + +按照目前的计划,GNOME 的 [软件应用(Software application)][1] 将作为基于 Unity 7 的桌面的默认包管理工具。 + +![GNOME Software](http://www.omgubuntu.co.uk/wp-content/uploads/2013/09/gnome-software.jpg) + +*GNOME 软件应用* + +作为这次变化的一个结果是,会新开发插件来支持软件中心的评级、评论和应用程序付费的功能。 + +该决定是在伦敦的 Canonical 总部最近举行的一次桌面峰会中通过的。 + +“相对于 Ubuntu 软件中心,我们认为我们在 GNOME 软件中心(sic)添加 Snaps 支持上能做的更好。所以,现在看起来我们将使用 GNOME 软件中心来取代 [Ubuntu 软件中心]”,Ubuntu 桌面经理 Will Cooke 在 Ubuntu 在线峰会解释说。 + +GNOME 3.18 架构与也将出现在 Ubuntu 16.04 中,其中一些应用程序将更新到 GNOME 3.20 , ‘这么做也是有道理的’,Will Cooke 补充说。 + +我们最近在 Twitter 上做了一项民意调查,询问如何在 Ubuntu 上安装软件。结果表明,只有少数人怀念现在的软件中心... + +你使用什么方式在 Ubuntu 上安装软件? + +- 软件中心 +- 终端 + +### 在 Ubuntu 16.04 其他应用程序也将会减少 ### + +Ubuntu 软件中心并不是唯一一个在 Xenial Xerus 中被丢弃的。 + +光盘刻录工具 Brasero 和即时通讯工具 **Empathy** 也将从默认镜像中删除。 + +虽然这些应用程序还在不断的开发,但随着笔记本减少了光驱以及基于移动网络的聊天服务,它们看起来越来越过时了。 + +如果你还在使用它们请不要惊慌:Brasero 和 Empathy 将 **仍然可以通过存档在 Ubuntu 上安装**。 + +也并不全是丢弃和替换,默认还包括了一个新的桌面应用程序:GNOME 日历。 + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/11/the-ubuntu-software-centre-is-being-replace-in-16-04-lts + +作者:[Sam Tran][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/111008502832304483939?rel=author +[1]:https://wiki.gnome.org/Apps/Software diff --git a/published/201511/20151105 How to Manage Your To-Do Lists in Ubuntu Using Go For It Application.md b/published/201511/20151105 How to Manage Your To-Do Lists in Ubuntu Using Go For It Application.md new file mode 100644 index 0000000000..81a298a227 --- /dev/null +++ b/published/201511/20151105 How to Manage Your To-Do Lists in Ubuntu Using Go For It Application.md @@ -0,0 +1,84 @@ +如何在 Ubuntu 上用 Go For It 管理您的待办清单 +================================================================================ +![](https://www.maketecheasier.com/assets/uploads/2015/10/gfi-featured1.jpg) + +任务管理可以说是工作及日常生活中最重要也最具挑战性的事情之一。当您在工作中承担越来越多的责任时,您的表现将与您管理任务的能力直接挂钩。 + +若您的工作有部分需要在电脑上完成,那么您一定很乐意知道,有多款应用软件自称可以为您减轻任务管理的负担。即便这些软件中的大多数都是为 Windows 用户服务的,在 Linux 系统中仍然有不少选择。在本文中,我们就来讨论这样一款软件:Go For It. + +### Go For It ### + +[Go For It][1] (GFI) 由 Manuel Kehl 开发,他声称:“这是款简单易用且时尚优雅的生产力软件,以待办清单(To-Do List)为主打特色,并整合了一个能让你专注于当前事务的定时器。”这款软件的定时器功能尤其有趣,它还可以让您在继续工作之前暂停下来,放松一段时间。 + +### 下载并安装 ### + +使用基于 Debian 系统(如Ubuntu)的用户可以通过运行以下终端命令轻松地安装这款软件: + + sudo add-apt-repository ppa:mank319/go-for-it + sudo apt-get update + sudo apt-get install go-for-it + +以上命令执行完毕后,您就可以使用这条命令运行这款应用软件了: + + go-for-it + +### 使用及配置### + +当你第一次运行 GFI 时,它的界面是长这样的: + +![gfi-first-run](https://www.maketecheasier.com/assets/uploads/2015/10/gfi-first-run1.png) + +可以看到,界面由三个标签页组成,分别是*待办* (To-Do),*定时器* (Timer)和*完成* (Done)。*待办*页是一个任务列表(上图所示的4个任务是默认生成的——您可以点击头部的方框删除它们),*定时器*页内含有任务定时器,而*完成*页则是已完成任务的列表。底部有个文本框,您可以在此输入任务描述,并点击“+”号将任务添加到上面的列表中。 + +举个例子,我将一个名为“MTE-research-work”的任务添加到了列表中,并点击选中了它,如下图所示: + +![gfi-task-added](https://www.maketecheasier.com/assets/uploads/2015/10/gfi-task-added1.png) + +然后我进入*定时器*页,在这里我可以看到一个为当前“MTE-reaserch-work”任务设定的定时器,定时25分钟。 + +![gfi-active-task-timer](https://www.maketecheasier.com/assets/uploads/2015/10/gfi-active-task-timer.png) + +当然,您可以将定时器设定为你喜欢的任何值。然而我并没有修改,而是直接点击下方的“开始 (Start)”按钮启动定时器。一旦剩余时间为60秒,GFI 就会给出一个提示。 + +![gfi-first-notification-new](https://www.maketecheasier.com/assets/uploads/2015/10/gfi-first-notification-new.jpg) + +一旦时间到,它会提醒我休息5分钟。 + +![gfi-time-up-notification-new](https://www.maketecheasier.com/assets/uploads/2015/10/gfi-time-up-notification-new.jpg) + +5分钟过后,我可以为我的任务再次开启定时器。 + +![gfi-break-time-up-new](https://www.maketecheasier.com/assets/uploads/2015/10/gfi-break-time-up-new.jpg) + +任务完成以后,您可以点击*定时器*页中的“完成 (Done)”按钮,然后这个任务就会从*待办*页被转移到*完成*页。 + +![gfi-task-done](https://www.maketecheasier.com/assets/uploads/2015/10/gfi-task-done1.png) + +GFI 也能让您稍微调整一些它的设置。例如,下图所示的设置窗口就包含了一些选项,让您修改默认的任务时长,休息时长和提示时刻。 + +![gfi-settings](https://www.maketecheasier.com/assets/uploads/2015/10/gfi-settings1.png) + +值得一提的是,GFI 是以 TODO.txt 格式保存待办清单的,这种格式方便了移动设备之间的同步,也让您能使用其他前端程序来编辑任务——更多详情请阅读[这里][2]。 + +您还可以通过以下视频观看 GFI 的动态展示。 + +注:youtube 视频 + + +### 结论### + +正如您所看到的,GFI 是一款简洁明了且易于使用的任务管理软件。虽然它没有提供非常丰富的功能,但它实现了它的承诺,定时器的整合特别有用。如果您正在寻找一款实现了基础功能,并且开源的 Linux 任务管理软件,Go For It 值得您一试。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/to-do-lists-ubuntu-go-for-it/ + +作者:[Himanshu Arora][a] +译者:[Ricky-Gong](https://github.com/Ricky-Gong) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/himanshu/ +[1]:http://manuel-kehl.de/projects/go-for-it/ +[2]:http://todotxt.com/ diff --git a/published/201511/20151105 Linux FAQs with Answers--How to change default Java version on Linux.md b/published/201511/20151105 Linux FAQs with Answers--How to change default Java version on Linux.md new file mode 100644 index 0000000000..a2daadcc11 --- /dev/null +++ b/published/201511/20151105 Linux FAQs with Answers--How to change default Java version on Linux.md @@ -0,0 +1,51 @@ +Linux 有问必答:如何在 Linux 中改变默认的 Java 版本 +================================================================================ +> **提问**:当我尝试在Linux中运行一个Java程序时,我遇到了一个错误。看上去像程序编译所使用的Java版本与我本地的不同。我该如何在Linux上切换默认的Java版本? + + +当Java程序编译时,编译环境会设置一个“target”变量来设置程序可以运行的最低Java版本。如果你Linux系统上运行的程序不能满足最低的JRE版本要求,那么你会在运行的时候遇到下面的错误。 + + Exception in thread "main" java.lang.UnsupportedClassVersionError: com/xmodulo/hmon/gui/NetConf : Unsupported major.minor version 51.0 + +比如,程序在Java JRE 1.7下编译,但是系统只有Java JRE 1.6。 + +要解决这个问题,你需要改变默认的Java版本到Java JRE 1.7或者更高(假设JRE已经安装了)。 + +首先,试用下面的update-alternatives命令**检查你系统上可用的Java版本**: + + $ sudo update-alternatives --display java + +![](https://c2.staticflickr.com/6/5663/22661333316_81fe1ab7da_c.jpg) + +本例中,总共安装了4个不同的Java版本:OpenJDK JRE 1.6、Oracle Java JRE 1.6、OpenJDK JRE 1.7 和 Oracle Java JRE 1.7。现在默认的Java版本是OpenJDK JRE 1.6。 + +如果没有安装需要的Java JRE,你可以参考[这些指导][1]来完成安装。 + +现在有可用的候选版本,你可以用下面的命令在可用的Java JRE之间**切换默认的Java版本**: + + $ sudo update-alternatives --config java + +看到提示的时候,选择你想试用的Java版本。本例中,我们选择Oracle Java JRE 1.7。 + +![](https://c2.staticflickr.com/6/5651/22066181083_b9c4c5b676_c.jpg) + +现在用下面的命令验证默认的Java版本。 + + $ java -version + +![](https://c1.staticflickr.com/1/634/22499411280_1d702a4101_c.jpg) + +最后,如果你定义了JAVA_HOME环境变量,根据你设置的Java版本更新变量。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/change-default-java-version-linux.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://ask.xmodulo.com/install-java-runtime-linux.html diff --git a/published/201511/20151105 Linux FAQs with Answers--How to find which shell I am using on Linux.md b/published/201511/20151105 Linux FAQs with Answers--How to find which shell I am using on Linux.md new file mode 100644 index 0000000000..e9e3aeabcc --- /dev/null +++ b/published/201511/20151105 Linux FAQs with Answers--How to find which shell I am using on Linux.md @@ -0,0 +1,77 @@ +Linux 有问必答:如何知道当前正在使用的 shell 是哪个? +================================================================================ +> **问题**: 我经常在命令行中切换 shell。是否有一个快速简便的方法来找出我当前正在使用的 shell 呢?此外,我怎么能找到当前 shell 的版本? + +### 找到你当前正在使用的 Shell 版本 ### + +有多种方式可以查看你目前在使用什么 shell,最简单的方法就是通过使用 shell 的特殊参数。 + +其一,[一个名为 "$$" 的特殊参数][1] 表示当前你正在运行的 shell 实例的 PID。此参数是只读的,不能被修改。所以,下面的命令也将显示你正在运行的 shell 的名字: + + $ ps -p $$ + + PID TTY TIME CMD + 21666 pts/4 00:00:00 bash + +上述命令可在所有可用的 shell 中工作。 + +如果你不使用 csh,找到当前使用的 shell 的另外一个办法是使用特殊参数 “$0” ,它表示当前正在运行的 shell 或 shell 脚本的名称。这是 Bash 的一个特殊参数,但也可用在其他 shell 中,如 sh、zsh、tcsh 或 dash。使用 echo 命令可以查看你目前正在使用的 shell 的名称。 + + $ echo $0 + + bash + +不要被一个叫做 $SHELL 的单独的环境变量所迷惑,它被设置为你的默认 shell 的完整路径。因此,这个变量并不一定指向你当前使用的 shell。例如,即使你在终端中调用不同的 shell,$SHELL 也保持不变。 + + $ echo $SHELL + + /bin/shell + +![](https://c2.staticflickr.com/6/5688/22544087680_4a9c180485_c.jpg) + +因此,找出当前的shell,你应该使用 $$ 或 $0,但不是 $SHELL。 + +### 找出当前 Shell 的版本 ### + +一旦你知道你使用的是哪个 shell,你可能想知道此 shell 的版本。为此,在命令行中输入 shell 并在后面加上 “--version” 参数可以查看版本信息。例如: + +**对于** bash **shell** : + + $ bash --version + + GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu) + Copyright (C) 2013 Free Software Foundation, Inc. + License GPLv3+: GNU GPL version 3 or later + + This is free software; you are free to change and redistribute it. + There is NO WARRANTY, to the extent permitted by law. + +**对于** zsh **shell**: + + $ zsh --version + + zsh 5.0.7 (x86_64-pc-linux-gnu) + +**对于** tcsh **shell**: + $ tcsh --version + + tcsh 6.18.01 (Astron) 2012-02-14 (x86_64-unknown-linux) options wide,nls,dl,al,kan,rh,nd,color,filec + +对于某些 shell,你还可以使用 shell 特定的变量(例如,$BASH_VERSION 或 $ZSH_VERSION)。 + + $ echo $BASH_VERSION + + 4.3.8(1)-release + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/which-shell-am-i-using.html + +作者:[Dan Nanni][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://ask.xmodulo.com/process-id-pid-shell-script.html diff --git a/published/201511/20151109 Open Source Alternatives to LastPass.md b/published/201511/20151109 Open Source Alternatives to LastPass.md new file mode 100644 index 0000000000..32819f9a07 --- /dev/null +++ b/published/201511/20151109 Open Source Alternatives to LastPass.md @@ -0,0 +1,131 @@ +LastPass 的开源替代品 +================================================================================ +LastPass是一个跨平台的密码管理程序。在Linux平台中,它可作为Firefox, Chrome和Opera浏览器的插件使用。LastPass Sesame支持Ubuntu/Debian与Fedora系统。此外,LastPass还有安装在Firefox Portable的便携版,可将其安装在USB设备上。再加上适用于Ubuntu/Debian, Fedora和openSUSE的LastPass Pocket, 其具有良好的跨平台覆盖性。虽然LastPass备受好评,但它是一个专有软件。此外,LastPass最近被LogMeIn收购。如果你在找一个开源的替代品,这篇文章可能会对你有所帮助。 + +我们正面临着信息大爆炸。无论你是要在线经营生意,找工作,还是只为了休闲来进行阅读,互联网都是一个海量的信息源。在这种情况下,长期保留信息是很困难的。然而,及时地获取某些特定信息非常重要。密码就是这样的一个例子。 + +作为一个电脑用户,你可能会面临在不同服务或网站使用相同或不同密码的困境。这个事情非常复杂,因为有些网站会限制你对密码的选择。比如,一个网站可能会限制密码的最小位数,大写字母,数字或者特殊字符,这使得在所有网站使用统一密码变得不可能。更重要的是,不在不同网站中使用同一密码有安全方面的原因。这样就不可避免地意味着人们经常会有很多密码要记。一个解决方案是将所有的密码写下来。然而,这种做法也极度的不安全。 + +为了解决需要记忆无穷多串密码的问题,目前比较流行的解决方案是使用密码管理软件。事实上,这类软件对于活跃的互联网用户来说极为实用。它使得你获取、管理和安全保存所有密码变得极为容易,而大多数密码都是用软件或文件系统加密过的。因此,用户只需要记住一个简单的密码就可以获取到其它所有密码。密码管理软件鼓励用户对于不同服务去采用独一无二的,非直观的高强度的密码。 + +为了让大家更深入地了解Linux软件的质量,我将介绍4款优秀的、可替代LastPass的开源软件。 + +### KeePassX ### + +![KeePassX软件截图](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-KeePassX.png) + +KeePassX是KeePass的多平台移植,是一款开源、跨平台的密码管理软件。这款软件可以帮助你以安全的方式保管密码。你可以将所有密码保存在一个数据库中,而这个数据库被一个主密码或密码盘来保管。这使得用户只需要记住一个单一的主密码或插入密码盘即可解锁整个数据库。 + +密码数据库使用AES(即Rijndael)或者TwoFish算法进行加密,密钥长度为256位。 + +该软件功能包括: + +- 管理模式丰富 + - 通过标题使每条密码更容易被识别 + - 可设置密码过期时间 + - 可插入附件 + - 可为不同分组或密码自定义标志 + - 在分组中对密码排序 +- 搜索功能:可在特定分组或整个数据库中搜索 +- 自动键入: 这个功能允许你在登录网站时只需要按下几个键。KeePassX可以帮助你输入剩下的密码。自动键入通过读取当前窗口的标题,对密码数据库进行搜索来获取相应的密码 +- 数据库安全性强,用户可通过密码或一个密钥文件(可存储在CD或U盘中)访问数据库(或两者) +- 安全密码自动生成 +- 具有预防措施,获取用星号隐藏的密码并检查其安全性 +- 加密 - 用256位密钥,通过AES(高级加密标准)或TwoFish算法加密数据库, +- 密码可以导入或导出。可从PwManager文件(*.pwm)或KWallet文件(*.xml)中导入密码,可导出为文本(*.txt)格式。 + +--- +- 软件官网:[www.keepassx.org][1] +- 开发者:KeepassX Team +- 软件许可证:GNU GPL V2 +- 版本号:0.4.3 + +### Encryptr ### + +![Encryptr软件截图](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-Encryptr.png) + +Encryptr是一个开源的、零知识(zero-knowledge)的、基于云端的密码管理/电子钱包软件,以Crypton为基础开发。Crypton是一个Javascript库,允许开发者利用其开发应用来上传文件至服务器,而服务器无法知道用户所存储的文件内容。 + +Encryptr可将你的敏感信息,比如密码、信用卡数据、PIN码、或认证码存储在云端。然而,由于它基于零知识的Cypton框架开发,Encryptr可保证只有用户才拥有访问或读取秘密信息的权限。 + +由于其跨平台的特性,Encryptr允许用户随时随地、安全地通过一个账户从云端获取机密信息。 + +软件特性包括: + +- 使用非常安全的零知识Crypton框架,只在你的本地加密/解密数据 +- 易于使用 +- 基于云端 +- 可存储三种类型的数据:密码、信用卡账号以及通用的键值对 +- 可对每条密码设置“备注”项 +- 过滤和搜索密码 +- 对密码进行本地加密缓存,以节省载入时间 + +--- +- 软件官网: [encryptr.org][2] +- 开发者: Tommy Williams +- 软件许可证: GNU GPL v3 +- 版本号: 1.2.0 + +### RatticDB ### + +![RatticDB软件截图](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-RatticDB.png) + +RatticDB是一个开源的、基于Django的密码管理服务。 + +RatticDB被设计为一个“密码生命周期管理工具”而不是单单一个“密码存储工具”。RatticDB致力于及时提醒用户哪些密码在何时需要更改。它不提供应用层面的密码加密。 + +软件特性包括: + +- 简洁的ACL设计 +- 可改变队列功能,可让用户知晓何时需要更改某应用的密码 +- 支持Ansible配置 + +--- + +- 软件官网: [rattic.org][3] +- 开发者: Daniel Hall +- 软件许可证: GNU GPL v2 +- 版本号: 1.3.1 + +### Seahorse ### + +![Seahorse软件截图](http://www.linuxlinks.com/portal/content/reviews/Security/Screenshot-Seahorse.png) + +Seahorse是一个GnuPG(GNU隐私保护软件)的Gnome前端界面。它的目标是提供一个易于使用密钥管理工具,以及一个易于使用的界面来控制加密操作。 + +Seahorse是一个工具,用来提供安全传输和数据存储服务。数据加密和数字密钥生成操作可以轻易通过GUI来操作,密钥管理操作也可以轻易通过直观的界面来进行。 + +此外,Seahorse包含一个Gedit插件,可以使用鹦鹉螺文件管理器管理文件,一个管理剪贴板中事物的小程序,一个存储私密密码的代理,还有一个GnuPG和OpenSSH的密钥管理工具。 + +软件特性包括: + +- 对文本进行加密/解密/签名 +- 管理密钥及密钥环 +- 将密钥及密钥环与密钥服务器同步 +- 密码签名及发布 +- 将密码缓存起来,无需多次重复键入 +- 对密钥及密钥环进行备份 +- 可添加一个GDK支持格式的图片作为OpenGPG图片ID +- 生成SSH密钥,对其进行验证及储存 +- 多语言支持 + +--- + +- 软件官网: [www.gnome.org/projects/seahorse][4] +- 开发者: Jacob Perkins, Jose Carlos, Garcia Sogo, Jean Schurger, Stef Walter, Adam Schreiber +- 软件许可证: GNU GPL v2 +- 版本号: 3.18.0 + +-------------------------------------------------------------------------------- + +via: http://www.linuxlinks.com/article/20151108125950773/LastPassAlternatives.html + +译者:[StdioA](https://github.com/StdioA) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.keepassx.org/ +[2]:https://encryptr.org/ +[3]:http://rattic.org/ +[4]:http://www.gnome.org/projects/seahorse/ diff --git a/published/201511/20151116 Linux FAQs with Answers--How to set JAVA_HOME environment variable automatically on Linux.md b/published/201511/20151116 Linux FAQs with Answers--How to set JAVA_HOME environment variable automatically on Linux.md new file mode 100644 index 0000000000..f9368ec48b --- /dev/null +++ b/published/201511/20151116 Linux FAQs with Answers--How to set JAVA_HOME environment variable automatically on Linux.md @@ -0,0 +1,48 @@ +Linux 有问必答:如何在 Linux 上自动设置 JAVA_HOME 环境变量 +================================================================================ +> **问题**:我需要在我的 Linux 机器上编译 Java 程序。为此我已经安装了 JDK (Java Development Kit),而现在我正试图设置 JAVA\_HOME 环境变量使其指向安装好的 JDK 。关于在 Linux 上设置 JAVA\_HOME 环境变量,最受推崇的办法是什么? + +许多 Java 程序或基于 Java 的*集成开发环境* (IDE)都需要设置好 JAVA_HOME 环境变量。该变量应指向 *Java 开发工具包* (JDK)或 *Java 运行时环境* (JRE)的安装目录。JDK 不仅包含了 JRE 提供的一切,还带有用于编译 Java 程序的额外的二进制代码和库文件(例如编译器,调试器及 JavaDoc 文档生成器)。JDK 是用来构建 Java 程序的,如果只是运行已经构建好的 Java 程序,单独一份 JRE 就足够了。 + +当您正试图设置 JAVA\_HOME 环境变量时,麻烦的事情在于 JAVA\_HOME 变量需要根据以下几点而改变:(1) 您是否安装了 JDK 或 JRE;(2) 您安装了哪个版本;(3) 您安装的是 Oracle JDK 还是 Open JDK。 + +因此每当您的开发环境或运行时环境发生改变(例如为 JDK 更新版本)时,您需要根据实际情况调整 JAVA\_HOME 变量,而这种做法是繁重且缺乏效率的。 + +以下 export 命令能为您**自动设置** JAVA\_HOME 环境变量,而无须顾及上述的因素。 + +若您安装的是 JRE: + + export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java)))) + +若您安装的是 JDK: + + export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac)))) + +根据您的情况,将上述命令中的一条写入 ~/.bashrc(或 /etc/profile)文件中,它就会永久地设置好 JAVA\_HOME 变量。 + +注意,由于 java 或 javac 可以建立起多个层次的符号链接,为此"readlink -f"命令是用来获取它们真正的执行路径的。 + +举个例子,假如您安装的是 Oracle JRE 7,那么上述的第一条 export 命令将自动设置 JAVA\_HOME 为: + + /usr/lib/jvm/java-7-oracle/jre + +若您安装的是 Open JDK 第8版,那么第二条 export 命令将设置 JAVA\_HOME 为: + + /usr/lib/jvm/java-8-openjdk-amd64 + +![](https://c1.staticflickr.com/1/700/22961948071_c73a3261dd_c.jpg) + +简而言之,这些 export 命令会在您重装/升级您的JDK/JRE,或[更换默认 Java 版本][1]时自动更新 JAVA\_HOME 变量。您不再需要手动调整它。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/set-java_home-environment-variable-linux.html + +作者:[Dan Nanni][a] +译者:[Ricky-Gong](https://github.com/Ricky-Gong) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://ask.xmodulo.com/change-default-java-version-linux.html diff --git a/published/201511/20151117 N1--The Next Generation Open Source Email Client.md b/published/201511/20151117 N1--The Next Generation Open Source Email Client.md new file mode 100644 index 0000000000..b2cbb4c4ea --- /dev/null +++ b/published/201511/20151117 N1--The Next Generation Open Source Email Client.md @@ -0,0 +1,48 @@ +N1:下一代开源邮件客户端 +================================================================================ +![N1 Open Source email client](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/11/N1-email-client.png) + +当我们谈论到Linux中的邮件客户端,通常 Thunderbird、Geary 和 [Evolution][3] 就会出现在我们的脑海。作为对这些大咖们的挑战,一款新的开源邮件客户端正在涌入市场。 + +### 设计和功能 ### + +[N1][4]是一个设计与功能并重的新一代开源邮件客户端。作为一个开源软件,N1目前支持 Linux 和 Mac OS X,Windows的版本还在开发中。 + +N1宣传它自己为“可扩展的开源邮件客户端”,因为它包含了 Javascript 插件框架,任何人都可以为它创建强大的新功能。可扩展是一个非常流行的功能,它帮助[开源编辑器Atom][5]变得流行。N1同样把重点放在了可扩展上面。 + +除了可扩展性,N1同样着重设计了程序的外观。下面N1的截图就是个很好的例子: + +![N1 Open Source email client on Mac OS X](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/11/N1-email-client-1.jpeg) + +*Mac OS X上的N1客户端。图片来自:N1* + +除了这个功能,N1兼容上百个邮件服务提供商,包括Gmail、Yahoo、iCloud、Microsoft Exchange等等,这个桌面应用提供了离线功能。 + +### 目前只能邀请使用 ### + +我不知道为什么每个人都选择了 OnePlus 的‘只能邀请使用’的市场策略。目前,N1桌面端只能被邀请才能下载。你可以用下面的链接请求一个邀请。N1团队会在几天内邮件给你下载链接。 + + +- [请求N1邀请][6] + +### 感兴趣了么? ### + +我并不是桌面邮件客户端的粉丝,但是 N1 的确引起了我的兴趣,让我想要试一试。你呢? + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/n1-open-source-email-client/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:https://www.mozilla.org/en-US/thunderbird/ +[2]:https://wiki.gnome.org/Apps/Geary +[3]:https://help.gnome.org/users/evolution/stable/ +[4]:https://nylas.com/N1/ +[5]:http://itsfoss.com/atom-stable-released/ +[6]:https://invite.nylas.com/download diff --git a/published/201511/20151123 How to Install NVIDIA 358.16 Driver in Ubuntu 15.10 or 14.04.md b/published/201511/20151123 How to Install NVIDIA 358.16 Driver in Ubuntu 15.10 or 14.04.md new file mode 100644 index 0000000000..6ec1bdc1ec --- /dev/null +++ b/published/201511/20151123 How to Install NVIDIA 358.16 Driver in Ubuntu 15.10 or 14.04.md @@ -0,0 +1,68 @@ +如何在 Ubuntu 15.10,14.04 中安装 NVIDIA 358.16 驱动程序 +================================================================================ +![nvidia-logo-1](http://ubuntuhandbook.org/wp-content/uploads/2015/06/nvidia-logo-1.png) + +[NVIDIA 358.16][1] —— NVIDIA 358 系列的第一个稳定版本已经发布,并对 358.09 中(测试版)做了一些修正,以及一些小的改进。 + +NVIDIA 358 增加了一个新的 **nvidia-modeset.ko** 内核模块,可以配合 nvidia.ko 内核模块工作来调用 GPU 显示引擎。在以后发布版本中,**nvidia-modeset.ko** 内核驱动程序将被用于模式设置接口的基础,该接口由内核的直接渲染管理器(DRM)所提供。 + +新的驱动程序也有新的 GLX 协议扩展,以及在 OpenGL 驱动中分配大量内存的系统内存分配新机制。新的 GPU **GeForce 805A** 和 **GeForce GTX 960A** 都支持。NVIDIA 358.16 也支持 X.Org 1.18 服务器和 OpenGL 4.3。 + +### 如何在 Ubuntu 中安装 NVIDIA 358.16 : ### + +> **请不要在生产设备上安装,除非你知道自己在做什么以及如何才能恢复。** + +对于官方的二进制文件,请到 [nvidia.com/object/unix.html][1] 查看。 + +对于那些喜欢 Ubuntu PPA 的,我建议你使用 [显卡驱动 PPA][2]。到目前为止,支持 Ubuntu 16.04, Ubuntu 15.10, Ubuntu 15.04, Ubuntu 14.04。 + +**1. 添加 PPA.** + +通过按 `Ctrl+Alt+T` 快捷键来从 Unity 桌面打开终端。当打启动应用后,粘贴下面的命令并按回车键: + + sudo add-apt-repository ppa:graphics-drivers/ppa + +![nvidia-ppa](http://ubuntuhandbook.org/wp-content/uploads/2015/08/nvidia-ppa.jpg) + +它会要求你输入密码。输入密码后,密码不会显示在屏幕上,按 Enter 继续。 + +**2. 刷新并安装新的驱动程序** + +添加 PPA 后,逐一运行下面的命令刷新软件库并安装新的驱动程序: + + sudo apt-get update + + sudo apt-get install nvidia-358 nvidia-settings + +### (如果需要的话,) 卸载: ### + +开机从 GRUB 菜单进入恢复模式,进入根控制台。然后逐一运行下面的命令: + +重新挂载文件系统为可写: + + mount -o remount,rw / + +删除所有的 nvidia 包: + + apt-get purge nvidia* + +最后返回菜单并重新启动: + + reboot + +要禁用/删除显卡驱动 PPA,点击系统设置下的**软件和更新**,然后导航到**其他软件**标签。 + +-------------------------------------------------------------------------------- + +via: http://ubuntuhandbook.org/index.php/2015/11/install-nvidia-358-16-driver-ubuntu-15-10/ + +作者:[Ji m][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ubuntuhandbook.org/index.php/about/ +[1]:http://www.nvidia.com/Download/driverResults.aspx/95921/en-us +[2]:http://www.nvidia.com/object/unix.html +[3]:https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa diff --git a/published/201511/20151123 Install Intel Graphics Installer in Ubuntu 15.10.md b/published/201511/20151123 Install Intel Graphics Installer in Ubuntu 15.10.md new file mode 100644 index 0000000000..bf6b5c3b11 --- /dev/null +++ b/published/201511/20151123 Install Intel Graphics Installer in Ubuntu 15.10.md @@ -0,0 +1,46 @@ +在 Ubuntu 15.10 上安装 Intel Graphics 安装器 +================================================================================ +![Intel graphics installer](http://ubuntuhandbook.org/wp-content/uploads/2015/11/intel_logo.jpg) + +Intel 最近发布了一个新版本的 Linux Graphics 安装器。在新版本中,将不支持 Ubuntu 15.04,而必须用 Ubuntu 15.10 Wily。 + +> Linux 版 Intel® Graphics 安装器可以让你很容易的为你的 Intel Graphics 硬件安装最新版的图形与视频驱动。它能保证你一直使用最新的增强与优化功能,并能够安装到 Intel Graphics Stack 中,来保证你在你的 Intel 图形硬件下,享受到最佳的用户体验。*现在 Linux 版的 Intel® Graphics 安装器支持最新版的 Ubuntu。* + +![intel-graphics-installer](http://ubuntuhandbook.org/wp-content/uploads/2015/11/intel-graphics-installer.jpg) + +### 安装 ### + +**1.** 从[这个链接页面][1]中下载该安装器。当前支持 Ubuntu 15.10 的版本是1.2.1版。你可以在**系统设置 -> 详细信息**中检查你的操作系统(32位或64位)的类型。 + +![download-intel-graphics-installer](http://ubuntuhandbook.org/wp-content/uploads/2015/11/download-intel-graphics-installer.jpg) + +**2.** 一旦下载完成,到下载目录中点击 .deb 安装包,用 Ubuntu 软件中心打开它,然最后点击“安装”按钮。 + +![install-via-software-center](http://ubuntuhandbook.org/wp-content/uploads/2015/11/install-via-software-center.jpg) + +**3.** 为了让系统信任 Intel Graphics 安装器,你需要通过下面的命令来为它添加密钥。 + +用快捷键`Ctrl+Alt+T`或者在 Unity Dash 中的“应用程序启动器”中打开终端。依次粘贴运行下面的命令。 + + wget --no-check-certificate https://download.01.org/gfx/RPM-GPG-KEY-ilg -O - | sudo apt-key add - + + wget --no-check-certificate https://download.01.org/gfx/RPM-GPG-KEY-ilg-2 -O - | sudo apt-key add - + +![trust-intel](http://ubuntuhandbook.org/wp-content/uploads/2015/11/trust-intel.jpg) + +注意:在运行第一个命令的过程中,如果密钥下载完成后,光标停住不动并且一直闪烁的话,就像上面图片显示的那样,输入你的密码(输入时不会看到什么有变化)然后回车就行了。 + +最后通过 Unity Dash 或应用程序启动器打开 Intel Graphics 安装器。 + +-------------------------------------------------------------------------------- + +via: http://ubuntuhandbook.org/index.php/2015/11/install-intel-graphics-installer-in-ubuntu-15-10/ + +作者:[Ji m][a] +译者:[XLCYun](https://github.com/XLCYun) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ubuntuhandbook.org/index.php/about/ +[1]:https://01.org/linuxgraphics/downloads diff --git a/published/201511/Learn with Linux--Master Your Math with These Linux Apps.md b/published/201511/Learn with Linux--Master Your Math with These Linux Apps.md new file mode 100644 index 0000000000..7d8c9e1b5c --- /dev/null +++ b/published/201511/Learn with Linux--Master Your Math with These Linux Apps.md @@ -0,0 +1,126 @@ +与 Linux 一起学习:使用这些 Linux 应用来征服你的数学学习 +================================================================================ +![](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-featured.png) + +这篇文章是[与 Linux 一起学习][1]系列的一部分: + +- [与 Linux 一起学习: 学习类型][2] +- [与 Linux 一起学习: 物理模拟][3] +- [与 Linux 一起学习: 学习音乐][4] +- [与 Linux 一起学习: 两个地理应用程序][5] +- [与 Linux 一起学习: 使用这些 Linux 应用来征服你的数学学习][6] + +Linux 提供了大量的教育软件和许多优秀的工具来帮助各种年龄段和年级的学生学习和练习各种各样的习题,这通常是以交互的方式进行。“与 Linux 一起学习”这一系列的文章则为这些各种各样的教育软件和应用提供了一个介绍。 + +数学是计算机的核心。如果有人预期一个类如 GNU/ Linux 这样的伟大的操作系统精确而严格,那么这就是数学所起到的作用。如果你在寻求一些数学应用程序,那么你将不会感到失望。Linux 提供了很多优秀的工具使得数学看起来和你曾经做过的一样令人畏惧,但实际上他们会简化你使用它的方式。 + +### Gnuplot ### + +Gnuplot 是一个适用于不同平台的命令行脚本化和多功能的图形工具。尽管它的名字中带有“GNU”,但是它并不是 GNU 操作系统的一部分。虽然不是自由授权,但它是免费软件(这意味着它受版权保护,但免费使用)。 + +要在 Ubuntu 系统(或者衍生系统)上安装 `gnuplot`,输入: + + sudo apt-get install gnuplot gnuplot-x11 + +进入一个终端窗口。启动该程序,输入: + + gnuplot + +你会看到一个简单的命令行界面: + +![learnmath-gnuplot](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-gnuplot.png) + +在其中您可以直接输入函数开始。绘图命令将绘制一个曲线图。 + +输入内容,例如, + + plot sin(x)/x + +随着`gnuplot的`提示,将会打开一个新的窗口,图像便会在里面呈现。 + +![learnmath-gnuplot-plot1](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-gnuplot-plot1.png) + +你也可以即时设置设置这个图的不同属性,比如像这样指定“title” + + plot sin(x) title 'Sine Function', tan(x) title 'Tangent' + +![learnmath-gnuplot-plot2](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-gnuplot-plot2.png) + +你可以做的更深入一点,使用`splot`命令绘制3D图形: + + splot sin(x*y/20) + +![learnmath-gnuplot-plot3](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-gnuplot-plot3.png) + +这个图形窗口有几个基本的配置选项, + +![learnmath-gnuplot-options](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-gnuplot-options.png) + +但是`gnuplot`的真正力量在于在它的命令行和脚本功能,`gnuplot`更完整的文档在[Duke大学网站][8]上面[找到][7],带有这个了不起的教程的原始版本。 + +### Maxima ### + +[Maxima][9]是一个源于 Macsyma 开发的一个计算机代数系统,根据它的 SourceForge 页面所述: + +> “Maxima 是一个操作符号和数值表达式的系统,包括微分,积分,泰勒级数,拉普拉斯变换,常微分方程,线性方程组,多项式,集合,列表,向量,矩阵和张量等。Maxima 通过精确的分数,任意精度的整数和可变精度浮点数产生高精度的计算结果。Maxima 可以以二维和三维的方式绘制函数和数据。“ + +大多数Ubuntu衍生系统都有 Maxima 二进制包以及它的图形界面,要安装这些软件包,输入: + + sudo apt-get install maxima xmaxima wxmaxima + +在终端窗口中,Maxima 是一个没有什么 UI 的命令行工具,但如果你开始 wxmaxima,你会进入一个简单但功能强大的图形用户界面。 + +![learnmath-maxima](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-maxima.png) + +你可以通过简单的输入来开始。(提示:回车会增加更多的行,如果你想计算一个表达式,使用“Shift + Enter”。) + +Maxima 可以用于一些简单的问题,因此也可以作为一个计算器: + +![learnmath-maxima-1and1](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-maxima-1and1.png) + +以及一些更复杂的问题: + +![learnmath-maxima-functions](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-maxima-functions.png) + +它使用`gnuplot`使得绘制简单: + +![learnmath-maxima-plot](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-maxima-plot.png) + +或者绘制一些复杂的图形。 + +![learnmath-maxima-plot2](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-maxima-plot2.png) + +(它需要 gnuplot-X11 的软件包来显示它们。) + +除了将表达式表示为图形,Maxima 也可以用 latex 格式导出它们,或者通过右键快捷菜单进行一些常用操作. + +![learnmath-maxima-menu](https://www.maketecheasier.com/assets/uploads/2015/07/learnmath-maxima-menu.png) + +不过其主菜单还是提供了大量重磅功能,当然 Maxima 的功能远不止如此,这里也有一个广泛使用的[在线文档][10]。 + +### 总结 ### + +数学不是一门容易的学科,这些在 Linux 上的优秀软件也没有使得数学更加容易,但是这些应用使得使用数学变得更加的简单和方便。以上两种应用都只是介绍一下 Linux 所提供的。如果你是认真从事数学和需要更多的功能与丰富的文档,那你更应该看看这些 [Mathbuntu][11] 项目。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/learn-linux-maths/ + +作者:[Attila Orosz][a] +译者:[KnightJoker](https://github.com/KnightJoker/KnightJoker) +校对:[wxyD](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/attilaorosz/ +[1]:https://www.maketecheasier.com/series/learn-with-linux/ +[2]:https://www.maketecheasier.com/learn-to-type-in-linux/ +[3]:https://www.maketecheasier.com/linux-physics-simulation/ +[4]:https://www.maketecheasier.com/linux-learning-music/ +[5]:https://www.maketecheasier.com/linux-geography-apps/ +[6]:https://www.maketecheasier.com/learn-linux-maths/ +[7]:http://www.gnuplot.info/documentation.html +[8]:http://people.duke.edu/~hpgavin/gnuplot.html +[9]:http://maxima.sourceforge.net/ +[10]:http://maxima.sourceforge.net/documentation.html +[11]:http://www.mathbuntu.org/ \ No newline at end of file diff --git a/published/201511/LetsEncrypt.md b/published/201511/LetsEncrypt.md new file mode 100644 index 0000000000..c1c4a40ea0 --- /dev/null +++ b/published/201511/LetsEncrypt.md @@ -0,0 +1,112 @@ +# SSL/TLS 加密新纪元 - Let's Encrypt + +根据 Let's Encrypt 官方博客消息,Let's Encrypt 服务将在下周(11 月 16 日)正式对外开放。 + +Let's Encrypt 项目是由互联网安全研究小组(ISRG,Internet Security Research Group)主导并开发的一个新型数字证书认证机构(CA,Certificate Authority)。该项目旨在开发一个自由且开放的自动化 CA 套件,并向公众提供相关的证书免费签发服务以降低安全通讯的财务、技术和教育成本。在过去的一年中,互联网安全研究小组拟定了 [ACME 协议草案][1],并首次实现了使用该协议的应用套件:服务端 [Boulder][2] 和客户端 [letsencrypt][3]。 + +至于为什么 Let's Encrypt 让我们如此激动,以及 HTTPS 协议如何保护我们的通讯请参考[浅谈 HTTPS 和 SSL/TLS 协议的背景与基础][4]。 + +## ACME 协议 + +Let's Encrypt 的诞生离不开 ACME(Automated Certificate Management Environment,自动证书管理环境)协议的拟定。 + +说到 ACME 协议,我们不得不提一下传统 CA 的认证方式。Let's Encrypt 服务所签发的证书为域名认证证书(DV,Domain-validated Certificate),签发这类证书需要域名所有者完成以下至少一种挑战(Challenge)以证明自己对域名的所有权: + +* 验证申请人对域名的 Whois 信息中邮箱的控制权; +* 验证申请人对域名的常见管理员邮箱(如以 `admin@`、`postmaster@` 开头的邮箱等)的控制权; +* 在 DNS 的 TXT 记录中发布一条 CA 提供的字符串; +* 在包含域名的网址中特定路径发布一条 CA 提供的字符串。 + +不难发现,其中最容易实现自动化的一种操作必然为最后一条,ACME 协议中的 [Simple HTTP][5] 认证即是用一种类似的方法对从未签发过任何证书的域名进行认证。该协议要求在访问 `http://域名/.well-known/acme-challenge/指定字符串` 时返回特定的字符串。 + +然而实现该协议的客户端 [letsencrypt][3] 做了更多——它不仅可以通过 ACME 协议配合服务端 [Boulder][2] 的域名进行独立(standalone)的认证工作,同时还可以自动配置常见的服务器软件(目前支持 Nginx 和 Apache)以完成认证。 + +## Let's Encrypt 免费证书签发服务 + +对于大多数网站管理员来讲,想要对自己的 Web 服务器进行加密需要一笔不小的支出进行证书签发并且难以配置。根据早些年 SSL Labs 公布的 [2010 年互联网 SSL 调查报告(PDF)][6] 指出超过半数的 Web 服务器没能正确使用 Web 服务器证书,主要的问题有证书不被浏览器信任、证书和域名不匹配、证书过期、证书信任链没有正确配置、使用已知有缺陷的协议和算法等。而且证书过期后的续签和泄漏后的吊销仍需进行繁琐的人工操作。 + +幸运的是 Let's Encrypt 免费证书签发服务在经历了漫长的开发和测试之后终于来临,在 Let's Encrypt 官方 CA 被广泛信任之前,IdenTrust 的根证书对 Let's Encrypt 的二级 CA 进行了交叉签名使得大部分浏览器已经信任 Let's Encrypt 签发的证书。 + +## 使用 letsencrypt + +由于当前 Let's Encrypt 官方的证书签发服务还未公开,你只能尝试开发版本。这个版本会签发一个 CA 标识为 `happy hacker fake CA` 的测试证书,注意这个证书不受信任。 + +要获取开发版本请直接 `$ git clone https://github.com/letsencrypt/letsencrypt`。 + +以下的[使用方法][7]摘自 Let's Encrypt 官方网站。 + +### 签发证书 + +`letsencrypt` 工具可以协助你处理证书请求和验证工作。 + +#### 自动配置 Web 服务器 + +下面的操作将会自动帮你将新证书配置到 Nginx 和 Apache 中。 + +``` +$ letsencrypt run +``` + +#### 独立签发证书 + +下面的操作将会将新证书置于当前目录下。 + +``` +$ letsencrypt -d example.com auth +``` + +### 续签证书 + +默认情况下 `letsencrypt` 工具将协助你跟踪当前证书的有效期限并在需要时自动帮你续签。如果需要手动续签,执行下面的操作。 + +``` +$ letsencrypt renew --cert-path example-cert.pem +``` + +### 吊销证书 + +列出当前托管的证书菜单以吊销。 + +``` +$ letsencrypt revoke +``` + +你也可以吊销某一个证书或者属于某个私钥的所有证书。 + +``` +$ letsencrypt revoke --cert-path example-cert.pem +``` + +``` +$ letsencrypt revoke --key-path example-key.pem +``` + +## Docker 化 letsencrypt + +如果你不想让 letsencrypt 自动配置你的 Web 服务器的话,使用 Docker 跑一份独立的版本将是一个不错的选择。你所要做的只是在装有 Docker 的系统中执行: + +``` +$ sudo docker run -it --rm -p 443:443 -p 80:80 --name letsencrypt \ + -v "/etc/letsencrypt:/etc/letsencrypt" \ + -v "/var/lib/letsencrypt:/var/lib/letsencrypt" \ + quay.io/letsencrypt/letsencrypt:latest auth +``` + +你就可以快速的为自己的 Web 服务器签发一个免费而且受信任的 DV 证书啦! + +## Let's Encrypt 的注意事项 + +* Let's Encrypt 当前发行的 DV 证书仅能验证域名的所有权,并不能验证其所有者身份; +* Let's Encrypt 不像其他 CA 那样对安全事故有保险赔付; +* Let's Encrypt 目前不提共 Wildcard 证书; +* Let's Encrypt 的有效时间仅为 90 天,逾期需要续签(可自动续签)。 + +对于 Let's Encrypt 的介绍就到这里,让我们一起目睹这场互联网的安全革命吧。 + +[1]: https://github.com/letsencrypt/acme-spec +[2]: https://github.com/letsencrypt/boulder +[3]: https://github.com/letsencrypt/letsencrypt +[4]: https://linux.cn/article-5175-1.html +[5]: https://letsencrypt.github.io/acme-spec/#simple-http +[6]: https://community.qualys.com/servlet/JiveServlet/download/38-1636/Qualys_SSL_Labs-State_of_SSL_2010-v1.6.pdf +[7]: https://letsencrypt.org/howitworks/ diff --git a/published/20151122 Doubly linked list in the Linux Kernel.md b/published/20151122 Doubly linked list in the Linux Kernel.md new file mode 100644 index 0000000000..d21ae7ded6 --- /dev/null +++ b/published/20151122 Doubly linked list in the Linux Kernel.md @@ -0,0 +1,259 @@ +Linux 内核里的数据结构——双向链表 +================================================================================ + +双向链表 +-------------------------------------------------------------------------------- + +Linux 内核中自己实现了双向链表,可以在 [include/linux/list.h](https://github.com/torvalds/linux/blob/master/include/linux/list.h) 找到定义。我们将会首先从双向链表数据结构开始介绍**内核里的数据结构**。为什么?因为它在内核里使用的很广泛,你只需要在 [free-electrons.com](http://lxr.free-electrons.com/ident?i=list_head) 检索一下就知道了。 + +首先让我们看一下在 [include/linux/types.h](https://github.com/torvalds/linux/blob/master/include/linux/types.h) 里的主结构体: + +```C +struct list_head { + struct list_head *next, *prev; +}; +``` + +你可能注意到这和你以前见过的双向链表的实现方法是不同的。举个例子来说,在 [glib](http://www.gnu.org/software/libc/) 库里是这样实现的: + +```C +struct GList { + gpointer data; + GList *next; + GList *prev; +}; +``` + +通常来说一个链表结构会包含一个指向某个项目的指针。但是 Linux 内核中的链表实现并没有这样做。所以问题来了:**链表在哪里保存数据呢?**。实际上,内核里实现的链表是**侵入式链表(Intrusive list)**。侵入式链表并不在节点内保存数据-它的节点仅仅包含指向前后节点的指针,以及指向链表节点数据部分的指针——数据就是这样附加在链表上的。这就使得这个数据结构是通用的,使用起来就不需要考虑节点数据的类型了。 + +比如: + +```C +struct nmi_desc { + spinlock_t lock; + struct list_head head; +}; +``` + +让我们看几个例子来理解一下在内核里是如何使用 `list_head` 的。如上所述,在内核里有很多很多不同的地方都用到了链表。我们来看一个在杂项字符驱动里面的使用的例子。在 [drivers/char/misc.c](https://github.com/torvalds/linux/blob/master/drivers/char/misc.c) 的杂项字符驱动 API 被用来编写处理小型硬件或虚拟设备的小驱动。这些驱动共享相同的主设备号: + +```C +#define MISC_MAJOR 10 +``` + +但是都有各自不同的次设备号。比如: + +``` +ls -l /dev | grep 10 +crw------- 1 root root 10, 235 Mar 21 12:01 autofs +drwxr-xr-x 10 root root 200 Mar 21 12:01 cpu +crw------- 1 root root 10, 62 Mar 21 12:01 cpu_dma_latency +crw------- 1 root root 10, 203 Mar 21 12:01 cuse +drwxr-xr-x 2 root root 100 Mar 21 12:01 dri +crw-rw-rw- 1 root root 10, 229 Mar 21 12:01 fuse +crw------- 1 root root 10, 228 Mar 21 12:01 hpet +crw------- 1 root root 10, 183 Mar 21 12:01 hwrng +crw-rw----+ 1 root kvm 10, 232 Mar 21 12:01 kvm +crw-rw---- 1 root disk 10, 237 Mar 21 12:01 loop-control +crw------- 1 root root 10, 227 Mar 21 12:01 mcelog +crw------- 1 root root 10, 59 Mar 21 12:01 memory_bandwidth +crw------- 1 root root 10, 61 Mar 21 12:01 network_latency +crw------- 1 root root 10, 60 Mar 21 12:01 network_throughput +crw-r----- 1 root kmem 10, 144 Mar 21 12:01 nvram +brw-rw---- 1 root disk 1, 10 Mar 21 12:01 ram10 +crw--w---- 1 root tty 4, 10 Mar 21 12:01 tty10 +crw-rw---- 1 root dialout 4, 74 Mar 21 12:01 ttyS10 +crw------- 1 root root 10, 63 Mar 21 12:01 vga_arbiter +crw------- 1 root root 10, 137 Mar 21 12:01 vhci +``` + +现在让我们看看它是如何使用链表的。首先看一下结构体 `miscdevice`: + +```C +struct miscdevice +{ + int minor; + const char *name; + const struct file_operations *fops; + struct list_head list; + struct device *parent; + struct device *this_device; + const char *nodename; + mode_t mode; +}; +``` + +可以看到结构体`miscdevice`的第四个变量`list` 是所有注册过的设备的链表。在源代码文件的开始可以看到这个链表的定义: + +```C +static LIST_HEAD(misc_list); +``` + +它实际上是对用`list_head` 类型定义的变量的扩展。 + +```C +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) +``` + +然后使用宏 `LIST_HEAD_INIT` 进行初始化,这会使用变量`name` 的地址来填充`prev`和`next` 结构体的两个变量。 + +```C +#define LIST_HEAD_INIT(name) { &(name), &(name) } +``` + +现在来看看注册杂项设备的函数`misc_register`。它在一开始就用函数 `INIT_LIST_HEAD` 初始化了`miscdevice->list`。 + +```C +INIT_LIST_HEAD(&misc->list); +``` + +作用和宏`LIST_HEAD_INIT`一样。 + +```C +static inline void INIT_LIST_HEAD(struct list_head *list) +{ + list->next = list; + list->prev = list; +} +``` + +接下来,在函数`device_create` 创建了设备后,我们就用下面的语句将设备添加到设备链表: + +``` +list_add(&misc->list, &misc_list); +``` + +内核文件`list.h` 提供了向链表添加新项的 API 接口。我们来看看它的实现: + + +```C +static inline void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} +``` + +实际上就是使用3个指定的参数来调用了内部函数`__list_add`: + +* new - 新项。 +* head - 新项将会插在`head`的后面 +* head->next - 插入前,`head` 后面的项。 + +`__list_add`的实现非常简单: + +```C +static inline void __list_add(struct list_head *new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} +``` + +这里,我们在`prev`和`next` 之间添加了一个新项。所以我们开始时用宏`LIST_HEAD_INIT`定义的`misc` 链表会包含指向`miscdevice->list` 的向前指针和向后指针。 + +这儿还有一个问题:如何得到列表的内容呢?这里有一个特殊的宏: + +```C +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) +``` + +使用了三个参数: + +* ptr - 指向结构 `list_head` 的指针; +* type - 结构体类型; +* member - 在结构体内类型为`list_head` 的变量的名字; + +比如说: + +```C +const struct miscdevice *p = list_entry(v, struct miscdevice, list) +``` + +然后我们就可以使用`p->minor` 或者 `p->name`来访问`miscdevice`。让我们来看看`list_entry` 的实现: + +```C +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) +``` + +如我们所见,它仅仅使用相同的参数调用了宏`container_of`。初看这个宏挺奇怪的: + +```C +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) +``` + +首先你可以注意到花括号内包含两个表达式。编译器会执行花括号内的全部语句,然后返回最后的表达式的值。 + +举个例子来说: + +``` +#include + +int main() { + int i = 0; + printf("i = %d\n", ({++i; ++i;})); + return 0; +} +``` + +最终会打印出`2` + +下一点就是`typeof`,它也很简单。就如你从名字所理解的,它仅仅返回了给定变量的类型。当我第一次看到宏`container_of`的实现时,让我觉得最奇怪的就是表达式`((type *)0)`中的0。实际上这个指针巧妙的计算了从结构体特定变量的偏移,这里的`0`刚好就是位宽里的零偏移。让我们看一个简单的例子: + +```C +#include + +struct s { + int field1; + char field2; + char field3; +}; + +int main() { + printf("%p\n", &((struct s*)0)->field3); + return 0; +} +``` + +结果显示`0x5`。 + +下一个宏`offsetof`会计算从结构体起始地址到某个给定结构字段的偏移。它的实现和上面类似: + +```C +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +``` + +现在我们来总结一下宏`container_of`。只需给定结构体中`list_head`类型 字段的地址、名字和结构体容器的类型,它就可以返回结构体的起始地址。在宏定义的第一行,声明了一个指向结构体成员变量`ptr`的指针`__mptr`,并且把`ptr` 的地址赋给它。现在`ptr` 和`__mptr` 指向了同一个地址。从技术上讲我们并不需要这一行,但是它可以方便地进行类型检查。第一行保证了特定的结构体(参数`type`)包含成员变量`member`。第二行代码会用宏`offsetof`计算成员变量相对于结构体起始地址的偏移,然后从结构体的地址减去这个偏移,最后就得到了结构体。 + +当然了`list_add` 和 `list_entry`不是``提供的唯一功能。双向链表的实现还提供了如下API: + +* list\_add +* list\_add\_tail +* list\_del +* list\_replace +* list\_move +* list\_is\_last +* list\_empty +* list\_cut\_position +* list\_splice +* list\_for\_each +* list\_for\_each\_entry + +等等很多其它API。 + +---- + +via: https://github.com/0xAX/linux-insides/blob/master/DataStructures/dlist.md + +译者:[Ezio](https://github.com/oska874) +校对:[Mr小眼儿](https://github.com/tinyeyeser) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20151123 Data Structures in the Linux Kernel.md b/published/20151123 Data Structures in the Linux Kernel.md new file mode 100644 index 0000000000..d46d4293c4 --- /dev/null +++ b/published/20151123 Data Structures in the Linux Kernel.md @@ -0,0 +1,198 @@ +Linux 内核里的数据结构 —— 基数树 +================================================================================ + +基数树 Radix tree +-------------------------------------------------------------------------------- +正如你所知道的,Linux内核提供了许多不同的库和函数,它们实现了不同的数据结构和算法。在这部分,我们将研究其中一种数据结构——[基数树 Radix tree](http://en.wikipedia.org/wiki/Radix_tree)。在 Linux 内核中,有两个文件与基数树的实现和API相关: + +* [include/linux/radix-tree.h](https://github.com/torvalds/linux/blob/master/include/linux/radix-tree.h) +* [lib/radix-tree.c](https://github.com/torvalds/linux/blob/master/lib/radix-tree.c) + +让我们先说说什么是 `基数树` 吧。基数树是一种 `压缩的字典树 (compressed trie)` ,而[字典树](http://en.wikipedia.org/wiki/Trie)是实现了关联数组接口并允许以 `键值对` 方式存储值的一种数据结构。这里的键通常是字符串,但可以使用任意数据类型。字典树因为它的节点而与 `n叉树` 不同。字典树的节点不存储键,而是存储单个字符的标签。与一个给定节点关联的键可以通过从根遍历到该节点获得。举个例子: + +``` + +-----------+ + | | + | " " | + | | + +------+-----------+------+ + | | + | | + +----v------+ +-----v-----+ + | | | | + | g | | c | + | | | | + +-----------+ +-----------+ + | | + | | + +----v------+ +-----v-----+ + | | | | + | o | | a | + | | | | + +-----------+ +-----------+ + | + | + +-----v-----+ + | | + | t | + | | + +-----------+ +``` + +因此在这个例子中,我们可以看到一个有着两个键 `go` 和 `cat` 的 `字典树` 。压缩的字典树也叫做 `基数树` ,它和 `字典树` 的不同之处在于,所有只有一个子节点的中间节点都被删除。 + +Linux 内核中的基数树是把值映射到整形键的一种数据结构。[include/linux/radix-tree.h](https://github.com/torvalds/linux/blob/master/include/linux/radix-tree.h)文件中的以下结构体描述了基数树: + +```C +struct radix_tree_root { + unsigned int height; + gfp_t gfp_mask; + struct radix_tree_node __rcu *rnode; +}; +``` + +这个结构体描述了一个基数树的根,它包含了3个域成员: + +* `height` - 树的高度; +* `gfp_mask` - 告知如何执行动态内存分配; +* `rnode` - 孩子节点指针. + +我们第一个要讨论的字段是 `gfp_mask` : + +底层内核的内存动态分配函数以一组标志作为 `gfp_mask` ,用于描述如何执行动态内存分配。这些控制分配进程的 `GFP_` 标志拥有以下值:( `GF_NOIO` 标志)意味着睡眠以及等待内存,( `__GFP_HIGHMEM` 标志)意味着高端内存能够被使用,( `GFP_ATOMIC` 标志)意味着分配进程拥有高优先级并不能睡眠等等。 + +* `GFP_NOIO` - 睡眠等待内存 +* `__GFP_HIGHMEM` - 高端内存能够被使用; +* `GFP_ATOMIC` - 分配进程拥有高优先级并且不能睡眠; + +等等。 + +下一个字段是`rnode`: + +```C +struct radix_tree_node { + unsigned int path; + unsigned int count; + union { + struct { + struct radix_tree_node *parent; + void *private_data; + }; + struct rcu_head rcu_head; + }; + /* For tree user */ + struct list_head private_list; + void __rcu *slots[RADIX_TREE_MAP_SIZE]; + unsigned long tags[RADIX_TREE_MAX_TAGS][RADIX_TREE_TAG_LONGS]; +}; +``` +这个结构体包含的信息有父节点中的偏移以及到底端(叶节点)的高度、子节点的个数以及用于访问和释放节点的字段成员。这些字段成员描述如下: + +* `path` - 父节点中的偏移和到底端(叶节点)的高度 +* `count` - 子节点的个数; +* `parent` - 父节点指针; +* `private_data` - 由树的用户使用; +* `rcu_head` - 用于释放节点; +* `private_list` - 由树的用户使用; + +`radix_tree_node` 的最后两个成员—— `tags` 和 `slots` 非常重要且令人关注。Linux 内核基数树的每个节点都包含了一组指针槽( slots ),槽里存储着指向数据的指针。在Linux内核基数树的实现中,空槽存储的是 `NULL` 。Linux内核中的基数树也支持标签( tags ),它与 `radix_tree_node` 结构体的 `tags` 字段相关联。有了标签,我们就可以对基数树中存储的记录以单个比特位( bit )进行设置。 + +既然我们了解了基数树的结构,那么该是时候看一下它的API了。 + +Linux内核基数树API +--------------------------------------------------------------------------------- + +我们从结构体的初始化开始。有两种方法初始化一个新的基数树。第一种是使用 `RADIX_TREE` 宏: + +```C +RADIX_TREE(name, gfp_mask); +```` + +正如你所看到的,我们传递了 `name` 参数,所以通过 `RADIX_TREE` 宏,我们能够定义和初始化基数树为给定的名字。`RADIX_TREE` 的实现很简单: + +```C +#define RADIX_TREE(name, mask) \ + struct radix_tree_root name = RADIX_TREE_INIT(mask) + +#define RADIX_TREE_INIT(mask) { \ + .height = 0, \ + .gfp_mask = (mask), \ + .rnode = NULL, \ +} +``` + +在 `RADIX_TREE` 宏的开始,我们使用给定的名字定义 `radix_tree_root` 结构体实例,并使用给定的 mask 调用 `RADIX_TREE_INIT` 宏。 而 `RADIX_TREE_INIT` 宏则是使用默认值和给定的mask对 `radix_tree_root` 结构体进行了初始化。 + +第二种方法是手动定义`radix_tree_root`结构体,并且将它和mask传给 `INIT_RADIX_TREE` 宏: + +```C +struct radix_tree_root my_radix_tree; +INIT_RADIX_TREE(my_tree, gfp_mask_for_my_radix_tree); +``` + +`INIT_RADIX_TREE` 宏的定义如下: + +```C +#define INIT_RADIX_TREE(root, mask) \ +do { \ + (root)->height = 0; \ + (root)->gfp_mask = (mask); \ + (root)->rnode = NULL; \ +} while (0) +``` + +和`RADIX_TREE_INIT`宏所做的初始化工作一样,`INIT_RADIX_TREE` 宏使用默认值和给定的 mask 完成初始化工作。 + +接下来是用于向基数树插入和删除数据的两个函数: + +* `radix_tree_insert`; +* `radix_tree_delete`; + +第一个函数 `radix_tree_insert` 需要3个参数: + +* 基数树的根; +* 索引键; +* 插入的数据; + +`radix_tree_delete` 函数需要和 `radix_tree_insert` 一样的一组参数,但是不需要传入要删除的数据。 + +基数树的搜索以两种方法实现: + +* `radix_tree_lookup`; +* `radix_tree_gang_lookup`; +* `radix_tree_lookup_slot`. + +第一个函数`radix_tree_lookup`需要两个参数: + +* 基数树的根; +* 索引键; + +这个函数尝试在树中查找给定的键,并返回和该键相关联的记录。第二个函数 `radix_tree_gang_lookup` 有以下的函数签名: + +```C +unsigned int radix_tree_gang_lookup(struct radix_tree_root *root, + void **results, + unsigned long first_index, + unsigned int max_items); +``` + +它返回的是记录的个数。 `results` 中的结果,按键排序,并从第一个索引开始。返回的记录个数将不会超过 `max_items` 的值。 + +最后一个函数`radix_tree_lookup_slot`将会返回包含数据的指针槽。 + +链接 +--------------------------------------------------------------------------------- + +* [Radix tree](http://en.wikipedia.org/wiki/Radix_tree) +* [Trie](http://en.wikipedia.org/wiki/Trie) + +-------------------------------------------------------------------------------- + +via: https://github.com/0xAX/linux-insides/blob/master/DataStructures/radix-tree.md + +作者:0xAX +译者:[cposture](https://github.com/cposture) +校对:[Mr小眼儿](https://github.com/tinyeyeser) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + diff --git a/published/20151124 Review--5 memory debuggers for Linux coding.md b/published/20151124 Review--5 memory debuggers for Linux coding.md new file mode 100644 index 0000000000..4c2e8373a0 --- /dev/null +++ b/published/20151124 Review--5 memory debuggers for Linux coding.md @@ -0,0 +1,302 @@ +点评五款用于 Linux 编程的内存调试器 +================================================================================ +![](http://images.techhive.com/images/article/2015/11/penguinadmin-2400px-100627186-primary.idge.jpg) +>Credit: [Moini][1] + +作为一个程序员,我知道我肯定会犯错误——怎么可能不犯错!程序员也是人啊。有的错误能在编码过程中及时发现,而有些却得等到软件测试了才能显露出来。然而,还有一类错误并不能在这两个阶段被解决,这就导致软件不能正常运行,甚至是提前终止。 + +如果你还没猜出是那种错误,我说的就是和内存相关的错误。手动调试这些错误不仅耗时,而且很难发现并纠正。值得一提的是,这种错误很常见,特别是在用 C/C++ 这类允许[手动管理内存][2]的语言编写的软件里。 + +幸运的是,现行有一些编程工具能够帮你在软件程序中找到这些和内存相关的错误。在这些工具集中,我评估了五款支持 Linux 的、流行的、自由开源的内存调试器: Dmalloc 、 Electric Fence 、 Memcheck 、 Memwatch 以及 Mtrace 。在日常编码中,我已经用过这五个调试器了,所以这些评估是建立在我的实际体验之上的。 + +### [Dmalloc][3] ### + +**开发者**:Gray Watson + +**评估版本**:5.5.2 + +**支持的 Linux 版本**:所有种类 + +**许可**: CC 3.0 + +Dmalloc 是 Gray Watson 开发的一款内存调试工具。它是作为库来实现的,封装了标准内存管理函数如`malloc() , calloc() , free()`等,使程序员得以检测出有问题的代码。 + +![cw dmalloc output](http://images.techhive.com/images/article/2015/11/cw_dmalloc-output-100627040-large.idge.png) + +*Dmalloc* + +如同工具的网页所示,这个调试器提供的特性包括内存泄漏跟踪、[重复释放内存(double free)][4]错误跟踪、以及[越界写入(fence-post write)][5]检测。其它特性包括报告错误的文件/行号、通用的数据统计记录。 + +#### 更新内容 #### + +5.5.2 版本是一个 [bug 修正发行版][6],修复了几个有关构建和安装的问题。 + +#### 有何优点 #### + +Dmalloc 最大的优点就是高度可配置性。比如说,你可以配置它以支持 C++ 程序和多线程应用。 Dmalloc 还提供一个有用的功能:运行时可配置,这表示在 Dmalloc 执行时,可以轻易地启用或者禁用它提供的一些特性。 + +你还可以配合 [GNU Project Debugger (GDB)][7]来使用 Dmalloc ,只需要将`dmalloc.gdb`文件(位于 Dmalloc 源码包中的 contrib 子目录里)的内容添加到你的主目录中的`.gdbinit`文件里即可。 + +另外一个让我对 Dmalloc 爱不释手的优点是它有大量的资料文献。前往官网的 [Documentation 栏目][8],可以获取所有关于如何下载、安装、运行、怎样使用库,和 Dmalloc 所提供特性的细节描述,及其生成的输出文件的解释。其中还有一个章节介绍了一般问题的解决方法。 + +#### 注意事项 #### + +跟 Mtrace 一样, Dmalloc 需要程序员改动他们的源代码。比如说你可以(也是必须的)添加头文件`dmalloc.h`,工具就能汇报产生问题的调用的文件或行号。这个功能非常有用,因为它节省了调试的时间。 + +除此之外,还需要在编译你的程序时,把 Dmalloc 库(编译 Dmalloc 源码包时产生的)链接进去。 + +然而,还有点更麻烦的事,需要设置一个环境变量,命名为`DMALLOC_OPTION`,以供工具在运行时配置内存调试特性,比如定义输出文件的路径。可以手动为该环境变量分配一个值,不过初学者可能会觉得这个过程有点困难,因为该值的一部分用来表示要启用的 Dmalloc 特性——以十六进制值的累加值表示。[这里][9]有详细介绍。 + +一个比较简单方法设置这个环境变量是使用 [Dmalloc 实用指令][10],这是专为这个目的设计的方法。 + +#### 总结 #### + +Dmalloc 真正的优势在于它的可配置选项。而且高度可移植,曾经成功移植到多种操作系统如 AIX 、 BSD/OS 、 DG/UX 、 Free/Net/OpenBSD 、 GNU/Hurd 、 HPUX 、 Irix 、 Linux 、 MS-DOG 、 NeXT 、 OSF 、 SCO 、 Solaris 、 SunOS 、 Ultrix 、 Unixware 甚至 Unicos(运行在 Cray T3E 主机上)。虽然使用 Dmalloc 需要学习许多知识,但是它所提供的特性值得为之付出。 + +### [Electric Fence][15] ### + +**开发者**:Bruce Perens + +**评估版本**:2.2.3 + +**支持的 Linux 版本**:所有种类 + +**许可**:GPL v2 + +Electric Fence 是 Bruce Perens 开发的一款内存调试工具,它以库的形式实现,你的程序需要链接它。Electric Fence 能检测出[堆][11]内存溢出和访问已经释放的内存。 + +![cw electric fence output](http://images.techhive.com/images/article/2015/11/cw_electric-fence-output-100627041-large.idge.png) + +*Electric Fence* + +顾名思义, Electric Fence 在每个所申请的缓存边界建立了虚拟围栏,这样一来任何非法的内存访问都会导致[段错误][12]。这个调试工具同时支持 C 和 C++ 程序。 + +#### 更新内容 #### + +2.2.3 版本修复了工具的构建系统,使得 `-fno-builtin-malloc` 选项能真正传给 [GNU Compiler Collection (GCC)][13]。 + +#### 有何优点 #### + +我喜欢 Electric Fence 的首要一点是它不同于 Memwatch 、 Dmalloc 和 Mtrace ,不需要对你的源码做任何的改动,你只需要在编译的时候把它的库链接进你的程序即可。 + +其次, Electric Fence 的实现保证了产生越界访问的第一个指令就会引起段错误。这比在后面再发现问题要好多了。 + +不管是否有检测出错误, Electric Fence 都会在输出产生版权信息。这一点非常有用,由此可以确定你所运行的程序已经启用了 Electric Fence 。 + +#### 注意事项 #### + +另一方面,我对 Electric Fence 真正念念不忘的是它检测内存泄漏的能力。内存泄漏是 C/C++ 软件最常见也是最不容易发现的问题之一。不过, Electric Fence 不能检测出栈溢出,而且也不是线程安全的。 + +由于 Electric Fence 会在用户分配内存区的前后分配禁止访问的虚拟内存页,如果你过多的进行动态内存分配,将会导致你的程序消耗大量的额外内存。 + +Electric Fence 还有一个局限是不能明确指出错误代码所在的行号。它所能做只是在检测到内存相关错误时产生段错误。想要定位错误的行号,需要借助 [GDB][14]这样的调试工具来调试启用了 Electric Fence 的程序。 + +最后一点,尽管 Electric Fence 能检测出大部分的缓冲区溢出,有一个例外是,如果所申请的缓冲区大小不是系统字长的倍数,这时候溢出(即使只有几个字节)就不能被检测出来。 + +#### 总结 #### + +尽管局限性较大, Electric Fence 的易用性仍然是加分项。只要链接一次程序, Electric Fence 就可以在监测出内存相关问题的时候报警。不过,如同前面所说, Electric Fence 需要配合像 GDB 这样的源码调试器使用。 + +### [Memcheck][16] ### + +**开发者**:[Valgrind 开发团队][17] + +**评估版本**:3.10.1 + +**支持的 Linux 发行版**:所有种类 + +**许可**:GPL + +[Valgrind][18] 是一个提供好几款调试和分析 Linux 程序性能的工具的套件。虽然 Valgrind 能和不同语言——Java 、 Perl 、 Python 、 Assembly code 、 ortran 、 Ada 等——编写的程序一起工作,但是它主要还是针对使用 C/C++ 所编写的程序。 + +Memcheck ,一款内存错误检测器,是其中最受欢迎的工具。它能够检测出如内存泄漏、无效的内存访问、未定义变量的使用以及堆内存分配和释放相关的问题等诸多问题。 + +#### 更新内容 #### + +[工具套件( 3.10.1 )][19]主要修复了 3.10.0 版本发现的 bug 。除此之外,“从主干开发版本向后移植的一些补丁,修复了缺失的 AArch64 ARMv8 指令和系统调用”。 + +#### 有何优点 #### + +同其它所有 Valgrind 工具一样, Memcheck 也是命令行程序。它的操作非常简单:通常我们会使用诸如 `prog arg1 arg2` 格式的命令来运行程序,而 Memcheck 只要求你多加几个值即可,如 `valgrind --leak-check=full prog arg1 arg2` 。 + +![cw memcheck output](http://images.techhive.com/images/article/2015/11/cw_memcheck-output-100627037-large.idge.png) + +*Memcheck* + +(注意:因为 Memcheck 是 Valgrind 的默认工具,所以在命令行执行命令时无需提及 Memcheck。但是,需要在编译程序之初带上 `-g` 参数选项,这一步会添加调试信息,使得 Memcheck 的错误信息会包含正确的行号。) + +我真正倾心于 Memcheck 的是它提供了很多命令行选项(如上所述的`--leak-check`选项),如此不仅能控制工具运转还可以控制它的输出。 + +举个例子,可以开启`--track-origins`选项,以查看程序源码中未初始化的数据;可以开启`--show-mismatched-frees`选项让 Memcheck 匹配内存的分配和释放技术。对于 C 语言所写的代码, Memcheck 会确保只能使用`free()`函数来释放内存,`malloc()`函数来申请内存。而对 C++ 所写的源码, Memcheck 会检查是否使用了`delete`或`delete[]`操作符来释放内存,以及`new`或者`new[]`来申请内存。 + +Memcheck 最好的特点,尤其是对于初学者来说,是它会给用户建议使用哪个命令行选项能让输出更加有意义。比如说,如果你不使用基本的`--leak-check`选项, Memcheck 会在输出时给出建议:“使用 --leak-check=full 重新运行以查看更多泄漏内存细节”。如果程序有未初始化的变量, Memcheck 会产生信息:“使用 --track-origins=yes 以查看未初始化变量的定位”。 + +Memcheck 另外一个有用的特性是它可以[创建抑制文件( suppression files )][20],由此可以略过特定的不能修正的错误,这样 Memcheck 运行时就不会每次都报警了。值得一提的是, Memcheck 会去读取默认抑制文件来忽略系统库(比如 C 库)中的报错,这些错误在系统创建之前就已经存在了。可以选择创建一个新的抑制文件,或是编辑现有的文件(通常是`/usr/lib/valgrind/default.supp`)。 + +Memcheck 还有高级功能,比如可以使用[定制内存分配器][22]来[检测内存错误][21]。除此之外, Memcheck 提供[监控命令][23],当用到 Valgrind 内置的 gdbserver ,以及[客户端请求][24]机制(不仅能把程序的行为告知 Memcheck ,还可以进行查询)时可以使用。 + +#### 注意事项 #### + +毫无疑问, Memcheck 可以节省很多调试时间以及省去很多麻烦。但是它使用了很多内存,导致程序执行变慢([由文档可知][25],大概会花费 20 至 30 倍时间)。 + +除此之外, Memcheck 还有其它局限。根据用户评论, Memcheck 很明显不是[线程安全][26]的;它不能检测出 [静态缓冲区溢出][27];还有就是,一些 Linux 程序如 [GNU Emacs][28] 目前还不能配合 Memcheck 工作。 + +如果有兴趣,可以在[这里][29]查看 Valgrind 局限性的详细说明。 + +#### 总结 #### + +无论是对于初学者还是那些需要高级特性的人来说, Memcheck 都是一款便捷的内存调试工具。如果你仅需要基本调试和错误检查, Memcheck 会非常容易上手。而当你想要使用像抑制文件或者监控指令这样的特性,就需要花一些功夫学习了。 + +虽然罗列了大量的局限性,但是 Valgrind(包括 Memcheck )在它的网站上声称全球有[成千上万程序员][30]使用了此工具。开发团队称收到来自超过 30 个国家的用户反馈,而这些用户的工程代码有的高达两千五百万行。 + +### [Memwatch][31] ### + +**开发者**:Johan Lindh + +**评估版本**:2.71 + +**支持的 Linux 发行版**:所有种类 + +**许可**:GNU GPL + +Memwatch 是由 Johan Lindh 开发的内存调试工具,虽然它扮演的主要角色是内存泄漏检测器,但是(根据网页介绍)它也具有检测其它如[内存重复释放和错误释放][32]、缓冲区溢出和下溢、[野指针][33]写入等等内存相关问题的能力。 + +Memwatch 支持用 C 语言所编写的程序。也可以在 C++ 程序中使用它,但是这种做法并不提倡(由 Memwatch 源码包随附的 Q&A 文件中可知)。 + +#### 更新内容 #### + +这个版本添加了`ULONG_LONG_MAX`以区分 32 位和 64 位程序。 + +#### 有何优点 #### + +跟 Dmalloc 一样, Memwatch 也有优秀的文档资料。参考 USING 文件,可以学习如何使用 Memwatch ,可以了解 Memwatch 是如何初始化、如何清理以及如何进行 I/O 操作,等等。还有一个 FAQ 文件,旨在帮助用户解决使用过程遇到的一般问题。最后还有一个`test.c`文件提供工作案例参考。 + +![cw memwatch output](http://images.techhive.com/images/article/2015/11/cw_memwatch_output-100627038-large.idge.png) + +*Memwatch* + +不同于 Mtrace , Memwatch 产生的日志文件(通常是`memwatch.log`)是人类可阅读的格式。而且, Memwatch 每次运行时总会把内存调试结果拼接到输出该文件的末尾。如此便可在需要之时轻松查看之前的输出信息。 + +同样值得一提的是当你执行了启用 Memwatch 的程序, Memwatch 会在[标准输出][34]中产生一个单行输出,告知发现了错误,然后你可以在日志文件中查看输出细节。如果没有产生错误信息,就可以确保日志文件不会写入任何错误,多次运行的话确实能节省时间。 + +另一个我喜欢的优点是 Memwatch 还提供了在源码中获取其输出信息的方式,你可以获取信息,然后任由你进行处理(参考 Memwatch 源码中的`mwSetOutFunc()`函数获取更多有关的信息)。 + +#### 注意事项 #### + +跟 Mtrace 和 Dmalloc 一样, Memwatch 也需要你往你的源文件里增加代码:你需要把`memwatch.h`这个头文件包含进你的代码。而且,编译程序的时候,你需要连同`memwatch.c`一块编译;或者你可以把已经编译好的目标模块包含起来,然后在命令行定义`MEMWATCH`和`MW_STDIO`变量。不用说,想要在输出中定位行号, -g 编译器选项也少不了。 + +此外, Memwatch 缺少一些特性。比如 Memwatch 不能检测出对一块已经被释放的内存进行写入操作,或是在分配的内存块之外的进行读取操作。而且, Memwatch 也不是线程安全的。还有一点,正如我在开始时指出,在 C++ 程序上运行 Memwatch 的结果是不能预料的。 + +#### 总结 #### + +Memcheck 可以检测很多内存相关的问题,在处理 C 程序时是非常便捷的调试工具。因为源码小巧,所以可以从中了解 Memcheck 如何运转,有需要的话可以调试它,甚至可以根据自身需求扩展升级它的功能。 + +### [Mtrace][35] ### + +**开发者**: Roland McGrath 和 Ulrich Drepper + +**评估版本**: 2.21 + +**支持的 Linux 发行版**:所有种类 + +**许可**:GNU GPL + +Mtrace 是 [GNU C 库][36]中的一款内存调试工具,同时支持 Linux 上的 C 和 C++ 程序,可以检测由函数`malloc()`和`free()`不匹配的调用所引起的内存泄漏问题。 + +![cw mtrace output](http://images.techhive.com/images/article/2015/11/cw_mtrace-output-100627039-large.idge.png) + +*Mtrace* + +Mtrace 实际上是实现了一个名为`mtrace()`的函数,它可以跟踪程序中所有 malloc/free 调用,并在用户指定的文件中记录相关信息。文件以一种机器可读的格式记录数据,所以有一个 Perl 脚本——同样命名为 mtrace ——用来把文件转换并为人类可读格式。 + +#### 更新内容 #### + +[Mtrace 源码][37]和 [Perl 文件][38]同 GNU C 库( 2.21 版本)一起释出,除了更新版权日期,其它别无改动。 + +#### 有何优点 #### + +Mtrace 最好的地方是它非常简单易学。你只需要了解在你的源码中如何以及何处添加 mtrace() 及对应的 muntrace() 函数,还有如何使用 Mtrace 的 Perl 脚本。后者非常简单,只需要运行指令`mtrace `(例子见开头截图最后一条指令)。 + +Mtrace 另外一个优点是它的可伸缩性,这体现在不仅可以使用它来调试完整的程序,还可以使用它来检测程序中独立模块的内存泄漏。只需在每个模块里调用`mtrace()`和`muntrace()`即可。 + +最后一点,因为 Mtrace 会在`mtrace()`——在源码中添加的函数——执行时被触发,因此可以很灵活地[使用信号][39]动态地(在程序执行时)使能 Mtrace 。 + +#### 注意事项 #### + +因为`mtrace()`和`mauntrace()`函数 —— 声明在`mcheck.h`文件中,所以必须在源码中包含此头文件 —— 的调用是 Mtrace 工作的基础(`mauntrace()`函数并非[总是必要][40]),因此 Mtrace 要求程序员至少改动源码一次。 + +需要注意的是,在编译程序的时候带上 -g 选项( [GCC][41] 和 [G++][42] 编译器均有提供),才能使调试工具在输出结果时展示正确的行号。除此之外,有些程序(取决于源码体积有多大)可能会花很长时间进行编译。最后,带 -g 选项编译会增加了可执行文件的大小(因为提供了额外的调试信息),因此记得程序需要在测试结束后,不带 -g 选项重新进行编译。 + +使用 Mtrace ,你需要掌握 Linux 环境变量的基本知识,因为在程序执行之前,需要把用户把环境变量`MALLOC_TRACE`的值设为指定的文件(`mtrace()`函数将会记录全部信息到其中)路径。 + +Mtrace 在检测内存泄漏和试图释放未经过分配的内存方面存在局限。它不能检测其它内存相关问题如非法内存访问、使用未初始化内存。而且,[有人抱怨][43] Mtrace 不是[线程安全][44]的。 + +### 总结 ### + +不言自明,我在此讨论的每款内存调试器都有其优点和局限。所以,哪一款适合你取决于你所需要的特性,虽然有时候容易安装和使用也是一个决定因素。 + +要想捕获软件程序中的内存泄漏, Mtrace 最适合不过了。它还可以节省时间。由于 Linux 系统已经预装了此工具,对于不能联网或者不可以下载第三方调试调试工具的情况, Mtrace 也是极有助益的。 + +另一方面,相比 Mtrace , Dmalloc 不仅能检测更多错误类型,还提供更多特性,比如运行时可配置、 GDB 集成。而且, Dmalloc 不像这里所说的其它工具,它是线程安全的。更不用说它的详细资料了,这让 Dmalloc 成为初学者的理想选择。 + +虽然 Memwatch 的资料比 Dmalloc 的更加丰富,而且还能检测更多的错误种类,但是你只能在 C 语言写就的程序中使用它。一个让 Memwatch 脱颖而出的特性是它允许在你的程序源码中处理它的输出,这对于想要定制输出格式来说是非常有用的。 + +如果改动程序源码非你所愿,那么使用 Electric Fence 吧。不过,请记住, Electric Fence 只能检测两种错误类型,而此二者均非内存泄漏。还有就是,需要基本了解 GDB 以最大化发挥这款内存调试工具的作用。 + +Memcheck 可能是其中综合性最好的了。相比这里提及的其它工具,它能检测更多的错误类型,提供更多的特性,而且不需要你的源码做任何改动。但请注意,基本功能并不难上手,但是想要使用它的高级特性,就必须学习相关的专业知识了。 + +-------------------------------------------------------------------------------- + +via: http://www.computerworld.com/article/3003957/linux/review-5-memory-debuggers-for-linux-coding.html + +作者:[Himanshu Arora][a] +译者:[soooogreen](https://github.com/soooogreen) +校对:[PurlingNayuki](https://github.com/PurlingNayuki),[ezio](https://github.com/oska874) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.computerworld.com/author/Himanshu-Arora/ +[1]:https://openclipart.org/detail/132427/penguin-admin +[2]:https://en.wikipedia.org/wiki/Manual_memory_management +[3]:http://dmalloc.com/ +[4]:https://www.owasp.org/index.php/Double_Free +[5]:https://stuff.mit.edu/afs/sipb/project/gnucash-test/src/dmalloc-4.8.2/dmalloc.html#Fence-Post%20Overruns +[6]:http://dmalloc.com/releases/notes/dmalloc-5.5.2.html +[7]:http://www.gnu.org/software/gdb/ +[8]:http://dmalloc.com/docs/ +[9]:http://dmalloc.com/docs/latest/online/dmalloc_26.html#SEC32 +[10]:http://dmalloc.com/docs/latest/online/dmalloc_23.html#SEC29 +[11]:https://en.wikipedia.org/wiki/Memory_management#Dynamic_memory_allocation +[12]:https://en.wikipedia.org/wiki/Segmentation_fault +[13]:https://en.wikipedia.org/wiki/GNU_Compiler_Collection +[14]:http://www.gnu.org/software/gdb/ +[15]:https://launchpad.net/ubuntu/+source/electric-fence/2.2.3 +[16]:http://valgrind.org/docs/manual/mc-manual.html +[17]:http://valgrind.org/info/developers.html +[18]:http://valgrind.org/ +[19]:http://valgrind.org/docs/manual/dist.news.html +[20]:http://valgrind.org/docs/manual/mc-manual.html#mc-manual.suppfiles +[21]:http://valgrind.org/docs/manual/mc-manual.html#mc-manual.mempools +[22]:http://stackoverflow.com/questions/4642671/c-memory-allocators +[23]:http://valgrind.org/docs/manual/mc-manual.html#mc-manual.monitor-commands +[24]:http://valgrind.org/docs/manual/mc-manual.html#mc-manual.clientreqs +[25]:http://valgrind.org/docs/manual/valgrind_manual.pdf +[26]:http://sourceforge.net/p/valgrind/mailman/message/30292453/ +[27]:https://msdn.microsoft.com/en-us/library/ee798431%28v=cs.20%29.aspx +[28]:http://www.computerworld.com/article/2484425/linux/5-free-linux-text-editors-for-programming-and-word-processing.html?nsdr=true&page=2 +[29]:http://valgrind.org/docs/manual/manual-core.html#manual-core.limits +[30]:http://valgrind.org/info/ +[31]:http://www.linkdata.se/sourcecode/memwatch/ +[32]:http://www.cecalc.ula.ve/documentacion/tutoriales/WorkshopDebugger/007-2579-007/sgi_html/ch09.html +[33]:http://c2.com/cgi/wiki?WildPointer +[34]:https://en.wikipedia.org/wiki/Standard_streams#Standard_output_.28stdout.29 +[35]:http://www.gnu.org/software/libc/manual/html_node/Tracing-malloc.html +[36]:https://www.gnu.org/software/libc/ +[37]:https://sourceware.org/git/?p=glibc.git;a=history;f=malloc/mtrace.c;h=df10128b872b4adc4086cf74e5d965c1c11d35d2;hb=HEAD +[38]:https://sourceware.org/git/?p=glibc.git;a=history;f=malloc/mtrace.pl;h=0737890510e9837f26ebee2ba36c9058affb0bf1;hb=HEAD +[39]:http://webcache.googleusercontent.com/search?q=cache:s6ywlLtkSqQJ:www.gnu.org/s/libc/manual/html_node/Tips-for-the-Memory-Debugger.html+&cd=1&hl=en&ct=clnk&gl=in&client=Ubuntu +[40]:http://www.gnu.org/software/libc/manual/html_node/Using-the-Memory-Debugger.html#Using-the-Memory-Debugger +[41]:http://linux.die.net/man/1/gcc +[42]:http://linux.die.net/man/1/g++ +[43]:https://sourceware.org/ml/libc-help/2014-05/msg00008.html +[44]:https://en.wikipedia.org/wiki/Thread_safety diff --git a/published/20151130 Useful Linux and Unix Tape Managements Commands For Sysadmins.md b/published/20151130 Useful Linux and Unix Tape Managements Commands For Sysadmins.md new file mode 100644 index 0000000000..5bf991fef4 --- /dev/null +++ b/published/20151130 Useful Linux and Unix Tape Managements Commands For Sysadmins.md @@ -0,0 +1,426 @@ +给系统管理员的15条实用 Linux/Unix 磁带管理命令 +================================================================================ +磁带设备应只用于定期的文件归档或将数据从一台服务器传送至另一台。通常磁带设备与 Unix 机器连接,用 mt 或 mtx 控制。强烈建议您将所有的数据同时备份到磁盘(也许是云中)和磁带设备中。在本教程中你将会了解到: + +- 磁带设备名 +- 管理磁带驱动器的基本命令 +- 基本的备份和恢复命令 + +### 为什么备份? ### + +一个备份计划对定期备份文件来说很有必要,如果你宁愿选择不备份,那么丢失重要数据的风险会大大增加。有了备份,你就有了从磁盘故障中恢复的能力。备份还可以帮助你抵御: + +- 意外的文件删除 +- 文件或文件系统损坏 +- 服务器完全毁坏,包括由于火灾或其他问题导致的同盘备份毁坏 +- 硬盘或 SSD 崩溃 +- 病毒或勒索软件破坏或删除文件 + +你可以使用磁带归档备份整个服务器并将其离线存储。 + +### 理解磁带文件标记和块大小 ### + +![Fig.01: Tape file marks](http://s0.cyberciti.org/uploads/cms/2015/10/tape-format.jpg) + +*图01:磁带文件标记* + +每个磁带设备能存储多个备份文件。磁带备份文件通过 cpio,tar,dd 等命令创建。同时,磁带设备可以由多种程序打开、写入数据、及关闭。你可以存储若干备份(磁带文件)到一个物理磁带上。在每个磁带文件之间有个“磁带文件标记”。这用来指示一个物理磁带上磁带文件的结尾以及另一个文件的开始。你需要使用 mt 命令来定位磁带(快进,倒带和标记)。 + +#### 磁带上的数据是如何存储的 #### + +![Fig.02: How data is stored on a tape](http://s0.cyberciti.org/uploads/cms/2015/10/how-data-is-stored-on-a-tape.jpg) + +*图02:磁带上的数据是如何存储的* + +所有的数据使用 tar 以连续磁带存储格式连续地存储。第一个磁带归档会从磁带的物理开始端开始存储(tar #0)。接下来的就是 tar #1,以此类推。 + +### Unix 上的磁带设备名 ### + +1. /dev/rmt/0 或 /dev/rmt/1 或 /dev/rmt/[0-127] :Unix 上的常规磁带设备名。磁带自动倒回。 +1. /dev/rmt/0n :以无倒回为特征,换言之,磁带使用之后,停留在当前状态等待下个命令。 +1. /dev/rmt/0b :使用磁带接口,也就是 BSD 的行为。各种类型的操作系统比如 AIX,Windows,Linux,FreeBSD 等的行为更有可读性。 +1. /dev/rmt/0l :设置密度为低。 +1. /dev/rmt/0m :设置密度为中。 +1. /dev/rmt/0u :设置密度为高。 +1. /dev/rmt/0c :设置密度为压缩。 +1. /dev/st[0-9] :Linux 特定 SCSI 磁带设备名。 +1. /dev/sa[0-9] :FreeBSD 特定 SCSI 磁带设备名。 +1. /dev/esa0 :FreeBSD 特定 SCSI 磁带设备名,在关闭时弹出(如果可以的话)。 + +#### 磁带设备名示例 #### + +- /dev/rmt/1cn 指明正在使用 unity 1,压缩密度,无倒回。 +- /dev/rmt/0hb 指明正在使用 unity 0,高密度,BSD 行为。 +- Linux 上的自动倒回 SCSI 磁带设备名:/dev/st0 +- Linux 上的无倒回 SCSI 磁带设备名:/dev/nst0 +- FreeBSD 上的自动倒回 SCSI 磁带设备名:/dev/sa0 +- FreeBSD 上的无倒回 SCSI 磁带设备名:/dev/nsa0 + +#### 如何列出已安装的 scsi 磁带设备? #### + +输入下列命令: + + ### Linux(更多信息参阅 man) ### + lsscsi + lsscsi -g + + ### IBM AIX ### + lsdev -Cc tape + lsdev -Cc adsm + lscfg -vl rmt* + + ### Solaris Unix ### + cfgadm –a + cfgadm -al + luxadm probe + iostat -En + + ### HP-UX Unix ### + ioscan Cf + ioscan -funC tape + ioscan -fnC tape + ioscan -kfC tape + + +来自我的 Linux 服务器的输出示例: + +![Fig.03: Installed tape devices on Linux server](http://s0.cyberciti.org/uploads/cms/2015/10/linux-find-tape-devices-command.jpg) + +*图03:Linux 服务器上已安装的磁带设备* + +### mt 命令示例 ### + +在 Linux 和类 Unix 系统上,mt 命令用来控制磁带驱动器的操作,比如查看状态或查找磁带上的文件或写入磁带控制标记。下列大多数命令需要作为 root 用户执行。语法如下: + + mt -f /tape/device/name operation + +#### 设置环境 #### + +你可以设置 TAPE shell 变量。这是磁带驱动器的路径名。在 FreeBSD 上默认的(如果变量没有设置,而不是 null)是 /dev/nsa0。可以通过 mt 命令的 -f 参数传递变量覆盖它,就像下面解释的那样。 + + ### 添加到你的 shell 配置文件 ### + TAPE=/dev/st1 #Linux + TAPE=/dev/rmt/2 #Unix + TAPE=/dev/nsa3 #FreeBSD + export TAPE + +### 1:显示磁带/驱动器状态 ### + + mt status ### Use default + mt -f /dev/rmt/0 status ### Unix + mt -f /dev/st0 status ### Linux + mt -f /dev/nsa0 status ### FreeBSD + mt -f /dev/rmt/1 status ### Unix unity 1 也就是 tape device no. 1 + +你可以像下面一样使用 shell 循环语句遍历一个系统并定位其所有的磁带驱动器: + + for d in 0 1 2 3 4 5 + do + mt -f "/dev/rmt/${d}" status + done + +### 2:倒带 ### + + mt rew + mt rewind + mt -f /dev/mt/0 rewind + mt -f /dev/st0 rewind + +### 3:弹出磁带 ### + + mt off + mt offline + mt eject + mt -f /dev/mt/0 off + mt -f /dev/st0 eject + +### 4:擦除磁带(倒带,在支持的情况下卸载磁带) ### + + mt erase + mt -f /dev/st0 erase #Linux + mt -f /dev/rmt/0 erase #Unix + +### 5:张紧磁带盒 ### + +如果磁带在读取时发生错误,你重新张紧磁带,清洁磁带驱动器,像下面这样再试一次: + + mt retension + mt -f /dev/rmt/1 retension #Unix + mt -f /dev/st0 retension #Linux + +### 6:在磁带当前位置写入 EOF 标记 ### + + mt eof + mt weof + mt -f /dev/st0 eof + +### 7:将磁带前进指定的文件标记数目,即跳过指定个 EOF 标记 ### + +磁带定位在下一个文件的第一个块,即磁带会定位在下一区域的第一个块(见图01): + + mt fsf + mt -f /dev/rmt/0 fsf + mt -f /dev/rmt/1 fsf 1 #go 1 forward file/tape (see fig.01) + +### 8:将磁带后退指定的文件标记数目,即倒带指定个 EOF 标记 ### + +磁带定位在下一个文件的第一个块,即磁带会定位在 EOF 标记之后(见图01): + + mt bsf + mt -f /dev/rmt/1 bsf + mt -f /dev/rmt/1 bsf 1 #go 1 backward file/tape (see fig.01) + +这里是磁带定位命令列表: + + fsf 前进指定的文件标记数目。磁带定位在下一个文件的第一块。 + + fsfm 前进指定的文件标记数目。磁带定位在前一文件的最后一块。 + + bsf 后退指定的文件标记数目。磁带定位在前一文件的最后一块。 + + bsfm 后退指定的文件标记数目。磁带定位在下一个文件的第一块。 + + asf 磁带定位在指定文件标记数目的开始位置。定位通过先倒带,再前进指定的文件标记数目来实现。 + + fsr 前进指定的记录数。 + + bsr 后退指定的记录数。 + + fss (SCSI tapes)前进指定的 setmarks。 + + bss (SCSI tapes)后退指定的 setmarks。 + +### 基本备份命令 ### + +让我们来看看备份和恢复命令。 + +### 9:备份目录(tar 格式) ### + + tar cvf /dev/rmt/0n /etc + tar cvf /dev/st0 /etc + +### 10:恢复目录(tar 格式) ### + + tar xvf /dev/rmt/0n -C /path/to/restore + tar xvf /dev/st0 -C /tmp + +### 11:列出或检查磁带内容(tar 格式) ### + + mt -f /dev/st0 rewind; dd if=/dev/st0 of=- + + ### tar 格式 ### + tar tvf {DEVICE} {Directory-FileName} + tar tvf /dev/st0 + tar tvf /dev/st0 desktop + tar tvf /dev/rmt/0 foo > list.txt + +### 12:使用 dump 或 ufsdump 备份分区 ### + + ### Unix 备份 c0t0d0s2 分区 ### + ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t0d0s2 + + ### Linux 备份 /home 分区 ### + dump 0uf /dev/nst0 /dev/sda5 + dump 0uf /dev/nst0 /home + + ### FreeBSD 备份 /usr 分区 ### + dump -0aL -b64 -f /dev/nsa0 /usr + +### 12:使用 ufsrestore 或 restore 恢复分区 ### + + ### Unix ### + ufsrestore xf /dev/rmt/0 + ### Unix 交互式恢复 ### + ufsrestore if /dev/rmt/0 + + ### Linux ### + restore rf /dev/nst0 + ### 从磁带媒介上的第6个备份交互式恢复 ### + restore isf 6 /dev/nst0 + + ### FreeBSD 恢复 ufsdump 格式 ### + restore -i -f /dev/nsa0 + +### 13:从磁带开头开始写入(见图02) ### + + ### 这会覆盖磁带上的所有数据 ### + mt -f /dev/st1 rewind + + ### 备份 home ### + tar cvf /dev/st1 /home + + ### 离线并卸载磁带 ### + mt -f /dev/st0 offline + +从磁带开头开始恢复: + + mt -f /dev/st0 rewind + tar xvf /dev/st0 + mt -f /dev/st0 offline + +### 14:从最后一个 tar 后开始写入(见图02) ### + + ### 这会保留之前写入的数据 ### + mt -f /dev/st1 eom + + ### 备份 home ### + tar cvf /dev/st1 /home + + ### 卸载 ### + mt -f /dev/st0 offline + +### 15:从 tar number 2 后开始写入(见图02) ### + + ### 在 tar number 2 之后写入(应该是 2+1)### + mt -f /dev/st0 asf 3 + tar cvf /dev/st0 /usr + + ### asf 等效于 fsf ### + mt -f /dev/sf0 rewind + mt -f /dev/st0 fsf 2 + +从 tar number 2 恢复 tar: + + mt -f /dev/st0 asf 3 + tar xvf /dev/st0 + mt -f /dev/st0 offline + +### 如何验证使用 tar 创建的备份磁带? ### + +定期做全系统修复和服务测试是很重要的,这是唯一确定整个系统正确工作的途径。参见我们的[验证 tar 命令磁带备份的教程][1]以获取更多信息。 + +### 示例 shell 脚本 ### + + #!/bin/bash + # A UNIX / Linux shell script to backup dirs to tape device like /dev/st0 (linux) + # This script make both full and incremental backups. + # You need at two sets of five tapes. Label each tape as Mon, Tue, Wed, Thu and Fri. + # You can run script at midnight or early morning each day using cronjons. + # The operator or sys admin can replace the tape every day after the script has done. + # Script must run as root or configure permission via sudo. + # ------------------------------------------------------------------------- + # Copyright (c) 1999 Vivek Gite + # This script is licensed under GNU GPL version 2.0 or above + # ------------------------------------------------------------------------- + # This script is part of nixCraft shell script collection (NSSC) + # Visit http://bash.cyberciti.biz/ for more information. + # ------------------------------------------------------------------------- + # Last updated on : March-2003 - Added log file support. + # Last updated on : Feb-2007 - Added support for excluding files / dirs. + # ------------------------------------------------------------------------- + LOGBASE=/root/backup/log + + # Backup dirs; do not prefix / + BACKUP_ROOT_DIR="home sales" + + # Get todays day like Mon, Tue and so on + NOW=$(date +"%a") + + # Tape devie name + TAPE="/dev/st0" + + # Exclude file + TAR_ARGS="" + EXCLUDE_CONF=/root/.backup.exclude.conf + + # Backup Log file + LOGFIILE=$LOGBASE/$NOW.backup.log + + # Path to binaries + TAR=/bin/tar + MT=/bin/mt + MKDIR=/bin/mkdir + + # ------------------------------------------------------------------------ + # Excluding files when using tar + # Create a file called $EXCLUDE_CONF using a text editor + # Add files matching patterns such as follows (regex allowed): + # home/vivek/iso + # home/vivek/*.cpp~ + # ------------------------------------------------------------------------ + [ -f $EXCLUDE_CONF ] && TAR_ARGS="-X $EXCLUDE_CONF" + + #### Custom functions ##### + # Make a full backup + full_backup(){ + local old=$(pwd) + cd / + $TAR $TAR_ARGS -cvpf $TAPE $BACKUP_ROOT_DIR + $MT -f $TAPE rewind + $MT -f $TAPE offline + cd $old + } + + # Make a partial backup + partial_backup(){ + local old=$(pwd) + cd / + $TAR $TAR_ARGS -cvpf $TAPE -N "$(date -d '1 day ago')" $BACKUP_ROOT_DIR + $MT -f $TAPE rewind + $MT -f $TAPE offline + cd $old + } + + # Make sure all dirs exits + verify_backup_dirs(){ + local s=0 + for d in $BACKUP_ROOT_DIR + do + if [ ! -d /$d ]; + then + echo "Error : /$d directory does not exits!" + s=1 + fi + done + # if not; just die + [ $s -eq 1 ] && exit 1 + } + + #### Main logic #### + + # Make sure log dir exits + [ ! -d $LOGBASE ] && $MKDIR -p $LOGBASE + + # Verify dirs + verify_backup_dirs + + # Okay let us start backup procedure + # If it is Monday make a full backup; + # For Tue to Fri make a partial backup + # Weekend no backups + case $NOW in + Mon) full_backup;; + Tue|Wed|Thu|Fri) partial_backup;; + *) ;; + esac > $LOGFIILE 2>&1 + +### 关于第三方备份工具 ### + +Linux 和类Unix系统都提供了许多第三方工具,可以用来安排备份,包括磁带备份在内,如: + +- Amanda +- Bacula +- rsync +- duplicity +- rsnapshot + +另行参阅 + +- Man pages - [mt(1)][2], [mtx(1)][3], [tar(1)][4], [dump(8)][5], [restore(8)][6] + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/hardware/unix-linux-basic-tape-management-commands/ + +作者:Vivek Gite +译者:[alim0x](https://github.com/alim0x) +校对:[Mr小眼儿](https://github.com/tinyeyeser) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.cyberciti.biz/faq/unix-verify-tape-backup/ +[2]:http://www.manpager.com/linux/man1/mt.1.html +[3]:http://www.manpager.com/linux/man1/mtx.1.html +[4]:http://www.manpager.com/linux/man1/tar.1.html +[5]:http://www.manpager.com/linux/man8/dump.8.html +[6]:http://www.manpager.com/linux/man8/restore.8.html diff --git a/published/201512/20150410 How to Install and Configure Multihomed ISC DHCP Server on Debian Linux.md b/published/201512/20150410 How to Install and Configure Multihomed ISC DHCP Server on Debian Linux.md new file mode 100644 index 0000000000..32ce669b8c --- /dev/null +++ b/published/201512/20150410 How to Install and Configure Multihomed ISC DHCP Server on Debian Linux.md @@ -0,0 +1,162 @@ +在 Debian Linux 上安装配置 ISC DHCP 服务器 +================================================================================ + +动态主机控制协议(Dynamic Host Control Protocol,DHCP)给网络管理员提供了一种便捷的方式,为不断变化的网络主机或是动态网络提供网络层地址。其中最常用的 DHCP 服务工具是 ISC DHCP Server。DHCP 服务的目的是给主机提供必要的网络信息以便能够和其他连接在网络中的主机互相通信。DHCP 服务提供的信息包括:DNS 服务器信息,网络地址(IP),子网掩码,默认网关信息,主机名等等。 + +本教程介绍运行在 Debian 7.7 上 4.2.4 版的 ISC-DHCP-Server 如何管理多个虚拟局域网(VLAN),也可以非常容易应用到单一网络上。 + +测试用的网络是通过思科路由器使用传统的方式来管理 DHCP 租约地址的。目前有 12 个 VLAN 需要通过集中式服务器来管理。把 DHCP 的任务转移到一个专用的服务器上,路由器可以收回相应的资源,把资源用到更重要的任务上,比如路由寻址,访问控制列表,流量监测以及网络地址转换等。 + +另一个将 DHCP 服务转移到专用服务器的好处,以后会讲到,它可以建立动态域名服务器(DDNS),这样当主机从服务器请求 DHCP 地址的时候,这样新主机的主机名就会被添加到 DNS 系统里面。 + +### 安装和配置 ISC DHCP 服务器### + +1、使用 apt 工具用来安装 Debian 软件仓库中的 ISC 软件,来创建这个多宿主服务器。与其他教程一样需要使用 root 或者 sudo 访问权限。请适当的修改,以便使用下面的命令。(LCTT 译注:下面中括号里面是注释,使用的时候请删除,#表示使用的 root 权限) + + # apt-get install isc-dhcp-server [安装 the ISC DHCP Server 软件] + # dpkg --get-selections isc-dhcp-server [确认软件已经成功安装] + # dpkg -s isc-dhcp-server [用另一种方式确认成功安装] + +![Install ISC DHCP Server in Debian](http://www.tecmint.com/wp-content/uploads/2015/04/Install-ISC-DHCP-Server.jpg) + +2、 确认服务软件已经安装完成,现在需要提供网络信息来配置服务器,这样服务器才能够根据我们的需要来分发网络信息。作为管理员最起码需要了解的 DHCP 信息如下: + +- 网络地址 +- 子网掩码 +- 动态分配的地址范围 + +其他一些服务器动态分配的有用信息包括: + +- 默认网关 +- DNS 服务器 IP 地址 +- 域名 +- 主机名 +- 网络广播地址 + +这只是能让 ISC DHCP 服务器处理的选项中非常少的一部分。如果你想查看所有选项及其描述需要在安装好软件后输入以下命令: + + # man dhcpd.conf + +3、 一旦管理员已经确定了这台服务器分发的所有必要信息,那么是时候配置服务器并且分配必要的地址池了。在配置任何地址池或服务器配置之前,必须配置 DHCP 服务器侦听这台服务器上面的一个接口。 + +在这台特定的服务器上,设置好网卡后,DHCP 会侦听名称名为`'bond0'`的接口。请适根据你的实际情况来更改服务器以及网络环境。下面的配置都是针对本教程的。 + +![Configure ISC DHCP Network](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-ISC-DHCP-Network.jpg) + +这行指定的是 DHCP 服务侦听接口(一个或多个)上的 DHCP 流量。修改主配置文件,分配适合的 DHCP 地址池到所需要的网络上。主配置文件在 /etc/dhcp/dhcpd.conf。用文本编辑器打开这个文件 + + # nano /etc/dhcp/dhcpd.conf + +这个配置文件可以配置我们所需要的地址池/主机。文件顶部有 ‘ddns-update-style‘ 这样一句,在本教程中它设置为 ‘none‘。在以后的教程中会讲到动态 DNS,ISC-DHCP-Server 将会与 BIND9 集成,它能够使主机名更新指向到 IP 地址。 + +4、 接下来的部分是管理员配置全局网络设置,如 DNS 域名,默认的租约时间,IP地址,子网的掩码,以及其它。如果你想了解所有的选项,请阅读 man 手册中的 dhcpd.conf 文件,命令如下: + + # man dhcpd.conf + +对于这台服务器,我们需要在配置文件顶部配置一些全局网络设置,这样就不用到每个地址池中去单独设置了。 + +![Configure ISC DDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-ISC-DDNS.png) + +我们花一点时间来解释一下这些选项,在本教程中虽然它们是一些全局设置,但是也可以单独的为某一个地址池进行配置。 + +- option domain-name “comptech.local”; – 所有使用这台 DHCP 服务器的主机,都将成为 DNS 域 “comptech.local” 的一员 + +- option domain-name-servers 172.27.10.6; DHCP 向所有配置这台 DHCP 服务器的的网络主机分发 DNS 服务器地址为 172.27.10.6 + +- option subnet-mask 255.255.255.0; – 每个网络设备都分配子网掩码 255.255.255.0 或 /24 + +- default-lease-time 3600; – 默认有效的地址租约时间(单位是秒)。如果租约时间耗尽,那么主机可以重新申请租约。如果租约完成,那么相应的地址也将被尽快回收。 + +- max-lease-time 86400; – 这是一台主机所能租用的最大的租约时间(单位为秒)。 + +- ping-check true; – 这是一个额外的测试,以确保服务器分发出的网络地址不是当前网络中另一台主机已使用的网络地址。 + +- ping-timeout; – 在判断地址以前没有使用过前,服务器将等待 ping 响应多少秒。 + +- ignore client-updates; 现在这个选项是可以忽略的,因为 DDNS 在前面已在配置文件中已经被禁用,但是当 DDNS 运行时,这个选项会忽略主机更新其 DNS 主机名的请求。 + +5、 文件中下面一行是权威 DHCP 所在行。这行的意义是如果服务器是为文件中所配置的网络分发地址的服务器,那么取消对该权威关键字(authoritative stanza) 的注释。 + +通过去掉关键字 authoritative 前面的 ‘#’,取消注释全局权威关键字。这台服务器将是它所管理网络里面的唯一权威。 + +![Enable ISC Authoritative](http://www.tecmint.com/wp-content/uploads/2015/04/ISC-authoritative.png) + +默认情况下服务器被假定为**不是**网络上的权威服务器。之所以这样做是出于安全考虑。如果有人因为不了解 DHCP 服务的配置,导致配置不当或配置到一个不该出现的网络里面,这都将带来非常严重的连接问题。这行还可用在每个网络中单独配置使用。也就是说如果这台服务器不是整个网络的 DHCP 服务器,authoritative 行可以用在每个单独的网络中,而不是像上面截图中那样的全局配置。 + +6、 这一步是配置服务器将要管理的所有 DHCP 地址池/网络。简短起见,本教程只讲到配置的地址池之一。作为管理员需要收集一些必要的网络信息(比如域名,网络地址,有多少地址能够被分发等等) + +以下这个地址池所用到的信息都是管理员收集整理的:网络 ID 172.27.60.0, 子网掩码 255.255.255.0 或 /24, 默认子网网关 172.27.60.1,广播地址 172.27.60.255.0 。 + +以上这些信息对于构建 dhcpd.conf 文件中新网络非常重要。使用文本编辑器修改配置文件添加新网络进去,这里我们需要使用 root 或 sudo 访问权限。 + + # nano /etc/dhcp/dhcpd.conf + +![Configure DHCP Pools and Networks](http://www.tecmint.com/wp-content/uploads/2015/04/ISC-network.png) + +当前这个例子是给用 VMWare 创建的虚拟服务器分配 IP 地址。第一行显示是该网络的子网掩码。括号里面的内容是 DHCP 服务器应该提供给网络上面主机的所有选项。 + +第一行, range 172.27.60.50 172.27.60.254; 这一行显示的是,DHCP 服务在这个网络上能够给主机动态分发的地址范围。 + +第二行,option routers 172.27.60.1; 这里显示的是给网络里面所有的主机分发的默认网关地址。 + +最后一行, option broadcast-address 172.27.60.255; 显示当前网络的广播地址。这个地址不能被包含在要分发放的地址范围内,因为广播地址不能分配到一个主机上面。 + +必须要强调的是每行的结尾必须要用(;)来结束,所有创建的网络必须要在 {} 里面。 + +7、 如果要创建多个网络,继续创建完它们的相应选项后保存文本文件即可。配置完成以后如果有更改,ISC-DHCP-Server 进程需要重启来使新的更改生效。重启进程可以通过下面的命令来完成: + + # service isc-dhcp-server restart + +这条命令将重启 DHCP 服务,管理员能够使用几种不同的方式来检查服务器是否已经可以处理 dhcp 请求。最简单的方法是通过 [lsof 命令][1]来查看服务器是否在侦听67端口,命令如下: + + # lsof -i :67 + +![Check DHCP Listening Port](http://www.tecmint.com/wp-content/uploads/2015/04/lsof.png) + +这里输出的结果表明 dhcpd(DHCP 服务守护进程)正在运行并且侦听67端口。由于在 /etc/services 文件中67端口的映射,所以输出中的67端口实际上被转换成了 “bootps”。 + +在大多数的系统中这是非常常见的,现在服务器应该已经为网络连接做好准备,我们可以将一台主机接入网络请求DHCP地址来验证服务是否正常。 + +### 测试客户端连接 ### + +8、 现在许多系统使用网络管理器来维护网络连接状态,因此这个设备应该预先配置好的,只要对应的接口处于活跃状态就能够获取 DHCP。 + +然而当一台设备无法使用网络管理器时,它可能需要手动获取 DHCP 地址。下面的几步将演示怎样手动获取以及如何查看服务器是否已经按需要分发地址。 + +‘[ifconfig][2]‘工具能够用来检查接口的配置。这台被用来测试的 DHCP 服务器的设备,它只有一个网络适配器(网卡),这块网卡被命名为 ‘eth0‘。 + + # ifconfig eth0 + +![Check Network Interface IP Address](http://www.tecmint.com/wp-content/uploads/2015/04/No-ip.png) + +从输出结果上看,这台设备目前没有 IPv4 地址,这样很便于测试。我们把这台设备连接到 DHCP 服务器并发出一个请求。这台设备上已经安装了一个名为 ‘dhclient‘ 的DHCP客户端工具。因为操作系统各不相同,所以这个客户端软件也是互不一样的。 + + # dhclient eth0 + +![Request IP Address from DHCP](http://www.tecmint.com/wp-content/uploads/2015/04/IP.png) + +当前 `'inet addr:'` 字段中显示了属于 172.27.60.0 网络地址范围内的 IPv4 地址。值得欣慰的是当前网络还配置了正确的子网掩码并且分发了广播地址。 + +到这里看起来还都不错,让我们来测试一下,看看这台设备收到新 IP 地址是不是由服务器发出的。这里我们参照服务器的日志文件来完成这个任务。虽然这个日志的内容有几十万条,但是里面只有几条是用来确定服务器是否正常工作的。这里我们使用一个工具 ‘tail’,它只显示日志文件的最后几行,这样我们就可以不用拿一个文本编辑器去查看所有的日志文件了。命令如下: + + # tail /var/log/syslog + +![Check DHCP Logs](http://www.tecmint.com/wp-content/uploads/2015/04/DHCP-Log.png) + +OK!服务器记录表明它分发了一个地址给这台主机 (HRTDEBXENSRV)。服务器按预期运行,给它充当权威服务器的网络分发了适合的网络地址。至此 DHCP 服务器搭建成功并且运行。如果有需要你可以继续配置其他的网络,排查故障,确保安全。 + +在以后的Debian教程中我会讲一些新的 ISC-DHCP-Server 功能。有时间的话我将写一篇关于 Bind9 和 DDNS 的教程,融入到这篇文章里面。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-and-configure-multihomed-isc-dhcp-server-on-debian-linux/ + +作者:[Rob Turner][a] +译者:[ivo-wang](https://github.com/ivo-wang) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/robturner/ +[1]:http://www.tecmint.com/10-lsof-command-examples-in-linux/ +[2]:http://www.tecmint.com/ifconfig-command-examples/ diff --git a/published/201512/20150806 Installation Guide for Puppet on Ubuntu 15.04.md b/published/201512/20150806 Installation Guide for Puppet on Ubuntu 15.04.md new file mode 100644 index 0000000000..67ae06db9b --- /dev/null +++ b/published/201512/20150806 Installation Guide for Puppet on Ubuntu 15.04.md @@ -0,0 +1,435 @@ +如何在 Ubuntu 15.04 中安装 puppet +================================================================================ + +大家好,本教程将学习如何在 ubuntu 15.04 上面安装 puppet,它可以用来管理你的服务器基础环境。puppet 是由puppet 实验室(Puppet Labs)开发并维护的一款开源的配置管理软件,它能够帮我们自动化供给、配置和管理服务器的基础环境。不管我们管理的是几个服务器还是数以千计的计算机组成的业务报表体系,puppet 都能够使管理员从繁琐的手动配置调整中解放出来,腾出时间和精力去提系统的升整体效率。它能够确保所有自动化流程作业的一致性、可靠性以及稳定性。它让管理员和开发者更紧密的联系在一起,使开发者更容易产出付出设计良好、简洁清晰的代码。puppet 提供了配置管理和数据中心自动化的两个解决方案。这两个解决方案分别是 **puppet 开源版** 和 **puppet 企业版**。puppet 开源版以 Apache 2.0 许可证发布,它是一个非常灵活、可定制的解决方案,设置初衷是帮助管理员去完成那些重复性操作工作。pupprt 企业版是一个全平台复杂 IT 环境下的成熟解决方案,它除了拥有开源版本所有优势以外还有移动端 apps、只有商业版才有的加强支持,以及模块化和集成管理等。Puppet 使用 SSL 证书来认证主控服务器与代理节点之间的通信。 + +本教程将要介绍如何在运行 ubuntu 15.04 的主控服务器和代理节点上面安装开源版的 puppet。在这里,我们用一台服务器做主控服务器(master),管理和控制剩余的当作 puppet 代理节点(agent node)的服务器,这些代理节点将依据主控服务器来进行配置。在 ubuntu 15.04 只需要简单的几步就能安装配置好 puppet,用它来管理我们的服务器基础环境非常的方便。(LCTT 译注:puppet 采用 C/S 架构,所以必须有至少有一台作为服务器,其他作为客户端处理) + +### 1.设置主机文件 ### + +在本教程里,我们将使用2台运行 ubuntu 15.04 “Vivid Vervet" 的主机,一台作为主控服务器,另一台作为 puppet 的代理节点。下面是我们将用到的服务器的基础信息。 + +- puupet 主控服务器 IP:44.55.88.6 ,主机名: puppetmaster +- puppet 代理节点 IP: 45.55.86.39 ,主机名: puppetnode + +我们要在代理节点和服务器这两台机器的 hosts 文件里面都添加上相应的条目,使用 root 或是 sudo 访问权限来编辑 /etc/hosts 文件,命令如下: + + # nano /etc/hosts + + 45.55.88.6 puppetmaster.example.com puppetmaster + 45.55.86.39 puppetnode.example.com puppetnode + +注意,puppet 主控服务器必使用 8140 端口来运行,所以请务必保证开启8140端口。 + +### 2. 用 NTP 更新时间 ### + +puppet 代理节点所使用系统时间必须要准确,这样可以避免代理证书出现问题。如果有时间差异,那么证书将过期失效,所以服务器与代理节点的系统时间必须互相同步。我们使用 NTP(Network Time Protocol,网络时间协议)来同步时间。**在服务器与代理节点上面分别**运行以下命令来同步时间。 + + # ntpdate pool.ntp.org + + 17 Jun 00:17:08 ntpdate[882]: adjust time server 66.175.209.17 offset -0.001938 sec + +(LCTT 译注:显示类似的输出结果表示运行正常) + +如果没有安装 ntp,请使用下面的命令更新你的软件仓库,安装并运行ntp服务 + + # apt-get update && sudo apt-get -y install ntp ; service ntp restart + +### 3. 安装主控服务器软件 ### + +安装开源版本的 puppet 有很多的方法。在本教程中我们在 puppet 实验室官网下载一个名为 puppetlabs-release 的软件包的软件源,安装后它将为我们在软件源里面添加 puppetmaster-passenger。puppetmaster-passenger 包括带有 apache 的 puppet 主控服务器。我们开始下载这个软件包: + + # cd /tmp/ + # wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb + + --2015-06-17 00:19:26-- https://apt.puppetlabs.com/puppetlabs-release-trusty.deb + Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 192.155.89.90, 2600:3c03::f03c:91ff:fedb:6b1d + Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|192.155.89.90|:443... connected. + HTTP request sent, awaiting response... 200 OK + Length: 7384 (7.2K) [application/x-debian-package] + Saving to: ‘puppetlabs-release-trusty.deb’ + + puppetlabs-release-tr 100%[===========================>] 7.21K --.-KB/s in 0.06s + + 2015-06-17 00:19:26 (130 KB/s) - ‘puppetlabs-release-trusty.deb’ saved [7384/7384] + +下载完成,我们来安装它: + + # dpkg -i puppetlabs-release-trusty.deb + + Selecting previously unselected package puppetlabs-release. + (Reading database ... 85899 files and directories currently installed.) + Preparing to unpack puppetlabs-release-trusty.deb ... + Unpacking puppetlabs-release (1.0-11) ... + Setting up puppetlabs-release (1.0-11) ... + +使用 apt 包管理命令更新一下本地的软件源: + + # apt-get update + +现在我们就可以安装 puppetmaster-passenger 了 + + # apt-get install puppetmaster-passenger + +**提示**: 在安装的时候可能会报错: + + Warning: Setting templatedir is deprecated.see http://links.puppetlabs.com/env-settings-deprecations (at /usr/lib/ruby/vendor_ruby/puppet/settings.rb:1139:in `issue_deprecation_warning') + +不过不用担心,忽略掉它就好,我们只需要在设置配置文件的时候把这一项禁用就行了。 + +如何来查看puppet 主控服务器是否已经安装成功了呢?非常简单,只需要使用下面的命令查看它的版本就可以了。 + + # puppet --version + + 3.8.1 + +现在我们已经安装好了 puppet 主控服务器。因为我们使用的是配合 apache 的 passenger,由 apache 来控制 puppet 主控服务器,当 apache 运行时 puppet 主控才运行。 + +在开始之前,我们需要通过停止 apache 服务来让 puppet 主控服务器停止运行。 + + # systemctl stop apache2 + +### 4. 使用 Apt 工具锁定主控服务器的版本 ### + +现在已经安装了 3.8.1 版的 puppet,我们锁定这个版本不让它随意升级,因为升级会造成配置文件混乱。 使用 apt 工具来锁定它,这里我们需要使用文本编辑器来创建一个新的文件 **/etc/apt/preferences.d/00-puppet.pref** + + # nano /etc/apt/preferences.d/00-puppet.pref + +在新创建的文件里面添加以下内容: + + # /etc/apt/preferences.d/00-puppet.pref + Package: puppet puppet-common puppetmaster-passenger + Pin: version 3.8* + Pin-Priority: 501 + +这样在以后的系统软件升级中, puppet 主控服务器将不会跟随系统软件一起升级。 + +### 5. 配置 Puppet 主控服务器### + +Puppet 主控服务器作为一个证书发行机构,需要生成它自己的证书,用于签署所有代理的证书的请求。首先我们要删除所有在该软件包安装过程中创建出来的 ssl 证书。本地默认的 puppet 证书放在 /var/lib/puppet/ssl。因此我们只需要使用 rm 命令来整个移除这些证书就可以了。 + + # rm -rf /var/lib/puppet/ssl + +现在来配置该证书,在创建 puppet 主控服务器证书时,我们需要包括代理节点与主控服务器沟通所用的每个 DNS 名称。使用文本编辑器来修改服务器的配置文件 puppet.conf + + # nano /etc/puppet/puppet.conf + +输出的结果像下面这样 + + [main] + logdir=/var/log/puppet + vardir=/var/lib/puppet + ssldir=/var/lib/puppet/ssl + rundir=/var/run/puppet + factpath=$vardir/lib/facter + templatedir=$confdir/templates + + [master] + # These are needed when the puppetmaster is run by passenger + # and can safely be removed if webrick is used. + ssl_client_header = SSL_CLIENT_S_DN + ssl_client_verify_header = SSL_CLIENT_VERIFY + +在这我们需要注释掉 templatedir 这行使它失效。然后在文件的 `[main]` 小节的结尾添加下面的信息。 + + server = puppetmaster + environment = production + runinterval = 1h + strict_variables = true + certname = puppetmaster + dns_alt_names = puppetmaster, puppetmaster.example.com + +还有很多你可能用的到的配置选项。 如果你有需要,在 Puppet 实验室有一份详细的描述文件供你阅读: [Main Config File (puppet.conf)][1]。 + +编辑完成后保存退出。 + +使用下面的命令来生成一个新的证书。 + + # puppet master --verbose --no-daemonize + + Info: Creating a new SSL key for ca + Info: Creating a new SSL certificate request for ca + Info: Certificate Request fingerprint (SHA256): F6:2F:69:89:BA:A5:5E:FF:7F:94:15:6B:A7:C4:20:CE:23:C7:E3:C9:63:53:E0:F2:76:D7:2E:E0:BF:BD:A6:78 + ... + Notice: puppetmaster has a waiting certificate request + Notice: Signed certificate request for puppetmaster + Notice: Removing file Puppet::SSL::CertificateRequest puppetmaster at '/var/lib/puppet/ssl/ca/requests/puppetmaster.pem' + Notice: Removing file Puppet::SSL::CertificateRequest puppetmaster at '/var/lib/puppet/ssl/certificate_requests/puppetmaster.pem' + Notice: Starting Puppet master version 3.8.1 + ^CNotice: Caught INT; storing stop + Notice: Processing stop + +至此,证书已经生成。一旦我们看到 **Notice: Starting Puppet master version 3.8.1**,就表明证书就已经制作好了。我们按下 CTRL-C 回到 shell 命令行。 + +查看新生成证书的信息,可以使用下面的命令。 + + # puppet cert list -all + + + "puppetmaster" (SHA256) 33:28:97:86:A1:C3:2F:73:10:D1:FB:42:DA:D5:42:69:71:84:F0:E2:8A:01:B9:58:38:90:E4:7D:B7:25:23:EC (alt names: "DNS:puppetmaster", "DNS:puppetmaster.example.com") + +### 6. 创建一个 Puppet 清单 ### + +默认的主要清单(Manifest)是 /etc/puppet/manifests/site.pp。 这个主要清单文件包括了用于在代理节点执行的配置定义。现在我们来创建一个清单文件: + + # nano /etc/puppet/manifests/site.pp + +在刚打开的文件里面添加下面这几行: + + # execute 'apt-get update' + exec { 'apt-update': # exec resource named 'apt-update' + command => '/usr/bin/apt-get update' # command this resource will run + } + + # install apache2 package + package { 'apache2': + require => Exec['apt-update'], # require 'apt-update' before installing + ensure => installed, + } + + # ensure apache2 service is running + service { 'apache2': + ensure => running, + } + +以上这几行的意思是给代理节点部署 apache web 服务。 + +### 7. 运行 puppet 主控服务 ### + +已经准备好运行 puppet 主控服务器 了,那么开启 apache 服务来让它启动 + + # systemctl start apache2 + +我们 puppet 主控服务器已经运行,不过它还不能管理任何代理节点。现在我们给 puppet 主控服务器添加代理节点. + +**提示**: 如果报错 + + Job for apache2.service failed. see "systemctl status apache2.service" and "journalctl -xe" for details. + +肯定是 apache 服务器有一些问题,我们可以使用 root 或是 sudo 访问权限来运行**apachectl start**查看它输出的日志。在本教程执行过程中, 我们发现一个 **/etc/apache2/sites-enabled/puppetmaster.conf** 的证书配置问题。修改其中的**SSLCertificateFile /var/lib/puppet/ssl/certs/server.pem **为 **SSLCertificateFile /var/lib/puppet/ssl/certs/puppetmaster.pem**,然后注释掉后面这行**SSLCertificateKeyFile** 。然后在命令行重新启动 apache。 + +### 8. 安装 Puppet 代理节点的软件包 ### + +我们已经准备好了 puppet 的服务器,现在需要一个可以管理的代理节点,我们将安装 puppet 代理软件到节点上去。这里我们要给每一个需要管理的节点安装代理软件,并且确保这些节点能够通过 DNS 查询到服务器主机。下面将 安装最新的代理软件到 节点 puppetnode.example.com 上。 + +在代理节点上使用下面的命令下载 puppet 实验室提供的软件包: + + # cd /tmp/ + # wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb\ + + --2015-06-17 00:54:42-- https://apt.puppetlabs.com/puppetlabs-release-trusty.deb + Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 192.155.89.90, 2600:3c03::f03c:91ff:fedb:6b1d + Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|192.155.89.90|:443... connected. + HTTP request sent, awaiting response... 200 OK + Length: 7384 (7.2K) [application/x-debian-package] + Saving to: ‘puppetlabs-release-trusty.deb’ + + puppetlabs-release-tr 100%[===========================>] 7.21K --.-KB/s in 0.04s + + 2015-06-17 00:54:42 (162 KB/s) - ‘puppetlabs-release-trusty.deb’ saved [7384/7384] + +在 ubuntu 15.04 上我们使用debian包管理系统来安装它,命令如下: + + # dpkg -i puppetlabs-release-trusty.deb + +使用 apt 包管理命令更新一下本地的软件源: + + # apt-get update + +通过远程仓库安装: + + # apt-get install puppet + +Puppet 代理默认是不启动的。这里我们需要使用文本编辑器修改 /etc/default/puppet 文件,使它正常工作: + + # nano /etc/default/puppet + +更改 **START** 的值改成 "yes" 。 + + START=yes + +最后保存并退出。 + +### 9. 使用 Apt 工具锁定代理软件的版本 ### + +和上面的步骤一样为防止随意升级造成的配置文件混乱,我们要使用 apt 工具来把它锁定。具体做法是使用文本编辑器创建一个文件 **/etc/apt/preferences.d/00-puppet.pref** + + # nano /etc/apt/preferences.d/00-puppet.pref + +在新建的文件里面加入如下内容 + + # /etc/apt/preferences.d/00-puppet.pref + Package: puppet puppet-common + Pin: version 3.8* + Pin-Priority: 501 + +这样 puppet 就不会随着系统软件升级而随意升级了。 + +### 10. 配置 puppet 代理节点 ### + +我们需要编辑一下代理节点的 puppet.conf 文件,来使它运行。 + + # nano /etc/puppet/puppet.conf + +它看起来和服务器的配置文件完全一样。同样注释掉**templatedir**这行。不同的是在这里我们需要删除掉所有关于`[master]` 的部分。 + +假定主控服务器可以通过名字“puppet-master”访问,我们的客户端应该可以和它相互连接通信。如果不行的话,我们需要使用完整的主机域名 puppetmaster.example.com + + [agent] + server = puppetmaster.example.com + certname = puppetnode.example.com + +在文件的结尾增加上面3行,增加之后文件内容像下面这样: + + [main] + logdir=/var/log/puppet + vardir=/var/lib/puppet + ssldir=/var/lib/puppet/ssl + rundir=/var/run/puppet + factpath=$vardir/lib/facter + #templatedir=$confdir/templates + + [agent] + server = puppetmaster.example.com + certname = puppetnode.example.com + +最后保存并退出。 + +使用下面的命令来启动客户端软件: + + # systemctl start puppet + +如果一切顺利的话,我们不会看到命令行有任何输出。 第一次运行的时候,代理节点会生成一个 ssl 证书并且给服务器发送一个请求,经过签名确认后,两台机器就可以互相通信了。 + +**提示**: 如果这是你添加的第一个代理节点,建议你在添加其他节点前先给这个证书签名。一旦能够通过并正常运行,回过头来再添加其他代理节点。 + +### 11. 在主控服务器上对证书请求进行签名 ### + +第一次运行的时候,代理节点会生成一个 ssl 证书并且给服务器发送一个签名请求。在主控服务器给代理节点服务器证书签名之后,主服务器才能和代理服务器通信并且控制代理服务器。 + +在主控服务器上使用下面的命令来列出当前的证书请求: + + # puppet cert list + "puppetnode.example.com" (SHA256) 31:A1:7E:23:6B:CD:7B:7D:83:98:33:8B:21:01:A6:C4:01:D5:53:3D:A0:0E:77:9A:77:AE:8F:05:4A:9A:50:B2 + +因为只设置了一台代理节点服务器,所以我们将只看到一个请求。看起来类似如上,代理节点的完整域名即其主机名。 + +注意有没有“+”号在前面,代表这个证书有没有被签名。 + +使用带有主机名的**puppet cert sign**这个命令来签署这个签名请求,如下: + + # puppet cert sign puppetnode.example.com + Notice: Signed certificate request for puppetnode.example.com + Notice: Removing file Puppet::SSL::CertificateRequest puppetnode.example.com at '/var/lib/puppet/ssl/ca/requests/puppetnode.example.com.pem' + +主控服务器现在可以通讯和控制它签名过的代理节点了。 + +如果想签署所有的当前请求,可以使用 -all 选项,如下所示: + + # puppet cert sign --all + +### 12. 删除一个 Puppet 证书 ### + +如果我们想移除一个主机,或者想重建一个主机然后再添加它。下面的例子里我们将展示如何删除 puppet 主控服务器上面的一个证书。使用的命令如下: + + # puppet cert clean hostname + Notice: Revoked certificate with serial 5 + Notice: Removing file Puppet::SSL::Certificate puppetnode.example.com at '/var/lib/puppet/ssl/ca/signed/puppetnode.example.com.pem' + Notice: Removing file Puppet::SSL::Certificate puppetnode.example.com at '/var/lib/puppet/ssl/certs/puppetnode.example.com.pem' + +如果我们想查看所有的签署和未签署的请求,使用下面这条命令: + + # puppet cert list --all + + "puppetmaster" (SHA256) 33:28:97:86:A1:C3:2F:73:10:D1:FB:42:DA:D5:42:69:71:84:F0:E2:8A:01:B9:58:38:90:E4:7D:B7:25:23:EC (alt names: "DNS:puppetmaster", "DNS:puppetmaster.example.com") + + +### 13. 部署 Puppet 清单 ### + +当配置并完成 puppet 清单后,现在我们需要部署清单到代理节点服务器上。要应用并加载主 puppet 清单,我们可以在代理节点服务器上面使用下面的命令: + + # puppet agent --test + + Info: Retrieving pluginfacts + Info: Retrieving plugin + Info: Caching catalog for puppetnode.example.com + Info: Applying configuration version '1434563858' + Notice: /Stage[main]/Main/Exec[apt-update]/returns: executed successfully + Notice: Finished catalog run in 10.53 seconds + +这里向我们展示了主清单如何立即影响到了一个单一的服务器。 + +如果我们打算运行的 puppet 清单与主清单没有什么关联,我们可以简单使用 puppet apply 带上相应的清单文件的路径即可。它仅将清单应用到我们运行该清单的代理节点上。 + + # puppet apply /etc/puppet/manifest/test.pp + +### 14. 为特定节点配置清单 ### + +如果我们想部署一个清单到某个特定的节点,我们需要如下配置清单。 + +在主控服务器上面使用文本编辑器编辑 /etc/puppet/manifest/site.pp: + + # nano /etc/puppet/manifest/site.pp + +添加下面的内容进去 + + node 'puppetnode', 'puppetnode1' { + # execute 'apt-get update' + exec { 'apt-update': # exec resource named 'apt-update' + command => '/usr/bin/apt-get update' # command this resource will run + } + + # install apache2 package + package { 'apache2': + require => Exec['apt-update'], # require 'apt-update' before installing + ensure => installed, + } + + # ensure apache2 service is running + service { 'apache2': + ensure => running, + } + } + +这里的配置显示我们将在名为 puppetnode 和 puppetnode1 的2个指定的节点上面安装 apache 服务。这里可以添加其他我们需要安装部署的具体节点进去。 + +### 15. 配置清单模块 ### + +模块对于组合任务是非常有用的,在 Puppet 社区有很多人贡献了自己的模块组件。 + +在主控服务器上, 我们将使用 puppet module 命令来安装 **puppetlabs-apache** 模块。 + + # puppet module install puppetlabs-apache + +**警告**: 千万不要在一个已经部署 apache 环境的机器上面使用这个模块,否则它将清空你没有被 puppet 管理的 apache 配置。 + +现在用文本编辑器来修改 **site.pp** : + + # nano /etc/puppet/manifest/site.pp + +添加下面的内容进去,在 puppetnode 上面安装 apache 服务。 + + node 'puppet-node' { + class { 'apache': } # use apache module + apache::vhost { 'example.com': # define vhost resource + port => '80', + docroot => '/var/www/html' + } + } + +保存退出。然后重新运行该清单来为我们的代理节点部署 apache 配置。 + +### 总结 ### + +现在我们已经成功的在 ubuntu 15.04 上面部署并运行 puppet 来管理代理节点服务器的基础运行环境。我们学习了puppet 是如何工作的,编写清单文件,节点与主机间使用 ssl 证书认证的认证过程。使用 puppet 开源软件配置管理工具在众多的代理节点上来控制、管理和配置重复性任务是非常容易的。如果你有任何的问题,建议,反馈,与我们取得联系,我们将第一时间完善更新,谢谢。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-puppet-ubuntu-15-04/ + +作者:[Arun Pyasi][a] +译者:[ivo-wang](https://github.com/ivo-wang) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://docs.puppetlabs.com/puppet/latest/reference/config_file_main.html diff --git a/published/201512/20150824 How to Setup Zephyr Test Management Tool on CentOS 7.x.md b/published/201512/20150824 How to Setup Zephyr Test Management Tool on CentOS 7.x.md new file mode 100644 index 0000000000..4380346dc9 --- /dev/null +++ b/published/201512/20150824 How to Setup Zephyr Test Management Tool on CentOS 7.x.md @@ -0,0 +1,225 @@ +如何在 CentOS 7.x 上安装 Zephyr 测试管理工具 +================================================================================ + +测试管理(Test Management)指测试人员所需要的任何的所有东西。测试管理工具用来记录测试执行的结果、计划测试活动以及汇报质量控制活动的情况。在这篇文章中我们会向你介绍如何配置 Zephyr 测试管理工具,它包括了管理测试活动需要的所有东西,不需要单独安装测试活动所需要的应用程序从而降低测试人员不必要的麻烦。一旦你安装完它,你就看可以用它跟踪 bug 和缺陷,和你的团队成员协作项目任务,因为你可以轻松地共享和访问测试过程中多个项目团队的数据。 + +### Zephyr 要求 ### + +安装和运行 Zephyr 要求满足以下最低条件。可以根据你的基础设施提高资源。我们会在 64 位 CentOS-7 系统上安装 Zephyr,几乎在所有的 Linux 操作系统中都有可用的 Zephyr 二进制发行版。 + +注:表格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Zephyr test management tool
Linux OSCentOS Linux 7 (Core), 64-bit
PackagesJDK 7 或更高 ,  Oracle JDK 6 update没有事先安装的 Tomcat 和 MySQL
RAM4 GB推荐 8 GB
CPU2.0 GHZ 或更高
Hard Disk30 GB , 至少 5GB
+ +安装 Zephyr 要求你有超级用户(root)权限,并确保你已经正确配置了网络的静态 IP ,默认端口必须可用并允许通过防火墙。其中 tomcat 会使用 80/443、 8005、 8009、 8010 端口, Zephyr 内部使用 RTMP 协议的 flex 会使用 443 和 2099 号端口。 + +### 安装 Java JDK 7 ### + +安装 Zephyr 首先需要安装 Java JDK 7,如果你的系统上还没有安装,可以按照下面的方法安装 Java 并设置 JAVA_HOME 环境变量。 + +输入以下的命令安装 Java JDK 7。 + + [root@centos-007 ~]# yum install java-1.7.0-openjdk-1.7.0.79-2.5.5.2.el7_1 + + [root@centos-007 ~]# yum install java-1.7.0-openjdk-devel-1.7.0.85-2.6.1.2.el7_1.x86_64 + +安装完 java 和它的所有依赖后,运行下面的命令设置 JAVA_HOME 环境变量。 + + [root@centos-007 ~]# export JAVA_HOME=/usr/java/default + [root@centos-007 ~]# export PATH=/usr/java/default/bin:$PATH + +用下面的命令检查 java 版本以验证安装。 + + [root@centos-007 ~]# java –version + + java version "1.7.0_79" + OpenJDK Runtime Environment (rhel-2.5.5.2.el7_1-x86_64 u79-b14) + OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode) + +输出显示我们已经正确安装了 1.7.0_79 版本的 OpenJDK Java。 + +### 安装 MySQL 5.6.x ### + +如果的机器上有其它的 MySQL,建议你先卸载它们并安装这个版本,或者升级它们的模式(schemas)到指定的版本。因为 Zephyr 前提要求这个指定的 5.6.x 版本的 MySQL ,要有 root 用户名。 + +可以按照下面的步骤在 CentOS-7.1 上安装 MySQL 5.6 : + +下载 rpm 软件包,它会为安装 MySQL 服务器创建一个 yum 库文件。 + + [root@centos-007 ~]# yum install wget + [root@centos-007 ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm + +然后用 rpm 命令安装下载下来的 rpm 软件包。 + + [root@centos-007 ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm + +安装完这个软件包后你会有两个和 MySQL 相关的新的 yum 库。然后使用 yum 命令安装 MySQL Server 5.6,它会自动安装所有需要的依赖。 + + [root@centos-007 ~]# yum install mysql-server + +安装过程完成之后,运行下面的命令启动 mysqld 服务并检查它的状态是否激活。 + + [root@centos-007 ~]# service mysqld start + [root@centos-007 ~]# service mysqld status + +对于全新安装的 MySQL 服务器,MySQL root 用户的密码为空。为了安全起见,我们应该重置 MySQL root 用户的密码。用自动生成的空密码连接到 MySQL 并更改 root 用户密码。 + + [root@centos-007 ~]# mysql + mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your_password'); + mysql> flush privileges; + mysql> quit; + +现在我们需要在 MySQL 默认的配置文件中配置所需的数据库参数。打开 "/etc/" 目录中的文件并按照下面那样更新。 + + [root@centos-007 ~]# vi /etc/my.cnf + +---------- + + [mysqld] + datadir=/var/lib/mysql + socket=/var/lib/mysql/mysql.sock + symbolic-links=0 + + sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES + max_allowed_packet=150M + max_connections=600 + default-storage-engine=INNODB + character-set-server=utf8 + collation-server=utf8_unicode_ci + + [mysqld_safe] + log-error=/var/log/mysqld.log + pid-file=/var/run/mysqld/mysqld.pid + default-storage-engine=INNODB + character-set-server=utf8 + collation-server=utf8_unicode_ci + + [mysql] + max_allowed_packet = 150M + [mysqldump] + quick + +保存配置文件中的更新并重启 mysql 服务。 + + [root@centos-007 ~]# service mysqld restart + +### 下载 Zephyr 安装包 ### + +我们已经安装完了安装 Zephyr 所需要的软件包。现在我们需要获取 Zephyr 二进制发布包和它的许可证密钥。到 Zephyr 官方下载链接 [http://download.yourzephyr.com/linux/download.php](http://download.yourzephyr.com/linux/download.php) 输入你的电子邮件 ID 并点击下载。 + +![下载 Zephyr](http://blog.linoxide.com/wp-content/uploads/2015/08/13.png) + +然后确认你的电子邮件地址,你会获得 Zephyr 下载链接和它的许可证密钥链接。点击提供的链接从服务器中选择和你操作系统合适的版本下载二进制安装包以及许可证文件。 + +我们把它下载到 home 目录并更改它的权限为可执行。 + +![Zephyr 二进制包](http://blog.linoxide.com/wp-content/uploads/2015/08/22.png) + +### 开始安装和配置 Zephyr ### + +现在我们通过执行它的二进制安装脚本开始安装 Zephyr。 + + [root@centos-007 ~]# ./zephyr_4_7_9213_linux_setup.sh –c + +一旦你运行了上面的命令,它会检查是否正确配置了 Java 环境变量。如果配置不正确,你可能会看到类似下面的错误。 + + testing JVM in /usr ... + Starting Installer ... + Error : Either JDK is not found at expected locations or JDK version is mismatched. + Zephyr requires Oracle Java Development Kit (JDK) version 1.7 or higher. + +如果你正确配置了 Java,它会开始安装 Zephyr 并要求你输入 “o” 继续或者输入 “c” 取消安装。让我们敲击 “o” 并输入回车键开始安装。 + +![安装 zephyr](http://blog.linoxide.com/wp-content/uploads/2015/08/32.png) + +下一个选项是检查安装 Zephyr 所有的要求,输入回车进入下一个选项。 + +![zephyr 要求](http://blog.linoxide.com/wp-content/uploads/2015/08/42.png) + +输入 “1” 并回车同意许可证协议。 + + I accept the terms of this license agreement [1], I do not accept the terms of this license agreement [2, Enter] + +我们需要选择安装 Zephyr 合适的目标位置以及默认端口,如果你想用默认端口之外的其它端口,也可以在这里配置。 + +![installation folder](http://blog.linoxide.com/wp-content/uploads/2015/08/52.png) + +然后自定义 mysql 数据库参数并给出配置文件的正确路径。在这一步你可能看到类似下面的错误。 + + Please update MySQL configuration. Configuration parameter max_connection should be at least 500 (max_connection = 500) and max_allowed_packet should be at least 50MB (max_allowed_packet = 50M). + +要消除这个错误,你要确保在 mysql 配置文件中正确配置了 "max\_connection" 和 "max\_allowed\_packet" 参数。运行所示的命令连接到数据库确认这些设置。 + +![连接 mysql](http://blog.linoxide.com/wp-content/uploads/2015/08/62.png) + +当你正确配置了 mysql 数据库,它会提取配置文件并完成安装。 + +![配置 mysql](http://blog.linoxide.com/wp-content/uploads/2015/08/72.png) + +安装过程在你的计算机上成功的安装了 Zephyr 4.7。要启动 Zephyr 桌面,输入 “y” 完成 Zephyr 安装。 + +![启动 zephyr](http://blog.linoxide.com/wp-content/uploads/2015/08/82.png) + +### 启动 Zephyr 桌面 ### + +打开你的 web 浏览器并用你的本机 IP 地址启动 Zephyr 桌面,你会被导向 Zephyr 桌面。 + + http://your_server_IP/zephyr/desktop/ + +![Zephyr 桌面](http://blog.linoxide.com/wp-content/uploads/2015/08/91.png) + +从 Zephyr 仪表盘点击 "Test Manager" 并用默认的用户名和密码 "test.manager" 登录。 + +![Test Manage 登录](http://blog.linoxide.com/wp-content/uploads/2015/08/test_manager_login.png) + +你登录进去后你就可以配置你的管理设置了。根据你的环境选择你想要的设置。 + +![Test Manage 管理](http://blog.linoxide.com/wp-content/uploads/2015/08/test_manage_admin.png) + +完成管理设置后保存设置,资源管理和项目配置也类似,然后开始使用 Zephyr 作为你的测试管理工具吧。如图所示在 Department Dashboard Management 中检查和编辑管理设置状态。 + +![zephyr 仪表盘](http://blog.linoxide.com/wp-content/uploads/2015/08/dashboard.png) + +### 总结 ### + +好了! 我们已经在 CentOS 7.1 上安装完了 Zephyr。我们希望你能更加深入了解 Zephyr 测试管理工具,它提供简化测试流程、允许快速访问数据分析、协作工具以及多个项目成员之间交流。如果在你的环境中遇到任何问题,欢迎和我们联系。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/setup-zephyr-tool-centos-7-x/ + +作者:[Kashif Siddique][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/kashifs/ \ No newline at end of file diff --git a/published/201512/20150831 Linux workstation security checklist.md b/published/201512/20150831 Linux workstation security checklist.md new file mode 100644 index 0000000000..15daaa5382 --- /dev/null +++ b/published/201512/20150831 Linux workstation security checklist.md @@ -0,0 +1,509 @@ +来自 Linux 基金会内部的《Linux 工作站安全检查清单》 +================================================================================ + +### 目标受众 + + 这是一套 Linux 基金会为其系统管理员提供的推荐规范。 + +这个文档用于帮助那些使用 Linux 工作站来访问和管理项目的 IT 设施的系统管理员团队。 + +如果你的系统管理员是远程员工,你也许可以使用这套指导方针确保系统管理员的系统可以通过核心安全需求,降低你的IT 平台成为攻击目标的风险。 + +即使你的系统管理员不是远程员工,很多人也会在工作环境中通过便携笔记本完成工作,或者在家中设置系统以便在业余时间或紧急时刻访问工作平台。不论发生何种情况,你都能调整这个推荐规范来适应你的环境。 + + +### 限制 + +但是,这并不是一个详细的“工作站加固”文档,可以说这是一个努力避免大多数明显安全错误而不会导致太多不便的一组推荐基线(baseline)。你也许阅读这个文档后会认为它的方法太偏执,而另一些人也许会认为这仅仅是一些肤浅的研究。安全就像在高速公路上开车 -- 任何比你开的慢的都是一个傻瓜,然而任何比你开的快的人都是疯子。这个指南仅仅是一些列核心安全规则,既不详细又不能替代经验、警惕和常识。 + +我们分享这篇文档是为了[将开源协作的优势带到 IT 策略文献资料中][18]。如果你发现它有用,我们希望你可以将它用到你自己团体中,并分享你的改进,对它的完善做出你的贡献。 + +### 结构 + +每一节都分为两个部分: + +- 核对适合你项目的需求 +- 形式不定的提示内容,解释了为什么这么做 + +#### 严重级别 + +在清单的每一个项目都包括严重级别,我们希望这些能帮助指导你的决定: + +- **关键(ESSENTIAL)** 该项应该在考虑列表上被明确的重视。如果不采取措施,将会导致你的平台安全出现高风险。 +- **中等(NICE)** 该项将改善你的安全形势,但是会影响到你的工作环境的流程,可能会要求养成新的习惯,改掉旧的习惯。 +- **低等(PARANOID)** 留作感觉会明显完善我们平台安全、但是可能会需要大量调整与操作系统交互的方式的项目。 + +记住,这些只是参考。如果你觉得这些严重级别不能反映你的工程对安全的承诺,你应该调整它们为你所合适的。 + +## 选择正确的硬件 + +我们并不会要求管理员使用一个特殊供应商或者一个特殊的型号,所以这一节提供的是选择工作系统时的核心注意事项。 + +### 检查清单 + +- [ ] 系统支持安全启动(SecureBoot) _(关键)_ +- [ ] 系统没有火线(Firewire),雷电(thunderbolt)或者扩展卡(ExpressCard)接口 _(中等)_ +- [ ] 系统有 TPM 芯片 _(中等)_ + +### 注意事项 + +#### 安全启动(SecureBoot) + +尽管它还有争议,但是安全引导能够预防很多针对工作站的攻击(Rootkits、“Evil Maid”,等等),而没有太多额外的麻烦。它并不能阻止真正专门的攻击者,加上在很大程度上,国家安全机构有办法应对它(可能是通过设计),但是有安全引导总比什么都没有强。 + +作为选择,你也许可以部署 [Anti Evil Maid][1] 提供更多健全的保护,以对抗安全引导所需要阻止的攻击类型,但是它需要更多部署和维护的工作。 + +#### 系统没有火线(Firewire),雷电(thunderbolt)或者扩展卡(ExpressCard)接口 + +火线是一个标准,其设计上允许任何连接的设备能够完全地直接访问你的系统内存(参见[维基百科][2])。雷电接口和扩展卡同样有问题,虽然一些后来部署的雷电接口试图限制内存访问的范围。如果你没有这些系统端口,那是最好的,但是它并不严重,它们通常可以通过 UEFI 关闭或内核本身禁用。 + +#### TPM 芯片 + +可信平台模块(Trusted Platform Module ,TPM)是主板上的一个与核心处理器单独分开的加密芯片,它可以用来增加平台的安全性(比如存储全盘加密的密钥),不过通常不会用于日常的平台操作。充其量,这个是一个有则更好的东西,除非你有特殊需求,需要使用 TPM 增加你的工作站安全性。 + +## 预引导环境 + +这是你开始安装操作系统前的一系列推荐规范。 + +### 检查清单 + +- [ ] 使用 UEFI 引导模式(不是传统 BIOS)_(关键)_ +- [ ] 进入 UEFI 配置需要使用密码 _(关键)_ +- [ ] 使用安全引导 _(关键)_ +- [ ] 启动系统需要 UEFI 级别密码 _(中等)_ + +### 注意事项 + +#### UEFI 和安全引导 + +UEFI 尽管有缺点,还是提供了很多传统 BIOS 没有的好功能,比如安全引导。大多数现代的系统都默认使用 UEFI 模式。 + +确保进入 UEFI 配置模式要使用高强度密码。注意,很多厂商默默地限制了你使用密码长度,所以相比长口令你也许应该选择高熵值的短密码(关于密码短语请参考下面内容)。 + +基于你选择的 Linux 发行版,你也许需要、也许不需要按照 UEFI 的要求,来导入你的发行版的安全引导密钥,从而允许你启动该发行版。很多发行版已经与微软合作,用大多数厂商所支持的密钥给它们已发布的内核签名,因此避免了你必须处理密钥导入的麻烦。 + +作为一个额外的措施,在允许某人访问引导分区然后尝试做一些不好的事之前,让他们输入密码。为了防止肩窥(shoulder-surfing),这个密码应该跟你的 UEFI 管理密码不同。如果你经常关闭和启动,你也许不想这么麻烦,因为你已经必须输入 LUKS 密码了(LUKS 参见下面内容),这样会让你您减少一些额外的键盘输入。 + +## 发行版选择注意事项 + +很有可能你会坚持一个广泛使用的发行版如 Fedora,Ubuntu,Arch,Debian,或它们的一个类似发行版。无论如何,以下是你选择使用发行版应该考虑的。 + +### 检查清单 + +- [ ] 拥有一个强健的 MAC/RBAC 系统(SELinux/AppArmor/Grsecurity) _(关键)_ +- [ ] 发布安全公告 _(关键)_ +- [ ] 提供及时的安全补丁 _(关键)_ +- [ ] 提供软件包的加密验证 _(关键)_ +- [ ] 完全支持 UEFI 和安全引导 _(关键)_ +- [ ] 拥有健壮的原生全磁盘加密支持 _(关键)_ + +### 注意事项 + +#### SELinux,AppArmor,和 GrSecurity/PaX + +强制访问控制(Mandatory Access Controls,MAC)或者基于角色的访问控制(Role-Based Access Controls,RBAC)是一个用在老式 POSIX 系统的基于用户或组的安全机制扩展。现在大多数发行版已经捆绑了 MAC/RBAC 系统(Fedora,Ubuntu),或通过提供一种机制一个可选的安装后步骤来添加它(Gentoo,Arch,Debian)。显然,强烈建议您选择一个预装 MAC/RBAC 系统的发行版,但是如果你对某个没有默认启用它的发行版情有独钟,装完系统后应计划配置安装它。 + +应该坚决避免使用不带任何 MAC/RBAC 机制的发行版,像传统的 POSIX 基于用户和组的安全在当今时代应该算是考虑不足。如果你想建立一个 MAC/RBAC 工作站,通常认为 AppArmor 和 PaX 比 SELinux 更容易掌握。此外,在工作站上,很少有或者根本没有对外监听的守护进程,而针对用户运行的应用造成的最高风险,GrSecurity/PaX _可能_ 会比SELinux 提供更多的安全便利。 + +#### 发行版安全公告 + +大多数广泛使用的发行版都有一个给它们的用户发送安全公告的机制,但是如果你对一些机密感兴趣,去看看开发人员是否有见于文档的提醒用户安全漏洞和补丁的机制。缺乏这样的机制是一个重要的警告信号,说明这个发行版不够成熟,不能被用作主要管理员的工作站。 + +#### 及时和可靠的安全更新 + +多数常用的发行版提供定期安全更新,但应该经常检查以确保及时提供关键包更新。因此应避免使用附属发行版(spin-offs)和“社区重构”,因为它们必须等待上游发行版先发布,它们经常延迟发布安全更新。 + +现在,很难找到一个不使用加密签名、更新元数据或二者都不使用的发行版。如此说来,常用的发行版在引入这个基本安全机制就已经知道这些很多年了(Arch,说你呢),所以这也是值得检查的。 + +#### 发行版支持 UEFI 和安全引导 + +检查发行版是否支持 UEFI 和安全引导。查明它是否需要导入额外的密钥或是否要求启动内核有一个已经被系统厂商信任的密钥签名(例如跟微软达成合作)。一些发行版不支持 UEFI 或安全启动,但是提供了替代品来确保防篡改(tamper-proof)或防破坏(tamper-evident)引导环境([Qubes-OS][3] 使用 Anti Evil Maid,前面提到的)。如果一个发行版不支持安全引导,也没有防止引导级别攻击的机制,还是看看别的吧。 + +#### 全磁盘加密 + +全磁盘加密是保护静止数据的要求,大多数发行版都支持。作为一个选择方案,带有自加密硬盘的系统也可以用(通常通过主板 TPM 芯片实现),并提供了类似安全级别而且操作更快,但是花费也更高。 + +## 发行版安装指南 + +所有发行版都是不同的,但是也有一些一般原则: + +### 检查清单 + +- [ ] 使用健壮的密码全磁盘加密(LUKS) _(关键)_ +- [ ] 确保交换分区也加密了 _(关键)_ +- [ ] 确保引导程序设置了密码(可以和LUKS一样) _(关键)_ +- [ ] 设置健壮的 root 密码(可以和LUKS一样) _(关键)_ +- [ ] 使用无特权账户登录,作为管理员组的一部分 _(关键)_ +- [ ] 设置健壮的用户登录密码,不同于 root 密码 _(关键)_ + +### 注意事项 + +#### 全磁盘加密 + +除非你正在使用自加密硬盘,配置你的安装程序完整地加密所有存储你的数据与系统文件的磁盘很重要。简单地通过自动挂载的 cryptfs 环(loop)文件加密用户目录还不够(说你呢,旧版 Ubuntu),这并没有给系统二进制文件或交换分区提供保护,它可能包含大量的敏感数据。推荐的加密策略是加密 LVM 设备,以便在启动过程中只需要一个密码。 + +`/boot`分区将一直保持非加密,因为引导程序需要在调用 LUKS/dm-crypt 前能引导内核自身。一些发行版支持加密的`/boot`分区,比如 [Arch][16],可能别的发行版也支持,但是似乎这样增加了系统更新的复杂度。如果你的发行版并没有原生支持加密`/boot`也不用太在意,内核镜像本身并没有什么隐私数据,它会通过安全引导的加密签名检查来防止被篡改。 + +#### 选择一个好密码 + +现代的 Linux 系统没有限制密码口令长度,所以唯一的限制是你的偏执和倔强。如果你要启动你的系统,你将大概至少要输入两个不同的密码:一个解锁 LUKS ,另一个登录,所以长密码将会使你老的更快。最好从丰富或混合的词汇中选择2-3个单词长度,容易输入的密码。 + +优秀密码例子(是的,你可以使用空格): + +- nature abhors roombas +- 12 in-flight Jebediahs +- perdon, tengo flatulence + +如果你喜欢输入可以在公开场合和你生活中能见到的句子,比如: + +- Mary had a little lamb +- you're a wizard, Harry +- to infinity and beyond + +如果你愿意的话,你也应该带上最少要 10-12个字符长度的非词汇的密码。 + +除非你担心物理安全,你可以写下你的密码,并保存在一个远离你办公桌的安全的地方。 + +#### Root,用户密码和管理组 + +我们建议,你的 root 密码和你的 LUKS 加密使用同样的密码(除非你共享你的笔记本给信任的人,让他应该能解锁设备,但是不应该能成为 root 用户)。如果你是笔记本电脑的唯一用户,那么你的 root 密码与你的 LUKS 密码不同是没有安全优势上的意义的。通常,你可以使用同样的密码在你的 UEFI 管理,磁盘加密,和 root 登录中 -- 知道这些任意一个都会让攻击者完全控制您的系统,在单用户工作站上使这些密码不同,没有任何安全益处。 + +你应该有一个不同的,但同样强健的常规用户帐户密码用来日常工作。这个用户应该是管理组用户(例如`wheel`或者类似,根据发行版不同),允许你执行`sudo`来提升权限。 + +换句话说,如果在你的工作站只有你一个用户,你应该有两个独特的、强健(robust)而强壮(strong)的密码需要记住: + +**管理级别**,用在以下方面: + +- UEFI 管理 +- 引导程序(GRUB) +- 磁盘加密(LUKS) +- 工作站管理(root 用户) + +**用户级别**,用在以下: + +- 用户登录和 sudo +- 密码管理器的主密码 + +很明显,如果有一个令人信服的理由的话,它们全都可以不同。 + +## 安装后的加固 + +安装后的安全加固在很大程度上取决于你选择的发行版,所以在一个像这样的通用文档中提供详细说明是徒劳的。然而,这里有一些你应该采取的步骤: + +### 检查清单 + +- [ ] 在全局范围内禁用火线和雷电模块 _(关键)_ +- [ ] 检查你的防火墙,确保过滤所有传入端口 _(关键)_ +- [ ] 确保 root 邮件转发到一个你可以收到的账户 _(关键)_ +- [ ] 建立一个系统自动更新任务,或更新提醒 _(中等)_ +- [ ] 检查以确保 sshd 服务默认情况下是禁用的 _(中等)_ +- [ ] 配置屏幕保护程序在一段时间的不活动后自动锁定 _(中等)_ +- [ ] 设置 logwatch _(中等)_ +- [ ] 安装使用 rkhunter _(中等)_ +- [ ] 安装一个入侵检测系统(Intrusion Detection System) _(中等)_ + +### 注意事项 + +#### 将模块列入黑名单 + +将火线和雷电模块列入黑名单,增加一行到`/etc/modprobe.d/blacklist-dma.conf`文件: + + blacklist firewire-core + blacklist thunderbolt + +重启后的这些模块将被列入黑名单。这样做是无害的,即使你没有这些端口(但也不做任何事)。 + +#### Root 邮件 + +默认的 root 邮件只是存储在系统基本上没人读过。确保你设置了你的`/etc/aliases`来转发 root 邮件到你确实能读取的邮箱,否则你也许错过了重要的系统通知和报告: + + # Person who should get root's mail + root: bob@example.com + +编辑后这些后运行`newaliases`,然后测试它确保能投递到,像一些邮件供应商将拒绝来自不存在的域名或者不可达的域名的邮件。如果是这个原因,你需要配置邮件转发直到确实可用。 + +#### 防火墙,sshd,和监听进程 + +默认的防火墙设置将取决于您的发行版,但是大多数都允许`sshd`端口连入。除非你有一个令人信服的合理理由允许连入 ssh,你应该过滤掉它,并禁用 sshd 守护进程。 + + systemctl disable sshd.service + systemctl stop sshd.service + +如果你需要使用它,你也可以临时启动它。 + +通常,你的系统不应该有任何侦听端口,除了响应 ping 之外。这将有助于你对抗网络级的零日漏洞利用。 + +#### 自动更新或通知 + +建议打开自动更新,除非你有一个非常好的理由不这么做,如果担心自动更新将使您的系统无法使用(以前发生过,所以这种担心并非杞人忧天)。至少,你应该启用自动通知可用的更新。大多数发行版已经有这个服务自动运行,所以你不需要做任何事。查阅你的发行版文档了解更多。 + +你应该尽快应用所有明显的勘误,即使这些不是特别贴上“安全更新”或有关联的 CVE 编号。所有的问题都有潜在的安全漏洞和新的错误,比起停留在旧的、已知的问题上,未知问题通常是更安全的策略。 + +#### 监控日志 + +你应该会对你的系统上发生了什么很感兴趣。出于这个原因,你应该安装`logwatch`然后配置它每夜发送在你的系统上发生的任何事情的活动报告。这不会预防一个专业的攻击者,但是一个不错的安全网络功能。 + +注意,许多 systemd 发行版将不再自动安装一个“logwatch”所需的 syslog 服务(因为 systemd 会放到它自己的日志中),所以你需要安装和启用“rsyslog”来确保在使用 logwatch 之前你的 /var/log 不是空的。 + +#### Rkhunter 和 IDS + +安装`rkhunter`和一个类似`aide`或者`tripwire`入侵检测系统(IDS)并不是那么有用,除非你确实理解它们如何工作,并采取必要的步骤来设置正确(例如,保证数据库在外部介质,从可信的环境运行检测,记住执行系统更新和配置更改后要刷新散列数据库,等等)。如果你不愿在你的工作站执行这些步骤,并调整你如何工作的方式,这些工具只能带来麻烦而没有任何实在的安全益处。 + +我们建议你安装`rkhunter`并每晚运行它。它相当易于学习和使用,虽然它不会阻止一个复杂的攻击者,它也能帮助你捕获你自己的错误。 + +## 个人工作站备份 + +工作站备份往往被忽视,或偶尔才做一次,这常常是不安全的方式。 + +### 检查清单 + +- [ ] 设置加密备份工作站到外部存储 _(关键)_ +- [ ] 使用零认知(zero-knowledge)备份工具备份到站外或云上 _(中等)_ + +### 注意事项 + +#### 全加密的备份存到外部存储 + +把全部备份放到一个移动磁盘中比较方便,不用担心带宽和上行网速(在这个时代,大多数供应商仍然提供显著的不对称的上传/下载速度)。不用说,这个移动硬盘本身需要加密(再说一次,通过 LUKS),或者你应该使用一个备份工具建立加密备份,例如`duplicity`或者它的 GUI 版本 `deja-dup`。我建议使用后者并使用随机生成的密码,保存到离线的安全地方。如果你带上笔记本去旅行,把这个磁盘留在家,以防你的笔记本丢失或被窃时可以找回备份。 + +除了你的家目录外,你还应该备份`/etc`目录和出于取证目的的`/var/log`目录。 + +尤其重要的是,避免拷贝你的家目录到任何非加密存储上,即使是需要快速的在两个系统上移动文件时,一旦完成你肯定会忘了清除它,从而暴露个人隐私或者安全信息到监听者手中 -- 尤其是把这个存储介质跟你的笔记本放到同一个包里。 + +#### 有选择的零认知站外备份 + +站外备份(Off-site backup)也是相当重要的,是否可以做到要么需要你的老板提供空间,要么找一家云服务商。你可以建一个单独的 duplicity/deja-dup 配置,只包括重要的文件,以免传输大量你不想备份的数据(网络缓存、音乐、下载等等)。 + +作为选择,你可以使用零认知(zero-knowledge)备份工具,例如 [SpiderOak][5],它提供一个卓越的 Linux GUI工具还有更多的实用特性,例如在多个系统或平台间同步内容。 + +## 最佳实践 + +下面是我们认为你应该采用的最佳实践列表。它当然不是非常详细的,而是试图提供实用的建议,来做到可行的整体安全性和可用性之间的平衡。 + +### 浏览 + +毫无疑问, web 浏览器将是你的系统上最大、最容易暴露的面临攻击的软件。它是专门下载和执行不可信、甚至是恶意代码的一个工具。它试图采用沙箱和代码清洁(code sanitization)等多种机制保护你免受这种危险,但是在之前它们都被击败了多次。你应该知道,在任何时候浏览网站都是你做的最不安全的活动。 + +有几种方法可以减少浏览器的影响,但这些真实有效的方法需要你明显改变操作您的工作站的方式。 + +#### 1: 使用两个不同的浏览器 _(关键)_ + +这很容易做到,但是只有很少的安全效益。并不是所有浏览器都可以让攻击者完全自由访问您的系统 -- 有时它们只能允许某人读取本地浏览器存储,窃取其它标签的活动会话,捕获浏览器的输入等。使用两个不同的浏览器,一个用在工作/高安全站点,另一个用在其它方面,有助于防止攻击者请求整个 cookie 存储的小问题。主要的不便是两个不同的浏览器会消耗大量内存。 + +我们建议: + +##### 火狐用来访问工作和高安全站点 + +使用火狐登录工作有关的站点,应该额外关心的是确保数据如 cookies,会话,登录信息,击键等等,明显不应该落入攻击者手中。除了少数的几个网站,你不应该用这个浏览器访问其它网站。 + +你应该安装下面的火狐扩展: + +- [ ] NoScript _(关键)_ + - NoScript 阻止活动内容加载,除非是在用户白名单里的域名。如果用于默认浏览器它会很麻烦(可是提供了真正好的安全效益),所以我们建议只在访问与工作相关的网站的浏览器上开启它。 + +- [ ] Privacy Badger _(关键)_ + - EFF 的 Privacy Badger 将在页面加载时阻止大多数外部追踪器和广告平台,有助于在这些追踪站点影响你的浏览器时避免跪了(追踪器和广告站点通常会成为攻击者的目标,因为它们能会迅速影响世界各地成千上万的系统)。 + +- [ ] HTTPS Everywhere _(关键)_ + - 这个 EFF 开发的扩展将确保你访问的大多数站点都使用安全连接,甚至你点击的连接使用的是 http://(可以有效的避免大多数的攻击,例如[SSL-strip][7])。 + +- [ ] Certificate Patrol _(中等)_ + - 如果你正在访问的站点最近改变了它们的 TLS 证书,这个工具将会警告你 -- 特别是如果不是接近失效期或者现在使用不同的证书颁发机构。它有助于警告你是否有人正尝试中间人攻击你的连接,不过它会产生很多误报。 + +你应该让火狐成为你打开连接时的默认浏览器,因为 NoScript 将在加载或者执行时阻止大多数活动内容。 + +##### 其它一切都用 Chrome/Chromium + +Chromium 开发者在增加很多很好的安全特性方面走在了火狐前面(至少[在 Linux 上][6]),例如 seccomp 沙箱,内核用户空间等等,这会成为一个你访问的网站与你其它系统之间的额外隔离层。Chromium 是上游开源项目,Chrome 是 Google 基于它构建的专有二进制包(加一句偏执的提醒,如果你有任何不想让谷歌知道的事情都不要使用它)。 + +推荐你在 Chrome 上也安装**Privacy Badger** 和 **HTTPS Everywhere** 扩展,然后给它一个与火狐不同的主题,以让它告诉你这是你的“不可信站点”浏览器。 + +#### 2: 使用两个不同浏览器,一个在专用的虚拟机里 _(中等)_ + +这有点像上面建议的做法,除了您将添加一个通过快速访问协议运行在专用虚拟机内部 Chrome 的额外步骤,它允许你共享剪贴板和转发声音事件(如,Spice 或 RDP)。这将在不可信浏览器和你其它的工作环境之间添加一个优秀的隔离层,确保攻击者完全危害你的浏览器将必须另外打破 VM 隔离层,才能达到系统的其余部分。 + +这是一个鲜为人知的可行方式,但是需要大量的 RAM 和高速的处理器来处理多增加的负载。这要求作为管理员的你需要相应地调整自己的工作实践而付出辛苦。 + +#### 3: 通过虚拟化完全隔离你的工作和娱乐环境 _(低等)_ + +了解下 [Qubes-OS 项目][3],它致力于通过划分你的应用到完全隔离的 VM 中来提供高度安全的工作环境。 + +### 密码管理器 + +#### 检查清单 + +- [ ] 使用密码管理器 _(关键)_ +- [ ] 不相关的站点使用不同的密码 _(关键)_ +- [ ] 使用支持团队共享的密码管理器 _(中等)_ +- [ ] 给非网站类账户使用一个单独的密码管理器 _(低等)_ + +#### 注意事项 + +使用好的、唯一的密码对你的团队成员来说应该是非常关键的需求。凭证(credential)盗取一直在发生 — 通过被攻破的计算机、盗取数据库备份、远程站点利用、以及任何其它的方式。凭证绝不应该跨站点重用,尤其是关键的应用。 + +##### 浏览器中的密码管理器 + +每个浏览器有一个比较安全的保存密码机制,可以同步到供应商维护的,并使用用户的密码保证数据加密。然而,这个机制有严重的劣势: + +1. 不能跨浏览器工作 +2. 不提供任何与团队成员共享凭证的方法 + +也有一些支持良好、免费或便宜的密码管理器,可以很好的融合到多个浏览器,跨平台工作,提供小组共享(通常是付费服务)。可以很容易地通过搜索引擎找到解决方案。 + +##### 独立的密码管理器 + +任何与浏览器结合的密码管理器都有一个主要的缺点,它实际上是应用的一部分,这样最有可能被入侵者攻击。如果这让你不放心(应该这样),你应该选择两个不同的密码管理器 -- 一个集成在浏览器中用来保存网站密码,一个作为独立运行的应用。后者可用于存储高风险凭证如 root 密码、数据库密码、其它 shell 账户凭证等。 + +这样的工具在团队成员间共享超级用户的凭据方面特别有用(服务器 root 密码、ILO密码、数据库管理密码、引导程序密码等等)。 + +这几个工具可以帮助你: + +- [KeePassX][8],在第2版中改进了团队共享 +- [Pass][9],它使用了文本文件和 PGP,并与 git 结合 +- [Django-Pstore][10],它使用 GPG 在管理员之间共享凭据 +- [Hiera-Eyaml][11],如果你已经在你的平台中使用了 Puppet,在你的 Hiera 加密数据的一部分里面,可以便捷的追踪你的服务器/服务凭证。 + +### 加固 SSH 与 PGP 的私钥 + +个人加密密钥,包括 SSH 和 PGP 私钥,都是你工作站中最重要的物品 -- 这是攻击者最想得到的东西,这可以让他们进一步攻击你的平台或在其它管理员面前冒充你。你应该采取额外的步骤,确保你的私钥免遭盗窃。 + +#### 检查清单 + +- [ ] 用来保护私钥的强壮密码 _(关键)_ +- [ ] PGP 的主密码保存在移动存储中 _(中等)_ +- [ ] 用于身份验证、签名和加密的子密码存储在智能卡设备 _(中等)_ +- [ ] SSH 配置为以 PGP 认证密钥作为 ssh 私钥 _(中等)_ + +#### 注意事项 + +防止私钥被偷的最好方式是使用一个智能卡存储你的加密私钥,绝不要拷贝到工作站上。有几个厂商提供支持 OpenPGP 的设备: + +- [Kernel Concepts][12],在这里可以采购支持 OpenPGP 的智能卡和 USB 读取器,你应该需要一个。 +- [Yubikey NEO][13],这里提供 OpenPGP 功能的智能卡还提供很多很酷的特性(U2F、PIV、HOTP等等)。 + +确保 PGP 主密码没有存储在工作站也很重要,仅使用子密码。主密钥只有在签名其它的密钥和创建新的子密钥时使用 — 不经常发生这种操作。你可以照着 [Debian 的子密钥][14]向导来学习如何将你的主密钥移动到移动存储并创建子密钥。 + +你应该配置你的 gnupg 代理作为 ssh 代理,然后使用基于智能卡 PGP 认证密钥作为你的 ssh 私钥。我们发布了一个[详尽的指导][15]如何使用智能卡读取器或 Yubikey NEO。 + +如果你不想那么麻烦,最少要确保你的 PGP 私钥和你的 SSH 私钥有个强健的密码,这将让攻击者很难盗取使用它们。 + +### 休眠或关机,不要挂起 + +当系统挂起时,内存中的内容仍然保留在内存芯片中,可以会攻击者读取到(这叫做冷启动攻击(Cold Boot Attack))。如果你离开你的系统的时间较长,比如每天下班结束,最好关机或者休眠,而不是挂起它或者就那么开着。 + +### 工作站上的 SELinux + +如果你使用捆绑了 SELinux 的发行版(如 Fedora),这有些如何使用它的建议,让你的工作站达到最大限度的安全。 + +#### 检查清单 + +- [ ] 确保你的工作站强制(enforcing)使用 SELinux _(关键)_ +- [ ] 不要盲目的执行`audit2allow -M`,应该经常检查 _(关键)_ +- [ ] 绝不要 `setenforce 0` _(中等)_ +- [ ] 切换你的用户到 SELinux 用户`staff_u` _(中等)_ + +#### 注意事项 + +SELinux 是强制访问控制(Mandatory Access Controls,MAC),是 POSIX许可核心功能的扩展。它是成熟、强健,自从它推出以来已经有很长的路了。不管怎样,许多系统管理员现在仍旧重复过时的口头禅“关掉它就行”。 + +话虽如此,在工作站上 SELinux 会带来一些有限的安全效益,因为大多数你想运行的应用都是可以自由运行的。开启它有益于给网络提供足够的保护,也有可能有助于防止攻击者通过脆弱的后台服务提升到 root 级别的权限用户。 + +我们的建议是开启它并强制使用(enforcing)。 + +##### 绝不`setenforce 0` + +使用`setenforce 0`临时把 SELinux 设置为许可(permissive)模式很有诱惑力,但是你应该避免这样做。当你想查找一个特定应用或者程序的问题时,实际上这样做是把整个系统的 SELinux 给关闭了。 + +你应该使用`semanage permissive -a [somedomain_t]`替换`setenforce 0`,只把这个程序放入许可模式。首先运行`ausearch`查看哪个程序发生问题: + + ausearch -ts recent -m avc + +然后看下`scontext=`(源自 SELinux 的上下文)行,像这样: + + scontext=staff_u:staff_r:gpg_pinentry_t:s0-s0:c0.c1023 + ^^^^^^^^^^^^^^ + +这告诉你程序`gpg_pinentry_t`被拒绝了,所以你想排查应用的故障,应该增加它到许可域: + + semange permissive -a gpg_pinentry_t + +这将允许你使用应用然后收集 AVC 的其它数据,你可以结合`audit2allow`来写一个本地策略。一旦完成你就不会看到新的 AVC 的拒绝消息,你就可以通过运行以下命令从许可中删除程序: + + semanage permissive -d gpg_pinentry_t + +##### 用 SELinux 的用户 staff_r 使用你的工作站 + +SELinux 带有角色(role)的原生实现,基于用户帐户相关角色来禁止或授予某些特权。作为一个管理员,你应该使用`staff_r`角色,这可以限制访问很多配置和其它安全敏感文件,除非你先执行`sudo`。 + +默认情况下,用户以`unconfined_r`创建,你可以自由运行大多数应用,没有任何(或只有一点)SELinux 约束。转换你的用户到`staff_r`角色,运行下面的命令: + + usermod -Z staff_u [username] + +你应该退出然后登录新的角色,届时如果你运行`id -Z`,你将会看到: + + staff_u:staff_r:staff_t:s0-s0:c0.c1023 + +在执行`sudo`时,你应该记住增加一个额外标志告诉 SELinux 转换到“sysadmin”角色。你需要用的命令是: + + sudo -i -r sysadm_r + +然后`id -Z`将会显示: + + staff_u:sysadm_r:sysadm_t:s0-s0:c0.c1023 + +**警告**:在进行这个切换前你应该能很顺畅的使用`ausearch`和`audit2allow`,当你以`staff_r`角色运行时你的应用有可能不再工作了。在写作本文时,已知以下流行的应用在`staff_r`下没有做策略调整就不会工作: + +- Chrome/Chromium +- Skype +- VirtualBox + +切换回`unconfined_r`,运行下面的命令: + + usermod -Z unconfined_u [username] + +然后注销再重新回到舒适区。 + +## 延伸阅读 + +IT 安全的世界是一个没有底的兔子洞。如果你想深入,或者找到你的具体发行版更多的安全特性,请查看下面这些链接: + +- [Fedora 安全指南](https://docs.fedoraproject.org/en-US/Fedora/19/html/Security_Guide/index.html) +- [CESG Ubuntu 安全指南](https://www.gov.uk/government/publications/end-user-devices-security-guidance-ubuntu-1404-lts) +- [Debian 安全手册](https://www.debian.org/doc/manuals/securing-debian-howto/index.en.html) +- [Arch Linux 安全维基](https://wiki.archlinux.org/index.php/Security) +- [Mac OSX 安全](https://www.apple.com/support/security/guides/) + +## 许可 + +这项工作在[创作共用授权4.0国际许可证][0]许可下。 + +-------------------------------------------------------------------------------- + +via: https://github.com/lfit/itpol/blob/bbc17d8c69cb8eee07ec41f8fbf8ba32fdb4301b/linux-workstation-security.md + +作者:[mricon][a] +译者:[wyangsun](https://github.com/wyangsun) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://github.com/mricon +[0]: http://creativecommons.org/licenses/by-sa/4.0/ +[1]: https://github.com/QubesOS/qubes-antievilmaid +[2]: https://en.wikipedia.org/wiki/IEEE_1394#Security_issues +[3]: https://qubes-os.org/ +[4]: https://xkcd.com/936/ +[5]: https://spideroak.com/ +[6]: https://code.google.com/p/chromium/wiki/LinuxSandboxing +[7]: http://www.thoughtcrime.org/software/sslstrip/ +[8]: https://keepassx.org/ +[9]: http://www.passwordstore.org/ +[10]: https://pypi.python.org/pypi/django-pstore +[11]: https://github.com/TomPoulton/hiera-eyaml +[12]: http://shop.kernelconcepts.de/ +[13]: https://www.yubico.com/products/yubikey-hardware/yubikey-neo/ +[14]: https://wiki.debian.org/Subkeys +[15]: https://github.com/lfit/ssh-gpg-smartcard-config +[16]: http://www.pavelkogan.com/2014/05/23/luks-full-disk-encryption/ +[17]: https://en.wikipedia.org/wiki/Cold_boot_attack +[18]: http://www.linux.com/news/featured-blogs/167-amanda-mcpherson/850607-linux-foundation-sysadmins-open-source-their-it-policies \ No newline at end of file diff --git a/published/201512/20150917 A Repository with 44 Years of Unix Evolution.md b/published/201512/20150917 A Repository with 44 Years of Unix Evolution.md new file mode 100755 index 0000000000..5c19f0180f --- /dev/null +++ b/published/201512/20150917 A Repository with 44 Years of Unix Evolution.md @@ -0,0 +1,220 @@ +一个涵盖 Unix 44 年进化史的版本仓库 +============================================================================= + +http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html + +This is an HTML rendering of a working paper draft that led to a publication. The publication should always be cited in preference to this draft using the following reference: + +- **Diomidis Spinellis**. [A repository with 44 years of Unix evolution](http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html). In MSR '15: Proceedings of the 12th Working Conference on Mining Software Repositories, pages 13-16. IEEE, 2015. Best Data Showcase Award. ([doi:10.1109/MSR.2015.6](http://dx.doi.org/10.1109/MSR.2015.6)) + +This document is also available in [PDF format](http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.pdf). + +The document's metadata is available in [BibTeX format](http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c-bibtex.html). + +This material is presented to ensure timely dissemination of scholarly and technical work. Copyright and all rights therein are retained by authors or by other copyright holders. All persons copying this information are expected to adhere to the terms and constraints invoked by each author's copyright. In most cases, these works may not be reposted without the explicit permission of the copyright holder. + +[Diomidis Spinellis Publications](http://www.dmst.aueb.gr/dds/pubs/) + +© 2015 IEEE. Personal use of this material is permitted. However, permission to reprint/republish this material for advertising or promotional purposes or for creating new collective works for resale or redistribution to servers or lists, or to reuse any copyrighted component of this work in other works must be obtained from the IEEE. + +### 摘要 ### + +Unix 操作系统的进化历史,可以从一个版本控制仓库中窥见,时间跨度从 1972 年的 5000 行内核代码开始,到 2015 年成为一个含有 26,000,000 行代码的被广泛使用的系统。该仓库包含 659,000 条提交,和 2306 次合并。仓库部署了被普遍采用的 Git 系统用于储存其代码,并且在时下流行的 GitHub 上建立了存档。它由来自贝尔实验室(Bell Labs),伯克利大学(Berkeley University),386BSD 团队所开发的系统软件的 24 个快照综合定制而成,这包括两个老式仓库和一个开源 FreeBSD 系统的仓库。总的来说,可以确认其中的 850 位个人贡献者,更早些时候的一批人主要做基础研究。这些数据可以用于一些经验性的研究,在软件工程,信息系统和软件考古学领域。 + +### 1、介绍 ### + +Unix 操作系统作为一个主要的工程上的突破而脱颖而出,得益于其模范的设计、大量的技术贡献、它的开发模型及广泛的使用。Unix 编程环境的设计已经被视为一个提供非常简洁、强大而优雅的设计 [[1][1]] 。在技术方面,许多对 Unix 有直接贡献的,或者因 Unix 而流行的特性就包括 [[2][2]] :用高级语言编写的可移植部署的内核;一个分层式设计的文件系统;兼容的文件,设备,网络和进程间 I/O;管道和过滤架构;虚拟文件系统;和作为普通进程的可由用户选择的不同 shell。很早的时候,就有一个庞大的社区为 Unix 贡献软件 [[3][3]] ,[[4][4],pp. 65-72] 。随时间流逝,这个社区不断壮大,并且以现在称为开源软件开发的方式在工作着 [[5][5],pp. 440-442] 。Unix 和其睿智的晚辈们也将 C 和 C++ 编程语言、分析程序和词法分析生成器(*yacc*,*lex*)、文档编制工具(*troff*,*eqn*,*tbl*)、脚本语言(*awk*,*sed*,*Perl*)、TCP/IP 网络、和配置管理系统(configuration management system)(*SCSS*,*RCS*,*Subversion*,*Git*)发扬广大了,同时也形成了现代互联网基础设施和网络的最大的部分。 + +幸运的是,一些重要的具有历史意义的 Unix 材料已经保存下来了,现在保持对外开放。尽管 Unix 最初是由相对严格的协议发行,但在早期的开发中,很多重要的部分是通过 Unix 的版权拥有者之一(Caldera International) (LCTT 译注:2002年改名为 SCO Group)以一个自由的协议发行。通过将这些部分再结合上由加州大学伯克利分校(University of California, Berkeley)和 FreeBSD 项目组开发或发布的开源软件,贯穿了从 1972 年六月二十日开始到现在的整个系统的开发。 + +通过规划和处理这些可用的快照以及或旧或新的配置管理仓库,将这些可用数据的大部分重建到一个新合成的 Git 仓库之中。这个仓库以数字的形式记录了过去44年来最重要的数字时代产物的详细的进化。下列章节描述了该仓库的结构和内容(第[2][6]节)、创建方法(第[3][7]节)和该如何使用(第[4][8]节)。 + +### 2、数据概览 ### + +这 1GB 的 Unix 历史仓库可以从 [GitHub][9] 上克隆^[1][10] 。如今^[2][11] ,这个仓库包含来自 850 个贡献者的 659,000 个提交和 2,306 个合并。贡献者有来自贝尔实验室(Bell Labs)的 23 个员工,伯克利大学(Berkeley University)的计算机系统研究组(Computer Systems Research Group)(CSRG)的 158 个人,和 FreeBSD 项目的 660 个成员。 + +这个仓库的生命始于一个 *Epoch* 的标签,这里面只包含了证书信息和现在的 README 文件。其后各种各样的标签和分支记录了很多重要的时刻。 + +- *Research-VX* 标签对应来自贝尔实验室(Bell Labs)六个研究版本。从 *Research-V1* (4768 行 PDP-11 汇编代码)开始,到以 *Research-V7* (大约 324,000 行代码,1820 个 C 文件)结束。 +- *Bell-32V* 是第七个版本 Unix 在 DEC/VAX 架构上的移植。 +- *BSD-X* 标签对应伯克利大学(Berkeley University)释出的 15 个快照。 +- *386BSD-X* 标签对应该系统的两个开源版本,主要是 Lynne 和 William Jolitz 写的适用于 Intel 386 架构的内核代码。 +- *FreeBSD-release/X* 标签和分支标记了来自 FreeBSD 项目的 116 个发行版。 + +另外,以 *-Snapshot-Development* 为后缀的分支,表示该提交由来自一个以时间排序的快照文件序列而合成;而以一个 *-VCS-Development* 为后缀的标签,标记了有特定发行版出现的历史分支的时刻。 + +仓库的历史包含从系统开发早期的一些提交,比如下面这些。 + + commit c9f643f59434f14f774d61ee3856972b8c3905b1 + Author: Dennis Ritchie + Date: Mon Dec 2 18:18:02 1974 -0500 + Research V5 development + Work on file usr/sys/dmr/kl.c + +两个发布之间的合并代表着系统发生了进化,比如 BSD 3 的开发来自 BSD2 和 Unix 32/V,它在 Git 仓库里正是被表示为带两个父节点的图形节点。 + +更为重要的是,以这种方式构造的仓库允许 **git blame**,就是可以给源代码行加上注释,如版本、日期和它们第一次出现相关联的作者,这样可以知道任何代码的起源。比如说,检出 **BSD-4** 这个标签,并在内核的 *pipe.c* 文件上运行一下 git blame,就会显示出由 Ken Thompson 写于 1974,1975 和 1979年的代码行,和 Bill Joy 写于 1980 年的。这就可以自动(尽管计算上比较费事)检测出任何时刻出现的代码。 + +![](http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/provenance.png) + +*图1:各个重大 Unix 发行版的代码来源* + +如[上图][12]所示,现代版本的 Unix(FreeBSD 9)依然有相当部分的来自 BSD 4.3,BSD 4.3 Net/2 和 BSD 2.0 的代码块。有趣的是,这图片显示有部分代码好像没有保留下来,当时激进地要创造一个脱离于伯克利(386BSD 和 FreeBSD 1.0)所释出代码的开源操作系统。FreeBSD 9 中最古老的代码是一个 18 行的队列,在 C 库里面的 timezone.c 文件里,该文件也可以在第七版的 Unix 文件里找到,同样的名字,时间戳是 1979 年一月十日 - 36 年前。 + +### 3、数据收集和处理 ### + +这个项目的目的是以某种方式巩固从数据方面说明 Unix 的进化,通过将其并入一个现代的版本仓库,帮助人们对系统进化的研究。项目工作包括收录数据,分类并综合到一个单独的 Git 仓库里。 + +![](http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/branches.png) + +*图2:导入 Unix 快照、仓库及其合并* + +项目以三种数据类型为基础(见[图2][13])。首先,早期发布版本的快照,获取自 [Unix 遗产社会归档(Unix Heritage Society archive)][14]^[3][15] 、包括了 CSRG 全部的源代码归档的 [CD-ROM 镜像][16]^[4][17] , [Oldlinux 网站][18]^[5][19] 和 [FreeBSD 归档][20]^[6][21] 。 其次,以前的和现在的仓库,即 CSRG SCCS [[6][22]] 仓库,FreeBSD 1 CVS 仓库,和[现代 FreeBSD 开发的 Git 镜像][23]^[7][24] 。前两个都是从和快照相同的来源获得的。 + +最后,也是最费力的数据源是 **初步研究(primary research)**。释出的快照并没有提供关于它们的源头和每个文件贡献者的信息。因此,这些信息片段需要通过初步研究(primary research)验证。至于作者信息主要通过作者的自传,研究论文,内部备忘录和旧文档扫描件;通过阅读并且自动处理源代码和帮助页面补充;通过与那个年代的人用电子邮件交流;在 *StackExchange* 网站上贴出疑问;查看文件的位置(在早期的内核版本的源代码,分为 `usr/sys/dmr` 和 `/usr/sys/ken` 两个位置);从研究论文和帮助手册披露的作者找到源代码,从一个又一个的发行版中获取。(有趣的是,第一和第二的研究版(Research Edition)帮助页面都有一个 “owner” 部分,列出了作者(比如,*Ken*)及对应的系统命令、文件、系统调用或库函数。在第四版中这个部分就没了,而在 BSD 发行版中又浮现了 “Author” 部分。)关于作者信息更为详细地写在了项目的文件中,这些文件被用于匹配源代码文件和它们的作者和对应的提交信息。最后,关于源代码库之间的合并信息是获取自[ NetBSD 项目所维护的 BSD 家族树][25]^[8][26] 。 + +作为本项目的一部分而开发的软件和数据文件,现在可以[在线获取][27]^[9][28] ,并且,如果有合适的网络环境,CPU 和磁盘资源,可以用来从头构建这样一个仓库。关于主要发行版的作者信息,都存储在本项目的 `author-path` 目录下的文件里。它们的内容中带有正则表达式的文件路径后面指出了相符的作者。可以指定多个作者。正则表达式是按线性处理的,所以一个文件末尾的匹配一切的表达式可以指定一个发行版的默认作者。为避免重复,一个以 `.au` 后缀的独立文件专门用于映射作者的识别号(identifier)和他们的名字及 email。这样一个文件为每个与该系统进化相关的社区都建立了一个:贝尔实验室(Bell Labs),伯克利大学(Berkeley University),386BSD 和 FreeBSD。为了真实性的需要,早期贝尔实验室(Bell Labs)发行版的 emails 都以 UUCP 注释(UUCP notation)方式列出(例如, `research!ken`)。FreeBSD 作者的识别映射,需要导入早期的 CVS 仓库,通过从如今项目的 Git 仓库里拆解对应的数据构建。总的来说,由 1107 行构成了注释作者信息的文件(828 个规则),并且另有 640 行用于映射作者的识别号到名字。 + +现在项目的数据源被编码成了一个 168 行的 `Makefile`。它包括下面的步骤。 + +**Fetching** 从远程站点复制和克隆大约 11GB 的镜像、归档和仓库。 + +**Tooling** 从 2.9 BSD 中为旧的 PDP-11 归档获取一个归档器,并调整它以在现代的 Unix 版本下编译;编译 4.3 BSD 的 *compress* 程序来解压 386BSD 发行版,这个程序不再是现代 Unix 系统的组成部分了。 + +**Organizing** 用 *tar* 和 *cpio* 解压缩包;合并第六个研究版的三个目录;用旧的 PDP-11 归档器解压全部一个 BSD 归档;挂载 CD-ROM 镜像,这样可以作为文件系统处理;合并第 8 和 62 的 386BSD 磁盘镜像为两个独立的文件。 + +**Cleaning** 恢复第一个研究版的内核源代码文件,这个可以通过 OCR 从打印件上得到近似其原始状态的的格式;给第七个研究版的源代码文件打补丁;移除发行后被添加进来的元数据和其他文件,为避免得到错误的时间戳信息;修复毁坏的 SCCS 文件;用一个定制的 Perl 脚本移除指定到多个版本的 CVS 符号、删除与现在冲突的 CVS *Attr* 文件、用 *cvs2svn* 将 CVS 仓库转换为 Git 仓库,以处理早期的 FreeBSD CVS 仓库。 + +在仓库再现(representation)中有一个很有意思的部分就是,如何导入那些快照,并以一种方式联系起来,使得 *git blame* 可以发挥它的魔力。快照导入到仓库是基于每个文件的时间戳作为一系列的提交实现的。当所有文件导入后,就被用对应发行版的名字给标记了。然后,可以删除那些文件,并开始导入下一个快照。注意 *git blame* 命令是通过回溯一个仓库的历史来工作的,并使用启发法(heuristics)来检测文件之间或文件内的代码移动和复制。因此,删除掉的快照间会产生中断,以防止它们之间的代码被追踪。 + +相反,在下一个快照导入之前,之前快照的所有文件都被移动到了一个隐藏的后备目录里,叫做 `.ref`(引用)。它们保存在那,直到下个快照的所有文件都被导入了,这时候它们就会被删掉。因为 `.ref` 目录下的每个文件都精确对应一个原始文件,*git blame* 可以知道多少源代码通过 `.ref` 文件从一个版本移到了下一个,而不用显示出 `.ref` 文件。为了更进一步帮助检测代码起源,同时增加再现(representation)的真实性,每个发行版都被再现(represented)为一个有增量文件的分支(*-Development*)与之前发行版之间的合并。 + +上世纪 80 年代时期,只有伯克利(Berkeley) 开发的文件的一个子集是用 SCCS 版本控制的。在那个期间,我们的统一仓库里包含了来自 SCCS 的提交和快照的增量文件的导入数据。对于每个发行版,可用最近的时间戳找到该 SCCS 提交,并被标记为一个与发行版增量导入分支的合并。这些合并可以在[图2][29] 的中间看到。 + +将各种数据资源综合到一个仓库的工作,主要是用两个脚本来完成的。一个 780 行的 Perl 脚本(`import-dir.pl`)可以从一个单独的数据源(快照目录、SCCS 仓库,或者 Git 仓库)中,以 *Git fast export* 格式导出(真实的或者综合的)提交历史。输出是一个简单的文本格式,Git 工具用这个来导入和导出提交。其他方面,这个脚本以一些东西为参数,如文件到贡献者的映射、贡献者登录名和他们的全名间的映射、哪个导入的提交会被合并、哪些文件要处理和忽略、以及“引用”文件的处理。一个 450 行的 Shell 脚本创建 Git 仓库,并调用带适当参数的 Perl 脚本,来导入 27 个可用的历史数据资源。Shell 脚本也会运行 30 个测试,比较特定标签的仓库和对应的数据源,核对查看的目录中出现的和没出现的,并回溯查看分支树和合并的数量,*git blame* 和 *git log* 的输出。最后,调用 *git* 作垃圾收集和仓库压缩,从最初的 6GB 降到分发的 1GB 大小。 + +### 4、数据使用 ### + +该数据可以用于软件工程、信息系统和软件考古学(software archeology)领域的经验性研究。鉴于它从不间断而独一无二的存在了超过了 40 年,可以供软件进化和跨代更迭参考。从那时以来,处理速度已经成千倍地增长、存储容量扩大了百万倍,该数据同样可以用于软件和硬件技术交叉进化(co-evolution)的研究。软件开发从研究中心到大学,到开源社区的转移,可以用来研究组织文化对于软件开发的影响。该仓库也可以用于学习著名人物的实际编程,比如 Turing 奖获得者(Dennis Ritchie 和 Ken Thompson)和 IT 产业的大佬(Bill Joy 和 Eric Schmidt)。另一个值得学习的现象是代码的长寿,无论是单行的水平,或是作为那个时代随 Unix 发布的完整的系统(Ingres、 Lisp、 Pascal、 Ratfor、 Snobol、 TMP),和导致代码存活或消亡的因素。最后,因为该数据让 Git 感到了压力,底层的软件仓库存储技术达到了其极限,这会推动版本管理系统领域的工程进度。 + +![](http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/metrics.png) + +*图3:Unix 发行版的代码风格进化* + +[图3][30] 根据 36 个主要 Unix 发行版描述了一些有趣的代码统计的趋势线(用 R 语言的局部多项式回归拟合函数生成),验证了代码风格和编程语言的使用在很长的时间尺度上的进化。这种进化是软硬件技术的需求和支持、软件构筑理论,甚至社会力量所驱动的。图片中的日期计算了出现在一个给定发行版中的所有文件的平均日期。正如可以从中看到,在过去的 40 年中,标示符和文件名字的长度已经稳步从 4 到 6 个字符增长到 7 到 11 个字符。我们也可以看到注释数量的少量稳步增加,以及 *goto* 语句的使用量减少,同时 *register* 这个类型修饰符的消失。 + +### 5、未来的工作 ### + +可以做很多事情去提高仓库的正确性和有效性。创建过程以开源代码共享了,通过 GitHub 的拉取请求(pull request),可以很容易地贡献更多代码和修复。最有用的社区贡献将使得导入的快照文件的覆盖面增长,以便归属于某个具体的作者。现在,大约 90,000 个文件(在 160,000 总量之外)通过默认规则指定了作者。类似地,大约有 250 个作者(最初 FreeBSD 那些)仅知道其识别号。两个都列在了 build 仓库的 unmatched 目录里,欢迎贡献数据。进一步,BSD SCCS 和 FreeBSD CVS 的提交共享相同的作者和时间戳,这些可以结合成一个单独的 Git 提交。导入 SCCS 文件提交的支持会被添加进来,以便引入仓库对应的元数据。最后,也是最重要的,开源系统的更多分支会添加进来,比如 NetBSD、 OpenBSD、DragonFlyBSD 和 *illumos*。理想情况下,其他历史上重要的 Unix 发行版,如 System III、System V、 NeXTSTEP 和 SunOS 等的当前版权拥有者,也会在一个允许他们的合作伙伴使用仓库用于研究的协议下释出他们的系统。 + +### 鸣谢 ### + +本文作者感谢很多付出努力的人们。 Brian W. Kernighan, Doug McIlroy 和 Arnold D. Robbins 在贝尔实验室(Bell Labs)的登录识别号方面提供了帮助。 Clem Cole, Era Erikson, Mary Ann Horton, Kirk McKusick, Jeremy C. Reed, Ingo Schwarze 和 Anatole Shaw 在 BSD 的登录识别号方面提供了帮助。BSD SCCS 的导入代码是基于 H. Merijn Brand 和 Jonathan Gray 的工作。 + +这次研究由欧盟 ( 欧洲社会基金(European Social Fund,ESF)) 和 希腊国家基金(Greek national funds)通过国家战略参考框架( National Strategic Reference Framework ,NSRF) 的 Operational Program " Education and Lifelong Learning" - Research Funding Program: Thalis - Athens University of Economics and Business - Software Engineering Research Platform ,共同出资赞助。 + +### 引用 ### + +[[1]][31] + M. D. McIlroy, E. N. Pinson, and B. A. Tague, "UNIX time-sharing system: Foreword," *The Bell System Technical Journal*, vol. 57, no. 6, pp. 1899-1904, July-August 1978. + +[[2]][32] + D. M. Ritchie and K. Thompson, "The UNIX time-sharing system," *Bell System Technical Journal*, vol. 57, no. 6, pp. 1905-1929, July-August 1978. + +[[3]][33] + D. M. Ritchie, "The evolution of the UNIX time-sharing system," *AT&T Bell Laboratories Technical Journal*, vol. 63, no. 8, pp. 1577-1593, Oct. 1984. + +[[4]][34] + P. H. Salus, *A Quarter Century of UNIX*. Boston, MA: Addison-Wesley, 1994. + +[[5]][35] + E. S. Raymond, *The Art of Unix Programming*. Addison-Wesley, 2003. + +[[6]][36] + M. J. Rochkind, "The source code control system," *IEEE Transactions on Software Engineering*, vol. SE-1, no. 4, pp. 255-265, 1975. + +---------- + +#### 脚注 #### + +[1][37] - [https://github.com/dspinellis/unix-history-repo][38] + +[2][39] - Updates may add or modify material. To ensure replicability the repository's users are encouraged to fork it or archive it. + +[3][40] - [http://www.tuhs.org/archive_sites.html][41] + +[4][42] - [https://www.mckusick.com/csrg/][43] + +[5][44] - [http://www.oldlinux.org/Linux.old/distributions/386BSD][45] + +[6][46] - [http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/][47] + +[7][48] - [https://github.com/freebsd/freebsd][49] + +[8][50] - [http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/share/misc/bsd-family-tree][51] + +[9][52] - [https://github.com/dspinellis/unix-history-make][53] + +-------------------------------------------------------------------------------- + +via: http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html + +作者:Diomidis Spinellis +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#MPT78 +[2]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#RT78 +[3]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#Rit84 +[4]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#Sal94 +[5]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#Ray03 +[6]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#sec:data +[7]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#sec:dev +[8]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#sec:use +[9]:https://github.com/dspinellis/unix-history-repo +[10]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFtNtAAB +[11]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFtNtAAC +[12]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#fig:provenance +[13]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#fig:branches +[14]:http://www.tuhs.org/archive_sites.html +[15]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFtNtAAD +[16]:https://www.mckusick.com/csrg/ +[17]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFtNtAAE +[18]:http://www.oldlinux.org/Linux.old/distributions/386BSD +[19]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFtNtAAF +[20]:http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/ +[21]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFtNtAAG +[22]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#SCCS +[23]:https://github.com/freebsd/freebsd +[24]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFtNtAAH +[25]:http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/share/misc/bsd-family-tree +[26]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFtNtAAI +[27]:https://github.com/dspinellis/unix-history-make +[28]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFtNtAAJ +[29]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#fig:branches +[30]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#fig:metrics +[31]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#CITEMPT78 +[32]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#CITERT78 +[33]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#CITERit84 +[34]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#CITESal94 +[35]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#CITERay03 +[36]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#CITESCCS +[37]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFrefAAB +[38]:https://github.com/dspinellis/unix-history-repo +[39]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFrefAAC +[40]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFrefAAD +[41]:http://www.tuhs.org/archive_sites.html +[42]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFrefAAE +[43]:https://www.mckusick.com/csrg/ +[44]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFrefAAF +[45]:http://www.oldlinux.org/Linux.old/distributions/386BSD +[46]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFrefAAG +[47]:http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/ +[48]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFrefAAH +[49]:https://github.com/freebsd/freebsd +[50]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFrefAAI +[51]:http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/share/misc/bsd-family-tree +[52]:http://www.dmst.aueb.gr/dds/pubs/conf/2015-MSR-Unix-History/html/Spi15c.html#tthFrefAAJ +[53]:https://github.com/dspinellis/unix-history-make diff --git a/published/201512/20151012 The Brief History Of Aix HP-UX Solaris BSD And LINUX.md b/published/201512/20151012 The Brief History Of Aix HP-UX Solaris BSD And LINUX.md new file mode 100644 index 0000000000..2f6780cdc2 --- /dev/null +++ b/published/201512/20151012 The Brief History Of Aix HP-UX Solaris BSD And LINUX.md @@ -0,0 +1,101 @@ +UNIX 家族小史 +================================================================================ +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/05/linux-712x445.png) + +要记住,当一扇门在你面前关闭的时候,另一扇门就会打开。肯·汤普森([Ken Thompson][1]) 和丹尼斯·里奇([Dennis Richie][2]) 两个人就是这句名言很好的实例。他们俩是**20世纪**最优秀的信息技术专家之二,因为他们创造了最具影响力和创新性的软件之一: **UNIX**。 + +### UNIX 系统诞生于贝尔实验室 ### + +**UNIX** 最开始的名字是 **UNICS** (**UN**iplexed **I**nformation and **C**omputing **S**ervice),它有一个大家庭,并不是从石头缝里蹦出来的。UNIX的祖父是 **CTSS** (**C**ompatible **T**ime **S**haring **S**ystem),它的父亲是 **Multics** (**MULT**iplexed **I**nformation and **C**omputing **S**ervice),这个系统能支持大量用户通过交互式分时(timesharing)的方式使用大型机。 + +UNIX 诞生于 **1969** 年,由**肯·汤普森**以及后来加入的**丹尼斯·里奇**共同完成。这两位优秀的研究员和科学家在一个**通用电器 GE**和**麻省理工学院**的合作项目里工作,项目目标是开发一个叫 Multics 的交互式分时系统。 + +Multics 的目标是整合分时技术以及当时其他先进技术,允许用户在远程终端通过电话(拨号)登录到主机,然后可以编辑文档,阅读电子邮件,运行计算器,等等。 + +在之后的五年里,AT&T 公司为 Multics 项目投入了数百万美元。他们购买了 GE-645 大型机,聚集了贝尔实验室的顶级研究人员,例如肯·汤普森、 Stuart Feldman、丹尼斯·里奇、道格拉斯·麦克罗伊(M. Douglas McIlroy)、 Joseph F. Ossanna 以及 Robert Morris。但是项目目标太过激进,进度严重滞后。最后,AT&T 高层决定放弃这个项目。 + +贝尔实验室的管理层决定停止这个让许多研究人员无比纠结的操作系统上的所有遗留工作。不过要感谢汤普森,里奇和一些其他研究员,他们把老板的命令丢到一边,并继续在实验室里满怀热心地忘我工作,最终孵化出前无古人后无来者的 UNIX。 + +UNIX 的第一声啼哭是在一台 PDP-7 微型机上,它是汤普森测试自己在操作系统设计上的点子的机器,也是汤普森和 里奇一起玩 Space and Travel 游戏的模拟器。 + +> “我们想要的不仅是一个优秀的编程环境,而是能围绕这个系统形成团体。按我们自己的经验,通过远程访问和分时主机实现的公共计算,本质上不只是用终端输入程序代替打孔机而已,而是鼓励密切沟通。”丹尼斯·里奇说。 + +UNIX 是第一个靠近理想的系统,在这里程序员可以坐在机器前自由摆弄程序,探索各种可能性并随手测试。在 UNIX 整个生命周期里,它吸引了大量因其他操作系统限制而投身过来的高手做出无私贡献,因此它的功能模型一直保持上升趋势。 + +UNIX 在 1970 年因为 PDP-11/20 获得了首次资金注入,之后正式更名为 UNIX 并支持在 PDP-11/20 上运行。UNIX 带来的第一次用于实际场景中是在 1971 年,贝尔实验室的专利部门配备来做文字处理。 + +### UNIX 上的 C 语言革命 ### + +丹尼斯·里奇在 1972 年发明了一种叫 “**C**” 的高级编程语言 ,之后他和肯·汤普森决定用 “C” 重写 UNIX 系统,来支持更好的移植性。他们在那一年里编写和调试了差不多 100,000 行代码。在迁移到 “C” 语言后,系统可移植性非常好,只需要修改一小部分机器相关的代码就可以将 UNIX 移植到其他计算机平台上。 + +UNIX 第一次公开露面是 1973 年丹尼斯·里奇和肯·汤普森在操作系统原理(Operating Systems Principles)上发表的一篇论文,然后 AT&T 发布了 UNIX 系统第 5 版,并授权给教育机构使用,之后在 1975 年第一次以 **$20.000** 的价格授权企业使用 UNIX 第 6 版。应用最广泛的是 1980 年发布的 UNIX 第 7 版,任何人都可以购买授权,只是授权条款非常严格。授权内容包括源代码,以及用 PDP-11 汇编语言写的及其相关内核。反正,各种版本 UNIX 系统完全由它的用户手册确定。 + +### AIX 系统 ### + +在 **1983** 年,**微软**计划开发 **Xenix** 作为 MS-DOS 的多用户版继任者,他们在那一年花了 $8,000 搭建了一台拥有 **512 KB** 内存以及 **10 MB**硬盘并运行 Xenix 的 Altos 586。而到 1984 年为止,全世界 UNIX System V 第二版的安装数量已经超过了 100,000 。在 1986 年发布了包含因特网域名服务的 4.3BSD,而且 **IBM** 宣布 **AIX 系统**的安装数已经超过 250,000。AIX 基于 Unix System V 开发,这套系统拥有 BSD 风格的根文件系统,是两者的结合。 + +AIX 第一次引入了 **日志文件系统 (JFS)** 以及集成逻辑卷管理器 (Logical Volume Manager ,LVM)。IBM 在 1989 年将 AIX 移植到自己的 RS/6000 平台。2001 年发布的 5L 版是一个突破性的版本,提供了 Linux 友好性以及支持 Power4 服务器的逻辑分区。 + +在 2004 年发布的 AIX 5.3 引入了支持高级电源虚拟化( Advanced Power Virtualization,APV)的虚拟化技术,支持对称多线程、微分区,以及共享处理器池。 + +在 2007 年,IBM 同时发布 AIX 6.1 和 Power6 架构,开始加强自己的虚拟化产品。他们还将高级电源虚拟化重新包装成 PowerVM。 + +这次改进包括被称为 WPARs 的负载分区形式,类似于 Solaris 的 zones/Containers,但是功能更强。 + +### HP-UX 系统 ### + +**惠普 UNIX (Hewlett-Packard’s UNIX,HP-UX)** 源于 System V 第 3 版。这套系统一开始只支持 PA-RISC HP 9000 平台。HP-UX 第 1 版发布于 1984 年。 + +HP-UX 第 9 版引入了 SAM,一个基于字符的图形用户界面 (GUI),用户可以用来管理整个系统。在 1995 年发布的第 10 版,调整了系统文件分布以及目录结构,变得有点类似 AT&T SVR4。 + +第 11 版发布于 1997 年。这是 HP 第一个支持 64 位寻址的版本。不过在 2000 年重新发布成 11i,因为 HP 为特定的信息技术用途,引入了操作环境(operating environments)和分级应用(layered applications)的捆绑组(bundled groups)。 + +在 2001 年发布的 11.20 版宣称支持安腾(Itanium)系统。HP-UX 是第一个使用 ACLs(访问控制列表,Access Control Lists)管理文件权限的 UNIX 系统,也是首先支持内建逻辑卷管理器(Logical Volume Manager)的系统之一。 + +如今,HP-UX 因为 HP 和 Veritas 的合作关系使用了 Veritas 作为主文件系统。 + +HP-UX 目前的最新版本是 11iv3, update 4。 + +### Solaris 系统 ### + +Sun 的 UNIX 版本是 **Solaris**,用来接替 1992 年创建的 **SunOS**。SunOS 一开始基于 BSD(伯克利软件发行版,Berkeley Software Distribution)风格的 UNIX,但是 SunOS 5.0 版以及之后的版本都是基于重新包装为 Solaris 的 Unix System V 第 4 版。 + +SunOS 1.0 版于 1983 年发布,用于支持 Sun-1 和 Sun-2 平台。随后在 1985 年发布了 2.0 版。在 1987 年,Sun 和 AT&T 宣布合作一个项目以 SVR4 为基础将 System V 和 BSD 合并成一个版本。 + +Solaris 2.4 是 Sun 发布的第一个 Sparc/x86 版本。1994 年 11 月份发布的 SunOS 4.1.4 版是最后一个版本。Solaris 7 是首个 64 位 Ultra Sparc 版本,加入了对文件系统元数据记录的原生支持。 + +Solaris 9 发布于 2002 年,支持 Linux 特性以及 Solaris 卷管理器(Solaris Volume Manager)。之后,2005 年发布了 Solaris 10,带来许多创新,比如支持 Solaris Containers,新的 ZFS 文件系统,以及逻辑域(Logical Domains)。 + +目前 Solaris 最新的版本是 第 10 版,最后的更新发布于 2008 年。 + +### Linux ### + +到了 1991 年,用来替代商业操作系统的自由(free)操作系统的需求日渐高涨。因此,**Linus Torvalds** 开始构建一个自由的操作系统,最终成为 **Linux**。Linux 最开始只有一些 “C” 文件,并且使用了阻止商业发行的授权。Linux 是一个类 UNIX 系统但又不尽相同。 + +2015 年发布了基于 GNU Public License (GPL)授权的 3.18 版。IBM 声称有超过 1800 万行开源代码开源给开发者。 + +如今 GNU Public License 是应用最广泛的自由软件授权方式。根据开源软件原则,这份授权允许个人和企业自由分发、运行、通过拷贝共享、学习,以及修改软件源码。 + +### UNIX vs. Linux:技术概要 ### + +- Linux 鼓励多样性,Linux 的开发人员来自各种背景,有更多不同经验和意见。 +- Linux 比 UNIX 支持更多的平台和架构。 +- UNIX 商业版本的开发人员针对特定目标平台以及用户设计他们的操作系统。 +- **Linux 比 UNIX 有更好的安全性**,更少受病毒或恶意软件攻击。截止到现在,Linux 上大约有 60-100 种病毒,但是没有任何一种还在传播。另一方面,UNIX 上大约有 85-120 种病毒,但是其中有一些还在传播中。 +- 由于 UNIX 命令、工具和元素很少改变,甚至很多接口和命令行参数在后续 UNIX 版本中一直沿用。 +- 有些 Linux 开发项目以自愿为基础进行资助,比如 Debian。其他项目会维护一个和商业 Linux 的社区版,比如 SUSE 的 openSUSE 以及红帽的 Fedora。 +- 传统 UNIX 是纵向扩展,而另一方面 Linux 是横向扩展。 + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/brief-history-aix-hp-ux-solaris-bsd-linux/ + +作者:[M.el Khamlichi][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/pirat9/ +[1]:http://www.unixmen.com/ken-thompson-unix-systems-father/ +[2]:http://www.unixmen.com/dennis-m-ritchie-father-c-programming-language/ diff --git a/published/201512/20151020 how to h2 in apache.md b/published/201512/20151020 how to h2 in apache.md new file mode 100644 index 0000000000..add5bb7560 --- /dev/null +++ b/published/201512/20151020 how to h2 in apache.md @@ -0,0 +1,370 @@ +如何在 Apache 中启用 HTTP/2 +================================================================================ +Copyright (C) 2015 greenbytes GmbH + +刚发布的 Apache httpd 2.4.17 终于支持 HTTP/2 了。这个页面给出了一些如何构建/部署/配置的建议。目的是为了大家发现 bugs 时能升级它,或者给一些能更好工作的建议。 + +最后,这会归并回到官方 Apache 文档,这里只会留下一个到那里的链接。暂时我们还没做到。 + +### 源码 ### + +你可以从[这里][1]得到 Apache 版本。Apache 2.4.17 及其更高版本都支持 HTTP/2。我不会再重复介绍如何构建该服务器的指令。在很多地方有很好的指南,例如[这里][2]。 + +(有任何这个试验性软件包的相关链接?在 Twitter 上告诉我吧 @icing) + +#### 编译支持 HTTP/2 #### + +在你编译版本之前,你要进行一些**配置**。这里有成千上万的选项。和 HTTP/2 相关的是: + +- **--enable-http2** + + 启用在 Apache 服务器内部实现该协议的 ‘http2’ 模块。 + +- **--with-nghttp2=\** + + 指定 http2 模块需要的 libnghttp2 模块的非默认位置。如果 nghttp2 是在默认的位置,配置过程会自动采用。 + +- **--enable-nghttp2-staticlib-deps** + + 很少用到的选项,你可能想将 nghttp2 库静态链接到服务器里。在大部分平台上,只有在找不到共享 nghttp2 库时才有用。 + +如果你想自己编译 nghttp2,你可以到 [nghttp2.org][3] 查看文档。最新的 Fedora 以及其它版本已经附带了这个库。 + +#### TLS 支持 #### + +大部分人想在浏览器上使用 HTTP/2, 而浏览器只在使用 TLS 连接(**https:// 开头的 url)时才支持 HTTP/2。你需要一些我下面介绍的配置。但首先你需要的是支持 ALPN 扩展的 TLS 库。 + +ALPN 用来协商(negotiate)服务器和客户端之间的协议。如果你服务器上 TLS 库还没有实现 ALPN,客户端只能通过 HTTP/1.1 通信。那么,可以和 Apache 链接并支持它的是什么库呢? + +- **OpenSSL 1.0.2** 及其以后。 +- ??? (别的我也不知道了) + +如果你的 OpenSSL 库是 Linux 版本自带的,这里使用的版本号可能和官方 OpenSSL 版本的不同。如果不确定的话检查一下你的 Linux 版本吧。 + +### 配置 ### + +另一个给服务器的好建议是为 http2 模块设置合适的日志等级。添加下面的配置: + + # 放在某个地方的这样一行 + LoadModule http2_module modules/mod_http2.so + + + LogLevel http2:info + + +当你启动服务器的时候,你可以在错误日志中看来类似的一行: + + [timestamp] [http2:info] [pid XXXXX:tid numbers] + mod_http2 (v1.0.0, nghttp2 1.3.4), initializing... + +#### 协议 #### + +那么,假设你已经编译部署好了服务器, TLS 库也是最新的,你启动了你的服务器,打开了浏览器。。。你怎么知道它在工作呢? + +如果除此之外你没有添加其它的服务器配置,很可能它没有工作。 + +你需要告诉服务器在哪里使用该协议。默认情况下,你的服务器并没有启动 HTTP/2 协议。因为这样比较安全,也许才能让你已有的部署可以继续工作。 + +你可以用新的 **Protocols** 指令启用 HTTP/2 协议: + + # 对于 https 服务器 + Protocols h2 http/1.1 + ... + + # 对于 http 服务器 + Protocols h2c http/1.1 + +你可以给整个服务器或者指定的 **vhosts** 添加这个配置。 + +#### SSL 参数 #### + +对于 TLS (SSL),HTTP/2 有一些特殊的要求。阅读下面的“ https:// 连接”一节了解更详细的信息。 + +### http:// 连接 (h2c) ### + +尽管现在还没有浏览器支持,但是 HTTP/2 协议也工作在 http:// 这样的 url 上, 而且 mod_h[ttp]2 也支持。启用它你唯一所要做的是在 Protocols 配置中启用它: + + # 对于 http 服务器 + Protocols h2c http/1.1 + +这里有一些支持 **h2c** 的客户端(和客户端库)。我会在下面介绍: + +#### curl #### + +Daniel Stenberg 维护的用于访问网络资源的命令行客户端 curl 当然支持。如果你的系统上有 curl,有一个简单的方法检查它是否支持 http/2: + + sh> curl -V + curl 7.43.0 (x86_64-apple-darwin15.0) libcurl/7.43.0 SecureTransport zlib/1.2.5 + Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp + Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets + +不好了。这些功能中没有 'HTTP2'。你想要的是下面这样: + + sh> curl -V + url 7.45.0 (x86_64-apple-darwin15.0.0) libcurl/7.45.0 OpenSSL/1.0.2d zlib/1.2.8 nghttp2/1.3.4 + Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp + Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets + +如果你的 curl 支持 HTTP2 功能,你可以用一些简单的命令检查你的服务器: + + sh> curl -v --http2 http:/// + ... + > Connection: Upgrade, HTTP2-Settings + > Upgrade: h2c + > HTTP2-Settings: AAMAAABkAAQAAP__ + > + < HTTP/1.1 101 Switching Protocols + < Upgrade: h2c + < Connection: Upgrade + * Received 101 + * Using HTTP2, server supports multi-use + * Connection state changed (HTTP/2 confirmed) + ... + + +恭喜,如果看到了有 **...101 Switching...** 的行就表示它正在工作! + +有一些情况不会发生 HTTP/2 的升级切换(Upgrade)。如果你的第一个请求有内容数据(body),例如你上传一个文件时,就不会触发升级切换。[h2c 限制][5]部分有详细的解释。 + +#### nghttp #### + +nghttp2 可以一同编译它自己的客户端和服务器。如果你的系统中有该客户端,你可以简单地通过获取一个资源来验证你的安装: + + sh> nghttp -uv http:/// + [ 0.001] Connected + [ 0.001] HTTP Upgrade request + ... + Connection: Upgrade, HTTP2-Settings + Upgrade: h2c + HTTP2-Settings: AAMAAABkAAQAAP__ + ... + [ 0.005] HTTP Upgrade response + HTTP/1.1 101 Switching Protocols + Upgrade: h2c + Connection: Upgrade + + [ 0.006] HTTP Upgrade success + ... + + +这和我们上面 **curl** 例子中看到的 Upgrade 输出很相似。 + +有另外一种在命令行参数中不用 **-u** 参数而使用 **h2c** 的方法。这个参数会指示 **nghttp** 进行 HTTP/1 升级切换过程。但如果我们不使用呢? + + sh> nghttp -v http:/// + [ 0.002] Connected + [ 0.002] send SETTINGS frame + ... + [ 0.002] send HEADERS frame + ; END_STREAM | END_HEADERS | PRIORITY + (padlen=0, dep_stream_id=11, weight=16, exclusive=0) + ; Open new stream + :method: GET + :path: / + :scheme: http + ... + +连接马上使用了 HTTP/2!这就是协议中所谓的直接(direct)模式,当客户端发送一些特殊的 24 字节到服务器时就会发生: + + 0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a + +用 ASCII 表示是: + + PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n + +支持 **h2c** 的服务器在一个新的连接中看到这些信息就会马上切换到 HTTP/2。HTTP/1.1 服务器则认为是一个可笑的请求,响应并关闭连接。 + +因此,**直接**模式只适合于那些确定服务器支持 HTTP/2 的客户端。例如,当前一个升级切换过程成功了的时候。 + +**直接**模式的魅力是零开销,它支持所有请求,即使带有请求数据部分(查看[h2c 限制][6])。 + +对于 2.4.17 版本,明文连接时默认启用 **H2Direct** 。但是有一些模块和这不兼容。因此,在下一版本中,默认会设置为**off**,如果你希望你的服务器支持它,你需要设置它为: + + H2Direct on + +### https:// 连接 (h2) ### + +当你的 mod_h[ttp]2 可以支持 h2c 连接时,那就可以一同启用 **h2** 兄弟了,现在的浏览器仅支持它和 **https:** 一同使用。 + +HTTP/2 标准对 https:(TLS)连接增加了一些额外的要求。上面已经提到了 ALNP 扩展。另外的一个要求是不能使用特定[黑名单][7]中的加密算法。 + +尽管现在版本的 **mod_h[ttp]2** 不增强这些算法(以后可能会),但大部分客户端会这么做。如果让你的浏览器使用不恰当的算法打开 **h2** 服务器,你会看到不明确的警告**INADEQUATE_SECURITY**,浏览器会拒接连接。 + +一个可行的 Apache SSL 配置类似: + + SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK + SSLProtocol All -SSLv2 -SSLv3 + ... + +(是的,这确实很长。) + +这里还有一些应该调整,但不是必须调整的 SSL 配置参数:**SSLSessionCache**, **SSLUseStapling** 等,其它地方也有介绍这些。例如 Ilya Grigorik 写的一篇超赞的博客: [高性能浏览器网络][8]。 + +#### curl #### + +再次回到 shell 使用 curl(查看上面的“curl h2c”章节了解要求),你也可以通过 curl 用简单的命令检测你的服务器: + + sh> curl -v --http2 https:/// + ... + * ALPN, offering h2 + * ALPN, offering http/1.1 + ... + * ALPN, server accepted to use h2 + ... + + +恭喜你,能正常工作啦!如果还不能,可能原因是: + +- 你的 curl 不支持 HTTP/2。查看上面的“检测 curl”一节。 +- 你的 openssl 版本太低不支持 ALPN。 +- 不能验证你的证书,或者不接受你的算法配置。尝试添加命令行选项 -k 停用 curl 中的这些检查。如果可以工作,就重新配置你的 SSL 和证书。 + +#### nghttp #### + +我们已经在 **h2c** 讨论过 **nghttp**。如果你用它来进行 **https:** 连接,你会看到类似下面的信息: + + sh> nghttp https:/// + [ERROR] HTTP/2 protocol was not selected. (nghttp2 expects h2) + +这有两种可能,你可以通过添加 -v 来检查。如果是: + + sh> nghttp -v https:/// + [ 0.034] Connected + [ERROR] HTTP/2 protocol was not selected. (nghttp2 expects h2) + +这意味着你服务器使用的 TLS 库没有实现 ALPN。有时候正确安装有点困难。多看看 Stackoverflow 吧。 + +你看到的也可能是: + + sh> nghttp -v https:/// + [ 0.034] Connected + The negotiated protocol: http/1.1 + [ERROR] HTTP/2 protocol was not selected. (nghttp2 expects h2) + +这表示 ALPN 能正常工作,但并没有用 h2 协议。你需要像上面介绍的那样检查你服务器上的 Protocols 配置。如果一开始在 vhost 部分设置不能正常工作,试着在通用部分设置它。 + +#### Firefox #### + +更新: [Apache Lounge][11] 的 Steffen Land 告诉我 [Firefox 上有个 HTTP/2 指示插件][12]。你可以看到有多少地方用到了 h2(提示:Apache Lounge 用 h2 已经有一段时间了。。。) + +你可以在 Firefox 浏览器中打开开发者工具,在那里的网络标签页查看 HTTP/2 连接。当你打开了 HTTP/2 并重新刷新 html 页面时,你会看到类似下面的东西: + +![](https://icing.github.io/mod_h2/images/firefox-h2.png) + +在响应头中,你可以看到奇怪的 **X-Firefox-Spdy** 条目中列出了 “h2”。这表示在这个 **https:** 连接中使用了 HTTP/2。 + +#### Google Chrome #### + +在 Google Chrome 中,你在开发者工具中看不到 HTTP/2 指示器。相反,Chrome 用特殊的地址 **chrome://net-internals/#http2** 给出了相关信息。(LCTT 译注:Chrome 已经有一个 “HTTP/2 and SPDY indicator” 可以很好的在地址栏识别 HTTP/2 连接) + +如果你打开了一个服务器的页面,可以在 Chrome 中查看那个 net-internals 页面,你可以看到类似下面这样: + +![](https://icing.github.io/mod_h2/images/chrome-h2.png) + +如果你的服务器在上面的列表中,就表示它正在工作。 + +#### Microsoft Edge #### + +Windows 10 中 Internet Explorer 的继任者 Edge 也支持 HTTP/2。你也可以在开发者工具的网络标签页看到 HTTP/2 协议。 + +![](https://icing.github.io/mod_h2/images/ie-h2.png) + +#### Safari #### + +在 Apple 的 Safari 中,打开开发者工具,那里有个网络标签页。重新加载你的服务器上的页面,并在开发者工具中选择显示了加载的那行。如果你启用了在右边显示详细视图,看 **Status** 部分。那里显示了 **HTTP/2.0 200**,像这样: + +![](https://icing.github.io/mod_h2/images/safari-h2.png) + +#### 重新协商 #### + +https: 连接重新协商是指正在运行的连接中特定的 TLS 参数会发生变化。在 Apache httpd 中,你可以在 directory 配置中改变 TLS 参数。如果进来一个获取特定位置资源的请求,配置的 TLS 参数会和当前的 TLS 参数进行对比。如果它们不相同,就会触发重新协商。 + +这种最常见的情形是算法变化和客户端证书。你可以要求客户访问特定位置时需要通过验证,或者对于特定资源,你可以使用更安全的、对 CPU 压力更大的算法。 + +但不管你的想法有多么好,HTTP/2 中都**不可以**发生重新协商。在同一个连接上会有 100 多个请求,那么重新协商该什么时候做呢? + +对于这种配置,现有的 **mod_h[ttp]2** 还没有办法。如果你有一个站点使用了 TLS 重新协商,别在上面启用 h2! + +当然,我们会在后面的版本中解决这个问题,然后你就可以安全地启用了。 + +### 限制 ### + +#### 非 HTTP 协议 ### + +实现除 HTTP 之外协议的模块可能和 **mod_http2** 不兼容。这在其它协议要求服务器首先发送数据时无疑会发生。 + +**NNTP** 就是这种协议的一个例子。如果你在服务器中配置了 **mod\_nntp\_like\_ssl**,那么就不要加载 mod_http2。等待下一个版本。 + +#### h2c 限制 #### + +**h2c** 的实现还有一些限制,你应该注意: + +##### 在虚拟主机中拒绝 h2c ##### + +你不能对指定的虚拟主机拒绝 **h2c 直连**。连接建立而没有看到请求时会触发**直连**,这使得不可能预先知道 Apache 需要查找哪个虚拟主机。 + +##### 有请求数据时的升级切换 ##### + +对于有数据的请求,**h2c** 升级切换不能正常工作。那些是 PUT 和 POST 请求(用于提交和上传)。如果你写了一个客户端,你可能会用一个简单的 GET 或者 OPTIONS * 来处理那些请求以触发升级切换。 + +原因从技术层面来看显而易见,但如果你想知道:在升级切换过程中,连接处于半疯状态。请求按照 HTTP/1.1 的格式,而响应使用 HTTP/2 帧。如果请求有一个数据部分,服务器在发送响应之前需要读取整个数据。因为响应可能需要从客户端处得到应答用于流控制及其它东西。但如果仍在发送 HTTP/1.1 请求,客户端就仍然不能以 HTTP/2 连接。 + +为了使行为可预测,几个服务器在实现上决定不在任何带有请求数据的请求中进行升级切换,即使请求数据很小。 + +##### 302 时的升级切换 ##### + +有重定向发生时,当前的 h2c 升级切换也不能工作。看起来 mod_http2 之前的重写有可能发生。这当然不会导致断路,但你测试这样的站点也许会让你迷惑。 + +#### h2 限制 #### + +这里有一些你应该意识到的 h2 实现限制: + +##### 连接重用 ##### + +HTTP/2 协议允许在特定条件下重用 TLS 连接:如果你有带通配符的证书或者多个 AltSubject 名称,浏览器可能会重用现有的连接。例如: + +你有一个 **a.example.org** 的证书,它还有另外一个名称 **b.example.org**。你在浏览器中打开 URL **https://a.example.org/**,用另一个标签页加载 **https://b.example.org/**。 + +在重新打开一个新的连接之前,浏览器看到它有一个到 **a.example.org** 的连接并且证书对于 **b.example.org** 也可用。因此,它在第一个连接上面发送第二个标签页的请求。 + +这种连接重用是刻意设计的,它使得使用了 HTTP/1 切分(sharding)来提高效率的站点能够不需要太多变化就能利用 HTTP/2。 + +Apache **mod_h[ttp]2** 还没有完全实现这点。如果 **a.example.org** 和 **b.example.org** 是不同的虚拟主机, Apache 不会允许这样的连接重用,并会告知浏览器状态码 **421 Misdirected Request**。浏览器会意识到它需要重新打开一个到 **b.example.org** 的连接。这仍然能工作,只是会降低一些效率。 + +我们期望下一次的发布中能有合适的检查。 + +Münster, 12.10.2015, + +Stefan Eissing, greenbytes GmbH + +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 warranty of any kind. See LICENSE for details. + + +---------- + +该项目由 [icing][13] 维护。 + +-------------------------------------------------------------------------------- + +via: https://icing.github.io/mod_h2/howto.html + +作者:[icing][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://github.com/icing +[1]:https://httpd.apache.org/download.cgi +[2]:https://httpd.apache.org/docs/2.4/install.html +[3]:https://nghttp2.org/ +[4]:https://icing.github.io/mod_h2/howto.html#https +[5]:https://icing.github.io/mod_h2/howto.html#h2c-restrictions +[6]:https://icing.github.io/mod_h2/howto.html#h2c-restrictions +[7]:https://httpwg.github.io/specs/rfc7540.html#BadCipherSuites +[8]:http://chimera.labs.oreilly.com/books/1230000000545 +[9]:https://icing.github.io/mod_h2/howto.html#curl +[10]:https://icing.github.io/mod_h2/howto.html#curl +[11]:https://www.apachelounge.com/ +[12]:https://addons.mozilla.org/en-US/firefox/addon/spdy-indicator/ +[13]:https://github.com/icing \ No newline at end of file diff --git a/published/201512/20151022 9 Tips for Improving WordPress Performance.md b/published/201512/20151022 9 Tips for Improving WordPress Performance.md new file mode 100644 index 0000000000..ea1a76200d --- /dev/null +++ b/published/201512/20151022 9 Tips for Improving WordPress Performance.md @@ -0,0 +1,519 @@ +深入浅出讲述提升 WordPress 性能的九大秘笈 +================================================================================ + +在建站和 web 应用程序交付方面,WordPress 是全球最大的一个平台。全球大约[四分之一][1] 的站点现在正在使用开源 WordPress 软件,包括 eBay、 Mozilla、 RackSpace、 TechCrunch、 CNN、 MTV、纽约时报、华尔街日报 等等。 + +最流行的个人博客平台 WordPress.com,其也运行在 WordPress 开源软件上。[而 NGINX 则为 WordPress.com 提供了动力][2]。在 WordPress.com 的用户当中,许多站点起步于 WordPress.com,然后换成了自己运行 WordPress 开源软件;它们中越来越多的站点也使用了 NGINX 软件。 + +WordPress 的吸引力源于其简单性,无论是对于最终用户还是安装架设。然而,当使用量不断增长时,WordPress 站点的体系结构也存在一定的问题 - 这里有几个方法,包括使用缓存,以及将 WordPress 和 NGINX 组合起来,可以解决这些问题。 + +在这篇博客中,我们提供了九个提速技巧来帮助你解决 WordPress 中一些常见的性能问题: + +- [缓存静态资源][3] +- [缓存动态文件][4] +- [迁移到 NGINX][5] +- [添加 NGINX 静态链接支持][6] +- [为 NGINX 配置 FastCGI][7] +- [为 NGINX 配置 W3_Total_Cache][8] +- [为 NGINX 配置 WP-Super-Cache][9] +- [为 NGINX 配置安全防范措施][10] +- [配置 NGINX 支持 WordPress 多站点][11] + +### 在 LAMP 架构下 WordPress 的性能 ### + +大多数 WordPress 站点都运行在传统的 LAMP 架构下:Linux 操作系统,Apache Web 服务器软件,MySQL 数据库软件(通常是一个单独的数据库服务器)和 PHP 编程语言。这些都是非常著名的,广泛应用的开源工具。在 WordPress 世界里,很多人都用的是 LAMP,所以很容易寻求帮助和支持。 + +当用户访问 WordPress 站点时,浏览器为每个用户创建六到八个连接来连接到 Linux/Apache 上。当用户请求连接时,PHP 即时生成每个页面,从 MySQL 数据库获取资源来响应请求。 + +LAMP 或许对于数百个并发用户依然能照常工作。然而,流量突然增加是常见的,并且通常这应该算是一件好事。 + +但是,当 LAMP 站点变得繁忙时,当同时在线的用户达到数千个时,它的瓶颈就会被暴露出来。瓶颈存在主要是两个原因: + +1. Apache Web 服务器 - Apache 的每个/每次连接需要消耗大量资源。如果 Apache 接受了太多的并发连接,内存可能会耗尽,从而导致性能急剧降低,因为数据必须交换到磁盘了。如果以限制连接数来提高响应时间,新的连接必须等待,这也导致了用户体验变得很差。 + +1. PHP/MySQL 的交互 - 一个运行 PHP 和 MySQL 数据库服务器的应用服务器上每秒的请求量有一个最大限制。当请求的数量超过这个最大限制时,用户必须等待。超过这个最大限制时也会增加所有用户的响应时间。超过其两倍以上时会出现明显的性能问题。 + +LAMP 架构的网站出现性能瓶颈是常见的情况,这时就需要升级硬件了 - 增加 CPU,扩大磁盘空间等等。当 Apache 和 PHP/MySQL 的架构超载后,在硬件上不断的提升却跟不上系统资源指数增长的需求。 + +首选替代 LAMP 架构的是 LEMP 架构 – Linux, NGINX, MySQL, 和 PHP。 (这是 LEMP 的缩写,E 代表着 “engine-x.” 的发音。) 我们在 [技巧 3][12] 中会描述 LEMP 架构。 + +### 技巧 1. 缓存静态资源 ### + +静态资源是指不变的文件,像 CSS,JavaScript 和图片。这些文件往往在网页的数据中占半数以上。页面的其余部分是动态生成的,像在论坛中评论,性能仪表盘,或个性化的内容(可以看看 Amazon.com 产品)。 + +缓存静态资源有两大好处: + +- 更快的交付给用户 - 用户可以从它们浏览器的缓存或者从互联网上离它们最近的缓存服务器获取静态文件。有时候文件较大,因此减少等待时间对它们来说帮助很大。 + +- 减少应用服务器的负载 - 从缓存中检索到的每个文件会让 web 服务器少处理一个请求。你的缓存越多,用户等待的时间越短。 + +要让浏览器缓存文件,需要在静态文件中设置正确的 HTTP 首部。看看 HTTP Cache-Control 首部,特别是设置了 max-age 参数,Expires 首部,以及 Entity 标记。[这里][13] 有详细的介绍。 + +当启用本地缓存,然后用户请求以前访问过的文件时,浏览器首先检查该文件是否在缓存中。如果在,它会询问 Web 服务器该文件是否改变过。如果该文件没有改变,Web 服务器将立即响应一个304状态码(未改变),这意味着该文件没有改变,而不是返回状态码200 OK 并检索和发送已改变的文件。 + +要在浏览器之外支持缓存,可以考虑下面讲到的技巧,以及考虑使用内容分发网络(CDN)。CDN 是一​​种流行且​​强大的缓存工具,但我们在这里不详细描述它。在你实现了这里讲到的其它技术之后可以考虑 CDN。此外,当你的站点从 HTTP/1.x 过渡到 HTTP/2 协议时,CDN 的用处可能不太大;根据需要调查和测试,找到你网站需要的正确方法。 + +如果你转向 NGINX Plus 或将开源的 NGINX 软件作为架构的一部分,建议你考虑 [技巧 3][14],然后配置 NGINX 缓存静态资源。使用下面的配置,用你 Web 服务器的 URL 替换 www.example.com。 + + server { + # substitute your web server's URL for www.example.com + server_name www.example.com; + root /var/www/example.com/htdocs; + index index.php; + + access_log /var/log/nginx/example.com.access.log; + error_log /var/log/nginx/example.com.error.log; + + location / { + try_files $uri $uri/ /index.php?$args; + } + + location ~ \.php$ { + try_files $uri =404; + include fastcgi_params; + # 使用你 WordPress 服务器的套接字,地址和端口来替换 + fastcgi_pass unix:/var/run/php5-fpm.sock; + #fastcgi_pass 127.0.0.1:9000; + } + + location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { + expires max; + log_not_found off; + access_log off; + } + } + +### 技巧 2. 缓存动态文件 ### + +WordPress 动态地生成网页,这意味着每次请求时它都要生成一个给定的网页(即使和前一次的结果相同)。这意味着用户随时获得的是最新内容。 + +想一下,当用户访问一个帖子时,并在文章底部有用户的评论时。你希望用户能够看到所有的评论 - 即使评论刚刚发布。动态内容就是处理这种情况的。 + +但现在,当帖子每秒出现十几二十几个请求时。应用服务器可能每秒需要频繁生成页面导致其压力过大,造成延误。为了给用户提供最新的内容,每个访问理论上都是新的请求,因此它们不得不在原始出处等待很长时间。 + +为了防止页面由于不断提升的负载而变得缓慢,需要缓存动态文件。这需要减少文件的动态内容来提高整个系统的响应速度。 + +要在 WordPress 中启用缓存中,需要使用一些流行的插件 - 如下所述。WordPress 的缓存插件会请求最新的页面,然后将其缓存短暂时间 - 也许只有几秒钟。因此,如果该网站每秒中会有几个请求,那大多数用户获得的页面都是缓存的副本。这也有助于提高所有用户的检索时间: + +- 大多数用户获得页面的缓存副本。应用服务器没有做任何工作。 +- 用户会得到一个之前的崭新副本。应用服务器只需每隔一段时间生成一个崭新页面。当服务器产生一个崭新页面(对于缓存过期后的第一个用户访问),它这样做要快得多,因为它的请求并没有超载。 + +你可以缓存运行在 LAMP 架构或者 [LEMP 架构][15] 上 WordPress 的动态文件(在 [技巧 3][16] 中说明了)。有几个缓存插件,你可以在 WordPress 中使用。运用到了最流行的缓存插件和缓存技术,从最简单到最强大的: + +- [Hyper-Cache][17] 和 [Quick-Cache][18] – 这两个插件为每个 WordPress 页面创建单个 PHP 文件。它支持绕过多个 WordPress 与数据库的连接核心处理的一些动态功能,创建一个更快的用户体验。它们不会绕过所有的 PHP 处理,所以并不会如下面那些取得同样的性能提升。它们也不需要修改 NGINX 的配置。 + +- [WP Super Cache][19] – 最流行的 WordPress 缓存插件。在它易用的界面易用上提供了许多功能,如下所示。我们在 [技巧 7][20] 中展示了一个简单的 NGINX 配置实例。 + +- [W3 Total Cache][21] – 这是第二流行的 WordPress 缓存插件。它比 WP Super Cache 的功能更强大,但它有些配置选项比较复杂。样例 NGINX 配置,请看 [技巧 6][22]。 + +- [FastCGI][23] – CGI 的意思是通用网关接口( Common Gateway Interface),在因特网上发送请求和接收文件的一种通用方式。它不是一个插件,而是一种与缓存交互缓存的方法。FastCGI 可以被用在 Apache 和 Nginx 上,它也是最流行的动态缓存方法;我们在 [技巧 5][24] 中描述了如何配置 NGINX 来使用它。 + +这些插件和技术的文档解释了如何在典型的 LAMP 架构中配置它们。配置方式包括数据库和对象缓存;最小化 HTML、CSS 和 JavaScript;集成流行的 CDN 集成环境。对于 NGINX 的配置,请看列表中的提示技巧。 + +**注意**:缓存不会用于已经登录的 WordPress 用户,因为他们的 WordPress 页面都是不同的。(对于大多数网站来说,只有一小部分用户可能会登录)此外,大多数缓存不会对刚刚评论过的用户显示缓存页面,因为当用户刷新页面时希望看到他们的评论。若要缓存页面的非个性化内容,如果它对整体性能来说很重要,可以使用一种称为 [碎片缓存(fragment caching)][25] 的技术。 + +### 技巧 3. 使用 NGINX ### + +如上所述,当并发用户数超过某一数量时 Apache 会导致性能问题 – 可能是数百个用户同时使用。Apache 对于每一个连接会消耗大量的资源,因而容易耗尽内存。Apache 可以配置连接数的值来避免耗尽内存,但是这意味着,超过限制时,新的连接请求必须等待。 + +此外,Apache 为每个连接加载一个 mod_php 模块副本到内存中,即使只有服务于静态文件(图片,CSS,JavaScript 等)。这使得每个连接消耗更多的资源,从而限制了服务器的性能。 + +要解决这些问题,从 LAMP 架构迁到 LEMP 架构 – 使用 NGINX 取代 Apache 。NGINX 在一定的内存之下就能处理成千上万的并发连接数,所以你不必经历颠簸,也不必限制并发连接数到很小的数量。 + +NGINX 处理静态文件的性能也较好,它有内置的,容易调整的 [缓存][26] 控制策略。减少应用服务器的负载,你的网站的访问速度会更快,用户体验更好。 + +你可以在部署环境的所有 Web 服务器上使用 NGINX,或者你可以把一个 NGINX 服务器作为 Apache 的“前端”来进行反向代理 - NGINX 服务器接收客户端请求,将请求的静态文件直接返回,将 PHP 请求转发到 Apache 上进行处理。 + +对于动态页面的生成,这是 WordPress 核心体验,可以选择一个缓存工具,如 [技巧 2][27] 中描述的。在下面的技巧中,你可以看到 FastCGI,W3\_Total\_Cache 和 WP-Super-Cache 在 NGINX 上的配置示例。 (Hyper-Cache 和 Quick-Cache 不需要改变 NGINX 的配置。) + +**技巧** 缓存通常会被保存到磁盘上,但你可以用 [tmpfs][28] 将缓存放在内存中来提高性能。 + +为 WordPress 配置 NGINX 很容易。仅需四步,其详细的描述在指定的技巧中: + +1. 添加永久链接的支持 - 让 NGINX 支持永久链接。此步消除了对 **.htaccess** 配置文件的依赖,这是 Apache 特有的。参见 [技巧 4][29]。 +2. 配置缓存 - 选择一个缓存工具并安装好它。可选择的有 FastCGI cache,W3 Total Cache, WP Super Cache, Hyper Cache, 和 Quick Cache。请看技巧 [5][30]、 [6][31] 和 [7][32]。 +3. 落实安全防范措施 - 在 NGINX 上采用对 WordPress 最佳安全的做法。参见 [技巧 8][33]。 +4. 配置 WordPress 多站点 - 如果你使用 WordPress 多站点,在 NGINX 下配置子目录,子域,或多域名架构。见 [技巧9][34]。 + +### 技巧 4. 让 NGINX 支持永久链接 ### + +许多 WordPress 网站依赖于 **.htaccess** 文件,此文件为 WordPress 的多个功能所需要,包括永久链接支持、插件和文件缓存。NGINX 不支持 **.htaccess** 文件。幸运的是,你可以使用 NGINX 的简单而全面的配置文件来实现大部分相同的功能。 + +你可以在你的主 [server][36] 块下添加下面的 location 块中为使用 NGINX 的 WordPress 启用 [永久链接][35]。(此 location 块在其它代码示例中也会被包括)。 + +**try_files** 指令告诉 NGINX 检查请求的 URL 在文档根目录(**/var/www/example.com/htdocs**)下是作为文件(**$uri**)还是目录(**$uri/**) 存在的。如果都不是,NGINX 将重定向到 **/index.php**,并传递查询字符串参数作为参数。 + + server { + server_name example.com www.example.com; + root /var/www/example.com/htdocs; + index index.php; + + access_log /var/log/nginx/example.com.access.log; + error_log /var/log/nginx/example.com.error.log; + + location / { + try_files $uri $uri/ /index.php?$args; + } + } + +### 技巧 5. 在 NGINX 中配置 FastCGI ### + +NGINX 可以缓存来自 FastCGI 应用程序的响应,如 PHP 响应。此方法可提供最佳的性能。 + +对于开源的 NGINX,编译入第三方模块 [ngx\_cache\_purge][37] 可以提供缓存清除能力,配置代码如下所示。NGINX Plus 已经包含了它自己实现此代码。 + +当使用 FastCGI 时,我们建议你安装 [NGINX 辅助插件][38] 并使用下面的配置文件,尤其是要注意 **fastcgi\_cache\_key** 的使用和包括 **fastcgi\_cache\_purge** 的 location 块。当页面发布或有改变时,有新评论被发布时,该插件会自动清除你的缓存,你也可以从 WordPress 管理控制台手动清除。 + +NGINX 的辅助插件还可以在你网页的底部添加一个简短的 HTML 代码,以确认缓存是否正常并显示一些统计数据。(你也可以使用 [$upstream\_cache\_status][39] 确认缓存功能是否正常。) + + fastcgi_cache_path /var/run/nginx-cache levels=1:2 + keys_zone=WORDPRESS:100m inactive=60m; + fastcgi_cache_key "$scheme$request_method$host$request_uri"; + + server { + server_name example.com www.example.com; + root /var/www/example.com/htdocs; + index index.php; + + access_log /var/log/nginx/example.com.access.log; + error_log /var/log/nginx/example.com.error.log; + + set $skip_cache 0; + + # POST 请求和带有查询参数的网址应该交给 PHP + if ($request_method = POST) { + set $skip_cache 1; + } + + if ($query_string != "") { + set $skip_cache 1; + } + + #以下 uris 中包含的部分不缓存 + if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php + |sitemap(_index)?.xml") { + set $skip_cache 1; + } + + #不要为登录用户或最近的评论者进行缓存 + if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass + |wordpress_no_cache|wordpress_logged_in") { + set $skip_cache 1; + } + + location / { + try_files $uri $uri/ /index.php?$args; + } + + location ~ \.php$ { + try_files $uri /index.php; + include fastcgi_params; + fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_cache_bypass $skip_cache; + fastcgi_no_cache $skip_cache; + fastcgi_cache WORDPRESS; + fastcgi_cache_valid 60m; + } + + location ~ /purge(/.*) { + fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; + } + + location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png + |ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { + + access_log off; + log_not_found off; + expires max; + } + + location = /robots.txt { + access_log off; + log_not_found off; + } + + location ~ /\. { + deny all; + access_log off; + log_not_found off; + } + } + +### 技巧 6. 为 NGINX 配置 W3\_Total\_Cache ### + +[W3 Total Cache][40], 是 [W3-Edge][41] 的 Frederick Townes 出品的, 是一个支持 NGINX 的 WordPress 缓存框架。其有众多选项配置,可以替代 FastCGI 缓存。 + +这个缓存插件提供了各种缓存配置,还包括数据库和对象的缓存,最小化 HTML、CSS 和 JavaScript,并可选与流行的 CDN 整合。 + +这个插件会通过写入一个位于你的域的根目录的 NGINX 配置文件来控制 NGINX。 + + server { + server_name example.com www.example.com; + + root /var/www/example.com/htdocs; + index index.php; + access_log /var/log/nginx/example.com.access.log; + error_log /var/log/nginx/example.com.error.log; + + include /path/to/wordpress/installation/nginx.conf; + + location / { + try_files $uri $uri/ /index.php?$args; + } + + location ~ \.php$ { + try_files $uri =404; + include fastcgi_params; + fastcgi_pass unix:/var/run/php5-fpm.sock; + } + } + +### 技巧 7. 为 NGINX 配置 WP Super Cache ### + +[WP Super Cache][42] 是由 Donncha O Caoimh 开发的, 他是 [Automattic][43] 的一个 WordPress 开发者, 这是一个 WordPress 缓存引擎,它可以将 WordPress 的动态页面转变成静态 HTML 文件,以使 NGINX 可以很快的提供服务。它是第一个 WordPress 缓存插件,和其它的相比,它更专注于某一特定的领域。 + +配置 NGINX 使用 WP Super Cache 可以根据你的喜好而进行不同的配置。以下是一个示例配置。 + +在下面的配置中,带有名为 supercache 的 location 块是 WP Super Cache 特有的部分。 WordPress 规则的其余代码用于不缓存已登录用户的信息,不缓存 POST 请求,并对静态资源设置过期首部,再加上标准的 PHP 处理;这部分可以根据你的需求进行定制。 + + + server { + server_name example.com www.example.com; + root /var/www/example.com/htdocs; + index index.php; + + access_log /var/log/nginx/example.com.access.log; + error_log /var/log/nginx/example.com.error.log debug; + + set $cache_uri $request_uri; + + # POST 请求和带有查询字符串的网址应该交给 PHP + if ($request_method = POST) { + set $cache_uri 'null cache'; + } + if ($query_string != "") { + set $cache_uri 'null cache'; + } + + #以下 uris 中包含的部分不缓存 + if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php + |wp-.*.php|/feed/|index.php|wp-comments-popup.php + |wp-links-opml.php|wp-locations.php |sitemap(_index)?.xml + |[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { + + set $cache_uri 'null cache'; + } + + #不对已登录用户和最近的评论者使用缓存 + if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+ + |wp-postpass|wordpress_logged_in") { + set $cache_uri 'null cache'; + } + + #当请求的文件存在时使用缓存,否则将请求转发给 WordPress + location / { + try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html + $uri $uri/ /index.php; + } + + location = /favicon.ico { + log_not_found off; + access_log off; + } + + location = /robots.txt { + log_not_found off + access_log off; + } + + location ~ .php$ { + try_files $uri /index.php; + include fastcgi_params; + fastcgi_pass unix:/var/run/php5-fpm.sock; + #fastcgi_pass 127.0.0.1:9000; + } + + # 尽可能的缓存静态文件 + location ~*.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css + |rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2 + |doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { + expires max; + log_not_found off; + access_log off; + } + } + +### 技巧 8. 为 NGINX 配置安全防范措施 ### + +为了防止攻击,可以控制对关键资源的访问并限制机器人对登录功能的过量攻击。 + +只允许特定的 IP 地址访问 WordPress 的仪表盘。 + + #对访问 WordPress 的仪表盘进行限制 + location /wp-admin { + deny 192.192.9.9; + allow 192.192.1.0/24; + allow 10.1.1.0/16; + deny all; + } + +只允许上传特定类型的文件,以防止恶意代码被上传和运行。 + + #当上传的不是图像,视频,音乐等时,拒绝访问。 + location ~* ^/wp-content/uploads/.*.(html|htm|shtml|php|js|swf)$ { + deny all; + } + +拒绝其它人访问 WordPress 的配置文件 **wp-config.php**。拒绝其它人访问的另一种方法是将该文件的一个目录移到域的根目录之上的目录。 + + # 拒绝其它人访问 wp-config.php + location ~* wp-config.php { + deny all; + } + +对 **wp-login.php** 进行限速来防止暴力破解。 + + # 拒绝访问 wp-login.php + location = /wp-login.php { + limit_req zone=one burst=1 nodelay; + fastcgi_pass unix:/var/run/php5-fpm.sock; + #fastcgi_pass 127.0.0.1:9000; + } + +### 技巧 9. 配置 NGINX 支持 WordPress 多站点 ### + +WordPress 多站点(WordPress Multisite),顾名思义,这个版本 WordPress 可以让你以单个实例管理两个或多个网站。[WordPress.com][44] 运行的就是 WordPress 多站点,其主机为成千上万的用户提供博客服务。 + +你可以从单个域的任何子目录或从不同的子域来运行独立的网站。 + +使用此代码块添加对子目录的支持。 + + # 在 WordPress 多站点中添加对子目录结构的支持 + if (!-e $request_filename) { + rewrite /wp-admin$ $scheme://$host$uri/ permanent; + rewrite ^(/[^/]+)?(/wp-.*) $2 last; + rewrite ^(/[^/]+)?(/.*\.php) $2 last; + } + +使用此代码块来替换上面的代码块以添加对子目录结构的支持,替换为你自己的子目录名。 + + # 添加支持子域名 + server_name example.com *.example.com; + +旧版本(3.4以前)的 WordPress 多站点使用 readfile() 来提供静态内容。然而,readfile() 是 PHP 代码,它会导致在执行时性能会显著降低。我们可以用 NGINX 来绕过这个非必要的 PHP 处理。该代码片段在下面被(==============)线分割出来了。 + + # 避免对子目录中 /blogs.dir/ 结构执行 PHP readfile() + location ^~ /blogs.dir { + internal; + alias /var/www/example.com/htdocs/wp-content/blogs.dir; + access_log off; + log_not_found off; + expires max; + } + + ============================================================ + + # 避免对子目录中 /files/ 结构执行 PHP readfile() + location ~ ^(/[^/]+/)?files/(?.+) { + try_files /wp-content/blogs.dir/$blogid/files/$rt_file /wp-includes/ms-files.php?file=$rt_file; + access_log off; + log_not_found off; + expires max; + } + + ============================================================ + + # 子域路径的WPMU 文件结构 + location ~ ^/files/(.*)$ { + try_files /wp-includes/ms-files.php?file=$1 =404; + access_log off; + log_not_found off; + expires max; + } + + ============================================================ + + # 映射博客 ID 到特定的目录 + map $http_host $blogid { + default 0; + example.com 1; + site1.example.com 2; + site1.com 2; + } + +### 结论 ### + +可扩展性对许多要让他们的 WordPress 站点取得成功的开发者来说是一项挑战。(对于那些想要跨越 WordPress 性能门槛的新站点而言。)为 WordPress 添加缓存,并将 WordPress 和 NGINX 结合,是不错的答案。 + +NGINX 不仅用于 WordPress 网站。世界上排名前 1000、10000 和 100000 网站中 NGINX 也是 [遥遥领先的 web 服务器][45]。 + +欲了解更多有关 NGINX 的性能,请看我们最近的博客,[让应用性能提升 10 倍的 10 个技巧][46]。 + +NGINX 软件有两个版本: + +- NGINX 开源软件 - 像 WordPress 一样,此软件你可以自行下载,配置和编译。 +- NGINX Plus - NGINX Plus 包括一个预构建的参考版本的软件,以及服务和技术支持。 + +想要开始,先到 [nginx.org][47] 下载开源软件并了解下 [NGINX Plus][48]。 + +-------------------------------------------------------------------------------- + +via: https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/ + +作者:[Floyd Smith][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.nginx.com/blog/author/floyd/ +[1]:http://w3techs.com/technologies/overview/content_management/all +[2]:https://www.nginx.com/press/choosing-nginx-growth-wordpresscom/ +[3]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#cache-static +[4]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#cache-dynamic +[5]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#adopt-nginx +[6]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#permalink +[7]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#fastcgi +[8]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#w3-total-cache +[9]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#wp-super-cache +[10]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#security +[11]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#multisite +[12]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#adopt-nginx +[13]:http://www.mobify.com/blog/beginners-guide-to-http-cache-headers/ +[14]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#adopt-nginx +[15]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#lamp +[16]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#adopt-nginx +[17]:https://wordpress.org/plugins/hyper-cache/ +[18]:https://wordpress.org/plugins/quick-cache/ +[19]:https://wordpress.org/plugins/wp-super-cache/ +[20]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#wp-super-cache +[21]:https://wordpress.org/plugins/w3-total-cache/ +[22]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#w3-total-cache +[23]:http://www.fastcgi.com/ +[24]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#fastcgi +[25]:https://css-tricks.com/wordpress-fragment-caching-revisited/ +[26]:https://www.nginx.com/resources/admin-guide/content-caching/ +[27]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#cache-dynamic +[28]:https://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt +[29]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#permalink +[30]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#fastcgi +[31]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#w3-total-cache +[32]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#wp-super-cache +[33]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#security +[34]:https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#multisite +[35]:http://codex.wordpress.org/Using_Permalinks +[36]:http://nginx.org/en/docs/http/ngx_http_core_module.html#server +[37]:https://github.com/FRiCKLE/ngx_cache_purge +[38]:https://wordpress.org/plugins/nginx-helper/ +[39]:http://nginx.org/en/docs/http/ngx_http_upstream_module.html#variables +[40]:https://wordpress.org/plugins/w3-total-cache/ +[41]:http://www.w3-edge.com/ +[42]:https://wordpress.org/plugins/wp-super-cache/ +[43]:http://automattic.com/ +[44]:https://wordpress.com/ +[45]:http://w3techs.com/technologies/cross/web_server/ranking +[46]:https://www.nginx.com/blog/10-tips-for-10x-application-performance/ +[47]:http://www.nginx.org/en +[48]:https://www.nginx.com/products/ +[49]: +[50]: diff --git a/published/201512/20151030 How To Install FreeBSD on Raspberry Pi 2 Model B.md b/published/201512/20151030 How To Install FreeBSD on Raspberry Pi 2 Model B.md new file mode 100644 index 0000000000..6057efd5fb --- /dev/null +++ b/published/201512/20151030 How To Install FreeBSD on Raspberry Pi 2 Model B.md @@ -0,0 +1,96 @@ + +如何在树莓派 2B 上安装 FreeBSD +================================================================================ + +在树莓派 2B 上如何安装 FreeBSD 10 或 FreeBSD 11(current)?怎么在 Linux,OS X,FreeBSD 或类 Unix 操作系统上烧录 SD 卡? + +在树莓派 2B 上安装 FreeBSD 10 或 FreeBSD 11(current)很容易。使用 FreeBSD 操作系统可以打造一个非常易用的 Unix 服务器。FreeBSD-CURRENT 自2012年十一月以来一直支持树莓派,2015年三月份后也开始支持树莓派2了。在这个快速教程中我将介绍如何在树莓派 2B 上安装 FreeBSD 11 current arm 版。 + +### 1. 下载 FreeBSD-current 的 arm 镜像 ### + +你可以 [访问这个页面来下载][1] 树莓派2的镜像。使用 wget 或 curl 命令来下载镜像: + + $ wget ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv6/ISO-IMAGES/11.0/FreeBSD-11.0-CURRENT-arm-armv6-RPI2-20151016-r289420.img.xz + +或 + + $ curl -O ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv6/ISO-IMAGES/11.0/FreeBSD-11.0-CURRENT-arm-armv6-RPI2-20151016-r289420.img.xz + +### 2. 解压 FreeBSD-current 镜像 ### + +执行以下命令中的任何一个: + + $ unxz FreeBSD-11.0-CURRENT-arm-armv6-RPI2-20151016-r289420.img.xz + +或 + + $ xz --decompress FreeBSD-11.0-CURRENT-arm-armv6-RPI2-20151016-r289420.img.xz + +### 3. 设置 SD ### + +你可以在 OS X,Linux,FreeBSD,MS-Windows 和类 Unix 系统来烧录 SD 卡。 + +### 在 Mac OS X 下烧录 FreeBSD-current ### + +使用下面的 dd 命令: + + $ diskutil list + $ diskutil unmountDisk /dev/diskN + $ sudo dd if=FreeBSD-11.0-CURRENT-arm-armv6-RPI2-20151016-r289420.img of=/dev/disk2 bs=64k + +示例输出: + + 1024+0 records in + 1024+0 records out + 1073741824 bytes transferred in 661.669584 secs (1622776 bytes/sec) + +#### 使用 Linux/FreeBSD 或者类 Unix 系统来烧录 FreeBSD-current #### + +语法是这样: + + $ dd if=FreeBSD-11.0-CURRENT-arm-armv6-RPI2-20151016-r289420.img of=/dev/sdb bs=1M + +**确保使用实际的 SD 卡的设备名称来替换 /dev/sdb**(LCTT 译注:千万注意不要写错了)。 + +### 4. 引导 FreeBSD ### + +在树莓派 2B 上插入 SD 卡。你需要连接键盘,鼠标和显示器。我使用的是 USB 转串口线来连接显示器的: + +![Fig.01 RPi USB based serial connection](http://s0.cyberciti.org/uploads/faq/2015/10/Raspberry-Pi-2-Model-B.pin-out.jpg) + +*图01 基于树莓派 USB 的串行连接* + +在下面的例子中,我使用 screen 命令来连接我的 RPI: + + ## Linux 上 ## + screen /dev/tty.USB0 115200 + + ## OS X 上 ## + screen /dev/cu.usbserial 115200 + + ## Windows 请使用 Putty.exe ## + +FreeBSD RPI 启动输出样例: + +![Gif 01: Booting FreeBSD-current on RPi 2](http://s0.cyberciti.org/uploads/faq/2015/10/freebsd-current-rpi.gif) + +*图02: 在树莓派 2上引导 FreeBSD-current* + +### 5. FreeBSD 在 RPi 2上的用户名和密码 ### + +默认的密码是 freebsd/freebsd 和 root/root。 + +到此为止, FreeBSD-current 已经安装并运行在树莓派 2上。 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/faq/how-to-install-freebsd-on-raspberry-pi-2-model-b/ + +作者:[Vivek Gite][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.cyberciti.biz/tips/about-us +[1]:ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv6/ISO-IMAGES/11.0 diff --git a/published/201512/20151104 How to Install Redis Server on CentOS 7.md b/published/201512/20151104 How to Install Redis Server on CentOS 7.md new file mode 100644 index 0000000000..90e090ef39 --- /dev/null +++ b/published/201512/20151104 How to Install Redis Server on CentOS 7.md @@ -0,0 +1,239 @@ +如何在 CentOS 7 上安装 Redis 服务器 +================================================================================ + +大家好,本文的主题是 Redis,我们将要在 CentOS 7 上安装它。编译源代码,安装二进制文件,创建、安装文件。在安装了它的组件之后,我们还会配置 redis ,就像配置操作系统参数一样,目标就是让 redis 运行的更加可靠和快速。 + +![Runnins Redis](http://blog.linoxide.com/wp-content/uploads/2015/10/run-redis-standalone.jpg) + +*Redis 服务器* + +Redis 是一个开源的多平台数据存储软件,使用 ANSI C 编写,直接在内存使用数据集,这使得它得以实现非常高的效率。Redis 支持多种编程语言,包括 Lua, C, Java, Python, Perl, PHP 和其他很多语言。redis 的代码量很小,只有约3万行,它只做“很少”的事,但是做的很好。尽管是在内存里工作,但是数据持久化的保存还是有的,而redis 的可靠性就很高,同时也支持集群,这些可以很好的保证你的数据安全。 + +### 构建 Redis ### + +redis 目前没有官方 RPM 安装包,我们需要从源代码编译,而为了要编译就需要安装 Make 和 GCC。 + +如果没有安装过 GCC 和 Make,那么就使用 yum 安装。 + + yum install gcc make + +从[官网][1]下载 tar 压缩包。 + + curl http://download.redis.io/releases/redis-3.0.4.tar.gz -o redis-3.0.4.tar.gz + +解压缩。 + + tar zxvf redis-3.0.4.tar.gz + +进入解压后的目录。 + + cd redis-3.0.4 + +使用Make 编译源文件。 + + make + +### 安装 ### + +进入源文件的目录。 + + cd src + +复制 Redis 的服务器和客户端到 /usr/local/bin。 + + cp redis-server redis-cli /usr/local/bin + +最好也把 sentinel,benchmark 和 check 复制过去。 + + cp redis-sentinel redis-benchmark redis-check-aof redis-check-dump /usr/local/bin + +创建redis 配置文件夹。 + + mkdir /etc/redis + +在`/var/lib/redis` 下创建有效的保存数据的目录 + + mkdir -p /var/lib/redis/6379 + +#### 系统参数 #### + +为了让 redis 正常工作需要配置一些内核参数。 + +配置 `vm.overcommit_memory` 为1,这可以避免数据被截断,详情[见此][2]。 + + sysctl -w vm.overcommit_memory=1 + +修改 backlog 连接数的最大值超过 redis.conf 中的 `tcp-backlog` 值,即默认值511。你可以在[kernel.org][3] 找到更多有关基于 sysctl 的 ip 网络隧道的信息。 + + sysctl -w net.core.somaxconn=512 + +取消对透明巨页内存(transparent huge pages)的支持,因为这会造成 redis 使用过程产生延时和内存访问问题。 + + echo never > /sys/kernel/mm/transparent_hugepage/enabled + +### redis.conf ### + +redis.conf 是 redis 的配置文件,然而你会看到这个文件的名字是 6379.conf ,而这个数字就是 redis 监听的网络端口。如果你想要运行超过一个的 redis 实例,推荐用这样的名字。 + +复制示例的 redis.conf 到 **/etc/redis/6379.conf**。 + + cp redis.conf /etc/redis/6379.conf + +现在编辑这个文件并且配置参数。 + + vi /etc/redis/6379.conf + +#### daemonize #### + +设置 `daemonize` 为 no,systemd 需要它运行在前台,否则 redis 会突然挂掉。 + + daemonize no + +#### pidfile #### + +设置 `pidfile` 为 /var/run/redis_6379.pid。 + + pidfile /var/run/redis_6379.pid + +#### port #### + +如果不准备用默认端口,可以修改。 + + port 6379 + +#### loglevel #### + +设置日志级别。 + + loglevel notice + +#### logfile #### + +修改日志文件路径。 + + logfile /var/log/redis_6379.log + +#### dir #### + +设置目录为 /var/lib/redis/6379 + + dir /var/lib/redis/6379 + +### 安全 ### + +下面有几个可以提高安全性的操作。 + +#### Unix sockets #### + +在很多情况下,客户端程序和服务器端程序运行在同一个机器上,所以不需要监听网络上的 socket。如果这和你的使用情况类似,你就可以使用 unix socket 替代网络 socket,为此你需要配置 `port` 为0,然后配置下面的选项来启用 unix socket。 + +设置 unix socket 的套接字文件。 + + unixsocket /tmp/redis.sock + +限制 socket 文件的权限。 + + unixsocketperm 700 + +现在为了让 redis-cli 可以访问,应该使用 -s 参数指向该 socket 文件。 + + redis-cli -s /tmp/redis.sock + +#### requirepass #### + +你可能需要远程访问,如果是,那么你应该设置密码,这样子每次操作之前要求输入密码。 + + requirepass "bTFBx1NYYWRMTUEyNHhsCg" + +#### rename-command #### + +想象一下如下指令的输出。是的,这会输出服务器的配置,所以你应该在任何可能的情况下拒绝这种访问。 + + CONFIG GET * + +为了限制甚至禁止这条或者其他指令可以使用 `rename-command` 命令。你必须提供一个命令名和替代的名字。要禁止的话需要设置替代的名字为空字符串,这样禁止任何人猜测命令的名字会比较安全。 + + rename-command FLUSHDB "FLUSHDB_MY_SALT_G0ES_HERE09u09u" + rename-command FLUSHALL "" + rename-command CONFIG "CONFIG_MY_S4LT_GO3S_HERE09u09u" + +![Access Redis through unix with password and command changes](http://blog.linoxide.com/wp-content/uploads/2015/10/redis-security-test.jpg) + +*使用密码通过 unix socket 访问,和修改命令* + +#### 快照 #### + +默认情况下,redis 会周期性的将数据集转储到我们设置的目录下的 **dump.rdb** 文件。你可以使用 `save` 命令配置转储的频率,它的第一个参数是以秒为单位的时间帧,第二个参数是在数据文件上进行修改的数量。 + +每隔15分钟并且最少修改过一次键。 + + save 900 1 + +每隔5分钟并且最少修改过10次键。 + + save 300 10 + +每隔1分钟并且最少修改过10000次键。 + + save 60 10000 + +文件 `/var/lib/redis/6379/dump.rdb` 包含了从上次保存以来内存里数据集的转储数据。因为它先创建临时文件然后替换之前的转储文件,这里不存在数据破坏的问题,你不用担心,可以直接复制这个文件。 + +### 开机时启动 ### + +你可以使用 systemd 将 redis 添加到系统开机启动列表。 + +复制示例的 init_script 文件到 `/etc/init.d`,注意脚本名所代表的端口号。 + + cp utils/redis_init_script /etc/init.d/redis_6379 + +现在我们要使用 systemd,所以在 `/etc/systems/system` 下创建一个单位文件名字为 `redis_6379.service`。 + + vi /etc/systemd/system/redis_6379.service + +填写下面的内容,详情可见 systemd.service。 + + [Unit] + Description=Redis on port 6379 + + [Service] + Type=forking + ExecStart=/etc/init.d/redis_6379 start + ExecStop=/etc/init.d/redis_6379 stop + + [Install] + WantedBy=multi-user.target + +现在添加我之前在 `/etc/sysctl.conf` 里面修改过的内存过量使用和 backlog 最大值的选项。 + + vm.overcommit_memory = 1 + + net.core.somaxconn=512 + +对于透明巨页内存支持,并没有直接 sysctl 命令可以控制,所以需要将下面的命令放到 `/etc/rc.local` 的结尾。 + + echo never > /sys/kernel/mm/transparent_hugepage/enabled + +### 总结 ### + +这样就可以启动了,通过设置这些选项你就可以部署 redis 服务到很多简单的场景,然而在 redis.conf 还有很多为复杂环境准备的 redis 选项。在一些情况下,你可以使用 [replication][4] 和 [Sentinel][5] 来提高可用性,或者[将数据分散][6]在多个服务器上,创建服务器集群。 + +谢谢阅读。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/storage/install-redis-server-centos-7/ + +作者:[Carlos Alberto][a] +译者:[ezio](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/carlosal/ +[1]:http://redis.io/download +[2]:https://www.kernel.org/doc/Documentation/vm/overcommit-accounting +[3]:https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt +[4]:http://redis.io/topics/replication +[5]:http://redis.io/topics/sentinel +[6]:http://redis.io/topics/partitioning diff --git a/published/201512/20151105 Linus Torvalds Lambasts Open Source Programmers over Insecure Code.md b/published/201512/20151105 Linus Torvalds Lambasts Open Source Programmers over Insecure Code.md new file mode 100644 index 0000000000..964a9774ca --- /dev/null +++ b/published/201512/20151105 Linus Torvalds Lambasts Open Source Programmers over Insecure Code.md @@ -0,0 +1,35 @@ +开源开发者提交不安全代码,遭 Linus 炮轰 +================================================================================ +![](http://thevarguy.com/site-files/thevarguy.com/files/imagecache/medium_img/uploads/2015/11/linus-torvalds.jpg) + +Linus 上个月骂了一个 Linux 开发者,原因是他向 kernel 提交了一份不安全的代码。 + +Linus 是个 Linux 内核项目非官方的“仁慈的独裁者(benevolent dictator)”(LCTT译注:英国《卫报》曾将乔布斯评价为‘仁慈的独裁者’),这意味着他有权决定将哪些代码合入内核,哪些代码直接丢掉。 + +在10月28号,一个开源开发者提交的代码未能符合 Torvalds 的要求,于是遭来了[一顿臭骂][1]。Torvalds 在他提交的代码下评论道:“你提交的是什么东西。” + +接着他说这个开发者是“毫无能力的神经病”。 + +Torvalds 为什么会这么生气?他觉得那段代码可以写得更有效率一点,可读性更强一点,编译器编译后跑得更好一点(编译器的作用就是将让人看的代码翻译成让电脑看的代码)。 + +Torvalds 重新写了一版代码将原来的那份替换掉,并建议所有开发者应该像他那种风格来写代码。 + +Torvalds 一直在嘲讽那些不符合他观点的人。早在1991年他就攻击过 [Andrew Tanenbaum][2]——那个 Minix 操作系统的作者,而那个 Minix 操作系统被 Torvalds 描述为“脑残”。 + +但是 Torvalds 在这次嘲讽中表现得更有战略性了:“我想让*每个人*都知道,像他这种代码是完全不能被接收的。”他说他的目的是提醒每个 Linux 开发者,而不是针对那个开发者。 + +Torvalds 也用这个机会强调了烂代码的安全问题。现在的企业对安全问题很重视,所以安全问题需要在开源开发者心中得到足够重视,甚至需要在代码中表现为最高等级(LCTT 译注:操作系统必须权衡许多因素:安全、处理速度、灵活性、易用性等,而这里 Torvalds 将安全提升为最高优先级了)。骂一下那些提交不安全代码的开发者可以帮助提高 Linux 系统的安全性。 + +-------------------------------------------------------------------------------- + +via: http://thevarguy.com/open-source-application-software-companies/110415/linus-torvalds-lambasts-open-source-programmers-over-inse + +作者:[Christopher Tozzi][a] +译者:[bazz2](https://github.com/bazz2) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://thevarguy.com/author/christopher-tozzi +[1]:http://lkml.iu.edu/hypermail/linux/kernel/1510.3/02866.html +[2]:https://en.wikipedia.org/wiki/Tanenbaum%E2%80%93Torvalds_debate diff --git a/published/201512/20151109 How to Monitor the Progress of a Linux Command Line Operation Using PV Command.md b/published/201512/20151109 How to Monitor the Progress of a Linux Command Line Operation Using PV Command.md new file mode 100644 index 0000000000..37e17b4266 --- /dev/null +++ b/published/201512/20151109 How to Monitor the Progress of a Linux Command Line Operation Using PV Command.md @@ -0,0 +1,80 @@ +如何使用 pv 命令监控 linux 命令的执行进度 +================================================================================ + +![](https://www.maketecheasier.com/assets/uploads/2015/11/pv-featured-1.jpg) + +如果你是一个 linux 系统管理员,那么毫无疑问你必须花费大量的工作时间在命令行上:安装和卸载软件,监视系统状态,复制、移动、删除文件,查错,等等。很多时候都是你输入一个命令,然后等待很长时间直到执行完成。也有的时候你执行的命令挂起了,而你只能猜测命令执行的实际情况。 + +通常 linux 命令不提供和进度相关的信息,而这些信息特别重要,尤其当你只有有限的时间时。然而这并不意味着你是无助的——现在有一个命令,pv,它会显示当前在命令行执行的命令的进度信息。在本文我们会讨论它并用几个简单的例子说明其特性。 + +### PV 命令 ### + +[PV][1] 由Andrew Wood 开发,是 Pipe Viewer 的简称,意思是通过管道显示数据处理进度的信息。这些信息包括已经耗费的时间,完成的百分比(通过进度条显示),当前的速度,全部传输的数据,以及估计剩余的时间。 + +> "要使用 PV,需要配合合适的选项,把它放置在两个进程之间的管道。命令的标准输入将会通过标准输出传进来的,而进度会被输出到标准错误输出。” + +上述解释来自该命令的帮助页。 + +### 下载和安装 ### + +Debian 系的操作系统,如 Ubuntu,可以简单的使用下面的命令安装 PV: + + sudo apt-get install pv + +如果你使用了其他发行版本,你可以使用各自的包管理软件在你的系统上安装 PV。一旦 PV 安装好了你就可以在各种场合使用它(详见下文)。需要注意的是下面所有例子都使用的是 pv 1.2.0。 + +### 特性和用法 ### + +我们(在 linux 上使用命令行的用户)的大多数使用场景都会用到的命令是从一个 USB 驱动器拷贝电影文件到你的电脑。如果你使用 cp 来完成上面的任务,你会什么情况都不清楚,直到整个复制过程结束或者出错。 + +然而pv 命令在这种情景下很有帮助。比如: + + pv /media/himanshu/1AC2-A8E3/fNf.mkv > ./Desktop/fnf.mkv + +输出如下: + +![pv-copy](https://www.maketecheasier.com/assets/uploads/2015/10/pv-copy.png) + +所以,如你所见,这个命令显示了很多和操作有关的有用信息,包括已经传输了的数据量,花费的时间,传输速率,进度条,进度的百分比,以及剩余的时间。 + +`pv` 命令提供了多种显示选项开关。比如,你可以使用`-p` 来显示百分比,`-t` 来显示时间,`-r` 表示传输速率,`-e` 代表eta(LCTT 译注:估计剩余的时间)。好事是你不必记住某一个选项,因为默认这几个选项都是启用的。但是,如果你只要其中某一个信息,那么可以通过控制这几个选项来完成任务。 + +这里还有一个`-n` 选项来允许 pv 命令显示整数百分比,在标准错误输出上每行显示一个数字,用来替代通常的可视进度条。下面是一个例子: + + pv -n /media/himanshu/1AC2-A8E3/fNf.mkv > ./Desktop/fnf.mkv + +![pv-numeric](https://www.maketecheasier.com/assets/uploads/2015/10/pv-numeric.png) + +这个特殊的选项非常合适某些情境下的需求,如你想把用管道把输出传给[dialog][2] 命令。 + +接下来还有一个命令行选项,`-L` 可以让你修改 pv 命令的传输速率。举个例子,使用 -L 选项来限制传输速率为2MB/s。 + + pv -L 2m /media/himanshu/1AC2-A8E3/fNf.mkv > ./Desktop/fnf.mkv + +![pv-ratelimit](https://www.maketecheasier.com/assets/uploads/2015/10/pv-ratelimit.png) + +如上图所见,数据传输速度按照我们的要求被限制了。 + +另一个pv 可以帮上忙的情景是压缩文件。这里有一个例子可以向你解释如何与压缩软件Gzip 一起工作。 + + pv /media/himanshu/1AC2-A8E3/fnf.mkv | gzip > ./Desktop/fnf.log.gz + +![pv-gzip](https://www.maketecheasier.com/assets/uploads/2015/10/pv-gzip.png) + +### 结论 ### + +如上所述,pv 是一个非常有用的小工具,它可以在命令没有按照预期执行的情况下帮你节省你宝贵的时间。而且这些显示的信息还可以用在 shell 脚本里。我强烈的推荐你使用这个命令,它值得你一试。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/monitor-progress-linux-command-line-operation/ + +作者:[Himanshu Arora][a] +译者:[ezio](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/himanshu/ +[1]:http://linux.die.net/man/1/pv +[2]:http://linux.die.net/man/1/dialog diff --git a/published/201512/20151109 How to Set Up AWStats On Ubuntu Server.md b/published/201512/20151109 How to Set Up AWStats On Ubuntu Server.md new file mode 100644 index 0000000000..7bea4e40d8 --- /dev/null +++ b/published/201512/20151109 How to Set Up AWStats On Ubuntu Server.md @@ -0,0 +1,107 @@ +如何在 Ubuntu 服务器中配置 AWStats +================================================================================ +![](https://www.maketecheasier.com/assets/uploads/2015/10/Apache_awstats_featured.jpg) + +AWStats 是一个开源的网站分析报告工具,可以生成强大的网站、流媒体、FTP 或邮件服务器的访问统计图。此日志分析器以 CGI 或命令行方式进行工作,并在网页中以图表的形式尽可能的显示你日志中所有的信息。它可以“部分”读取信息文件,以便能够频繁并快速处理大量的日志文件。它支持绝大多数 Web 服务器日志文件格式,包括 Apache,IIS 等。 + +本文将帮助你在 Ubuntu 上安装配置 AWStats。 + +### 安装 AWStats 包 ### + +默认情况下,AWStats 的包可以在 Ubuntu 仓库中找到。 + +可以通过运行下面的命令来安装: + + sudo apt-get install awstats + +接下来,你需要启用 Apache 的 CGI 模块。 + +运行以下命令来启动 CGI: + + sudo a2enmod cgi + +现在,重新启动 Apache 以使改变生效。 + + sudo /etc/init.d/apache2 restart + +### 配置 AWStats ### + +你需要为你想要查看统计的每个域或网站创建一个配置文件。在这个例子中,我们将为 “test.com” 创建一个配置文件。 + +要完成此步,你可以通过复制 AWStats 的默认配置文件来配置你要统计的域。 + + sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.test.com.conf + +现在,你需要在配置文件中做一些修改: + + sudo nano /etc/awstats/awstats.test.com.conf + +像下面这样修改一下: + + # Change to Apache log file, by default it's /var/log/apache2/access.log + LogFile="/var/log/apache2/access.log" + + # Change to the website domain name + SiteDomain="test.com" + HostAliases="www.test.com localhost 127.0.0.1" + + # When this parameter is set to 1, AWStats adds a button on report page to allow to "update" statistics from a web browser + AllowToUpdateStatsFromBrowser=1 + +保存并关闭文件。 + +修改配置文件后,你需要用服务器的当前日志建立初步统计。你可以这样做: + + sudo /usr/lib/cgi-bin/awstats.pl -config=test.com -update + +输出会是这个样子: + +![awtstats](https://www.maketecheasier.com/assets/uploads/2015/10/awtstats.png) + +### 为 Apache 配置 AWStats ### + +接下来,你需要配置 Apache2 来显示统计数据。现在你需要将 “cgi-bin” 文件夹中的内容复制到 Apache 默认根目录下。默认它是在 “/usr/lib/cgi-bin”。 + +运行以下命令来完成此步: + + sudo cp -r /usr/lib/cgi-bin /var/www/html/ + sudo chown www-data:www-data /var/www/html/cgi-bin/ + sudo chmod -R 755 /var/www/html/cgi-bin/ + +### 测试 AWStats ### + +现在,您可以通过访问 url “http://your-server-ip/cgi-bin/awstats.pl?config=test.com.” 来查看 AWStats 的页面。 + +它的页面像下面这样: + +![awstats_page](https://www.maketecheasier.com/assets/uploads/2015/10/awstats_page.jpg) + +### 设置定时任务来更新日志 ### + +建议你创建一个定时任务,使用新创建的日志条目定期更新 AWStats 的数据库,然后统计会定期更新。这也将节省你的时间。 + +要做到这一点,你需要编辑 “/etc/crontab” 文件: + + sudo nano /etc/crontab + +添加下面那一行来让 AWStats 每十分钟更新一次。 + + */10 * * * * root /usr/lib/cgi-bin/awstats.pl -config=test.com -update + +保存并关闭文件。 + +### 结论 ### + +AWStats 是一个非常有用的工具,可以让你对网站的状况了如指掌,并能协助你分析网站。它非常容易安装和配置。如果你有任何疑问,请在下面发表评论。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/set-up-awstats-ubuntu/ + +作者:[Hitesh Jethva][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/hiteshjethva/ diff --git a/published/201512/20151117 Install PostgreSQL 9.4 And phpPgAdmin On Ubuntu 15.10.md b/published/201512/20151117 Install PostgreSQL 9.4 And phpPgAdmin On Ubuntu 15.10.md new file mode 100644 index 0000000000..040fb40302 --- /dev/null +++ b/published/201512/20151117 Install PostgreSQL 9.4 And phpPgAdmin On Ubuntu 15.10.md @@ -0,0 +1,313 @@ +在 Ubuntu 上安装世界上最先进的开源数据库 PostgreSQL 9.4 和 phpPgAdmin +================================================================================ +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2014/05/postgresql.png) + +### 简介 ### + +[PostgreSQL][1] 是一款强大的,开源的,对象关系型数据库系统。它支持所有的主流操作系统,包括 Linux、Unix(AIX、BSD、HP-UX,SGI IRIX、Mac OS、Solaris、Tru64) 以及 Windows 操作系统。 + +下面是 **Ubuntu** 发起者 **Mark Shuttleworth** 对 PostgreSQL 的一段评价。 + +> PostgreSQL 是一款极赞的数据库系统。刚开始我们在 Launchpad 上使用它的时候,并不确定它能否胜任工作。但我是错了。它很强壮、快速,在各个方面都很专业。 +> +> — Mark Shuttleworth. + +在这篇简短的指南中,让我们来看看如何在 Ubuntu 15.10 服务器中安装 PostgreSQL 9.4。 + +### 安装 PostgreSQL ### + +默认仓库中就有可用的 PostgreSQL。在终端中输入下面的命令安装它。 + + sudo apt-get install postgresql postgresql-contrib + +如果你需要其它的版本,按照下面那样先添加 PostgreSQL 仓库然后再安装。 + +**PostgreSQL apt 仓库** 支持 amd64 和 i386 架构的 Ubuntu 长期支持版(10.04、12.04 和 14.04),以及非长期支持版(14.04)。对于其它非长期支持版,该软件包虽然没有完全支持,但使用和 LTS 版本近似的也能正常工作。 + +#### Ubuntu 14.10 系统: #### + +新建文件**/etc/apt/sources.list.d/pgdg.list**; + + sudo vi /etc/apt/sources.list.d/pgdg.list + +用下面一行添加仓库: + + deb http://apt.postgresql.org/pub/repos/apt/ utopic-pgdg main + +**注意**: 上面的库只能用于 Ubuntu 14.10。还没有升级到 Ubuntu 15.04 和 15.10。 + +对于 **Ubuntu 14.04**,添加下面一行: + + deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main + +对于 **Ubuntu 12.04**,添加下面一行: + + deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main + +导入库签名密钥: + + wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc + + sudo apt-key add - + +更新软件包列表: + + sudo apt-get update + +然后安装需要的版本。 + + sudo apt-get install postgresql-9.4 + +### 访问 PostgreSQL 命令窗口 ### + +默认的数据库名称和数据库用户名称都是 “**postgres**”。切换到 postgres 用户进行 postgresql 相关的操作: + + sudo -u postgres psql postgres + +#### 示例输出: #### + + psql (9.4.5) + Type "help" for help. + postgres=# + +要退出 postgresql 窗口,在 **psql** 窗口输入 **\q** 退出到终端。 + +### 设置 “postgres” 用户密码 ### + +登录到 postgresql 窗口, + + sudo -u postgres psql postgres + +用下面的命令为用户 postgres 设置密码: + + postgres=# \password postgres + Enter new password: + Enter it again: + postgres=# \q + +要安装 PostgreSQL Adminpack 扩展,在 postgresql 窗口输入下面的命令: + + sudo -u postgres psql postgres + +---------- + + postgres=# CREATE EXTENSION adminpack; + CREATE EXTENSION + +在 **psql** 窗口输入 **\q** 从 postgresql 窗口退回到终端。 + +### 创建新用户和数据库 ### + +例如,让我们创建一个新的用户,名为 “**senthil**”,密码是 “**ubuntu**”,以及名为 “**mydb**” 的数据库。 + + sudo -u postgres createuser -D -A -P senthil + +---------- + + sudo -u postgres createdb -O senthil mydb + +### 删除用户和数据库 ### + +要删除数据库,首先切换到 postgres 用户: + + sudo -u postgres psql postgres + +输入命令: + + $ drop database + +要删除一个用户,输入下面的命令: + + $ drop user + +### 配置 PostgreSQL-MD5 验证 ### + +**MD5 验证** 要求用户提供一个 MD5 加密的密码用于认证。首先编辑 **/etc/postgresql/9.4/main/pg_hba.conf** 文件: + + sudo vi /etc/postgresql/9.4/main/pg_hba.conf + +按照下面所示添加或修改行 + + [...] + # TYPE DATABASE USER ADDRESS METHOD + # "local" is for Unix domain socket connections only + local all all md5 + # IPv4 local connections: + host all all 127.0.0.1/32 md5 + host all all 192.168.1.0/24 md5 + # IPv6 local connections: + host all all ::1/128 md5 + [...] + +其中, 192.168.1.0/24 是我的本地网络 IP 地址。用你自己的地址替换。 + +重启 postgresql 服务以使更改生效: + + sudo systemctl restart postgresql + +或者, + + sudo service postgresql restart + +### 配置 PostgreSQL TCP/IP 配置 ### + +默认情况下,没有启用 TCP/IP 连接,因此其它计算机的用户不能访问 postgresql。为了允许其它计算机的用户访问,编辑文件 **/etc/postgresql/9.4/main/postgresql.conf:** + + sudo vi /etc/postgresql/9.4/main/postgresql.conf + +找到下面一行: + + [...] + #listen_addresses = 'localhost' + [...] + #port = 5432 + [...] + +取消该行的注释,然后设置你 postgresql 服务器的 IP 地址,或者设置为 ‘*’ 监听所有用户。你应该谨慎设置所有远程用户都可以访问 PostgreSQL。 + + [...] + listen_addresses = '*' + [...] + port = 5432 + [...] + +重启 postgresql 服务保存更改: + + sudo systemctl restart postgresql + +或者, + + sudo service postgresql restart + +### 用 phpPgAdmin 管理 PostgreSQL ### + +[**phpPgAdmin**][2] 是基于 web 用 PHP 写的 PostgreSQL 管理工具。 + +默认仓库中有可用的 phpPgAdmin。用下面的命令安装 phpPgAdmin: + + sudo apt-get install phppgadmin + +默认情况下,你可以在本地系统的 web 浏览器用 **http://localhost/phppgadmin** 访问 phppgadmin。 + +要访问远程系统,在 Ubuntu 15.10 上做如下操作: + +编辑文件 **/etc/apache2/conf-available/phppgadmin.conf**, + + sudo vi /etc/apache2/conf-available/phppgadmin.conf + +找到 **Require local** 的一行在这行前面添加 **#** 注释掉它。 + + #Require local + +添加下面的一行: + + allow from all + +保存并退出文件。 + +然后重启 apache 服务。 + + sudo systemctl restart apache2 + +对于 Ubuntu 14.10 及之前版本: + +编辑 **/etc/apache2/conf.d/phppgadmin**: + + sudo nano /etc/apache2/conf.d/phppgadmin + +注释掉下面一行: + + [...] + #allow from 127.0.0.0/255.0.0.0 ::1/128 + +取消下面一行的注释使所有系统都可以访问 phppgadmin。 + + allow from all + +编辑 **/etc/apache2/apache2.conf**: + + sudo vi /etc/apache2/apache2.conf + +添加下面一行: + + Include /etc/apache2/conf.d/phppgadmin + +然后重启 apache 服务。 + + sudo service apache2 restart + +### 配置 phpPgAdmin ### + +编辑文件 **/etc/phppgadmin/config.inc.php**, 做以下更改。下面大部分选项都带有解释。认真阅读以便了解为什么要更改这些值。 + + sudo nano /etc/phppgadmin/config.inc.php + +找到下面一行: + + $conf['servers'][0]['host'] = ''; + +按照下面这样更改: + + $conf['servers'][0]['host'] = 'localhost'; + +找到这一行: + + $conf['extra_login_security'] = true; + +更改值为 **false**。 + + $conf['extra_login_security'] = false; + +找到这一行: + + $conf['owned_only'] = false; + +更改值为 **true**。 + + $conf['owned_only'] = true; + +保存并关闭文件。重启 postgresql 服务和 Apache 服务。 + + sudo systemctl restart postgresql + + sudo systemctl restart apache2 + +或者, + + sudo service postgresql restart + + sudo service apache2 restart + +现在打开你的浏览器并导航到 **http://ip-address/phppgadmin**。你会看到以下截图。 + +![phpPgAdmin ](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/11/phpPgAdmin-Google-Chrome_001.jpg) + +用你之前创建的用户登录。我之前已经创建了一个名为 “**senthil**” 的用户,密码是 “**ubuntu**”,因此我以 “senthil” 用户登录。 + +![phpPgAdmin ](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/11/phpPgAdmin-Google-Chrome_002.jpg) + +然后你就可以访问 phppgadmin 面板了。 + +![phpPgAdmin ](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/11/phpPgAdmin-Google-Chrome_003.jpg) + +用 postgres 用户登录: + +![phpPgAdmin ](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/11/phpPgAdmin-Google-Chrome_004.jpg) + +就是这样。现在你可以用 phppgadmin 可视化创建、删除或者更改数据库了。 + +加油! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/install-postgresql-9-4-and-phppgadmin-on-ubuntu-15-10/ + +作者:[SK][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.twitter.com/ostechnix +[1]:http://www.postgresql.org/ +[2]:http://phppgadmin.sourceforge.net/doku.php \ No newline at end of file diff --git a/published/201512/20151123 7 ways hackers can use Wi-Fi against you.md b/published/201512/20151123 7 ways hackers can use Wi-Fi against you.md new file mode 100644 index 0000000000..d8794383c7 --- /dev/null +++ b/published/201512/20151123 7 ways hackers can use Wi-Fi against you.md @@ -0,0 +1,71 @@ +黑客利用 Wi-Fi 攻击你的七种方法 +================================================================================ +![Image courtesy Thinkstock](http://core0.staticworld.net/images/article/2015/11/intro_title-100626673-orig.jpg) + +### 黑客利用 Wi-Fi 侵犯你隐私的七种方法 ### + +Wi-Fi — 啊,你是如此的方便,却又如此的危险! + +这里给大家介绍一下通过Wi-Fi连接“慷慨捐赠”你的身份信息的七种方法和反制措施。 + +![Image courtesy Thinkstock](http://core0.staticworld.net/images/article/2015/11/1_free-hotspots-100626674-orig.jpg) + +### 利用免费热点 ### + +它们似乎无处不在,而且它们的数量会在[接下来四年里增加三倍][1]。但是它们当中很多都是不值得信任的,从你的登录凭证、email 甚至更加敏感的账户,都能被黑客用“嗅探器(sniffers)”软件截获 — 这种软件能截获到任何你通过该连接提交的信息。防止被黑客盯上的最好办法就是使用VPN(虚拟私有网virtual private network),它加密了你所输入的信息,因此能够保护你的数据隐私。 + +![Image courtesy Thinkstock](http://core0.staticworld.net/images/article/2015/11/2_online-banking-100626675-orig.jpg) + +### 网上银行 ### + +你可能认为没有人需要被提醒不要使用免费 Wi-Fi 来操作网上银行, 但网络安全厂商卡巴斯基实验室表示**[全球超过100家银行因为网络黑客而损失9亿美元][2]**,由此可见还是有很多人因此受害。如果你确信一家咖啡店的免费 Wi-Fi 是正规的,想要连接它,那么你应该向服务员确认网络名称。[其他人在店里用路由器设置一个开放的无线连接][3],并将它的网络名称设置成店名是一件相当简单的事。 + +![Image courtesy Thinkstock](http://core0.staticworld.net/images/article/2015/11/3_keeping-wifi-on-100626676-orig.jpg) + +### 始终开着 Wi-Fi 开关 ### + +如果你手机的 Wi-Fi 开关一直开着的,你会自动被连接到一个不安全的网络中去,你甚至都没有意识到。你可以利用你手机中[基于位置的 Wi-Fi 功能][4],如果有这种功能的话,那它会在你离开你所保存的网络范围后自动关闭你的 Wi-Fi 开关并在你回去之后再次开启。 + +![Image courtesy Thinkstock](http://core0.staticworld.net/images/article/2015/11/4_not-using-firewall-100626677-orig.jpg) + +### 不使用防火墙 ### + +防火墙是你的第一道抵御恶意入侵的防线,它能有效地让你的电脑网络保持通畅并阻挡黑客和恶意软件。你应该时刻开启它除非你的杀毒软件有它自己的防火墙。 + +![Image courtesy Thinkstock](http://core0.staticworld.net/images/article/2015/11/5_browsing-unencrypted-sites-100626678-orig.jpg) + +### 浏览非加密网页 ### + +说起来很难过,**[世界上排名前100万个网站中55%是不加密的][5]**,一个未加密的网站会让一切传输数据暴露在黑客的眼中。如果一个网页是安全的,你的浏览器则会有标明(比如说火狐浏览器是一把灰色的挂锁,Chrome 浏览器则是个绿锁图标)。但是即使是安全的网站不能让你免于被劫持的风险,他们能通过公共网络从你访问过的网站上窃取 cookies,无论是不是正规网站。 + +![Image courtesy Thinkstock](http://core0.staticworld.net/images/article/2015/11/6_updating-security-software-100626679-orig.jpg) + +### 不更新你的安全防护软件 ### + +如果你想要确保你自己的网络是受保护的,就更新路由器固件。你要做的就是进入你的路由器管理页面去检查,通常你能在厂商的官方网页上下载到最新的固件版本。 + +![Image courtesy Thinkstock](http://core0.staticworld.net/images/article/2015/11/7_securing-home-wifi-100626680-orig.jpg) + +### 不保护你的家用 Wi-Fi ### + +不用说,设置一个复杂的密码和更改无线连接的默认名都是非常重要的。你还可以过滤你的 MAC 地址来让你的路由器只识别那些确认过的设备。 + +本文作者 **Josh Althuser** 是一个开源支持者、网络架构师和科技企业家。在过去12年里,他花了很多时间去倡导使用开源软件来管理团队和项目,同时为网络应用程序提供企业级咨询并帮助它们把产品推向市场。你可以通过[他的推特][6]联系他。 + +-------------------------------------------------------------------------------- + +via: http://www.networkworld.com/article/3003170/mobile-security/7-ways-hackers-can-use-wi-fi-against-you.html + +作者:[Josh Althuser][a] +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://twitter.com/JoshAlthuser +[1]:http://www.pcworld.com/article/243464/number_of_wifi_hotspots_to_quadruple_by_2015_says_study.html +[2]:http://www.nytimes.com/2015/02/15/world/bank-hackers-steal-millions-via-malware.html?hp&action=click&pgtype=Homepage&module=first-column-region%C2%AEion=top-news&WT.nav=top-news&_r=3 +[3]:http://news.yahoo.com/blogs/upgrade-your-life/banking-online-not-hacked-182159934.html +[4]:http://pocketnow.com/2014/10/15/should-you-leave-your-smartphones-wifi-on-or-turn-it-off +[5]:http://www.cnet.com/news/chrome-becoming-tool-in-googles-push-for-encrypted-web/ +[6]:https://twitter.com/JoshAlthuser diff --git a/published/201512/20151123 How to access Dropbox from the command line in Linux.md b/published/201512/20151123 How to access Dropbox from the command line in Linux.md new file mode 100644 index 0000000000..3c452ac4f6 --- /dev/null +++ b/published/201512/20151123 How to access Dropbox from the command line in Linux.md @@ -0,0 +1,97 @@ +Linux 中如何通过命令行访问 Dropbox +================================================================================ +在当今这个多设备的环境下,云存储无处不在。无论身处何方,人们都想通过多种设备来从云存储中获取所需的内容。由于拥有漂亮的 UI 和完美的跨平台兼容性,Dropbox 已成为最为广泛使用的云存储服务。 Dropbox 的流行已引发了一系列官方或非官方 Dropbox 客户端的出现,它们支持不同的操作系统平台。 + +当然 Linux 平台下也有着自己的 Dropbox 客户端: 既有命令行的,也有图形界面客户端。[Dropbox Uploader][1] 是一个简单易用的 Dropbox 命令行客户端,它是用 Bash 脚本语言所编写的(LCTT 译注:对,你没看错, 就是 Bash)。在这篇教程中,我将描述 **在 Linux 中如何使用 Dropbox Uploader 通过命令行来访问 Dropbox**。 + +### Linux 中安装和配置 Dropbox Uploader ### + +要使用 Dropbox Uploader,你需要下载该脚本并使其可被执行。 + + $ wget https://raw.github.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh + $ chmod +x dropbox_uploader.sh + +请确保你已经在系统中安装了 `curl`,因为 Dropbox Uploader 通过 curl 来运行 Dropbox 的 API。 + +要配置 Dropbox Uploader,只需运行 dropbox_uploader.sh 即可。当你第一次运行这个脚本时,它将请求得到授权以使得脚本可以访问你的 Dropbox 账户。 + + $ ./dropbox_uploader.sh + +![](https://c2.staticflickr.com/6/5739/22860931599_10c08ff15f_c.jpg) + +如上图所指示的那样,你需要通过浏览器访问 [https://www.dropbox.com/developers/apps][2] 页面,并创建一个新的 Dropbox app。接着像下图那样填入新 app 的相关信息,并输入 app 的名称,它与 Dropbox Uploader 所生成的 app 名称类似。 + +![](https://c2.staticflickr.com/6/5745/22932921350_4123d2dbee_c.jpg) + +在你创建好一个新的 app 之后,你将在下一个页面看到 app key 和 app secret。请记住它们。 + +![](https://c1.staticflickr.com/1/736/22932962610_7db51aa718_c.jpg) + +然后在正运行着 dropbox_uploader.sh 的终端窗口中输入 app key 和 app secret。然后 dropbox_uploader.sh 将产生一个 oAUTH 网址(例如,https://www.dropbox.com/1/oauth/authorize?oauth_token=XXXXXXXXXXXX)。 + +![](https://c1.staticflickr.com/1/563/22601635533_423738baed_c.jpg) + +接着通过浏览器访问那个 oAUTH 网址,并同意访问你的 Dropbox 账户。 + +![](https://c1.staticflickr.com/1/675/23202598606_6110c1a31b_c.jpg) + +这便完成了 Dropbox Uploader 的配置。若要确认 Dropbox Uploader 是否真的被成功地认证了,可以运行下面的命令。 + + $ ./dropbox_uploader.sh info + +---------- + + Dropbox Uploader v0.12 + + > Getting info... + + Name: Dan Nanni + UID: XXXXXXXXXX + Email: my@email_address + Quota: 2048 Mb + Used: 13 Mb + Free: 2034 Mb + +### Dropbox Uploader 示例 ### + +要显示根目录中的所有内容,运行: + + $ ./dropbox_uploader.sh list + +要列出某个特定文件夹中的所有内容,运行: + + $ ./dropbox_uploader.sh list Documents/manuals + +要上传一个本地文件到一个远程的 Dropbox 文件夹,使用: + + $ ./dropbox_uploader.sh upload snort.pdf Documents/manuals + +要从 Dropbox 下载一个远程的文件到本地,使用: + + $ ./dropbox_uploader.sh download Documents/manuals/mysql.pdf ./mysql.pdf + +要从 Dropbox 下载一个完整的远程文件夹到一个本地的文件夹,运行: + + $ ./dropbox_uploader.sh download Documents/manuals ./manuals + +要在 Dropbox 上创建一个新的远程文件夹,使用: + + $ ./dropbox_uploader.sh mkdir Documents/whitepapers + +要完全删除 Dropbox 中某个远程的文件夹(包括它所含的所有内容),运行: + + $ ./dropbox_uploader.sh delete Documents/manuals + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/access-dropbox-command-line-linux.html + +作者:[Dan Nanni][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://www.andreafabrizi.it/?dropbox_uploader +[2]:https://www.dropbox.com/developers/apps diff --git a/published/201512/20151123 How to install Android Studio on Ubuntu 15.04 or CentOS 7.md b/published/201512/20151123 How to install Android Studio on Ubuntu 15.04 or CentOS 7.md new file mode 100644 index 0000000000..c851ce0da2 --- /dev/null +++ b/published/201512/20151123 How to install Android Studio on Ubuntu 15.04 or CentOS 7.md @@ -0,0 +1,129 @@ +如何在 Ubuntu 15.04 / CentOS 7 上安装 Android Studio +================================================================================ +随着最近几年智能手机的进步,安卓成为了最大的手机平台之一,在开发安卓应用中所用到的所有工具也都可以免费得到。Android Studio 是基于 [IntelliJ IDEA][1] 用于开发安卓应用的集成开发环境(IDE)。它是 Google 2014 年发布的免费开源软件,继 Eclipse 之后成为主要的 IDE。 + +在这篇文章,我们一起来学习如何在 Ubuntu 15.04 和 CentOS 7 上安装 Android Studio。 + +### 在 Ubuntu 15.04 上安装 ### + +我们可以用两种方式安装 Android Studio。第一种是配置所需的库然后再安装它;另一种是从 Android 官方网站下载然后在本地编译安装。在下面的例子中,我们会使用命令行设置库并安装它。在继续下一步之前,我们需要确保我们已经安装了 JDK 1.6 或者更新版本。 + +这里,我打算安装 JDK 1.8。 + + $ sudo add-apt-repository ppa:webupd8team/java + $ sudo apt-get update + $ sudo apt-get install oracle-java8-installer oracle-java8-set-default + +验证 java 是否安装成功: + + poornima@poornima-Lenovo:~$ java -version + +现在,设置安装 Android Studio 需要的库 + + $ sudo apt-add-repository ppa:paolorotolo/android-studio + +![Android-Studio-repo](http://blog.linoxide.com/wp-content/uploads/2015/11/Android-studio-repo.png) + + $ sudo apt-get update + $ sudo apt-get install android-studio + +上面的安装命令会在 /opt 目录下面安装 Android Studio。 + +现在,运行下面的命令启动安装向导: + + $ /opt/android-studio/bin/studio.sh + +这会激活安装窗口。下面的截图展示了安装 Android Studio 的过程。 + +![安装 Android Studio](http://blog.linoxide.com/wp-content/uploads/2015/11/Studio-setup.png) + +![安装类型](http://blog.linoxide.com/wp-content/uploads/2015/11/Install-type.png) + +![设置模拟器](http://blog.linoxide.com/wp-content/uploads/2015/11/Emulator-settings.png) + +你点击了 Finish 按钮之后,就会显示同意协议页面。当你接受协议之后,它就开始下载需要的组件。 + +![下载组件](http://blog.linoxide.com/wp-content/uploads/2015/11/Download.png) + +这一步完成之后就结束了 Android Studio 的安装。当你重启 Android Studio 时,你会看到下面的欢迎界面,从这里你可以开始用 Android Studio 工作了。 + +![欢迎界面](http://blog.linoxide.com/wp-content/uploads/2015/11/Welcome-screen.png) + +### 在 CentOS 7 上安装 ### + +现在再让我们来看看如何在 CentOS 7 上安装 Android Studio。这里你同样需要安装 JDK 1.6 或者更新版本。如果你不是 root 用户,记得在命令前面使用 ‘sudo’。你可以下载[最新版本][2]的 JDK。如果你已经安装了一个比较旧的版本,在安装新的版本之前你需要先卸载旧版本。在下面的例子中,我会通过下载需要的 rpm 包安装 JDK 1.8.0_65。 + + [root@li1260-39 ~]# rpm -ivh jdk-8u65-linux-x64.rpm + Preparing... ################################# [100%] + Updating / installing... + 1:jdk1.8.0_65-2000:1.8.0_65-fcs ################################# [100%] + Unpacking JAR files... + tools.jar... + plugin.jar... + javaws.jar... + deploy.jar... + rt.jar... + jsse.jar... + charsets.jar... + localedata.jar... + jfxrt.jar... + +如果没有正确设置 Java 路径,你会看到错误信息。因此,设置正确的路径: + + export JAVA_HOME=/usr/java/jdk1.8.0_25/ + export PATH=$PATH:$JAVA_HOME + +检查是否安装了正确的版本: + + [root@li1260-39 ~]# java -version + java version "1.8.0_65" + Java(TM) SE Runtime Environment (build 1.8.0_65-b17) + Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode) + +如果你安装 Android Studio 的时候看到任何类似 “unable-to-run-mksdcard-sdk-tool:” 的错误信息,你可能要在 CentOS 7 64 位系统中安装以下软件包: + + - glibc.i686 + - glibc-devel.i686 + - libstdc++.i686 + - zlib-devel.i686 + - ncurses-devel.i686 + - libX11-devel.i686 + - libXrender.i686 + - libXrandr.i686 + +通过从 [Android 网站][3] 下载 IDE 文件然后解压安装 studio 也是一样的。 + + [root@li1260-39 tmp]# unzip android-studio-ide-141.2343393-linux.zip + +移动 android-studio 目录到 /opt 目录 + + [root@li1260-39 tmp]# mv /tmp/android-studio/ /opt/ + +需要的话你可以创建一个到 studio 可执行文件的符号链接用于快速启动。 + + [root@li1260-39 tmp]# ln -s /opt/android-studio/bin/studio.sh /usr/local/bin/android-studio + +现在在终端中启动 studio: + + [root@localhost ~]#studio + +之后用于完成安装的截图和前面 Ubuntu 安装过程中的是一样的。安装完成后,你就可以开始开发你自己的 Android 应用了。 + +### 总结 ### + +虽然发布不到一年,但是 Android Studio 已经替代 Eclipse 成为了 Android 的开发最主要的 IDE。它是唯一能支持 Google 之后将要提供的 Android SDK 和其它 Android 特性的官方 IDE 工具。那么,你还在等什么呢?赶快安装 Android Studio 来体验开发 Android 应用的乐趣吧。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/tools/install-android-studio-ubuntu-15-04-centos-7/ + +作者:[B N Poornima][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/bnpoornima/ +[1]:https://www.jetbrains.com/idea/ +[2]:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html +[3]:http://developer.android.com/sdk/index.html diff --git a/published/201512/20151123 LNAV--Ncurses based log file viewer.md b/published/201512/20151123 LNAV--Ncurses based log file viewer.md new file mode 100644 index 0000000000..d51ebe8e76 --- /dev/null +++ b/published/201512/20151123 LNAV--Ncurses based log file viewer.md @@ -0,0 +1,81 @@ +LNAV:基于 Ncurses 的日志文件阅读器 +================================================================================ +日志文件导航器(Logfile Navigator,简称 lnav),是一个基于 curses 的,用于查看和分析日志文件的工具。和文本阅读器/编辑器相比, lnav 的好处是它充分利用了可以从日志文件中获取的语义信息,例如时间戳和日志等级。利用这些额外的语义信息, lnav 可以处理像这样的事情:来自不同文件的交错的信息;按照时间生成信息直方图;支持在文件中导航的快捷键。它希望使用这些功能可以使得用户可以快速有效地定位和解决问题。 + +### lnav 功能 ### + +#### 支持以下日志文件格式: #### + +Syslog、Apache 访问日志、strace、tcsh 历史以及常见的带时间戳的日志文件。读入文件的时候回自动检测文件格式。 + +#### 直方图视图: #### + +以时间区划来显示日志信息数量。这对于大概了解在一长段时间内发生了什么非常有用。 + +#### 过滤器: #### + +只显示那些匹配或不匹配一些正则表达式的行。对于移除大量你不感兴趣的日志行非常有用。 + +#### 即时操作: #### + +在你输入到时候会同时完成检索;当添加了新日志行的时候会自动加载和搜索;加载行的时候会应用过滤器;另外,还会在你输入 SQL 查询的时候检查其正确性。 + +#### 自动显示后文: #### + +日志文件视图会自动往下滚动到新添加到文件中的行。只需要向上滚动就可以锁定当前视图,然后向下滚动到底部恢复显示后文。 + +#### 按照日期顺序排序行: #### + +从所有文件中加载的日志行会按照日期进行排序。使得你不需要手动从不同文件中收集日志信息。 + +#### 语法高亮: #### + +错误和警告会用红色和黄色显示。高亮还可用于: SQL 关键字、XML 标签、Java 文件行号和括起来的字符串。 + +#### 导航: #### + +有快捷键用于跳转到下一个或上一个错误或警告,按照指定的时间向后或向前翻页。 + +#### 用 SQL 查询日志: #### + +每个日志文件行都相当于数据库中的一行,可以使用 SQL 进行查询。可以使用的列取决于查看的日志文件类型。 + +#### 命令和搜索历史: #### + +会自动保存你之前输入的命令和搜素,因此你可以在会话之间使用它们。 + +#### 压缩文件: #### + +会实时自动检测和解压压缩的日志文件。 + +### 在 ubuntu 15.10 上安装 lnav #### + +打开终端运行下面的命令 + + sudo apt-get install lnav + +### 使用 lnav ### + +如果你想使用 lnav 查看日志,你可以使用下面的命令,默认它会显示 syslogs + + lnav + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/11/51.png) + +如果你想查看特定的日志,那么需要指定路径。如果你想看 CPU 日志,在你的终端里运行下面的命令 + + lnav /var/log/cups + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/11/6.png) + +-------------------------------------------------------------------------------- + +via: http://www.ubuntugeek.com/lnav-ncurses-based-log-file-viewer.html + +作者:[ruchi][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.ubuntugeek.com/author/ubuntufix diff --git a/published/201512/20151125 How to Install GIMP 2.8.16 in Ubuntu 16.04 or 15.10 or 14.04.md b/published/201512/20151125 How to Install GIMP 2.8.16 in Ubuntu 16.04 or 15.10 or 14.04.md new file mode 100644 index 0000000000..7c2e304403 --- /dev/null +++ b/published/201512/20151125 How to Install GIMP 2.8.16 in Ubuntu 16.04 or 15.10 or 14.04.md @@ -0,0 +1,59 @@ +如何在 Ubuntu 16.04,15.10,14.04 中安装 GIMP 2.8.16 +================================================================================ +![GIMP 2.8.16](http://ubuntuhandbook.org/wp-content/uploads/2015/11/gimp-icon.png) + +GIMP 图像编辑器 2.8.16 版本在其20岁生日时发布了。下面是如何安装或升级 GIMP 在 Ubuntu 16.04, Ubuntu 15.10, Ubuntu 14.04, Ubuntu 12.04 及其衍生版本中,如 Linux Mint 17.x/13, Elementary OS Freya。 + +GIMP 2.8.16 支持 OpenRaster 文件中的层组,修复了 PSD 中的层组支持以及各种用户界面改进,修复了 OSX 上的构建系统,以及更多新的变化。请阅读 [官方声明][1]。 + +![GIMP image editor 2.8,16](http://ubuntuhandbook.org/wp-content/uploads/2014/08/gimp-2-8-14.jpg) + +### 如何安装或升级: ### + +多亏了 Otto Meier,[Ubuntu PPA][2] 中最新的 GIMP 包可用于当前所有的 Ubuntu 版本和其衍生版。 + +**1. 添加 GIMP PPA** + +从 Unity Dash 中打开终端,或通过 Ctrl+Alt+T 快捷键打开。在它打开它后,粘贴下面的命令并回车: + + sudo add-apt-repository ppa:otto-kesselgulasch/gimp + +![add GIMP PPA](http://ubuntuhandbook.org/wp-content/uploads/2015/11/gimp-ppa.jpg) + +输入你的密码,密码不会在终端显示,然后回车继续。 + +**2. 安装或升级编辑器** + +在添加了 PPA 后,启动 **Software Updater**(在 Mint 中是 Software Manager)。检查更新后,你将看到 GIMP 的更新列表。点击 “Install Now” 进行升级。 + +![upgrade-gimp2816](http://ubuntuhandbook.org/wp-content/uploads/2015/11/upgrade-gimp2816.jpg) + +对于那些喜欢 Linux 命令的,按顺序执行下面的命令,刷新仓库的缓存然后安装 GIMP: + + sudo apt-get update + + sudo apt-get install gimp + +**3. (可选的) 卸载** + +如果你想卸载或降级 GIMP 图像编辑器。从软件中心直接删除它,或者按顺序运行下面的命令来将 PPA 清除并降级软件: + + sudo apt-get install ppa-purge + + sudo ppa-purge ppa:otto-kesselgulasch/gimp + +就这样。玩的愉快! + +-------------------------------------------------------------------------------- + +via: http://ubuntuhandbook.org/index.php/2015/11/how-to-install-gimp-2-8-16-in-ubuntu-16-04-15-10-14-04/ + +作者:[Ji m][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ubuntuhandbook.org/index.php/about/ +[1]:http://www.gimp.org/news/2015/11/22/20-years-of-gimp-release-of-gimp-2816/ +[2]:https://launchpad.net/~otto-kesselgulasch/+archive/ubuntu/gimp diff --git a/published/201512/20151125 The tar command explained.md b/published/201512/20151125 The tar command explained.md new file mode 100644 index 0000000000..22244bf89c --- /dev/null +++ b/published/201512/20151125 The tar command explained.md @@ -0,0 +1,143 @@ +tar 命令使用介绍 +================================================================================ +Linux [tar][1] 命令是归档或分发文件时的强大武器。GNU tar 归档包可以包含多个文件和目录,还能保留其文件权限,它还支持多种压缩格式。Tar 表示 "**T**ape **Ar**chiver",这种格式是 POSIX 标准。 + +### Tar 文件格式 ### + +tar 压缩等级简介: + +- **无压缩** 没有压缩的文件用 .tar 结尾。 +- **Gzip 压缩** Gzip 格式是 tar 使用最广泛的压缩格式,它能快速压缩和提取文件。用 gzip 压缩的文件通常用 .tar.gz 或 .tgz 结尾。这里有一些如何[创建][2]和[解压][3] tar.gz 文件的例子。 +- **Bzip2 压缩** 和 Gzip 格式相比 Bzip2 提供了更好的压缩比。创建压缩文件也比较慢,通常采用 .tar.bz2 结尾。 +- **Lzip(LAMA)压缩** Lizp 压缩结合了 Gzip 快速的优势,以及和 Bzip2 类似(甚至更好) 的压缩率。尽管有这些好处,这个格式并没有得到广泛使用。 +- **Lzop 压缩** 这个压缩选项也许是 tar 最快的压缩格式,它的压缩率和 gzip 类似,但也没有广泛使用。 + +常见的格式是 tar.gz 和 tar.bz2。如果你想快速压缩,那么就是用 gzip。如果归档文件大小比较重要,就是用 tar.bz2。 + +### tar 命令用来干什么? ### + +下面是一些使用 tar 命令的常见情形。 + +- 备份服务器或桌面系统 +- 文档归档 +- 软件分发 + +### 安装 tar ### + +大部分 Linux 系统默认都安装了 tar。如果没有,这里有安装 tar 的命令。 + +#### CentOS #### + +在 CentOS 中,以 root 用户在 shell 中执行下面的命令安装 tar。 + + yum install tar + +#### Ubuntu #### + +下面的命令会在 Ubuntu 上安装 tar。“sudo” 命令确保 apt 命令是以 root 权限运行的。 + + sudo apt-get install tar + +#### Debian #### + +下面的 apt 命令在 Debian 上安装 tar。 + + apt-get install tar + +#### Windows #### + +tar 命令在 Windows 也可以使用,你可以从 Gunwin 项目[http://gnuwin32.sourceforge.net/packages/gtar.htm][4]中下载它。 + +### 创建 tar.gz 文件 ### + +下面是在 shell 中运行 [tar 命令][5] 的一些例子。下面我会解释这些命令行选项。 + + tar pczf myarchive.tar.gz /home/till/mydocuments + +这个命令会创建归档文件 myarchive.tar.gz,其中包括了路径 /home/till/mydocuments 中的文件和目录。**命令行选项解释**: + +- **[p]** 这个选项表示 “preserve”,它指示 tar 在归档文件中保留文件属主和权限信息。 +- **[c]** 表示创建。要创建文件时不能缺少这个选项。 +- **[z]** z 选项启用 gzip 压缩。 +- **[f]** file 选项告诉 tar 创建一个归档文件。如果没有这个选项 tar 会把输出发送到标准输出( LCTT 译注:如果没有指定,标准输出默认是屏幕,显然你不会想在屏幕上显示一堆乱码,通常你可以用管道符号送到其它程序去)。 + +#### Tar 命令示例 #### + +**示例 1: 备份 /etc 目录** + +创建 /etc 配置目录的一个备份。备份保存在 root 目录。 + + tar pczvf /root/etc.tar.gz /etc + +![用 tar 备份 /etc 目录](https://www.howtoforge.com/images/linux-tar-command/big/create-tar.png) + +要以 root 用户运行命令确保 /etc 中的所有文件都会被包含在备份中。这次,我在命令中添加了 [v] 选项。这个选项表示 verbose,它告诉 tar 显示所有被包含到归档文件中的文件名。 + +**示例 2: 备份你的 /home 目录** + +创建你的 home 目录的备份。备份会被保存到 /backup 目录。 + + tar czf /backup/myuser.tar.gz /home/myuser + +用你的用户名替换 myuser。这个命令中,我省略了 [p] 选项,也就不会保存权限。 + +**示例 3: 基于文件的 MySQL 数据库备份** + +在大部分 Linux 发行版中,MySQL 数据库保存在 /var/lib/mysql。你可以使用下面的命令来查看: + + ls /var/lib/mysql + +![使用 tar 基于文件备份 MySQL](https://www.howtoforge.com/images/linux-tar-command/big/tar_backup_mysql.png) + +用 tar 备份 MySQL 数据文件时为了保持数据一致性,首先停用数据库服务器。备份会被写到 /backup 目录。 + +1) 创建 backup 目录 + + mkdir /backup + chmod 600 /backup + +2) 停止 MySQL,用 tar 进行备份并重新启动数据库。 + + service mysql stop + tar pczf /backup/mysql.tar.gz /var/lib/mysql + service mysql start + ls -lah /backup + +![基于文件的 MySQL 备份](https://www.howtoforge.com/images/linux-tar-command/big/tar-backup-mysql2.png) + +### 提取 tar.gz 文件### + +提取 tar.gz 文件的命令是: + + tar xzf myarchive.tar.gz + +#### tar 命令选项解释 #### + +- **[x]** x 表示提取,提取 tar 文件时这个命令不可缺少。 +- **[z]** z 选项告诉 tar 要解压的归档文件是 gzip 格式。 +- **[f]** 该选项告诉 tar 从一个文件中读取归档内容,本例中是 myarchive.tar.gz。 + +上面的 tar 命令会安静地提取 tar.gz 文件,除非有错误信息。如果你想要看提取了哪些文件,那么添加 “v” 选项。 + + tar xzvf myarchive.tar.gz + +**[v]** 选项表示 verbose,它会向你显示解压的文件名。 + +![提取 tar.gz 文件](https://www.howtoforge.com/images/linux-tar-command/big/tar-xfz.png) + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/linux-tar-command/ + +作者:[howtoforge][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.howtoforge.com/ +[1]:https://en.wikipedia.org/wiki/Tar_(computing) +[2]:http://www.faqforge.com/linux/create-tar-gz/ +[3]:http://www.faqforge.com/linux/extract-tar-gz/ +[4]:http://gnuwin32.sourceforge.net/packages/gtar.htm +[5]:http://www.faqforge.com/linux/tar-command/ \ No newline at end of file diff --git a/published/201512/20151130 eSpeak--Text To Speech Tool For Linux.md b/published/201512/20151130 eSpeak--Text To Speech Tool For Linux.md new file mode 100644 index 0000000000..e968be847b --- /dev/null +++ b/published/201512/20151130 eSpeak--Text To Speech Tool For Linux.md @@ -0,0 +1,64 @@ +eSpeak: Linux 文本转语音工具 +================================================================================ +![Text to speech tool in Linux](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/11/Text-to-speech-Linux.jpg) + +[eSpeak][1]是一款 Linux 命令行工具,能把文本转换成语音。它是一款简洁的语音合成器,用C语言编写而成,它支持英语和其它多种语言。 + +eSpeak 从标准输入或者输入文件中读取文本。虽然语音输出与真人声音相去甚远,但是,在你项目需要的时候,eSpeak 仍不失为一个简便快捷的工具。 + +eSpeak 部分主要特性如下: + +- 提供给 Linux 和 Windows 的命令行工具 +- 从文件或者标准输入中把文本读出来 +- 提供给其它程序使用的共享库版本 +- 为 Windows 提供 SAPI5 版本,所以它能用于 screen-readers 或者其它支持 Windows SAPI5 接口的程序 +- 可移植到其它平台,包括安卓,OSX等 +- 提供多种声音特性选择 +- 语音输出可保存为 [.WAV][2] 格式的文件 +- 配合 HTML 部分可支持 SSML(语音合成标记语言,[Speech Synthesis Markup Language][3]) +- 体积小巧,整个程序连同语言支持等占用小于2MB +- 可以实现文本到音素编码(phoneme code)的转化,因此可以作为其它语音合成引擎的前端工具 +- 开发工具可用于生产和调整音素数据 + +### 安装 eSpeak ### + +基于 Ubuntu 的系统中,在终端运行以下命令安装 eSpeak: + + sudo apt-get install espeak + +eSpeak 是一个古老的工具,我推测它应该能在其它众多 Linux 发行版中运行,比如 Arch,Fedora。使用 dnf,pacman 等命令就能轻松安装。 + +eSpeak 用法如下:输入 espeak 运行程序。输入字符按 enter 转换为语音输出(LCTT 译注:补充)。使用 Ctrl+C 来关闭运行中的程序。 + +![eSpeak command line](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/11/eSpeak-example.png) + +还有一些其他的选项可用,可以通过程序帮助进行查看。 + +### GUI 版本:Gespeaker ### + +如果你更倾向于使用 GUI 版本,可以安装 Gespeaker,它为 eSpeak 提供了 GTK 界面。 + +使用以下命令来安装 Gespeaker: + + sudo apt-get install gespeaker + +操作界面简明易用,你完全可以自行探索。 + +![eSpeak GUI tool for text to speech in Ubuntu](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/11/eSpeak-GUI.png) + +虽然这些工具在大多数计算任务下用不到,但是当你的项目需要把文本转换成语音时,使用 espeak 还是挺方便的。是否使用 espeak 这款语音合成器,选择权就交给你们啦。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/espeak-text-speech-linux/ + +作者:[Abhishek][a] +译者:[soooogreen](https://github.com/soooogreen) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://espeak.sourceforge.net/ +[2]:http://en.wikipedia.org/wiki/WAV +[3]:http://en.wikipedia.org/wiki/Speech_Synthesis_Markup_Language diff --git a/published/201512/20151201 How to Install The Latest Arduino IDE 1.6.6 in Ubuntu.md b/published/201512/20151201 How to Install The Latest Arduino IDE 1.6.6 in Ubuntu.md new file mode 100644 index 0000000000..27160257ad --- /dev/null +++ b/published/201512/20151201 How to Install The Latest Arduino IDE 1.6.6 in Ubuntu.md @@ -0,0 +1,73 @@ +如何在 Ubuntu 中安装最新的 Arduino IDE 1.6.6 +================================================================================ +![Install latest Arduino in Ubuntu](http://ubuntuhandbook.org/wp-content/uploads/2015/11/arduino-icon.png) + +> 本篇教程会教你如何在当前的 Ubuntu 发行版中安装最新的 Arduino IDE 1.6.6。 + +开源的 Arduino IDE 发布了1.6.6,并带来了很多的改变。新的发布已经切换到 Java 8,它与 IDE 绑定并且用于编译所需。具体见 [发布说明][1]。 + +![Arduino 1.6.6 in Ubuntu 15.10](http://ubuntuhandbook.org/wp-content/uploads/2015/11/arduino-ubuntu.jpg) + +对于那些不想使用软件中心的 1.0.5 旧版本的人而言,你可以使用下面的步骤在所有的 Ubuntu 发行版中安装 Arduino。 + +> **请用正确版本号替换软件包的版本号** + +**1、** 从下面的官方链接下载最新的包 **Linux 32-bit 或者 Linux 64-bit**。 + +- [https://www.arduino.cc/en/Main/Software][2] + +如果不知道你系统的类型?进入系统设置->详细->概览。 + +**2、** 从Unity Dash、App Launcher 或者使用 Ctrl+Alt+T 打开终端。打开后,一个个运行下面的命令: + +进入下载文件夹: + + cd ~/Downloads + +![navigate-downloads](http://ubuntuhandbook.org/wp-content/uploads/2015/11/navigate-downloads.jpg) + +使用 tar 命令解压: + + tar -xvf arduino-1.6.6-*.tar.xz + +![extract-archive](http://ubuntuhandbook.org/wp-content/uploads/2015/11/extract-archive.jpg) + +将解压后的文件移动到**/opt/**下: + + sudo mv arduino-1.6.6 /opt + +![move-opt](http://ubuntuhandbook.org/wp-content/uploads/2015/11/move-opt.jpg) + +**3、** 现在 IDE 已经与最新的 Java 绑定使用了。但是最好为程序设置一个桌面图标/启动方式: + +进入安装目录: + + cd /opt/arduino-1.6.6/ + +在这个目录给 install.sh 可执行权限 + + chmod +x install.sh + +最后运行脚本同时安装桌面快捷方式和启动图标: + + ./install.sh + +下图中我用“&&”同时运行这三个命令: + +![install-desktop-icon](http://ubuntuhandbook.org/wp-content/uploads/2015/11/install-desktop-icon.jpg) + +最后从 Unity Dash、程序启动器或者桌面快捷方式运行 Arduino IDE。 + +-------------------------------------------------------------------------------- + +via: http://ubuntuhandbook.org/index.php/2015/11/install-arduino-ide-1-6-6-ubuntu/ + +作者:[Ji m][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ubuntuhandbook.org/index.php/about/ +[1]:https://www.arduino.cc/en/Main/ReleaseNotes +[2]:https://www.arduino.cc/en/Main/Software diff --git a/published/201512/20151201 Linux and Unix Port Scanning With netcat [nc] Command.md b/published/201512/20151201 Linux and Unix Port Scanning With netcat [nc] Command.md new file mode 100644 index 0000000000..f6d69b0cf5 --- /dev/null +++ b/published/201512/20151201 Linux and Unix Port Scanning With netcat [nc] Command.md @@ -0,0 +1,95 @@ +使用 netcat [nc] 命令对 Linux 和 Unix 进行端口扫描 +================================================================================ + +我如何在自己的服务器上找出哪些端口是开放的?如何使用 nc 命令进行端口扫描来替换 [Linux 或类 Unix 中的 nmap 命令][1]? + +nmap (“Network Mapper”)是一个用于网络探测和安全审核的开源工具。如果 nmap 没有安装或者你不希望使用 nmap,那你可以用 netcat/nc 命令进行端口扫描。它对于查看目标计算机上哪些端口是开放的或者运行着服务是非常有用的。你也可以使用 [nmap 命令进行端口扫描][2] 。 + +### 如何使用 nc 来扫描 Linux,UNIX 和 Windows 服务器的端口呢? ### + +如果未安装 nmap,试试 nc/netcat 命令,如下所示。-z 参数用来告诉 nc 报告开放的端口,而不是启动连接。在 nc 命令中使用 -z 参数时,你需要在主机名/ip 后面限定端口的范围和加速其运行: + + ### 语法 ### + ### nc -z -v {host-name-here} {port-range-here} + nc -z -v host-name-here ssh + nc -z -v host-name-here 22 + nc -w 1 -z -v server-name-here port-Number-her + + ### 扫描 1 to 1023 端口 ### + nc -zv vip-1.vsnl.nixcraft.in 1-1023 + +输出示例: + + Connection to localhost 25 port [tcp/smtp] succeeded! + Connection to vip-1.vsnl.nixcraft.in 25 port [tcp/smtp] succeeded! + Connection to vip-1.vsnl.nixcraft.in 80 port [tcp/http] succeeded! + Connection to vip-1.vsnl.nixcraft.in 143 port [tcp/imap] succeeded! + Connection to vip-1.vsnl.nixcraft.in 199 port [tcp/smux] succeeded! + Connection to vip-1.vsnl.nixcraft.in 783 port [tcp/*] succeeded! + Connection to vip-1.vsnl.nixcraft.in 904 port [tcp/vmware-authd] succeeded! + Connection to vip-1.vsnl.nixcraft.in 993 port [tcp/imaps] succeeded! + +你也可以扫描单个端口: + + nc -zv v.txvip1 443 + nc -zv v.txvip1 80 + nc -zv v.txvip1 22 + nc -zv v.txvip1 21 + nc -zv v.txvip1 smtp + nc -zvn v.txvip1 ftp + + ### 使用1秒的超时值来更快的扫描 ### + netcat -v -z -n -w 1 v.txvip1 1-1023 + +输出示例: + +![Fig.01: Linux/Unix: Use Netcat to Establish and Test TCP and UDP Connections on a Server](http://s0.cyberciti.org/uploads/faq/2007/07/scan-with-nc.jpg) + +*图01:Linux/Unix:使用 Netcat 来测试 TCP 和 UDP 与服务器建立连接* + +1. -z : 端口扫描模式即零 I/O 模式。 +1. -v : 显示详细信息 [使用 -vv 来输出更详细的信息]。 +1. -n : 使用纯数字 IP 地址,即不用 DNS 来解析 IP 地址。 +1. -w 1 : 设置超时值设置为1。 + +更多例子: + + $ netcat -z -vv www.cyberciti.biz http + www.cyberciti.biz [75.126.153.206] 80 (http) open + sent 0, rcvd 0 + $ netcat -z -vv google.com https + DNS fwd/rev mismatch: google.com != maa03s16-in-f2.1e100.net + DNS fwd/rev mismatch: google.com != maa03s16-in-f6.1e100.net + DNS fwd/rev mismatch: google.com != maa03s16-in-f5.1e100.net + DNS fwd/rev mismatch: google.com != maa03s16-in-f3.1e100.net + DNS fwd/rev mismatch: google.com != maa03s16-in-f8.1e100.net + DNS fwd/rev mismatch: google.com != maa03s16-in-f0.1e100.net + DNS fwd/rev mismatch: google.com != maa03s16-in-f7.1e100.net + DNS fwd/rev mismatch: google.com != maa03s16-in-f4.1e100.net + google.com [74.125.236.162] 443 (https) open + sent 0, rcvd 0 + $ netcat -v -z -n -w 1 192.168.1.254 1-1023 + (UNKNOWN) [192.168.1.254] 989 (ftps-data) open + (UNKNOWN) [192.168.1.254] 443 (https) open + (UNKNOWN) [192.168.1.254] 53 (domain) open + +也可以看看 : + +- [使用 nmap 命令扫描网络中开放的端口][3]。 +- 手册页 - [nc(1)][4], [nmap(1)][5] + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/faq/linux-port-scanning/ + +作者:Vivek Gite +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://linux.cn/article-2561-1.html +[2]:https://linux.cn/article-2561-1.html +[3]:https://linux.cn/article-2561-1.html +[4]:http://www.manpager.com/linux/man1/nc.1.html +[5]:http://www.manpager.com/linux/man1/nmap.1.html diff --git a/published/201512/20151202 How to use the Linux ftp command to up- and download files on the shell.md b/published/201512/20151202 How to use the Linux ftp command to up- and download files on the shell.md new file mode 100644 index 0000000000..dbb7e9d189 --- /dev/null +++ b/published/201512/20151202 How to use the Linux ftp command to up- and download files on the shell.md @@ -0,0 +1,146 @@ +如何在命令行中使用 ftp 命令上传和下载文件 +================================================================================ +本文中,介绍在 Linux shell 中如何使用 ftp 命令。包括如何连接 FTP 服务器,上传或下载文件以及创建文件夹。尽管现在有许多不错的 FTP 桌面应用,但是在服务器、SSH、远程会话中命令行 ftp 命令还是有很多应用的。比如。需要服务器从 ftp 仓库拉取备份。 + +### 步骤 1: 建立 FTP 连接 ### + +想要连接 FTP 服务器,在命令上中先输入`ftp`然后空格跟上 FTP 服务器的域名 'domain.com' 或者 IP 地址 + +#### 例如: #### + + ftp domain.com + + ftp 192.168.0.1 + + ftp user@ftpdomain.com + +**注意: 本例中使用匿名服务器。** + +替换下面例子中 IP 或域名为你的服务器地址。 + +![FTP 登录](https://www.howtoforge.com/images/how-to-use-ftp-in-the-linux-shell/big/ftpanonymous.png) + +### 步骤 2: 使用用户名密码登录 ### + +绝大多数的 FTP 服务器是使用密码保护的,因此这些 FTP 服务器会询问'**username**'和'**password**'. + +如果你连接到被称作匿名 FTP 服务器(LCTT 译注:即,并不需要你有真实的用户信息即可使用的 FTP 服务器称之为匿名 FTP 服务器),可以尝试`anonymous`作为用户名以及使用空密码: + + Name: anonymous + + Password: + +之后,终端会返回如下的信息: + + 230 Login successful. + Remote system type is UNIX. + Using binary mode to transfer files. + ftp> + +登录成功。 + +![FTP 登录成功](https://www.howtoforge.com/images/how-to-use-ftp-in-the-linux-shell/big/login.png) + +### 步骤 3: 目录操作 ### + +FTP 命令可以列出、移动和创建文件夹,如同我们在本地使用我们的电脑一样。`ls`可以打印目录列表,`cd`可以改变目录,`mkdir`可以创建文件夹。 + +#### 使用安全设置列出目录 #### + + ftp> ls + +服务器将返回: + + 200 PORT command successful. Consider using PASV. + 150 Here comes the directory listing. + directory list + .... + .... + 226 Directory send OK. + +![打印目录](https://www.howtoforge.com/images/how-to-use-ftp-in-the-linux-shell/big/listing.png) + +#### 改变目录: #### + +改变目录可以输入: + + ftp> cd directory + +服务器将会返回: + + 250 Directory succesfully changed. + +![FTP中改变目录](https://www.howtoforge.com/images/how-to-use-ftp-in-the-linux-shell/big/directory.png) + +### 步骤 4: 使用 FTP 下载文件 ### + +在下载一个文件之前,我们首先需要使用`lcd`命令设定本地接受目录位置。 + + lcd /home/user/yourdirectoryname + +如果你不指定下载目录,文件将会下载到你登录 FTP 时候的工作目录。 + +现在,我们可以使用命令 get 来下载文件,比如: + + get file + +文件会保存在使用lcd命令设置的目录位置。 + +服务器返回消息: + + local: file remote: file + 200 PORT command successful. Consider using PASV. + 150 Opening BINARY mode data connection for file (xxx bytes). + 226 File send OK. + XXX bytes received in x.xx secs (x.xxx MB/s). + +![使用FTP下载文件](https://www.howtoforge.com/images/how-to-use-ftp-in-the-linux-shell/big/gettingfile.png) + +下载多个文件可以使用通配符及 `mget` 命令。例如,下面这个例子我打算下载所有以 .xls 结尾的文件。 + + mget *.xls + +### 步骤 5: 使用 FTP 上传文件 ### + +完成 FTP 连接后,FTP 同样可以上传文件 + +使用 `put`命令上传文件: + + put file + +当文件不再当前本地目录下的时候,可以使用绝对路径: + + put /path/file + +同样,可以上传多个文件: + + mput *.xls + +### 步骤 6: 关闭 FTP 连接 ### + +完成FTP工作后,为了安全起见需要关闭连接。有三个命令可以关闭连接: + + bye + + exit + + quit + +任意一个命令可以断开FTP服务器连接并返回: + + 221 Goodbye + +![](https://www.howtoforge.com/images/how-to-use-ftp-in-the-linux-shell/big/goodbye.png) + +需要更多帮助,在使用 ftp 命令连接到服务器后,可以使用`help`获得更多帮助。 + +![](https://www.howtoforge.com/images/how-to-use-ftp-in-the-linux-shell/big/helpwindow.png) + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-use-ftp-on-the-linux-shell/ + +译者:[VicYu](http://vicyu.net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201512/20151204 How to Remove Banned IP from Fail2ban on CentOS 6 or CentOS 7.md b/published/201512/20151204 How to Remove Banned IP from Fail2ban on CentOS 6 or CentOS 7.md new file mode 100644 index 0000000000..a527982122 --- /dev/null +++ b/published/201512/20151204 How to Remove Banned IP from Fail2ban on CentOS 6 or CentOS 7.md @@ -0,0 +1,60 @@ +如何在 CentOS 6/7 上移除被 Fail2ban 禁止的 IP +================================================================================ +![](http://www.ehowstuff.com/wp-content/uploads/2015/12/security-265130_1280.jpg) + +[fail2ban][1] 是一款用于保护你的服务器免于暴力攻击的入侵保护软件。fail2ban 用 python 写成,并广泛用于很多服务器上。fail2ban 会扫描日志文件和 IP 黑名单来显示恶意软件、过多的密码失败尝试、web 服务器利用、wordpress 插件攻击和其他漏洞。如果你已经安装并使用了 fail2ban 来保护你的 web 服务器,你也许会想知道如何在 CentOS 6、CentOS 7、RHEL 6、RHEL 7 和 Oracle Linux 6/7 中找到被 fail2ban 阻止的 IP,或者你想将 ip 从 fail2ban 监狱中移除。 + +### 如何列出被禁止的 IP ### + +要查看所有被禁止的 ip 地址,运行下面的命令: + + # iptables -L + Chain INPUT (policy ACCEPT) + target prot opt source destination + f2b-AccessForbidden tcp -- anywhere anywhere tcp dpt:http + f2b-WPLogin tcp -- anywhere anywhere tcp dpt:http + f2b-ConnLimit tcp -- anywhere anywhere tcp dpt:http + f2b-ReqLimit tcp -- anywhere anywhere tcp dpt:http + f2b-NoAuthFailures tcp -- anywhere anywhere tcp dpt:http + f2b-SSH tcp -- anywhere anywhere tcp dpt:ssh + f2b-php-url-open tcp -- anywhere anywhere tcp dpt:http + f2b-nginx-http-auth tcp -- anywhere anywhere multiport dports http,https + ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED + ACCEPT icmp -- anywhere anywhere + ACCEPT all -- anywhere anywhere + ACCEPT tcp -- anywhere anywhere tcp dpt:EtherNet/IP-1 + ACCEPT tcp -- anywhere anywhere tcp dpt:http + REJECT all -- anywhere anywhere reject-with icmp-host-prohibited + + Chain FORWARD (policy ACCEPT) + target prot opt source destination + REJECT all -- anywhere anywhere reject-with icmp-host-prohibited + + Chain OUTPUT (policy ACCEPT) + target prot opt source destination + + + Chain f2b-NoAuthFailures (1 references) + target prot opt source destination + REJECT all -- 64.68.50.128 anywhere reject-with icmp-port-unreachable + REJECT all -- 104.194.26.205 anywhere reject-with icmp-port-unreachable + RETURN all -- anywhere anywhere + +### 如何从 Fail2ban 中移除 IP ### + + # iptables -D f2b-NoAuthFailures -s banned_ip -j REJECT + +我希望这篇教程可以给你在 CentOS 6、CentOS 7、RHEL 6、RHEL 7 和 Oracle Linux 6/7 中移除被禁止的 ip 一些指导。 + +-------------------------------------------------------------------------------- + +via: http://www.ehowstuff.com/how-to-remove-banned-ip-from-fail2ban-on-centos/ + +作者:[skytech][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.ehowstuff.com/author/skytech/ +[1]:http://www.fail2ban.org/wiki/index.php/Main_Page diff --git a/published/201512/20151208 Apple Swift Programming Language Comes To Linux.md b/published/201512/20151208 Apple Swift Programming Language Comes To Linux.md new file mode 100644 index 0000000000..1eb1de02fc --- /dev/null +++ b/published/201512/20151208 Apple Swift Programming Language Comes To Linux.md @@ -0,0 +1,41 @@ +可以在 Linux 下试试苹果编程语言 Swift +================================================================================ +![](http://itsfoss.com/wp-content/uploads/2015/12/Apple-Swift-Open-Source.jpg) + +是的,你知道的,苹果编程语言 Swift 已经开源了。其实我们并不应该感到意外,因为[在六个月以前苹果就已经宣布了这个消息][1]。 + +苹果宣布推出开源 Swift 社区。一个专用于开源 Swift 社区的[新网站][2]已经就位,网站首页显示以下信息: + +> 我们对 Swift 开源感到兴奋。在苹果推出了编程语言 Swift 之后,它很快成为历史上增长最快的语言之一。Swift 可以编写出难以置信的又快又安全的软件。目前,Swift 是开源的,你可以将这个最好的通用编程语言用在各种地方。 + +[swift.org][2] 这个网站将会作为一站式网站,它会提供各种资料的下载,包括各种平台,社区指南,最新消息,入门教程,为开源 Swift 做贡献的说明,文件和一些其他的指南。 如果你正期待着学习 Swift,那么必须收藏这个网站。 + +在苹果的这次宣布中,一个用于方便分享和构建代码的包管理器已经可用了。 + +对于所有的 Linux 使用者来说,最重要的是,源代码已经可以从 [Github][3]获得了.你可以从以下链接 Checkout 它: + +- [苹果 Swift 源代码][3] + +除此之外,对于 ubuntu 14.04 和 15.10 版本还有预编译的二进制文件。 + +- [ubuntu 系统的 Swift 二进制文件][4] + +不要急着在产品环境中使用它们,因为这些都是开发分支而不适合于产品环境。因此现在应避免使用在产品环境中,一旦发布了 Linux 下 Swift 的稳定版本,我希望 ubuntu 会把它包含在 [umake][5]中,和 [Visual Studio Code][6] 放一起。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/swift-open-source-linux/ + +作者:[Abhishek][a] +译者:[Flowsnow](https://github.com/Flowsnow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/apple-open-sources-swift-programming-language-linux/ +[2]:https://swift.org/ +[3]:https://github.com/apple +[4]:https://swift.org/download/#latest-development-snapshots +[5]:https://wiki.ubuntu.com/ubuntu-make +[6]:http://itsfoss.com/install-visual-studio-code-ubuntu/ diff --git a/published/201512/20151208 How to Customize Time and Date Format in Ubuntu Panel.md b/published/201512/20151208 How to Customize Time and Date Format in Ubuntu Panel.md new file mode 100644 index 0000000000..4b20628048 --- /dev/null +++ b/published/201512/20151208 How to Customize Time and Date Format in Ubuntu Panel.md @@ -0,0 +1,66 @@ +如何深度定制 Ubuntu 面板的时间日期显示格式 +================================================================================ +![时间日期格式](http://ubuntuhandbook.org/wp-content/uploads/2015/08/ubuntu_tips1.png) + +尽管设置页面里已经有一些选项可以用了,这个快速教程会向你展示如何更加深入地自定义 Ubuntu 面板上的时间和日期指示器。 + +![自定义世间日期](http://ubuntuhandbook.org/wp-content/uploads/2015/12/custom-timedate.jpg) + +在开始之前,在 Ubuntu 软件中心搜索并安装 **dconf Editor**。然后启动该软件并按以下步骤执行: + +**1、** 当 dconf Editor 启动后,导航至 **com -> canonical -> indicator -> datetime**。将 **time-format** 的值设置为 **custom**。 + +![自定义时间格式](http://ubuntuhandbook.org/wp-content/uploads/2015/12/time-format.jpg) + +你也可以通过终端里的命令完成以上操作: + + gsettings set com.canonical.indicator.datetime time-format 'custom' + +**2、** 现在你可以通过编辑 **custom-time-format** 的值来自定义时间和日期的格式。 + +![自定义-时间格式](http://ubuntuhandbook.org/wp-content/uploads/2015/12/customize-timeformat.jpg) + +你也可以通过命令完成:(LCTT 译注:将 FORMAT_VALUE_HERE 替换为所需要的格式值) + + gsettings set com.canonical.indicator.datetime custom-time-format 'FORMAT_VALUE_HERE' + +以下是参数含义: + +- %a = 星期名缩写 +- %A = 星期名完整拼写 +- %b = 月份名缩写 +- %B = 月份名完整拼写 +- %d = 每月的日期 +- %l = 小时 ( 1..12), %I = 小时 (01..12) +- %k = 小时 ( 1..23), %H = 小时 (01..23) +- %M = 分钟 (00..59) +- %p = 午别,AM 或 PM, %P = am 或 pm. +- %S = 秒 (00..59) + +可以打开终端键入命令 `man date` 并执行以了解更多细节。 + +一些自定义时间日期显示格式值的例子: + +**%a %H:%M %m/%d/%Y** + +![%a %H:%M %m/%d/%Y](http://ubuntuhandbook.org/wp-content/uploads/2015/12/exam-1.jpg) + +**%a %r %b %d or %a %I:%M:%S %p %b %d** + +![%a %r %b %d or %a %I:%M:%S %p %b %d](http://ubuntuhandbook.org/wp-content/uploads/2015/12/exam-2.jpg) + +**%a %-d %b %l:%M %P %z** + +![%a %-d %b %l:%M %P %z](http://ubuntuhandbook.org/wp-content/uploads/2015/12/exam-3.jpg) + +-------------------------------------------------------------------------------- + +via: http://ubuntuhandbook.org/index.php/2015/12/time-date-format-ubuntu-panel/ + +作者:[Ji m][a] +译者:[alim0x](https://github.com/alim0x) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ubuntuhandbook.org/index.php/about/ diff --git a/published/201512/20151208 Install Wetty on Centos or RHEL 6.X.md b/published/201512/20151208 Install Wetty on Centos or RHEL 6.X.md new file mode 100644 index 0000000000..c0f9f503b5 --- /dev/null +++ b/published/201512/20151208 Install Wetty on Centos or RHEL 6.X.md @@ -0,0 +1,72 @@ +在 Centos/RHEL 6.X 上安装 Wetty +================================================================================ +![](http://www.unixmen.com/wp-content/uploads/2015/11/Terminal.png) + +**Wetty 是什么?** + +Wetty = Web + tty + +作为系统管理员,如果你是在 Linux 桌面下,你可以用它像一个 GNOME 终端(或类似的)一样来连接远程服务器;如果你是在 Windows 下,你可以用它像使用 Putty 这样的 SSH 客户端一样来连接远程,然后同时可以在浏览器中上网并查收邮件等其它事情。 + +(LCTT 译注:简而言之,这是一个基于 Web 浏览器的远程终端) + +![](https://github.com/krishnasrinivas/wetty/raw/master/terminal.png) + +### 第1步: 安装 epel 源 ### + + # wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm + # rpm -ivh epel-release-6-8.noarch.rpm + +### 第2步:安装依赖 ### + + # yum install epel-release git nodejs npm -y + +(LCTT 译注:对,没错,是用 node.js 编写的) + +### 第3步:在安装完依赖后,克隆 GitHub 仓库 ### + + # git clone https://github.com/krishnasrinivas/wetty + +### 第4步:运行 Wetty ### + + # cd wetty + # npm install + +### 第5步:从 Web 浏览器启动 Wetty 并访问 Linux 终端 ### + + # node app.js -p 8080 + +### 第6步:为 Wetty 安装 HTTPS 证书 ### + + # openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes + +(等待完成) + +### 第7步:通过 HTTPS 来使用 Wetty ### + + # nohup node app.js --sslkey key.pem --sslcert cert.pem -p 8080 & + +### 第8步:为 wetty 添加一个用户 ### + + # useradd + # Passwd + +### 第9步:访问 wetty ### + + http://Your_IP-Address:8080 + +输入你之前为 wetty 创建的证书然后访问。 + +到此结束! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/install-wetty-centosrhel-6-x/ + +作者:[Debojyoti Das][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/debjyoti/ diff --git a/published/201512/20151215 How to enable Software Collections (SCL) on CentOS.md b/published/201512/20151215 How to enable Software Collections (SCL) on CentOS.md new file mode 100644 index 0000000000..2c0b835026 --- /dev/null +++ b/published/201512/20151215 How to enable Software Collections (SCL) on CentOS.md @@ -0,0 +1,100 @@ +如何在 CentOS 上启用 软件集 Software Collections(SCL) +================================================================================ + +红帽企业版 linux(RHEL)和它的社区版分支——CentOS,提供10年的生命周期,这意味着 RHEL/CentOS 的每个版本会提供长达10年的安全更新。虽然这么长的生命周期为企业用户提供了迫切需要的系统兼容性和可靠性,但也存在一个缺点:随着底层的 RHEL/CentOS 版本接近生命周期的结束,核心应用和运行时环境变得陈旧过时。例如 CentOS 6.5,它的生命周期结束时间是2020年11月30日,其所携带的 Python 2.6.6和 MySQL 5.1.73,以今天的标准来看已经非常古老了。 + +另一方面,在 RHEL/CentOS 上试图手动升级开发工具链和运行时环境存在使系统崩溃的潜在可能,除非所有依赖都被正确解决。通常情况下,手动升级都是不推荐的,除非你知道你在干什么。 + +[软件集(Software Collections)][1](SCL)源出现了,以帮助解决 RHEL/CentOS 下的这种问题。SCL 的创建就是为了给 RHEL/CentOS 用户提供一种以方便、安全地安装和使用应用程序和运行时环境的多个(而且可能是更新的)版本的方式,同时避免把系统搞乱。与之相对的是第三方源,它们可能会在已安装的包之间引起冲突。 + +最新的 SCL 提供了: + +- Python 3.3 和 2.7 +- PHP 5.4 +- Node.js 0.10 +- Ruby 1.9.3 +- Perl 5.16.3 +- MariaDB 和 MySQL 5.5 +- Apache httpd 2.4.6 + +在这篇教程的剩余部分,我会展示一下如何配置 SCL 源,以及如何安装和启用 SCL 中的包。 + +### 配置 SCL 源 + +SCL 可用于 CentOS 6.5 及更新的版本。要配置 SCL 源,只需执行: + + $ sudo yum install centos-release-SCL + +要启用和运行 SCL 中的应用,你还需要安装下列包: + + $ sudo yum install scl-utils-build + +执行下面的命令可以查看 SCL 中可用包的完整列表: + + $ yum --disablerepo="*" --enablerepo="scl" list available + +![](https://c2.staticflickr.com/6/5730/23304424250_f5c8a09584_c.jpg) + +### 从 SCL 中安装和启用包 + +既然你已配置好了 SCL,你可以继续并从 SCL 中安装包了。 + +你可以搜索 SCL 中的包: + + $ yum --disablerepo="*" --enablerepo="scl" search + +我们假设你要安装 Python 3.3。 + +继续,就像通常安装包那样使用 yum 安装: + + $ sudo yum install python33 + +任何时候你都可以查看从 SCL 中安装的包的列表,只需执行: + + $ scl --list + + python33 + +SCL 的优点之一是安装其中的包不会覆盖任何系统文件,并且保证不会引起与系统中其它库和应用的冲突。 + +例如,如果在安装 python33 包后检查默认的 python 版本,你会发现默认的版本并没有改变: + + $ python --version + + Python 2.6.6 + +如果想使用一个已经安装的 SCL 包,你需要在每个命令中使用 `scl` 命令显式启用它(LCTT 译注:即想在哪条命令中使用 SCL 中的包,就得通过`scl`命令执行该命令) + + $ scl enable + +例如,要针对`python`命令启用 python33 包: + + $ scl enable python33 'python --version' + + Python 3.3.2 + +如果想在启用 python33 包时执行多条命令,你可以像下面那样创建一个启用 SCL 的 bash 会话: + + $ scl enable python33 bash + +在这个 bash 会话中,默认的 python 会被切换为3.3版本,直到你输入`exit`,退出会话。 + +![](https://c2.staticflickr.com/6/5642/23491549632_1d08e163cc_c.jpg) + +简而言之,SCL 有几分像 Python 的虚拟环境,但更通用,因为你可以为远比 Python 更多的应用启用/禁用 SCL 会话。 + +更详细的 SCL 指南,参考官方的[快速入门指南][2] + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/enable-software-collections-centos.html + +作者:[Dan Nanni][a] +译者:[bianjp](https://github.com/bianjp) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:https://www.softwarecollections.org/ +[2]:https://www.softwarecollections.org/docs/ diff --git a/published/201512/20151215 Linux or UNIX Desktop Fun--Let it Snow On Your Desktop.md b/published/201512/20151215 Linux or UNIX Desktop Fun--Let it Snow On Your Desktop.md new file mode 100644 index 0000000000..29b9b1a77f --- /dev/null +++ b/published/201512/20151215 Linux or UNIX Desktop Fun--Let it Snow On Your Desktop.md @@ -0,0 +1,76 @@ +Linux/Unix 桌面趣事:让桌面下雪 +================================================================================ + +在这个节日里感到孤独么?试一下 Xsnow 吧。它是一个可以在 Unix/Linux 桌面下下雪的应用。圣诞老人和他的驯鹿会在屏幕中奔跑,伴随着雪片让你感受到节日的感觉。 + +我第一次安装它还是在 13、4 年前。它最初是在 1984 年 Macintosh 系统中创造的。你可以用下面的方法来安装: + +### 安装 xsnow ### + +Debian/Ubuntu/Mint 用户用下面的命令: + + $ sudo apt-get install xsnow + +Freebsd 用户输入下面的命令: + + # cd /usr/ports/x11/xsnow/ + # make install clean + +或者尝试添加包: + + # pkg_add -r xsnow + +#### 其他发行版的方法 #### + +1. Fedora/RHEL/CentOS 在 [rpmfusion][1] 仓库中找找。 +2. Gentoo 用户试下 Gentoo portage,也就是[emerge -p xsnow][2] +3. Opensuse 用户使用 yast 搜索 xsnow + +### 我该如何使用 xsnow? ### + +打开终端(程序 > 附件 > 终端),输入下面的额命令启动 xsnow: + + $ xsnow + +示例输出: + +![Fig.01: Snow for your Linux and Unix desktop systems](http://files.cyberciti.biz/uploads/tips/2011/12/application-to-bring-snow-to-desktop_small.png) + +*图01: 在 Linux 和 Unix 桌面中显示雪花* + +你可以设置背景为蓝色,并让它下白雪,输入: + + $ xsnow -bg blue -sc snow + +设置最大的雪片数量,并让它尽可能快地掉下,输入: + + $ xsnow -snowflakes 10000 -delay 0 + +不要显示圣诞树和圣诞老人满屏幕地跑,输入: + + $ xsnow -notrees -nosanta + +关于 xsnow 更多的信息和选项,在命令行下输入 man xsnow 查看手册: + + $ man xsnow + +建议阅读 + +- 官网[下载 Xsnow][1] +- 注意 [MS-Windows][2] 和 [Mac OS X][3] 版本有一次性的共享软件费用。 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/tips/linux-unix-xsnow.html + +作者:Vivek Gite +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://rpmfusion.org/Configuration +[2]:http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1 +[3]:http://dropmix.xs4all.nl/rick/Xsnow/ +[4]:http://dropmix.xs4all.nl/rick/WinSnow/ +[5]:http://dropmix.xs4all.nl/rick/MacOSXSnow/ diff --git a/published/201512/20151215 Linux or UNIX Desktop Fun--Steam Locomotive.md b/published/201512/20151215 Linux or UNIX Desktop Fun--Steam Locomotive.md new file mode 100644 index 0000000000..45a56d6ddc --- /dev/null +++ b/published/201512/20151215 Linux or UNIX Desktop Fun--Steam Locomotive.md @@ -0,0 +1,41 @@ +Linux/Unix 桌面趣事:蒸汽火车 +================================================================================ +一个你[经常犯的错误][1]是把 ls 输入成了 sl。我已经设置了[一个别名][2],也就是 `alias sl=ls`。但是这样你也许就错过了这辆带汽笛的蒸汽小火车了。 + +sl 是一个搞笑软件或,也是一个 Unix 游戏。它会在你错误地把“ls”输入成“sl”(Steam Locomotive)后出现一辆蒸汽火车穿过你的屏幕。 + +### 安装 sl ### + +在 Debian/Ubuntu 下输入下面的命令: + + # apt-get install sl + +它同样也在 Freebsd 和其他类Unix的操作系统上存在。 + +下面,让我们把 ls 输错成 sl: + + $ sl + +![Fig.01: Run steam locomotive across the screen if you type "sl" instead of "ls"](http://files.cyberciti.biz/uploads/tips/2011/05/sl_command_steam_locomotive.png) + +*图01: 如果你把 “ls” 输入成 “sl” ,蒸汽火车会穿过你的屏幕。* + +它同样支持下面的选项: + +- **-a** : 似乎发生了意外。你会为那些哭喊求助的人们感到难过。 +- **-l** : 显示小一点的火车 +- **-F** : 它居然飞走了 +- **-e** : 允许被 Ctrl+C 中断 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/tips/displays-animations-when-accidentally-you-type-sl-instead-of-ls.html + +作者:Vivek Gite +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html +[2]:http://bash.cyberciti.biz/guide/Create_and_use_aliases diff --git a/published/201512/20151215 Linux or UNIX Desktop Fun--Terminal ASCII Aquarium.md b/published/201512/20151215 Linux or UNIX Desktop Fun--Terminal ASCII Aquarium.md new file mode 100644 index 0000000000..e24c2f381e --- /dev/null +++ b/published/201512/20151215 Linux or UNIX Desktop Fun--Terminal ASCII Aquarium.md @@ -0,0 +1,67 @@ +Linux/Unix 桌面趣事:终端 ASCII 水族箱 +================================================================================ + +你可以在你的终端中使用 ASCIIQuarium 安全地欣赏海洋的神秘了。它是一个用 perl 写的 ASCII 艺术水族箱/海洋动画。 + +### 安装 Term::Animation ### + +首先你需要安装名为 Term-Animation 的perl模块。打开终端(选择程序 > 附件 > 终端),并输入: + + $ sudo apt-get install libcurses-perl + $ cd /tmp + $ wget http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-2.4.tar.gz + $ tar -zxvf Term-Animation-2.4.tar.gz + $ cd Term-Animation-2.4/ + $ perl Makefile.PL && make && make test + $ sudo make install + +### 下载安装 ASCIIQuarium ### + +接着在终端中输入: + + $ cd /tmp + $ wget http://www.robobunny.com/projects/asciiquarium/asciiquarium.tar.gz + $ tar -zxvf asciiquarium.tar.gz + $ cd asciiquarium_1.0/ + $ sudo cp asciiquarium /usr/local/bin + $ sudo chmod 0755 /usr/local/bin/asciiquarium + +### 我怎么观赏 ASCII 水族箱? ### + +输入下面的命令: + + $ /usr/local/bin/asciiquarium + +或者 + + $ perl /usr/local/bin/asciiquarium + +![Fig.01: ASCII Aquarium](http://s0.cyberciti.org/uploads/tips/2011/01/screenshot-ASCIIQuarium.png) + +*ASCII 水族箱* + +### 相关媒体 ### + +注:youtube 视频 + + +[视频01: ASCIIQuarium - Linux/Unix桌面上的海洋动画][1] + +### 下载:ASCII Aquarium 的 KDE 和 Mac OS X 版本 ### + +[点此下载 asciiquarium][2]。如果你运行的是 Mac OS X,试下这个可以直接使用的已经打包好的[版本][3]。对于 KDE 用户,试试基于 Asciiquarium 的[KDE 屏幕保护程序][4] + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/tips/linux-unix-apple-osx-terminal-ascii-aquarium.html + +作者:Vivek Gite +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://youtu.be/MzatWgu67ok +[2]:http://www.robobunny.com/projects/asciiquarium/html/ +[3]:http://habilis.net/macasciiquarium/ +[4]:http://kde-look.org/content/show.php?content=29207 diff --git a/published/201512/20151215 Linux or Unix Desktop Fun--Cat And Mouse Chase All Over Your Screen.md b/published/201512/20151215 Linux or Unix Desktop Fun--Cat And Mouse Chase All Over Your Screen.md new file mode 100644 index 0000000000..1994d7b797 --- /dev/null +++ b/published/201512/20151215 Linux or Unix Desktop Fun--Cat And Mouse Chase All Over Your Screen.md @@ -0,0 +1,89 @@ +Linux/Unix桌面趣事:显示器里的猫和老鼠 +================================================================================ +Oneko 是一个有趣的应用。它会把你的光标变成一只老鼠,并在后面创建一个可爱的小猫,并且始终追逐着老鼠光标。单词“neko”在日语中的意思是老鼠。它最初是一位日本人开发的 Macintosh 桌面附件。 + +### 安装 oneko ### + +试下下面的命令: + + $ sudo apt-get install oneko + +示例输出: + + [sudo] password for vivek: + Reading package lists... Done + Building dependency tree + Reading state information... Done + The following NEW packages will be installed: + oneko + 0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded. + Need to get 38.6 kB of archives. + After this operation, 168 kB of additional disk space will be used. + Get:1 http://debian.osuosl.org/debian/ squeeze/main oneko amd64 1.2.sakura.6-7 [38.6 kB] + Fetched 38.6 kB in 1s (25.9 kB/s) + Selecting previously deselected package oneko. + (Reading database ... 274152 files and directories currently installed.) + Unpacking oneko (from .../oneko_1.2.sakura.6-7_amd64.deb) ... + Processing triggers for menu ... + Processing triggers for man-db ... + Setting up oneko (1.2.sakura.6-7) ... + Processing triggers for menu ... + +FreeBSD 用户输入下面的命令安装 oneko: + + # cd /usr/ports/games/oneko + # make install clean + +### 我该如何使用 oneko? ### + +输入下面的命令: + + $ oneko + +你可以把猫变成 “tora-neko”,一只像白老虎条纹的猫: + + $ oneko -tora + +### 不喜欢猫? ### + +你可以用狗代替猫: + + $ oneko -dog + +下面可以用樱花代替猫: + + $ oneko -sakura + +用大道寺代替猫: + + $ oneko -tomoyo + +### 查看相关媒体 ### + +这个教程同样也有视频格式: + +注:youtube 视频 + + +(Video.01: 示例 - 在 Linux 下安装和使用 oneko) + +### 其他选项 ### + +你可以传入下面的选项 + +1. **-tofocus**:让猫在获得焦点的窗口顶部奔跑。当获得焦点的窗口不在视野中时,猫像平常那样追逐老鼠。 +2. **-position 坐标** :指定X和Y来调整猫相对老鼠的位置 +3. **-rv**:将前景色和背景色对调 +4. **-fg 颜色** : 前景色 (比如 oneko -dog -fg red)。 +5. **-bg 颜色** : 背景色 (比如 oneko -dog -bg green)。 +6. 查看 oneko 的手册获取更多信息。 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/open-source/oneko-app-creates-cute-cat-chasing-around-your-mouse/ + +作者:Vivek Gite +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201512/20151229 Watch Star Wars In Linux Terminal.md b/published/201512/20151229 Watch Star Wars In Linux Terminal.md new file mode 100644 index 0000000000..b92a5b8b61 --- /dev/null +++ b/published/201512/20151229 Watch Star Wars In Linux Terminal.md @@ -0,0 +1,55 @@ +在 Linux 终端下看《星球大战》 +================================================================================ +![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-2.png) + +《星球大战(Star Wars)》已经席卷世界。最新一期的 [《星球大战》系列, 《星球大战7:原力觉醒》,打破了有史以来的记录][1]。 + +虽然我不能帮你得到一张最新的《星球大战》的电影票,但我可以提供给你一种方式,看[星球大战第四集][2],它是非常早期的《星球大战》电影(1977 年)。 + + +不,它不会是高清,也不是蓝光版。相反,它将是 ASCII 版的《星球大战》第四集,你可以在 Linux 终端看它,这才是真正的极客的方式 :) + +### 在 Linux 终端看星球大战 ### + +打开一个终端,使用以下命令: + + telnet towel.blinkenlights.nl + +等待几秒钟,你可以在终端看到类似于以下这样的动画ASCII艺术: + +(LCTT 译注:有时候会解析到效果更好 IPv6 版本上,如果你没有 IPv6 地址,可以重新连接试试;另外似乎线路不稳定,出现卡顿时稍等。) + +![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal.png) + +它将继续播映…… + +![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-1.png) + +![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-2.png) + +![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-3.png) + +![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-5.png) + +要停止动画,按 ctrl +],在这之后输入 quit 来退出 telnet 程序。 + +### 更多有趣的终端 ### + +事实上,看《星球大战》并不是你在 Linux 终端下唯一能做有趣的事情。您可以运行[终端里的列车][3]或[通过ASCII艺术得到Linux标志][4]。 + +希望你能享受在 Linux 下看《星球大战》。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/star-wars-linux/ + +作者:[Abhishek][a] +译者:[zky001](https://github.com/zky001) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.gamespot.com/articles/star-wars-7-breaks-thursday-night-movie-opening-re/1100-6433246/ +[2]:http://www.imdb.com/title/tt0076759/ +[3]:http://itsfoss.com/ubuntu-terminal-train/ +[4]:http://itsfoss.com/display-linux-logo-in-ascii/ diff --git a/published/20151201 Backup (System Restore Point) your Ubuntu or Linux Mint with SystemBack.md b/published/20151201 Backup (System Restore Point) your Ubuntu or Linux Mint with SystemBack.md new file mode 100644 index 0000000000..aeb82f69e4 --- /dev/null +++ b/published/20151201 Backup (System Restore Point) your Ubuntu or Linux Mint with SystemBack.md @@ -0,0 +1,44 @@ +使用 SystemBack 备份/还原你的 Ubuntu/Linux Mint +================================================= + +对于任何一款允许用户还原电脑到之前状态(包括文件系统,安装的应用,以及系统设置)的操作系统来说,系统还原功能都是必备功能,它可以恢复系统故障以及其他的问题。 + +有的时候安装一个程序或者驱动可能让你的系统黑屏。系统还原则可以让你电脑里面的系统文件(LCTT 译注:是系统文件,并非普通文件,详情请看**注意**部分)和程序恢复到之前工作正常时候的状态,进而让你远离那让人头痛的排障过程了,而且它也不会影响你的文件,照片或者其他数据。 + +简单的系统备份还原工具 [Systemback](https://launchpad.net/systemback) 可以让你很容易地创建系统备份以及用户配置文件。一旦遇到问题,你可以简单地恢复到系统先前的状态。它还有一些额外的特征包括系统复制,系统安装以及Live系统创建。 + +**截图** + +![systemback](http://2.bp.blogspot.com/-2UPS3yl3LHw/VlilgtGAlvI/AAAAAAAAGts/ueRaAghXNvc/s1600/systemback-1.jpg) + +![systemback](http://2.bp.blogspot.com/-7djBLbGenxE/Vlilgk-FZHI/AAAAAAAAGtk/2PVNKlaPO-c/s1600/systemback-2.jpg) + +![](http://3.bp.blogspot.com/-beZYwKrsT4o/VlilgpThziI/AAAAAAAAGto/cwsghXFNGRA/s1600/systemback-3.jpg) + +![](http://1.bp.blogspot.com/-t_gmcoQZrvM/VlilhLP--TI/AAAAAAAAGt0/GWBg6bGeeaI/s1600/systemback-5.jpg) + +**注意**:使用系统还原不会还原你自己的文件、音乐、电子邮件或者其他任何类型的私人文件。对不同用户来讲,这既是优点又是缺点。坏消息是它不会还原你意外删除的文件,不过你可以通过一个文件恢复程序来解决这个问题。如果你的计算机没有创建还原点,那么系统恢复就无法奏效,所以这个工具就无法帮助你(还原系统),如果你尝试恢复一个主要问题,你将需要移步到另外的步骤来进行故障排除。 + +> 适用于 Ubuntu 15.10 Wily/16.04/15.04 Vivid/14.04 Trusty/Linux Mint 14.x/其他Ubuntu衍生版,打开终端,将下面这些命令复制过去: + +终端命令: + +``` +sudo add-apt-repository ppa:nemh/systemback +sudo apt-get update +sudo apt-get install systemback + +``` + +大功告成。 + +-------------------------------------------------------------------------------- + +via: http://www.noobslab.com/2015/11/backup-system-restore-point-your.html + +译者:[DongShuaike](https://github.com/DongShuaike) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://launchpad.net/systemback diff --git a/published/20151202 8 things to do after installing openSUSE Leap 42.1.md b/published/20151202 8 things to do after installing openSUSE Leap 42.1.md new file mode 100644 index 0000000000..38cefbf356 --- /dev/null +++ b/published/20151202 8 things to do after installing openSUSE Leap 42.1.md @@ -0,0 +1,111 @@ +安装 openSUSE Leap 42.1 之后要做的 8 件事 +================================================================================ +![Credit: Metropolitan Transportation/Flicrk](http://images.techhive.com/images/article/2015/11/things-to-do-100626947-primary.idge.jpg) + +*致谢:[Metropolitan Transportation/Flicrk][1]* + +> 如果你已经在你的电脑上安装了 openSUSE,这就是你接下来要做的。 + +[openSUSE Leap 确实是个巨大的飞跃][2],它允许用户运行一个和 SUSE Linux 企业版拥有同样基因的发行版。和其它系统一样,为了实现最佳的使用效果,在使用它之前需要做些优化设置。 + +下面是一些我在我的电脑上安装 openSUSE Leap 之后做的一些事情(不适用于服务器)。这里面没有强制性的设置,基本安装对你来说也可能足够了。但如果你想获得更好的 openSUSE Leap 体验,那就跟着我往下看吧。 + +### 1. 添加 Packman 仓库 ### + +由于专利和授权等原因,openSUSE 和许多 Linux 发行版一样,不通过官方仓库(repos)提供一些软件、解码器,以及驱动等。取而代之的是通过第三方或社区仓库来提供。第一个也是最重要的仓库是“Packman”。因为这些仓库不是默认启用的,我们需要添加它们。你可以通过 YaST(openSUSE 的特色之一)或者命令行完成(如下方介绍)。 + +![o42 yast repo](http://images.techhive.com/images/article/2015/11/o42-yast-repo-100626952-large970.idge.png) + +*添加 Packman 仓库。* + +使用 YaST,打开软件源部分。点击“添加”按钮并选择“社区仓库(Community Repositories)”。点击“下一步”。一旦仓库列表加载出来了,选择 Packman 仓库。点击“确认”,然后点击“信任”导入信任的 GnuPG 密钥。 + +或者在终端里使用以下命令添加并启用 Packman 仓库: + + zypper ar -f -n packmanhttp://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_42.1/ packman + +仓库添加之后,你就可以使用更多的包了。想安装任意软件或包,打开 YaST 软件管理器,搜索并安装即可。 + +### 2. 安装 VLC ### + +VLC 是媒体播放器里的瑞士军刀,几乎可以播放任何媒体文件。你可以从 YaST 软件管理器 或 software.opensuse.org 安装 VLC。你需要安装两个包:vlc 和 vlc-codecs。 + +如果你用终端,运行以下命令: + + sudo zypper install vlc vlc-codecs + +### 3. 安装 Handbrake ### + +如果你需要转码或转换视频文件格式,[Handbrake 是你的不二之选][3]。Handbrake 就在我们启用的仓库中,所以只需要在 YaST 中搜索并安装它即可。 + +如果你用终端,运行以下命令: + + sudo zypper install handbrake-cli handbrake-gtk + +(提示:VLC 也能转码音频和视频文件。) + +### 4. 安装 Chrome ### + +openSUSE 的默认浏览器是 Firefox。但是因为 Firefox 不能够播放专有媒体,比如 Netflix,我推荐安装 Chrome。这需要额外的工作。首先你需要从谷歌导入信任密钥。打开终端执行“wget”命令下载密钥: + + wget https://dl.google.com/linux/linux_signing_key.pub + +然后导入密钥: + + sudo rpm --import linux_signing_key.pub + +现在到 [Google Chrome 网站][4] 去,下载 64 位 .rpm 文件。下载完成后执行以下命令安装浏览器: + + sudo zypper install /PATH_OF_GOOGLE_CHROME.rpm + +### 5. 安装 Nvidia 驱动 ### + +即便你使用 Nvidia 或 ATI 显卡,openSUSE Leap 也能够开箱即用。但是,如果你需要专有驱动来游戏或其它目的,你可以安装这些驱动,但需要一点额外的工作。 + +首先你需要添加 Nvidia 源;它的步骤和使用 YaST 添加 Packman 仓库是一样的。唯一的不同是你需要在社区仓库部分选择 Nvidia。添加好了之后,到 **软件管理 > 附加** 去并选择“附加/安装所有匹配的推荐包”。 + +![o42 nvidia](http://images.techhive.com/images/article/2015/11/o42-nvidia-100626950-large.idge.png) + +它会打开一个对话框,显示所有将要安装的包,点击确认后按介绍操作。添加了 Nvidia 源之后你也可以通过命令安装需要的 Nvidia 驱动: + + sudo zypper inr + +(注:我没使用过 AMD/ATI 显卡,所以这方面我没有经验。) + +### 6. 安装媒体解码器 ### + +你安装 VLC 之后就不需要安装媒体解码器了,但如果你要使用其它软件来播放媒体的话就需要安装了。一些开发者写了脚本/工具来简化这个过程。打开[这个页面][5]并点击合适的按钮安装完整的包。它会打开 YaST 并自动安装包(当然通常你还需要提供 root 权限密码并信任 GnuPG 密钥)。 + +### 7. 安装你喜欢的电子邮件客户端 ### + +openSUSE 自带 Kmail 或 Evolution,这取决于你安装的桌面环境。我用的是 KDE Plasma 自带的 Kmail,这个邮件客户端还有许多地方有待改进。我建议可以试试 Thunderbird 或 Evolution。所有主要的邮件客户端都能在官方仓库找到。你还可以看看我[精心挑选的 Linux 最佳邮件客户端][7]。 + +### 8. 在防火墙允许 Samba 服务 ### + +相比于其它发行版,openSUSE 默认提供了更加安全的系统。但对新用户来说它也需要一点设置。如果你正在使用 Samba 协议分享文件到本地网络的话,你需要在防火墙允许该服务。 + +![o42 firewall](http://images.techhive.com/images/article/2015/11/o42-firewall-100626948-large970.idge.png) + +*在防火墙设置里允许 Samba 客户端和服务端* + +打开 YaST 并搜索 Firewall。在防火墙设置里,进入到“允许的服务(Allowed Services)”,你会在“要允许的服务(Service to allow)”下面看到一个下拉列表。选择“Samba 客户端”,然后点击“添加”。同样方法添加“Samba 服务器”。都添加了之后,点击“下一步”,然后点击“完成”,现在你就可以通过本地网络从你的 openSUSE 分享文件以及访问其它机器了。 + +这差不多就是我以我喜欢的方式对我的新 openSUSE 系统做的所有设置了。如果你有任何问题,欢迎在评论区提问。 + +-------------------------------------------------------------------------------- + +via: http://www.itworld.com/article/3003865/open-source-tools/8-things-to-do-after-installing-opensuse-leap-421.html + +作者:[Swapnil Bhartiya][a] +译者:[alim0x](https://github.com/alim0x) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.itworld.com/author/Swapnil-Bhartiya/ +[1]:https://www.flickr.com/photos/mtaphotos/11200079265/ +[2]:https://www.linux.com/news/software/applications/865760-opensuse-leap-421-review-the-most-mature-linux-distribution +[3]:https://www.linux.com/learn/tutorials/857788-how-to-convert-videos-in-linux-using-the-command-line +[4]:https://www.google.com/intl/en/chrome/browser/desktop/index.html#brand=CHMB&utm_campaign=en&utm_source=en-ha-na-us-sk&utm_medium=ha +[5]:http://opensuse-community.org/ +[6]:http://www.itworld.com/article/2875981/the-5-best-open-source-email-clients-for-linux.html diff --git a/published/20151202 KDE vs GNOME vs XFCE Desktop.md b/published/20151202 KDE vs GNOME vs XFCE Desktop.md new file mode 100644 index 0000000000..4eb3044958 --- /dev/null +++ b/published/20151202 KDE vs GNOME vs XFCE Desktop.md @@ -0,0 +1,53 @@ +KDE、GNOME 和 XFCE 桌面比较 +================================================================================ +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2013/07/300px-Xfce_logo.svg_.png) + +这么多年来,很多人一直都在他们的 linux 桌面端使用 KDE 或者 GNOME 桌面环境。在这两个桌面环境多年不断发展的同时,其它的桌面也在持续增加它们的用户规模。举个例子说,在轻量级桌面环境下,XFCE 一举成为了最受欢迎的桌面环境,相较于 LXDE 缺少的优美视觉效果,默认配置下的 XFCE 在这方面就可以打败前者。XFCE 提供的功能特性都能在 GNOME2 下得到,然而,在一些较老的计算机上,它的轻量级的特性却能取得更好的效果。 + +### 桌面主题定制 ### + +用户完成安装之后,XFCE 看起来可能会有一点无趣,因为它在视觉上还缺少一些吸引力。但是,请不要误解我的话, XFCE 仍然拥有漂亮的桌面,但是对于大多数刚刚接触 XFCE 桌面环境的人来说,可能它看起来像香草一样普普通通。不过好消息是当我们想要给 XFCE 安装新的主题的时候,这会是一个十分轻松的过程,因为你能够快速的找到你喜欢的 XFCE 主题,之后你就可以将它解压到一个合适的目录中。从这一点上来说,XFCE 自带的一个放在“外观”下的重要的图形界面工具可以帮助用户更加容易的选择中意的主题,这可能是目前在 XFCE 上这方面最好用的工具了。如果用户按照上面的建议去做的话,对于想要尝试使用 XFCE 的任何用户来说都将不存在困难。 + +在 GNOME 桌面上,用户也可以按照类似上面的方法去做。不过,其中最主要的不同点就是在你做之前,用户必须手动下载并安装 GNOME Tweak Tool。当然,对于使用来说都不会有什么障碍,但是对于用户来说,使用 XFCE 安装和激活主题并不需要去额外去下载安装各种调整工具,这可能是他们无法忽略的一个优势。而在 GNOME 上,尤其是在用户已经下载并安装了 GNOME Tweak tool 之后,你仍将必须确保你已经安装了“用户主题扩展”。 + +同 XFCE 一样,用户需要去搜索并下载自己喜欢的主题,然后,用户可以再次使用 GNOME Tweak tool,并点击该工具界面左边的“外观”按钮,接着用户便可以直接查看页面底部并点击文件浏览按钮,然后浏览到那个压缩的文件夹并打开。当完成这些之后,用户将会看到一个告诉用户已经成功应用了主题的对话框,这样你的主题便已经安装完成。然后用户就可以简单的使用下拉菜单来选择他们想要的主题。和 XFCE 一样,主题激活的过程也是十分简单的,然而,对于因为要使用一个新的主题而去下载一个没有预先安装到系统里面的应用,这种情况也是需要考虑的。 + +最后,就是 KDE 桌面主题定制的过程了。和 XFCE 一样,不需要去下载额外的工具来安装主题。从这点来看,让人有种XFCE 可能要被 KDE 战胜了的感觉。不仅在 KDE 上可以完全使用图形用户界面来安装主题,而且甚至只需要用户点击获取新主题的按钮就可以找到、查看新的主题,并且最后自动安装。 + +然而,我们应该注意到 KDE 相比 XFCE 而言,是一个更加健壮完善的桌面环境。当然,对于主要以极简设计为目的的桌面来说,缺失一些更多的功能是有一定的道理的。为此,我们要为这样优秀的功能给 KDE 加分。 + +### MATE 不是一个轻量级的桌面环境 ### + +在继续比较 XFCE、GNOME3 和 KDE 之前,对于老手我们需要澄清一下,我们没有将 MATE 桌面环境加入到我们的比较中。MATE 可被看作是 GNOME2 的另一个衍生品,但是它并没有主要作为一款轻量级或者快捷桌面出现。相反,它的主要目的是成为一款更加传统和舒适的桌面环境,并使它的用户在使用它时就像在家里一样舒适。 + +另一方面,XFCE 生来就是要实现他自己的一系列使命。XFCE 给它的用户提供了一个更轻量而仍保持吸引人的视觉体验的桌面环境。然后,对于一些认为 MATE 也是一款轻量级的桌面环境的人来说,其实 MATE 真正的目标并不是成为一款轻量级的桌面环境。这两种选择在各自安装了一款好的主题之后看起来都会让人觉得非常具有吸引力。 + +### 桌面导航 ### + +XFCE 除了桌面,还提供了一个醒目的导航器。任何使用过传统的 Windows 或者 GNOME 2/MATE 桌面环境的用户都可以在没有任何帮助的情况下自如的使用新安装的 XFCE 桌面环境的导航器。紧接着,添加小程序到面板中也是很显眼的。就像找一个已经安装的应用程序一样,直接使用启动器并点击你想要运行的应用程序图标就行。除了 LXDE 和 MATE 之外,还没有其他的桌面的导航器可以做到如此简单。不仅如此,更好的是控制面板的使用是非常容易使用的,对于刚刚使用这个新桌面的用户来说这是一个非常大的好处。如果用户更喜欢通过老式的方法去使用他们的桌面,那么 GNOME 就不合适。通过热角而取代了最小化按钮,加上其他的应用排布方式,这可以让大多数新用户易于使用它。 + +如果用户来自类似 Windows 这样的桌面环境,那么这些用户需要摒弃这些习惯,不能简单的通过鼠标右击一下就将一个小程序添加到他们的工作空间顶部。与此相反,它可以通过使用扩展来实现。GNOME 是可以安装拓展的,并且是非常的容易,这些容易之处体现在只需要用户简单的使用位于 GNOME 扩展页面上的 on/off 开关即可。不过,用户必须知道这个东西,才能真正使用上这个功能。 + +另一方面,GNOME 正在它的外观中体现它的设计理念,即为用户提供一个直观和易用的控制面板。你可能认为那并不是什么大事,但是,在我看来,它确实是我认为值得称赞并且有必要被提及的方面。KDE 给它的用户提供了更多的传统桌面使用体验,并通过提供相似的启动器和一种更加类似的获取软件的方式的能力来迎合来自 Windows 的用户。添加小部件或者小程序到 KDE 桌面是件非常简单的事情,只需要在桌面上右击即可。唯一的问题是 KDE 中这个功能不好发现,就像 KDE 中的其它东西一样,对于用户来说好像是隐藏的。KDE 的用户可能不同意我的观点,但我仍然坚持我的说法。 + +要增加一个小部件,只要在“我的面板”上右击就可以看见面板选项,但是并不是安装小部件的一个直观的方法。你并不能看见“添加部件”,除非你选择了“面板选项”,然后才能看见“添加部件”。这对我来说不是个问题,但是对于一些用户来说,它变成了不必要的困惑。而使事情变得更复杂的是,在用户能够找到部件区域后,他们后来发现一种称为“活动”的新术语。它和部件在同一个地方,可是它在自己的区域却是另外一种行为。 + +现在请不要误解我,KDE 中的活动特性是很不错的,也是很有价值的,但是从可用性的角度看,为了不让新手感到困惑,它更加适合于放在另一个菜单项。用户各有不同,但是让新用户多测试一段时间可以让它不断改进。对“活动”的批评先放一边,KDE 添加新部件的方法的确很棒。与 KDE 的主题一样,用户不能通过使用提供的图形用户界面浏览和自动安装部件。这是一个有点神奇的功能,但是它这样也可以工作。KDE 的控制面板可能和用户希望的样子不一样,它不是足够的简单。但是有一点很清楚,这将是他们致力于改进的地方。 + +### 因此,XFCE 是最好的桌面环境,对吗? ### + +就我自己而言,我在我的计算机上使用 GNOME、KDE,并在我的办公室和家里的电脑上使用 Xfce。我也有一些老机器在使用 Openbox 和 LXDE。每一个桌面的体验都可以给我提供一些有用的东西,可以帮助我以适合的方式使用每台机器。对我来说,Xfce 是我的心中的挚爱,因为 Xfce 是一个我使用了多年的桌面环境。但对于这篇文章,我是用我日常使用的机器来撰写的,事实上,它用的是 GNOME。 + +这篇文章的主要思想是,对于那些正在寻找稳定的、传统的、容易理解的桌面环境的用户来说,我还是觉得 Xfce 能提供好一点的用户体验。欢迎您在评论部分和我们分享你的意见。 + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/kde-vs-gnome-vs-xfce-desktop/ + +作者:[M.el Khamlichi][a] +译者:[kylepeng93](https://github.com/kylepeng93) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/pirat9/ diff --git a/published/20151207 5 great Raspberry Pi projects for the classroom.md b/published/20151207 5 great Raspberry Pi projects for the classroom.md new file mode 100644 index 0000000000..ddf2258d97 --- /dev/null +++ b/published/20151207 5 great Raspberry Pi projects for the classroom.md @@ -0,0 +1,94 @@ +5 个很适合在课堂上演示的树莓派项目 +===================================================== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/osdc-open-source-yearbook-lead3.png?itok=fSUS0fIt) + +### 1. 我的世界: Pi + +![](https://opensource.com/sites/default/files/lava.png) + +*源于 Raspberry Pi 基金会. [CC BY-SA 4.0][1]* + +“我的世界”是世界上几乎每一个青少年都特别喜欢的一款游戏,而且它成功抓住了年轻人眼球,成为目前最能激发年轻人创造力的游戏之一。这个树莓派版本自带的我的世界不仅仅是一个具有创造性的建筑游戏,还是一个具有编程接口,可以通过 Python 与之交互的版本。 + +我的世界:Pi 版对于老师来说是一个教授学生解决问题和编写代码完成任务的好方式。你可以使用 Python API 创建一个房子,并且一直跟随这你的脚步移动,在所到之处建造一座桥,让天空落下熔岩雨滴,在空中显示温度,以及其它你可以想象到的一切东西。 + +详情请见 "[我的世界: Pi 入门][2]" + +### 2. 反应游戏和交通灯 + +![](https://opensource.com/sites/default/files/pi_traffic_installed_yellow_led_on.jpg) + +*源于 [Low Voltage Labs][3]. [CC BY-SA 4.0][1]* + +使用树莓派可以很轻松地进行物理计算,只需要连接几个 LED 和按钮到开发板上的 GPIO 接口,再用几行代码你就可以按下按钮来开灯。一旦你了解了如何使用代码来完成这些基本的操作,接下来就可以根据你的想象来做其它事情了。 + +如果你知道如何让一个灯闪烁,你就可以控制三个灯闪烁。挑选三个和交通灯一样颜色的 LED 灯,然后编写控制交通灯的代码。如果你知道如何使用按钮触发事件,那么你就可以模拟一个行人过马路。同时你可以参考其它已经完成的交通灯附件,比如[PI-TRAFFIC][4], [PI-STOP][5], [Traffic HAT][6],等等。 + +代码并不是全部——这只是一个演练,让你理解现实世界里系统是如何完成设计的。计算思维是一个让你终身受用的技能。 + +![](https://opensource.com/sites/default/files/reaction-game.png) + +*源于 Raspberry Pi 基金会. [CC BY-SA 4.0][1]* + +接下来试着接通两个按钮和 LED 灯的电源,实现一个双玩家的反应游戏 —— 让 LED 灯随机时间点亮,然后看是谁抢先按下按钮。 + +要想了解更多可以看看 [GPIO Zero recipes][7]。你所需要的资料都可以在 [CamJam EduKit 1][8] 找到。 + +### 3. Sense HAT 电子宠物 + +Astro Pi —— 一个增强版的树莓派 —— 将在 12 月问世,但是你并没有错过亲手把玩这个硬件的机会。Sense HAT 是使用在 Astro Pi 的一个传感器扩展板,现在已经开放购买了。你可以使用它来进行数据搜集、科学实验,游戏等等。可以看看下面树莓派的 Carrie Anne 拍摄的 Gurl Geek Diaries 的视频,里面演示了一种很棒的入门途径——在 Sense HAT 屏幕上自己设计一个生动的像素宠物: + +[video](https://youtu.be/gfRDFvEVz-w) + +> 详见 "[探索 Sense HAT][9]." + +### 4. 红外鸟笼 + +![](https://opensource.com/sites/default/files/ir-bird-box.png) + +*源于 Raspberry Pi 基金会. [CC BY-SA 4.0][1]* + +让整个班级都可以参与进来的好主意是在鸟笼里放置一个树莓派和夜视镜头,以及一些红外线灯,这样子你就可以在黑暗中看见鸟笼里的情况了,然后使用树莓派通过网络串流视频。然后就可以等待小鸟归笼了,你可以在不打扰的情况下近距离观察小窝里的它们了。 + +要了解更多有关红外线和光谱的知识,以及如何校准摄像头焦点和使用软件控制摄像头,可以访问 [打造一个红外鸟笼][10]。 + +### 5. 机器人 + +![](https://opensource.com/sites/default/files/edukit3_1500-alex-eames-sm.jpg) + +*源于 Raspberry Pi 基金会. [CC BY-SA 4.0][1]* + +只需要一个树莓派、很少的几个电机和电机控制器,你就可以自己动手制作一个机器人。可以制作的机器人有很多种,从简单的由几个轮子和自制底盘拼凑的简单小车,到由游戏控制器驱动、具有自我意识、配备了传感器,安装了摄像头的金属小马。 + +要学习如何控制不同的电机,可以使用 RTK 电机驱动开发板入门或者使用配置了电机、轮子和传感器的 CamJam 机器人开发套件——具有很大的价值和大量的学习潜力。 + +或者,如果你还想了解更多核心内容,可以试试 PiBorg 的 [4Borg][11](£99/$150)和 [DiddyBorg][12](£180/$273),或者购买 Metal 版 DoodleBorg (£250/$380),然后构建一个最小版本的 [DoodleBorg tank][13](非卖品)。 + +详情可见 [机器人装备表][14]。 + +------------------------------------------------------------------------------ + +via: https://opensource.com/education/15/12/5-great-raspberry-pi-projects-classroom + +作者:[Ben Nuttall][a] +译者:[ezio](https://github.com/oska874) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bennuttall +[1]: https://creativecommons.org/licenses/by-sa/4.0/ +[2]: https://opensource.com/life/15/5/getting-started-minecraft-pi +[3]: http://lowvoltagelabs.com/ +[4]: http://lowvoltagelabs.com/products/pi-traffic/ +[5]: http://4tronix.co.uk/store/index.php?rt=product/product&product_id=390 +[6]: https://ryanteck.uk/hats/1-traffichat-0635648607122.html +[7]: http://pythonhosted.org/gpiozero/recipes/ +[8]: http://camjam.me/?page_id=236 +[9]: https://opensource.com/life/15/10/exploring-raspberry-pi-sense-hat +[10]: https://www.raspberrypi.org/learning/infrared-bird-box/ +[11]: https://www.piborg.org/4borg +[12]: https://www.piborg.org/diddyborg +[13]: https://www.piborg.org/doodleborg +[14]: http://camjam.me/?page_id=1035#worksheets diff --git a/published/20151227 Upheaval in the Debian Live project.md b/published/20151227 Upheaval in the Debian Live project.md new file mode 100644 index 0000000000..9b3d4dc2f0 --- /dev/null +++ b/published/20151227 Upheaval in the Debian Live project.md @@ -0,0 +1,67 @@ +Debian Live项目的剧变 +================================================================================== + +尽管围绕 Debian Live 项目发生了很多戏剧性事件,关于 [Debian Live 项目][1]结束的[公告][2]的影响力甚至小于该项目首次出现时的公告。主要开发者的离开是最显而易见的损失,而社区对他本人及其项目的态度是很令人困惑的,但是这个项目也许还是会以其他的形式继续下去。所以 Debian 仍然会有更多的工具去创造启动光盘和其他介质。尽管是用这样一种有遗憾的方式,项目创始人 Dabiel Baumann 和 Debian CD 团队以及安装检测团队之间出现的长期争论已经被「解决」了。                                      +在 11 月 9 日, Baumann 发表了题为「 Debian Live 项目的突然结束」的一篇公告。在那篇短文中,他一一列举出了自从这个和他有关的[项目被发起][3]以来近 10 年间发生的不同的事件,这些事件可以表明他在 Debian Live 项目上的努力一直没有被重视或没有被足够重视。最具决定性的因素是因为在「包的含义」上存在冲突, R.Learmonth [申请][4]了新的包名,而这侵犯了在 Debian Live 上使用的命名空间。 + +考虑到最主要的 Debian Live 包之一被命名为 live-build ,而 R.Learmonth 申请的新包名却是 live-build-ng ,这简直是对 live-build 的挑战。 live-build-ng 意为一种围绕 [vmdebootstrap][5]【译者注:创造真实的和虚拟机Debian的磁盘映像】工具的外部包装,这种包装是为了创造 live 介质(光盘和USB的插入),也是 Debian Live 最需要的的部分。但是当 Baumann Learmonth [要求][6]为他的包换一个不同的名字的时候,他得到了一个「有趣」的[回复][7]: + +``` +应该注意到, live-build 不是一个 Debian 项目,它是一个声称自己是官方 Debian 项目的外部项目,这是一个需要我们解决的问题。 +这不是命名空间的问题,我们要将以目前维护的 live-config 和 live-boot 包为基础,把它们加入到 Debian 的本地项目。如果迫不得已的话,这将会有很多分支,但是我希望它不要发生,这样的话我们就可以把这些包整合到 Debian 中并继续以一种协作的方式去开发。 +live-build 已经被 debian-cd 放弃,live-build-ng 将会取代它。至少在一个精简的 Debian 环境中,live-build 会被放弃。我们(开发团队)正在与 debian-cd 和 Debian Installer 团队合作开发 live-build-ng 。 +``` + +Debian Live 是一个「官方的」 Debian 项目(也可以是狭义的「官方」),尽管它因为思路上的不同产生过争论。除此之外, vmdebootstrap 的维护者 Neil Willians 为脱离 Debian Live 项目[提供了如下的解释][8]: + +``` +为了更好的支持 live-build 的代替者, vmdebootstrap 肯定会被推广。为了能够用 live-build 解决目前存在的问题,这项工作会由 debian-cd 团队来负责。这些问题包括可靠性问题,以及不能很好的支持多种机器和 UEFI 等。 vmdebootstrap 也存在着这些问题,我们用来自于对 live-boot 和 live-config 的支持情况来确定 vmdebootstrap 的功能。 +``` + +这些抱怨听起来合情合理,但是它们可能已经在目前的项目中得到了解决。然而一些秘密的项目有很明显的取代 live-build 的意图。正如 Baumann [指出][9]的,这些计划没有被发布到 debian-live 的邮件列表中。人们首次从 Debian Live 项目中获知这些计划正是因为这一次的ITP事件,所以它看起来像是一个「秘密计划」——有些事情在像 Debian 这样的项目中得不到很好的安排。 + +人们可能已经猜到了,有很多帖子都支持 Baumann [重命名][10] live-build-ng 的请求,但是紧接着,人们就因为他要停止继续在 Debian Live 上工作的决定而变得沮丧。然而 Learmonth 和 Williams 却坚持认为取代 live-build 很有必要。Learmonth 给 live-build-ng 换了一个争议性也许小一些的名字: live-wrapper 。他说他的目标是为 Debian Live 项目加入新的工具(并且「把 Debian Live 项目引入 Debian 里面」),但是完成这件事还需要很大的努力。 + +``` +我向已经被 ITP 问题所困扰的每个人道歉。我们已经告知大家 live-wrapper 还不足以完全替代 live-build 且开发工作仍在进行以收集反馈。尽管有了这部分的工作,我们收到的反馈缺并不是我们所需要的。 +``` + +这种对于取代 live-build 的强烈反对或许已经被预知到了。自由软件社区的沟通和交流很关键,所以,计划去替换一个项目的核心很容易引起争议——更何况是一个一直不为人所知的计划。从 Banumann 的角度来说,他当然不是完美的,他因为上传个不合适的 [syslinux 包][11]导致了 wheezy 的延迟发布,并且从那以后他被从 Debian 开发者暂时[降级][12]为 Debian 维护者。但是这不意味着他应该受到这种对待。当然,这个项目还有其他人参与,所以不仅仅是 Baumann 受到了影响。 + +Ben Armstrong 是其他参与者中的一位,在这个事件中,他很圆滑地处理了一些事,并且想从这个事件中全身而退。他从一封邮件[13]开始,这个邮件是为了庆祝这个项目,以及他和他的团队在过去几年取得的成果。正如他所说, Debian Live 的[下游项目列表][14]是很令人振奋的。在另一封邮件中,他也[指出][15]了这个项目不是没有生命力的: + +``` +如果 Debian CD 开发团队通过他们的努力开发出可行的、可靠的、经过完善测试替代品,以及一个合适的取代 live-build 的候选者,这对于 Debian 项目有利无害。如果他们继续做这件事,他们不会「用一个官方改良,但不可靠且几乎没有经过测试的待选者取代 live-build 」。到目前为止,我还没有看到他们那样做的迹象。其间, live-build 仍保留在存档中——它仍然处于良好状态,且没有一种经过改良的继任者来取代它,因此开发团队没有必要尽快删除它。 +``` + +11 月 24 号, Armstrong 也在[他的博客][16]上[发布][17]了一个有关 Debian Live 的新消息。它展示了从 Baumann 退出起两周内的令人高兴的进展。甚至有迹象表明 Debian Live 项目与 live-wrapper 开发者开展了合作。博客上也有了一个[计划表][18],同时不可避免地寻求更多的帮助。这让人们有理由相信围绕项目发生的戏剧性事件仅仅是一个小摩擦——也许不可避免,但绝不是像现在看起来这么糟糕。 + +--------------------------------- + +via: https://lwn.net/Articles/665839/ + +作者:Jake Edge +译者:[vim-kakali](https://github.com/vim-kakali) +校对:[PurlingNayuki](https://github.com/PurlingNayuki) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + + +[1]: https://lwn.net/Articles/666127/ +[2]: http://live.debian.net/ +[3]: https://www.debian.org/News/weekly/2006/08/ +[4]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804315 +[5]: http://liw.fi/vmdebootstrap/ +[6]: https://lwn.net/Articles/666173/ +[7]: https://lwn.net/Articles/666176/ +[8]: https://lwn.net/Articles/666181/ +[9]: https://lwn.net/Articles/666208/ +[10]: https://lwn.net/Articles/666321/ +[11]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699808 +[12]: https://nm.debian.org/public/process/14450 +[13]: https://lwn.net/Articles/666336/ +[14]: http://live.debian.net/project/downstream/ +[15]: https://lwn.net/Articles/666338/ +[16]: https://lwn.net/Articles/666340/ +[17]: http://syn.theti.ca/2015/11/24/debian-live-after-debian-live/ +[18]: https://wiki.debian.org/DebianLive/TODO diff --git a/published/201601/20101020 19 Years of KDE History--Step by Step.md b/published/201601/20101020 19 Years of KDE History--Step by Step.md new file mode 100644 index 0000000000..50cfff73fb --- /dev/null +++ b/published/201601/20101020 19 Years of KDE History--Step by Step.md @@ -0,0 +1,232 @@ +KDE 的19年进化历程 +================ + +注:youtube 视频 + + +## 概述 + +KDE – 史上功能最强大的桌面环境之一;开源且可自由使用。19年前,1996年10月14日,德国程序员 Matthias Ettrich 开始了这个美观的桌面环境的开发。KDE 提供了用户界面以及其他很多日常使用的程序。今日,KDE 被成千上万人在 Unix 和 Windows 上使用。19年,一个对软件项目而言极为漫长的年岁。现在是时候让我们回到最初,看看这一切肇始于何处。 + +K Desktop Environment(KDE)有很多创新之处:新设计,美观,一致的体验,易于使用,对普通用户和专业用户都足够强大的应用库。“KDE”这个名字是对单词“通用桌面环境”(Common Desktop Environment)玩的一个简单谐音游戏,“K”即“Cool”。 第一代 KDE 在双许可证授权下使用了 Trolltech 公司专利的 Qt framework(现 Qt 的前身),这两个许可证分别是开源的 QPL(Q public license)和商业专利许可证(proprietary commercial license)。在2000年 Trolltech 公司让一部分 Qt 软件库开始发布在 GPL 证书下; Qt 4.5 发布在了 LGPL 2.1 许可证下。自2009起 KDE 桌面环境由三部分构成:Plasma Workspaces(用做交互界面),KDE Applications,作为 KDE Software 编译的 KDE Platform。 + +## 各发布版本 + +### 预发布版本 – 1996年10月14日 + +![](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/0b3.png) + +当时名称为 Kool Desktop Environment;“Kool”这个单词在很快就被弃用了。最初,所有 KDE 的组件都是被单独发布在开发社区里的,它们并没有被一个大的项目所贯穿起来。开发组邮件列表中的首选通信是发往kde@fiwi02.wiwi.uni-Tubingen.de 邮件列表。 + +### KDE 1.0 – 1998年7月12日 + +![](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/10.png) + +这个版本受到了颇有争议的反馈。很多人反对使用 Qt 框架,因为当时的 FreeQt 许可证和自由软件许可证并不兼容,他们建议开发组使用 Motif 或者 LessTif 替代。尽管有着这些反对声,KDE 仍然被很多用户所青睐,并且成功作为第一个 Linux 发行版的环境被集成了进去。 + +![28 January 1999](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/11.png) + +*1999年1月28日* + +有一次升级,**K Desktop Environment 1.1**,更快,更稳定的同时加入了很多小的改进。这个版本同时也加入了很多新的图标,背景和材质纹理。和这些全面翻新同时出现的还有 Torsten Rahn 绘制的全新 KDE 图标----一个放在齿轮前的字母 K ;这个图标的修改版也一直沿用至今。 + +### KDE 2.0 – 2000年10月23日 + +![](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/20.png) + +重大更新: + +- DCOP (Desktop COmmunication Protocol),一个端到端的通信协议 +- KIO,一个应用程序 I/O 库 +- KParts,组件对象模型 +- KHTML,一个符合 HTML 4.0 标准的渲染绘制引擎。 + +![26 February 2001](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/21.png) + +*2001年2月26日* + +**K Desktop Environment 2.1** 首次发布了媒体播放器 noatun,它使用了模组化、插件设计。为了便利开发者,K Desktop Environment 2.1 打包了 KDevelop。 + +![15 August 2001](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/22.png) + +*2001年8月15日* + +**KDE 2.2**版本在 GNU/Linux 上加快了50%的应用启动速度,同时提高了 HTML 渲染、JavaScript 稳定性和性能,同时还增加了一些 KMail 的功能。 + +### KDE 3.0 – 2002年4月3日 + +![](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/30.png) + +K Desktop Environment 3.0 加入了更好的限制使用功能,这个功能在电话亭、网咖,企业公用电脑上被广泛需求,它可以禁止用户完全使用软件的某些能力。 + +![28 January 2003](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/31.png) + +*2003年1月28日* + +**K Desktop Environment 3.1** 加入了新的默认窗口(Keramik)和图标样式(Crystal)和其他一些改进。 + +![3 February 2004](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/32.png) + +*2004年2月3日* + +**K Desktop Environment 3.2** 加入了诸如在网页表格、书写邮件中拼写检查的新功能;增强了邮件和日历功能。完善了 Konqueror 中的标签机制和对 Microsoft Windows 桌面共享协议(RDP)的支持。 + +![19 August 2004](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/33.png) + +*2004年8月19日* + +**K Desktop Environment 3.3** 侧重于组合不同的桌面组件。Kontact 被放进了群件应用 Kolab 并与 Kpilot 结合。Konqueror 的加入让 KDE 有了更好的 IM 交流功能,比如支持发送文件,以及其他 IM 协议(如IRC)的支持。 + +![16 March 2005](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/34.png) + +*2005年3月16日* + +**K Desktop Environment 3.4** 侧重于提高易用性。这次更新为 Konqueror、Kate、KPDF 加入了文字-语音转换功能;也在桌面系统中加入了独立的 KSayIt 文字-语音转换软件。 + +![29 November 2005](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/35.png) + +*2005年11月29日* + +**The K Desktop Environment 3.5** 发布加入了 SuperKaramba,为桌面环境提供了易于安装的插件(widgets)机制。 Konqueror 加入了广告屏蔽功能并成为了有史以来第二个通过 Acid2 CSS 测试的浏览器。 + +### KDE SC 4.0 – 2008年1月11日 + +![](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/400.png) + +大部分的开发投身于把最新的技术和开发框架整合进 KDE 4 当中。Plasma 和 Oxygen 是两次最大的用户界面风格变更。同时,Dolphin 替代 Konqueror 成为默认文件管理器,Okular 成为了默认文档浏览器。 + +![29 July 2008](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/401.png) + +*2008年7月29日* + +**KDE 4.1** 引入了一个在 PIM 和 Kopete 中共享使用的表情主题系统;引入了可以让用户便利地从互联网上一键下载数据的 DXS。同时引入了 GStreamer、QuickTime 和 DirectShow 9 Phonon 后端。加入了新应用如: + +- Dragon Player +- Kontact +- Skanlite — 扫描仪软件 +- Step —— 物理模拟软件 +- 新游戏: Kdiamond、Kollision、KBreakout 和更多...... + +![27 January 2009](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/402.png) + +*2009年1月27日* + +**KDE 4.2** 被认为是在已经极佳的 KDE 4.1 基础上的又一次全面超越,同时也成为了大多数用户替换旧 3.5 版本的完美选择。 + +![4 August 2009](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/403.png) + +*2009年8月4日* + +**KDE 4.3** 修复了超过10000个 bug,同时加入了让近2000个用户要求的功能。整合一些新的技术例如:PolicyKit、NetworkManage & Geolocation services 等也是这个版本的一大重点。 + +![9 February 2010](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/404.png) + +*2010年2月9日* + +**KDE SC 4.4** 基于 Qt 4 toolkit 的 4.6 版本,加入新的应用 KAddressBook。 + +![10 August 2010](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/405.png) + +*2010年8月10日* + +**KDE SC 4.5** 增加了一些新特性:整合了开源的浏览器引擎 WebKit 库,其现在也在 Apple Safari 和 Google Chrome 中广泛使用。KPackageKit 替换了 Kpackage。 + +![26 January 2011](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/406.png) + +*2011年1月26日* + +**KDE SC 4.6** 加强了 OpenGl 的性能,同时照常更新了无数bug和小改进。 + +![27 July 2011](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/407.png) + +*2011年7月27日* + +**KDE SC 4.7** 升级 KWin 以兼容 OpenGL ES 2.0 ,更新了 Qt Quick,Plasma Desktop 带来许多增强和在应用里的大量新特性, 修复了1.2万个 bug。 + +![25 January 2012](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/408.png) + +*2012年1月25日* + +**KDE SC 4.8**: 更好的 KWin 性能与 Wayland 支持,更崭新的 Doplhin 的外观设计。 + +![1 August 2012](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/409.png) + +*2012年8月1日* + +**KDE SC 4.9**: 向 Dolphin 文件管理器增加了一些更新,比如重新加入了实时文件重命名,鼠标辅助按钮支持,更好的位置面板和更多文件分类管理功能。 + +![6 February 2013](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/410.png) + +*2013年2月6日* + +**KDE SC 4.10**: 很多 Plasma 插件使用 QML 重写; Nepomuk、Kontact 和 Okular 得到了很大程度的性能和功能提升。 + +![14 August 2013](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/411.png) + +*2013年8月14日* + +**KDE SC 4.11**: Kontact 和 Nepomuk 有了很多优化。 第一代 Plasma Workspaces 进入了单纯维护阶段。 + +![18 December 2013](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/412.png) + +*2013年12月18日* + +**KDE SC 4.12**: Kontact 得到了极大的提升,包括许多小的改进。 + +![16 April 2014](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/413.png) + +*2014年4月16日* + +**KDE SC 4.13**: Nepomuk 语义搜索功能替代了桌面上的原有的 Baloo 搜索。 KDE SC 4.13 以53个语言版本发布。 + +![20 August 2014](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/414.png) + +*2014年8月20日* + +**KDE SC 4.14**: 这个发布版本侧重于稳定性提升:大量的 bug 修复和增加了一些小的功能。这是最后一个 KDE SC 4 发布版本。 + +### KDE Plasma 5.0 – 2014年7月15日 + +![](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/500.png) + +KDE Plasma 5 – 第五代 KDE。大幅改进了设计和系统,新的默认主题 Breeze 完全迁移到了 QML,更好的 OpenGL 性能,更完美的 HiDPI (高分辨率)显示支持。 + +![11 November 2014](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/501.png) + +*2014年11月11日* + +**KDE Plasma 5.1**:迁移了从 Plasma 4 里丢失的功能。 + +![27 January 2015](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/502.png) + +*2015年1月27日* + +**KDE Plasma 5.2**:新组件:BlueDevil、KSSHAskPass、Muon、SDDM 主题设置、KScreen、GTK+ 样式设置和 KDecoration。 + +![28 April 2015](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/503.png) + +*2015年4月28日* + +**KDE Plasma 5.3**:Plasma Media Center 技术预览。新的蓝牙和触摸板小程序;改良了电源管理。 + +![25 August 2015](https://github.com/paulcarroty/Articles/raw/master/KDE_History/im/504.png) + +*2015年8月25日* + +**KDE Plasma 5.4**:Wayland 登场,新的基于 QML 的音频管理程序,一个全屏的程序启动器替代品。 + +万分感谢 [KDE][1] 开发者及社区,并感谢 Wikipedia 为书写 [概述][2] 带来的帮助,同时,感谢所有读者。让我们保持自由精神(be free)并继续支持如同 KDE 一样的开源的自由软件发展。 + +-------------------------------------------------------------------------------- + +via: [https://tlhp.cf/kde-history/](https://tlhp.cf/kde-history/) + +作者:[Pavlo Rudyi][a] +译者:[jerryling315](https://github.com/jerryling315) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]: https://www.kde.org/ +[2]: https://en.wikipedia.org/wiki/KDE_Plasma_5 +[a]: https://tlhp.cf/author/paul/ diff --git a/published/201601/20150921 14 tips for teaching open source development.md b/published/201601/20150921 14 tips for teaching open source development.md new file mode 100644 index 0000000000..2d5cfaf302 --- /dev/null +++ b/published/201601/20150921 14 tips for teaching open source development.md @@ -0,0 +1,88 @@ +在大学培养学生们参与开源代码开发的十四个技巧 +================================================================================ + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/education/EDU_TeachingOS.png) + +学术界是培养和塑造未来的开源开发者的最佳平台。研究中发现,我们偶尔会开源自己编写的软件。这样做有两个理由,一是为了推广自己编写的工具的使用,二是为了了解人们使用这些工具时会遇到哪些问题。在这样一个编写研究软件的背景下,我的任务就是为 Bradford 大学重新设计二年级的本科软件工程课程。 + +这是一个挑战,因为我所面对的 80 个学生是来自不同专业的,包括 IT、商务计算和软件工程,这些学生将要在一起上课。最有难度的是,需要和这些编程经验差距很大的学生一起编写代码。按照传统,该课程允许学生选择自己的小组,然后给他们布置构建一个加油站数据库系统的任务,最后提交报告作为评估的一部分。 + +而我决定重新设计课程,让学生了解现实中的软件团队是如何协作的过程。根据学生的专业和编程技能,我将他们分为五、六个人一组。这是为了确保每个小组的整体水平相当,避免小组之间的不等。 + +### 核心课程 ### + +课程的形式改为讲座和实践课两项结合在一起。然而实践课作为指导过程,主要是老师监督各个小组的实践进度以及他们如何处理客户和产品之间的关系。而传统的教学方式由项目管理、软件测试、工程需求分析以及类似主题的讲座组成,再辅以实践和导师会议。这些会议可以很好的考核学生的水平以及检测出他们是否可以跟得上我们在讲座部分中的软件工程方法。本年的教学主题包括以下内容: + +- 工程需求分析 +- 如何与客户及其他团队成员互动 +- 程序设计方法,如敏捷和极限编程方法 +- 如何通过学习不同的软件工程方法进行短期的水平提高 +- 小组会议及文档编写 +- 项目管理及项目进展图表(甘特图) +- UML 图表及系统描述 +- 使用 Git 来进行代码的版本控制 +- 软件测试及 BUG 跟踪 +- 使用开源库 +- 开源代码许可及其选择 +- 软件交付 + +在这些讲座之后,会有一些来自世界各地的嘉宾为我们说说他们在软件交付过程中的经验。我们也设法请来大学里知识产权律师谈关于软件在英国的知识产权问题,以及如何处理软件的知识产权问题。 + +### 协作工具 ### + +为了让上述教学内容的顺利进行,我们将会引入一些工具,并训练学生在他们的项目中使用这些工具。如下: + +- Google Drive:团队与导师之间进行共享的工具,暂时存储用于描述项目的文档和图表、需求收集、会议纪要以及项目时间跟踪等信息。采取这样一个方式来监控并提供直接反馈到每个团队,是非常有效的。 +- [Basecamp][1]:同样是用于分享文档,在随后的课程中,我们可能会考虑用它取代 Google Drive。 +- BUG 报告工具,如 [Mantis][2]:只能让有限的用户免费提交 BUG。稍后我们提到的 Git 可以让小组内的所有人员用做 BUG 提交。 +- 远程视频会议工具:在人员不在校内,甚至去了其他城市的情况下使用。学生们可以定期通过 Skype 来交流并记录会议内容或则进行录音作为今后其他用处。 +- 同时,学生们的项目中还会用到大量的开源工具包。他们可以根据自己小组的项目需求来选择自己使用的工具包和编程语言。唯一的条件是,这些项目必须开源,最后成果可以安装到大学里的实验室,并且大多的研究人员都非常支持这个条件。 +- 最后,所有团队必须向客户交付他们的项目,包括完整的可以工作的软件版本、文档和他们自己选择的开放源码许可。大多数的团队选择了 GPLv3 许可证。 + +### 技巧和经验教训 ### + +在最后,这一年过的很愉快,并且所有学生的项目都做的非常棒。这里有一些我学到的经验教训,可能有助于提高明年的课程质量: + +1. 提供各种各样有趣的选择项目给学生选择。比如说,游戏开发或者移动应用开发以及完成各种目标的项目等。建立普通的数据库系统已经不能提起学生的兴趣了,而参与到有趣的项目中去,学生本身就是自学者,同时可以帮助解决小组成员和小组之间的常见问题。再通过一个消息列表,学生们发表他们在测试中遇到的任何问题,以寻求其他人的帮助建议。然而,这种方法有一个缺点。外部考官建议我们使用统一种类型的项目和统一的编程语言以帮助缩小对学生的评估标准。 + +2. 定期给学生在每一个阶段的表现进行反馈。比方说,可以在和各个小组开指导会议的时候,或者每个阶段进行反馈,以帮助他们在接下来的工作中自我改进。 + +3. 学生更加愿意与校外的客户一起协作。他们期待着与外部公司代表或校外人员协作,不过是为了获得新体验而已。与导师进行交流时,他们都能够表现得很专业,这样使得老师非常放心。 + +4. 很多团队版将开发单元测试的部分放到项目结束之后,从极限编程方法的角度来说,这是一个严重的禁忌。也许测试应包括在不同阶段的评估中,来提醒他们需要并行开展软件开发和单元测试。 + +5. 在这个班的 80 个人里边,仅有 4 个女生,每个女生都分在不同的小组里边。我观察到,男生们总是充分准备好来承担起领队角色,并将最有趣的代码部分留给他们自己来编写,女生则多大遵循安排或者是编写文档。出于某种原因,女生选择不出头,即使在女性辅导员鼓励下,她们也不愿编写代码。这仍然是一个需要解决的主要问题。 + +6. 允许不同风格项目文档,比方说,UML 图表、状态图或其他形式的。让学生学习这些并与其他课程融汇贯通来提高他们的学习经验。 + +7. 学生里边,有些是很好的开发人员,有些做商务计算的则没有多少编程经验。我们要鼓励团队共同努力,避免开发人员做得比那些只做会议记录或文档的其他成员更好的错误认知。我们常在辅导课程中鼓励角色转换,让每个人都有机会学习如何编程。 + +8. 小组与导师每周见面沟通是非常重要的,可以有效监督各个小组进展情况,还可以了解是谁做了大部分工作。通常,没来参加会议的小组成员基本就是没有参与到他们的团队工作中去的,并且通过其他成员所提交的工作报告也可以确定哪些人不活跃。 + +9. 我们鼓励学生们把许可证附加到项目中去,使用外部库以及和客户协作的时候要表明确切知识产权问题。 这样可让打破陈规,开拓思维,并了解真实的软件交付问题。 + +10. 给学生们自己选择所用技术的空间。 + +11. 助教是关键。同时管理 80 个学生显然很有难度,特别是需要对他们进行评估的那几周。明年我一定会找个助教来帮我一起管理各个小组。 + +12. 实验室的技术支持是非常重要的。大学里的技术支持人员对于本课程是非常赞同的。他们正在考虑明年将虚拟机分配给每个团队,这样没个团队可以根据需要自行在虚拟机中安装任何软件。 + +13. 团队合作,相互帮助。大多数团队自然而然的支持其他团队成员,同时指导员在中间也帮助了不少。 + +14. 来自其他同事的帮助会锦上添花。作为一名新的大学导师,我需要从经验中学习,如果我想了解如何管理某些学生和团队,或者对如何让学生适应课程感到困惑时,我会通过多个方面来寻求建议。来自资深同事的支持对我来说是一种极大的鼓励。 + +最后,对于作为导师的我以及所有的学生来说,这都是个有趣的课程。在学习目标和传统评分方案上还有有一些问题需解决,以减少教师的工作量。明年,我计划会保留这种教学模式,并希望能够提出更好的评分方案以及引入更多的软件来帮助监督项目和控制代码版本。 + +-------------------------------------------------------------------------------- + +via: http://opensource.com/education/15/9/teaching-open-source-development-undergraduates + +作者:[Mariam Kiran][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://opensource.com/users/mariamkiran +[1]:https://basecamp.com/ +[2]:https://www.mantisbt.org/ diff --git a/published/201601/20151012 Remember sed and awk All Linux admins should.md b/published/201601/20151012 Remember sed and awk All Linux admins should.md new file mode 100644 index 0000000000..346557684b --- /dev/null +++ b/published/201601/20151012 Remember sed and awk All Linux admins should.md @@ -0,0 +1,66 @@ +sed 和 awk,所有的 Linux 管理员都应该会的技能! +========================== + +![](http://images.techhive.com/images/article/2015/03/linux-100573790-primary.idge.jpg) + +*图片来源: Shutterstock* + +**我们不要让下一代 Linux 和 Unix 的管理员忘记初始化脚本和基本工具的好处** + +我曾经有一次在 Reddit 看到一个帖子,“[请问如何操作文本文件][1]”。这是一个很简单的需求,就像我们常用 Unix 的人每天遇到的一样。他的问题是,如何删除文件中的重复行,只保留不重复的。 这听起来似乎很简单,但是当文件足够大时,就会有些复杂。 + +这个问题有很多种不同的答案。你可以使用几乎任何一种语言来写这样的一个脚本,只是时间的投入和代码的复杂性不同罢了。根据你的个人水平,它大概会花费20-60分钟。但是如果你使用了 Perl、Python、Ruby 中的一种,你可能很快实现它。 + +或者你可以使用下面的一个方法,让你无比暖心的: 只用 awk。 + +这个答案是迄今为止最简明、最简单的解决问题的方法。它只要一行! + +``` +awk '!seen[$0]++' +``` + +让我们来看看发生了什么: + +在这个命令中,其实隐藏了很多代码。awk 是一种文本处理语言,并且它内部有很多预设。首先,你看到的实际上是一个 for 循环的结果。awk 假定你想通过循环处理输入文件的每一行,所以你不需要明确的去指定它。awk 还假定了你需要打印输出处理后的数据,所以你也不需要去指定它。最后,awk 假定循环在最后一句指令执行完结束,这一块也不再需要你去指定它。 + +这个例子中的字符串 seen 是一个关联数组的名字。$0 是一个变量,表示整个当前行。所以,这个命令翻译成人类语言就是“对这个文件的每一行进行检查,如果你之前没有见过它,就打印出来。” 如果该关联数组的键名还不存在就添加到数组,并增加其取值,这样 awk 下次遇到同样的行时就会不匹配(条件判断为“假”),从而不打印出来。 + +一些人认为这样是优雅的,另外的人认为这可能会造成混淆。任何在日常工作上使用 awk 的都是第一类人。awk 就是设计用来做这个的。在 awk 中,你可以写多行代码。你甚至可以[用 awk 写一些让人不安的复杂功能][2]。但终究来说,awk 还是一个进行文本处理的程序,一般是通过管道。去掉(没必要的)循环定义是很常见的快捷用法,不过如果你乐意,你也可以用下面的代码做同样的事情: + + +``` +awk '{ if (!seen[$0]) print $0; seen[$0]++ }’ +``` + +这会产生相同的结果。 + +awk 是完成这项工作的完美工具。不过,我相信很多管理员--特别是新管理员会转而使用 [Bash][3] 或 Python 来完成这一任务,因为对 awk 的知识和对它的能力的了解看起来随着时间而慢慢被人淡忘。我认为这是标志着一个问题,由于对之前的解决方案缺乏了解,那些已经解决了几十年的问题又突然出现了。 + +shell、grep、sed 和 awk 是 Unix 的基础。如果你不能非常轻松的使用它们,你将会被自己束缚住,因为它们构成了通过命令行和脚本与 Unix 系统交互的基础。学习这些工具如何工作最好的方法之一就是观察真实的例子和实验,你可以在各种 Unix 衍生系统的初始化系统中找到很多,但在 Linux 发行版中它们已经被 [systemd][4] 取代了。 + +数以百万计的 Unix 管理员了解 Shell 脚本和 Unix 工具如何读、写、修改和用在初始化脚本上。不同系统的初始化脚本有很大不同,甚至是不同的 Linux 发行版也不同。但是它们都源自 sh,而且它们都用像 sed、awk 还有 grep 这样的核心的命令行工具。 + +我每天都会听到很多人抱怨初始化脚本太“古老”而且很“难”。但是实际上,初始化脚本和 Unix 管理员每天使用的工具一样,还提供了一个非常好的方式来更加熟悉和习惯这些工具。说初始化脚本难于阅读和难于使用实际上是承认你缺乏对 Unix 基础工具的熟悉。 + +说起在 Reddit 上看到的内容,我也碰到过这个问题,来自一个新入行的 Linux 系统管理员, “[问他是否应该还要去学老式的初始化系统 sysvinit][5]”。 这个帖子的大多数的答案都是正面的——是的,应该学习 sysvinit 和 systemd 两个。一位评论者甚至指出,初始化脚本是学习 Bash 的好方法。而另一个消息是,Fortune 50 强的公司还没有计划迁移到以 systemd 为基础的发行版上。 + +但是,这提醒了我这确实是一个问题。如果我们继续沿着消除脚本和脱离操作系统核心组件的方式发展下去,由于疏于接触,我们将会不经意间使新管理员难于学习基本的 Unix 工具。 + +我不知道为什么有些人想在一层又一层的抽象化来掩盖 Unix 内部,但是这样发展下去可能会让新一代的系统管理员们变成只会按下按钮的工人。我觉得这不是一件好事情。 + +------ + +via: http://www.infoworld.com/article/2985804/linux/remember-sed-awk-linux-admins-should.html + +作者:[Paul Venezia][a] +译者:[Bestony](https://github.com/Bestony) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.infoworld.com/author/Paul-Venezia/ +[1]: https://www.reddit.com/r/linuxadmin/comments/3lwyko/how_do_i_remove_every_occurence_of_duplicate_line/ +[2]: http://intro-to-awk.blogspot.com/2008/08/awk-more-complex-examples.html +[3]: http://www.infoworld.com/article/2613338/linux/linux-how-to-script-a-bash-crash-course.html +[4]: http://www.infoworld.com/article/2608798/data-center/systemd--harbinger-of-the-linux-apocalypse.html +[5]: https://www.reddit.com/r/linuxadmin/comments/3ltq2y/when_i_start_learning_about_linux_administration/ diff --git a/published/201601/20151013 DFileManager--Cover Flow File Manager.md b/published/201601/20151013 DFileManager--Cover Flow File Manager.md new file mode 100644 index 0000000000..31e953c8da --- /dev/null +++ b/published/201601/20151013 DFileManager--Cover Flow File Manager.md @@ -0,0 +1,64 @@ +DFileManager:封面流(CoverFlow)文件管理器 +================================================================================ + +这个一个 Ubuntu 标准软件仓库中缺失的像宝石般的、有着其独特的功能的文件管理器。这是 DFileManager 在推特中的宣称。 + +有一个不好回答的问题,如何知道到底有多少个 Linux 的开源软件?好奇的话,你可以在 Shell 里输入如下命令: + + ~$ for f in /var/lib/apt/lists/*Packages; do printf '%5d %s\n' $(grep '^Package: ' "$f" | wc -l) ${f##*/} done | sort -rn + +在我的 Ubuntu 15.04 系统上,产生结果如下: + +![Ubuntu 15.04 Packages](http://www.linuxlinks.com/portal/content/reviews/FileManagers/UbuntuPackages.png) + +正如上面的截图所示,在 Universe 仓库中,大约有39000个包,在 main 仓库中大约有8500个包。这听起来很多。但是这些包括了开源应用、工具、库,有很多不是由 Ubuntu 开发者打包的。更重要的是,有很多重要的软件不在库中,只能通过源代码编译。DFileManager 就是这样一个软件。它是仍处在开发早期的一个基于 QT 的跨平台文件管理器。QT提供单一源码下的跨平台可移植性。 + +现在还没有二进制文件包,用户需要编译源代码才行。对于一些工具来说,这个可能会产生很大的问题,特别是如果这个应用依赖于某个复杂的依赖库,或者需要与已经安装在系统中的软件不兼容的某个版本。 + +### 安装 ### + +幸运的是,DFileManager 非常容易编译。对于我的老 Ubutnu 机器来说,在开发者网站上的安装介绍提供了大部分的重要步骤,不过少量的基础包没有列出(为什么总是这样?虽然许多库会让文件系统变得一团糟!)。在我的系统上,从github 下载源代码并且编译这个软件,我在 Shell 里输入了以下命令: + + ~$ sudo apt-get install qt5-default qt5-qmake libqt5x11extras5-dev + ~$ git clone git://git.code.sf.net/p/dfilemanager/code dfilemanager-code + ~$ cd dfilemananger-code + ~$ mkdir build + ~$ cd build + ~$ cmake ../ -DCMAKE_INSTALL_PREFIX=/usr + ~$ make + ~$ sudo make install + +你可以通过在shell中输入如下命令来启动它: + + ~$ dfm + +下面是运行中的 DFileManager,完全展示了其最吸引人的地方:封面流(Cover Flow)视图。可以在当前文件夹的项目间滑动,提供了一个相当有吸引力的体验。这是看图片的理想选择。这个文件管理器酷似 Finder(苹果操作系统下的默认文件管理器),可能会吸引你。 + +![DFileManager in action](http://www.linuxlinks.com/portal/content/reviews/FileManagers/Screenshot-dfm.png) + +### 特点: ### + +- 4种视图:图标、详情、列视图和封面流 +- 按位置和设备归类书签 +- 标签页 +- 简单的搜索和过滤 +- 自定义文件类型的缩略图,包括多媒体文件 +- 信息栏可以移走 +- 单击打开文件和目录 +- 可以排队 IO 操作 +- 记住每个文件夹的视图属性 +- 显示隐藏文件 + +DFileManager 不是 KDE 的 Dolphin 的替代品,但是能做相同的事情。这个是一个真正能够帮助人们的浏览文件的文件管理器。还有,别忘了反馈信息给开发者,任何人都可以做出这样的贡献。 + +-------------------------------------------------------------------------------- + +via: http://gofk.tumblr.com/post/131014089537/dfilemanager-cover-flow-file-manager-a-real-gem + +作者:[gofk][a] +译者:[bestony](https://github.com/bestony) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://gofk.tumblr.com/ diff --git a/published/201601/20151107 Hackers Successfully Install Linux on a Potato.md b/published/201601/20151107 Hackers Successfully Install Linux on a Potato.md new file mode 100644 index 0000000000..b35220730b --- /dev/null +++ b/published/201601/20151107 Hackers Successfully Install Linux on a Potato.md @@ -0,0 +1,32 @@ +黑客们成功地在土豆上安装了 Linux ! +================================================================================ + +来自荷兰阿姆斯特丹的消息称,LinuxOnAnything.nl 网站的黑客们成功地在土豆上安装了 Linux!这是该操作系统第一次在根用蔬菜(root vegetable)上安装成功(LCTT 译注:root vetetable,一语双关,root 在 Linux 是指超级用户)。 + +![Linux Potato](http://www.bbspot.com/Images/News_Features/2008/12/linux-potato.jpg) + +“土豆没有 CPU,内存和存储器,这真的是个挑战,” Linux On Anything (LOA) 小组的 Johan Piest 说。“显然我们不能使用一个像 Fedora 或 Ubuntu 这些体量较大的发行版,所以我们用的是 Damn Small Linux。” + +在尝试了几周之后,LOA 小组的的同学们弄出了一个适合土豆的 Linux 内核,这玩艺儿上面可以用 vi 来编辑小的文本文件。这个 Linux 通过一个小型的 U 盘加载到土豆上,并通过一组红黑线以二进制的方式向这个土豆发送命令。 + +LOA 小组是一个不断壮大的黑客组织的分支;这个组织致力于将 Linux 安装到所有物体上;他们先是将 Linux 装到Gameboy 和 iPod 等电子产品上,不过最近他们在挑战一些高难度的东西,譬如将Linux安装到灯泡和小狗身上! + +LOA 小组在与另一个黑客小组 Stuttering Monarchs 竞赛,看谁先拿到土豆这一分。“土豆是一种每个人都会接触到的蔬菜,它的用途就像 Linux 一样极其广泛。无论你是想煮捣烹炸还是别的都可以” Piest 说道,“你也许认为我们完成这个挑战是为了获得某些好处,而我们只是追求逼格而已。” + +LOA 是第一个将 Linux 安装到一匹设德兰矮种马上的小组,但这五年来竞争愈演愈烈,其它黑客小组的进度已经反超了他们。 + +“我们本来可以成为在饼干上面安装 Linux 的第一个小组,但是那群来自挪威的混蛋把我们击败了。” Piest 说。 + +第一个成功安装了 Linux 的蔬菜是一头卷心菜,它是由一个土耳其的一个黑客小组完成的。 + +(好啦——是不是已经目瞪口呆,事实上,这是一篇好几年前的恶搞文,你看出来了吗?哈哈哈哈) + +-------------------------------------------------------------------------------- + +via: http://www.bbspot.com/news/2008/12/linux-on-a-potato.html + +作者:[Brian Briggs](briggsb@bbspot.com) +译者:[StdioA](https://github.com/StdioA), [hittlle](https://github.com/hittlle) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201601/20151109 How to Install GitLab on Ubuntu or Fedora or Debian.md b/published/201601/20151109 How to Install GitLab on Ubuntu or Fedora or Debian.md new file mode 100644 index 0000000000..7dbeb72f95 --- /dev/null +++ b/published/201601/20151109 How to Install GitLab on Ubuntu or Fedora or Debian.md @@ -0,0 +1,181 @@ +如何在 Ubuntu/Fedora/Debian 中安装 GitLab +================================================================================ + +在 Git 问世之前,分布式版本控制从来都不是一件简单的事。Git 是一个自由开源的软件,旨在轻松且快速地对从小规模到非常巨大的项目进行管理。Git 最开始由 Linus Torvalds 开发,他同时也是著名的 Linux 内核的创建者。在 git 和分布式版本控制系统领域中,[GitLab][1] 是一个极棒的新产品。它是一个基于 web 的 Git 仓库管理应用,包含代码审查、wiki、问题跟踪等诸多功能。使用 GitLab 可以很方便、快速地创建、审查、部署及托管代码。尽管它在其官方的服务器提供了与 Github 类似的免费托管的代码仓库,但它也可以运行在我们自己的服务器上。GitLab 有两个不同的版本:社区版(Community Edition)和企业版(Enterprise Edition)。社区版本完全免费且开源,遵循 MIT 协议;而企业版则遵循一个专有的协议,包含一些社区版中没有的功能。下面介绍的是有关如何在我们自己的运行着 Ubuntu、Fedora 或 Debian 操作系统的机器上安装 GitLab 社区版的简单步骤。 + +### 1. 安装先决条件 ### + +首先,我们需要安装 GitLab 所依赖的软件包。我们将安装 `curl`,用以下载我们所需的文件;安装`openssh-server` ,以此来通过 ssh 协议登录到我们的机器上;安装`ca-certificates`,用它来添加 CA 认证;以及 `postfix`,把它作为一个 MTA(Mail Transfer Agent,邮件传输代理)。 + +注: 若要安装 GitLab 社区版,我们需要一个至少包含 2 GB 内存和 2 核 CPU 的 linux 机器。 + +#### 在 Ubuntu 14 .04/Debian 8.x 中 #### + +鉴于这些依赖包都可以在 Ubuntu 14.04 和 Debian 8.x 的官方软件仓库中获取到,我们只需通过使用 `apt-get` 包管理器来安装它们。为此,我们需要在一个终端或控制台中执行下面的命令: + + # apt-get install curl openssh-server ca-certificates postfix + +![install dependencies gitlab ubuntu debian](http://blog.linoxide.com/wp-content/uploads/2015/10/install-dependencies-gitlab-ubuntu-debian.png) + +#### 在 Fedora 22 中 #### + +在 Fedora 22 中,由于 `yum` 已经被弃用了,默认的包管理器是 `dnf`。为了安装上面那些需要的软件包,我们只需运行下面的 dnf 命令: + + # dnf install curl openssh-server postfix + +![install dependencies gitlab fedora](http://blog.linoxide.com/wp-content/uploads/2015/10/install-dependencies-gitlab-fedora.png) + +### 2. 打开并开启服务 ### + +现在,我们将使用我们默认的初始化系统来打开 sshd 和 postfix 服务。并且我们将使得它们在每次系统启动时被自动开启。 + +#### 在 Ubuntu 14.04 中 #### + +由于在 Ubuntu 14.04 中安装的是 SysVinit 初始化系统,我们将使用 service 命令来开启 sshd 和 postfix 守护进程: + + # service sshd start + # service postfix start + +现在,为了使得它们在每次开机启动时被自动开启,我们需要运行下面的 update-rc.d 命令: + + # update-rc.d sshd enable + # update-rc.d postfix enable + +#### 在 Fedora 22/Debian 8.x 中 #### + +鉴于 Fedora 22 和 Debian 8.x 已经用 Systemd 代替了 SysVinit 来作为默认的初始化系统,我们只需运行下面的命令来开启 sshd 和 postfix 服务: + + # systemctl start sshd postfix + +现在,为了使得它们在每次开机启动时可以自动运行,我们需要运行下面的 systemctl 命令: + + # systemctl enable sshd postfix + + Created symlink from /etc/systemd/system/multi-user.target.wants/sshd.service to /usr/lib/systemd/system/sshd.service. + Created symlink from /etc/systemd/system/multi-user.target.wants/postfix.service to /usr/lib/systemd/system/postfix.service. + +### 3. 下载 GitLab ### + +现在,我们将使用 curl 从官方的 GitLab 社区版仓库下载二进制安装文件。首先,为了得到所需文件的下载链接,我们需要浏览到该软件仓库的页面。为此,我们需要在运行着相应操作系统的 linux 机器上运行下面的命令。 + +#### 在 Ubuntu 14.04 中 #### + +由于 Ubuntu 和 Debian 使用相同的 debian 格式的安装包,我们需要在 [https://packages.gitlab.com/gitlab/gitlab-ce?filter=debs][2] 下搜索所需版本的 GitLab,然后点击有着 ubuntu/trusty 标签的链接,即我们运行着的 Ubuntu 14.04。接着一个新的页面将会出现,我们将看到一个下载按钮,然后我们在它的上面右击,得到文件的链接,然后像下面这样使用 curl 来下载它。 + + # curl https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/trusty/gitlab-ce_8.1.2-ce.0_amd64.deb + +![Downloading Gitlab Ubuntu](http://blog.linoxide.com/wp-content/uploads/2015/10/downloading-gitlab-ubuntu.png) + +#### 在 Debian 8.x 中 #### + +与 Ubuntu 类似,我们需要在 [https://packages.gitlab.com/gitlab/gitlab-ce?filter=debs][3] 页面中搜索所需版本的 GitLab,然后点击带有 debian/jessie 标签的链接,即我们运行着的 Debian 8.x。接着,一个新的页面将会出现,然后我们在下载按钮上右击,得到文件的下载链接。最后我们像下面这样使用 curl 来下载该文件。 + + # curl https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/jessie/gitlab-ce_8.1.2-ce.0_amd64.deb/download + +![Downloading Gitlab Debian](http://blog.linoxide.com/wp-content/uploads/2015/10/downloading-gitlab-debian.png) + +#### 在 Fedora 22 中#### + +由于 Fedora 使用 rpm 文件来作为软件包,我们将在 [https://packages.gitlab.com/gitlab/gitlab-ce?filter=rpms][4] 页面下搜索所需版本的 GitLab,然后点击所需发行包的链接,这里由于我们运行的是 Fedora 22,所以我们将选择带有 el/7 标签的发行包。一个新的页面将会出现,在其中我们可以看到一个下载按钮,我们将右击它,得到所需文件的链接,然后像下面这样使用 curl 来下载它。 + + # curl https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-8.1.2-ce.0.el7.x86_64.rpm/download + +![Downloading Gitlab Fedora](http://blog.linoxide.com/wp-content/uploads/2015/10/downloading-gitlab-fedora.png) + +### 4. 安装 GitLab ### + +在相应的软件源被添加到我们的 linux 机器上之后,现在我们将使用相应 linux 发行版本中的默认包管理器来安装 GitLab 社区版。 + +#### 在 Ubuntu 14.04/Debian 8.x 中 #### + +要在运行着 Ubuntu 14.04 或 Debian 8.x linux 发行版本的机器上安装 GitLab 社区版,我们只需运行如下的命令: + + # dpkg -i gitlab-ce_8.1.2-ce.0_amd64.deb + +![Installing Gitlab Ubuntu Debian](http://blog.linoxide.com/wp-content/uploads/2015/10/installing-gitlab-ubuntu-debian.png) + +#### 在 Fedora 22 中 #### + +我们只需执行下面的 dnf 命令来在我们的 Fedora 22 机器上安装 GitLab。 + + # dnf install gitlab-ce-8.1.2-ce.0.el7.x86_64.rpm + +![Installing Gitlab Fedora](http://blog.linoxide.com/wp-content/uploads/2015/10/installing-gitlab-fedora.png) + +### 5. 配置和开启 GitLab ### + +GitLab 社区版已经成功地安装在我们的 linux 系统中了,接下来我们将要配置和开启它了。为此,我们需要运行下面的命令,这在 Ubuntu、Debian 和 Fedora 发行版本上都一样: + + # gitlab-ctl reconfigure + +![Reconfiguring Gitlab](http://blog.linoxide.com/wp-content/uploads/2015/10/reconfiguring-gitlab.png) + +### 6. 允许通过防火墙 ### + +假如在我们的 linux 机器中已经启用了防火墙程序,为了使得 GitLab 社区版的 web 界面可以通过网络进行访问,我们需要允许 80 端口通过防火墙,这个端口是 GitLab 社区版的默认端口。为此,我们需要运行下面的命令。 + +#### 在 iptables 中 #### + +Ubuntu 14.04 默认安装和使用的是 iptables。所以,我们将运行下面的 iptables 命令来打开 80 端口: + + # iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT + + # /etc/init.d/iptables save + +#### 在 firewalld 中 #### + +由于 Fedora 22 和 Debian 8.x 默认安装了 systemd,它包含了作为防火墙程序的 firewalld。为了使得 80 端口(http 服务) 能够通过 firewalld,我们需要执行下面的命令。 + + # firewall-cmd --permanent --add-service=http + + success + + # firewall-cmd --reload + + success + +### 7. 访问 GitLab Web 界面 ### + +最后,我们将访问 GitLab 社区版的 web 界面。为此,我们需要将我们的 web 浏览器指向 GitLab 服务器的网址,根据我们的配置,可能是 http://ip-address/ 或 http://domain.com/ 的格式。在我们成功指向该网址后,我们将会看到下面的页面。 + +![Gitlab Login Screen](http://blog.linoxide.com/wp-content/uploads/2015/10/gitlab-login-screen.png) + +现在,为了登录进面板,我们需要点击登录按钮,它将询问我们的用户名和密码。然后我们将输入默认的用户名和密码,即 **root** 和 **5iveL!fe** 。在登录进控制面板后,我们将被强制要求为我们的 GitLab root 用户输入新的密码。 + +![Setting New Password Gitlab](http://blog.linoxide.com/wp-content/uploads/2015/10/setting-new-password-gitlab.png) + +### 8. 创建仓库 ### + +在我们成功地更改密码并登录到我们的控制面板之后,现在,我们将为我们的新项目创建一个新的仓库。为此,我们需要来到项目栏,然后点击 **新项目** 绿色按钮。 + +![Creating New Projects](http://blog.linoxide.com/wp-content/uploads/2015/10/creating-new-projects.png) + +接着,我们将被询问给我们的项目输入所需的信息和设定,正如下面展示的那样。我们甚至可以从其他的 git 仓库提供商和仓库中导入我们的项目。 + +![Creating New Project](http://blog.linoxide.com/wp-content/uploads/2015/10/configuring-git-project.png) + +做完这些后,我们将能够使用任何包含基本 git 命令行的 Git 客户端来访问我们的 Git 仓库。我们可以看到在仓库中进行的任何活动,例如创建一个里程碑,管理问题,合并请求,管理成员,便签,Wiki 等。 + +![Gitlab Menu](http://blog.linoxide.com/wp-content/uploads/2015/10/gitlab-menu.png) + +### 总结 ### + +GitLab 是一个用来管理 git 仓库的很棒的开源 web 应用。它有着漂亮的带有诸多酷炫功能的响应式界面。它还打包有许多酷炫功能,例如管理群组,分发密钥,持续集成,查看日志,广播消息,钩子,系统 OAuth 应用,模板等。(注:OAuth 是一个开放标准,允许用户让第三方应用访问该用户在某一网站上存储的私密的资源(如照片,视频,联系人列表),而无需将用户名和密码提供给第三方应用。--- 摘取自 [维基百科上的 OAuth 词条](https://zh.wikipedia.org/wiki/OAuth)) 它还可以和大量的工具进行交互如 Slack,Hipchat,LDAP,JIRA,Jenkins,有很多类型的钩子和完整的 API。它至少需要 2 GB 的内存和 2 核 CPU 来流畅运行,支持多达 500 个用户,但它也可以被扩展到多个工作服务器上。 + +假如你有任何的问题,建议,回馈,请将它们写在下面的评论框中,以便我们可以提升或更新我们的内容。谢谢! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-gitlab-on-ubuntu-fedora-debian/ + +作者:[Arun Pyasi][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://about.gitlab.com/ +[2]:https://packages.gitlab.com/gitlab/gitlab-ce?filter=debs +[3]:https://packages.gitlab.com/gitlab/gitlab-ce?filter=debs +[4]:https://packages.gitlab.com/gitlab/gitlab-ce?filter=rpms \ No newline at end of file diff --git a/published/201601/20151117 Linux 101--Get the most out of Systemd.md b/published/201601/20151117 Linux 101--Get the most out of Systemd.md new file mode 100644 index 0000000000..b0df8fdfb9 --- /dev/null +++ b/published/201601/20151117 Linux 101--Get the most out of Systemd.md @@ -0,0 +1,171 @@ +Linux 101:最有效地使用 Systemd +================================================================================ +干嘛要这么做? + +- 理解现代 Linux 发行版中的显著变化; +- 看看 Systemd 是如何取代 SysVinit 的; +- 搞定单元(unit)和新的 journal 日志。 + +吐槽邮件、人身攻击、死亡威胁——Lennart Poettering,Systemd 的作者,对收到这些东西早就习以为常了。这位 Red Hat 公司的员工之前在 Google+ 上怒斥 FOSS 社区([http://tinyurl.com/poorlennart][1])的本质,悲痛且失望地表示:“那真是个令人恶心的地方”。他着重指出 Linus Torvalds 在邮件列表上言辞极其刻薄的帖子,并谴责这位内核的领导者为在线讨论定下基调,并使得人身攻击及贬抑之辞成为常态。 + +但为何 Poettering 会遭受如此多的憎恨?为何就这么个搞搞开源软件的人要忍受这等愤怒?答案就在于他的软件的重要性。如今大多数发行版中,Systemd 是 Linux 内核发起的第一个程序,并且它还扮演多种角色。它会启动系统服务、处理用户登录,每隔特定的时间执行一些任务,还有很多很多。它在不断地成长,并逐渐成为 Linux 的某种“基础系统”——提供系统启动和发行版维护所需的所有工具。 + +如今,在以下几点上 Systemd 颇具争议:它逃避了一些已经确立的 Unix 传统,例如纯文本的日志文件;它被看成是个“大一统”的项目,试图接管一切;它还是我们这个操作系统的支柱的重要革新。然而大多数主流发行版已经接受了(或即将接受)它,因此它就活了下来。而且它确实是有好处的:更快地启动,更简单地管理那些有依赖的服务程序,提供强大且安全的日志系统等。 + +因此在这篇教程中,我们将探索 Systemd 的特性,并向您展示如何最有效地利用这些特性。即便您此刻并不是这款软件的粉丝,读完本文后您至少可以更加了解和适应它。 + +![](http://narf-archive.com/pix/bd0fb252416206158627fb0b1bff9b4779dca13f.gif) + +*这部没正经的动画片来自[http://tinyurl.com/m2e7mv8][2],它把 Systemd 塑造成一只狂暴的动物,吞噬它路过的一切。大多数批评者的言辞可不像这只公仔一样柔软。* + +### 启动及服务 ### + +大多数主流发行版要么已经采用 Systemd,要么即将在下个发布中采用(如 Debian 和 Ubuntu)。在本教程中,我们使用 Fedora 21(该发行版已经是 Systemd 的优秀实验场地)的一个预览版进行演示,但不论您用哪个发行版,要用到的命令和注意事项都应该是一样的。这是 Systemd 的一个加分点:它消除了不同发行版之间许多细微且琐碎的区别。 + +在终端中输入 `ps ax | grep systemd`,看到第一行,其中的数字 **1** 表示它的进程号是1,也就是说它是 Linux 内核发起的第一个程序。因此,内核一旦检测完硬件并组织好了内存,就会运行 `/usr/lib/systemd/systemd` 可执行程序,这个程序会按顺序依次发起其他程序。(在还没有 Systemd 的日子里,内核会去运行 `/sbin/init`,随后这个程序会在名为 SysVinit 的系统中运行其余的各种启动脚本。) + +Systemd 的核心是一个叫*单元* (unit)的概念,它是一些存有关于服务(service)(在运行在后台的程序)、设备、挂载点、和操作系统其他方面信息的配置文件。Systemd 的其中一个目标就是简化这些事物之间的相互作用,因此如果你有程序需要在某个挂载点被创建或某个设备被接入后开始运行,Systemd 可以让这一切正常运作起来变得相当容易。(在没有 Systemd 的日子里,要使用脚本来把这些事情调配好,那可是相当丑陋的。)要列出您 Linux 系统上的所有单元,输入以下命令: + + systemctl list-unit-files + +现在,`systemctl` 是与 Systemd 交互的主要工具,它有不少选项。在单元列表中,您会注意到这儿有一些格式化:被使能(enabled)的单元显示为绿色,被禁用(disabled)的显示为红色。标记为“static”的单元不能直接启用,它们是其他单元所依赖的对象。若要限制输出列表只包含服务,使用以下命令: + + systemctl list-unit-files --type=service + +注意,一个单元显示为“enabled”,并不等于对应的服务正在运行,而只能说明它可以被开启。要获得某个特定服务的信息,以 GDM (Gnome Display Manager) 为例,输入以下命令: + + systemctl status gdm.service + +这条命令提供了许多有用的信息:一段给人看的服务描述、单元配置文件的位置、启动的时间、进程号,以及它所从属的 CGroups(用以限制各组进程的资源开销)。 + +如果您去查看位于 `/usr/lib/systemd/system/gdm.service` 的单元配置文件,您可以看到各种选项,包括要被运行的二进制文件(“ExecStart”那一行),相冲突的其他单元(即不能同时进入运行的单元),以及需要在本单元执行前进入运行的单元(“After”那一行)。一些单元有附加的依赖选项,例如“Requires”(必要的依赖)和“Wants”(可选的依赖)。 + +此处另一个有趣的选项是: + + Alias=display-manager.service + +当您启动 **gdm.service** 后,您将可以通过 `systemctl status display-manager.service` 来查看它的状态。当您知道有*显示管理程序* (display manager)在运行并想对它做点什么,但您不关心那究竟是 GDM,KDM,XDM 还是什么别的显示管理程序时,这个选项会非常有用。 + +![Image](http://www.linuxvoice.com/wp-content/uploads/2015/10/status-large.jpg) + +*使用 systemctl status 命令后面跟一个单元名,来查看对应的服务有什么情况。* + +### “目标(target)”锁定 ### + +如果您在 `/usr/lib/systemd/system` 目录中输入 `ls` 命令,您将看到各种以 `.target` 结尾的文件。*启动目标* (target)是一种将多个单元聚合在一起以致于将它们同时启动的方式。例如,对大多数类 Unix 操作系统而言有一种“多用户(multi-user)”状态,意思是系统已被成功启动,后台服务正在运行,并且已准备好让一个或多个用户登录并工作——至少在文本模式下。(其他状态包括用于进行管理工作的单用户(single-user)状态,以及用于机器关机的重启(reboot)状态。) + +如果您打开 **multi-user.target** 文件一探究竟,您可能期待看到的是一个要被启动的单元列表。但您会发现这个文件内部几乎空空如也——其实,一个服务会通过 **WantedBy** 选项让自己成为启动目标的依赖。因此如果您去打开 **avahi-daemon.service**, **NetworkManager.service** 及其他 **.service** 文件看看,您将在 Install 段看到这一行: + + WantedBy=multi-user.target + +因此,切换到多用户启动目标会使能(enable)那些包含上述语句的单元。还有其他一些启动目标可用(例如 **emergency.target** 提供一个紧急情况使用的 shell,以及 **halt.target** 用于机器关机),您可以用以下方式轻松地在它们之间切换: + + systemctl isolate emergency.target + +在许多方面,这些都很像 SysVinit 中的*运行级* (runlevel),如文本模式的 **multi-user.target** 类似于第3运行级,**graphical.target** 类似于第5运行级,**reboot.target** 类似于第6运行级,诸如此类。 + +![Image](http://www.linuxvoice.com/wp-content/uploads/2015/10/unit-large.jpg) + +**与传统的脚本相比,单元配置文件也许看起来很陌生,但并不难以理解。** + +### 开启与停止 ### + +现在您也许陷入了沉思:我们已经看了这么多,但仍没看到如何停止和开启服务!这其实是有原因的。从外部看,Systemd 也许很复杂,像野兽一般难以驾驭。因此在您开始摆弄它之前,有必要从宏观的角度看看它是如何工作的。实际用来管理服务的命令非常简单: + + systemctl stop cups.service + systemctl start cups.service + +(若某个单元被禁用了,您可以先通过 `systemctl enable` 加上该单元名的方式将其使能。这种做法会为该单元创建一个符号链接,并将其放置在当前启动目标的 `.wants` 目录下,这些 `.wants` 目录在`/etc/systemd/system` 文件夹中。) + +还有两个有用的命令是 `systemctl restart` 和 `systemctl reload`,后面接单元名。后者用于让单元重新加载它的配置文件。Systemd 的绝大部分都有良好的文档,因此您可以查看手册 (`man systemctl`) 了解每条命令的细节。 + +### 定时器单元:取代 Cron ### + +除了系统初始化和服务管理,Systemd 还染指了其他方面。在很大程度上,它能够完成 **cron** 的工作,而且可以说是以更灵活的方式(并带有更易读的语法)。**cron** 是一个以规定时间间隔执行任务的程序——例如清除临时文件,刷新缓存等。 + +如果您再次进入 `/usr/lib/systemd/system` 目录,您会看到那儿有多个 `.timer` 文件。用 `less` 来查看这些文件,您会发现它们与 `.service` 和 `.target` 文件有着相似的结构,而区别在于 `[Timer]` 段。举个例子: + + [Timer] + OnBootSec=1h + OnUnitActiveSec=1w + +**OnBootSec** 选项告诉 Systemd 在系统启动一小时后启动这个单元。第二个选项的意思是:自那以后每周启动这个单元一次。关于定时器有大量选项您可以设置,输入 `man systemd.time` 查看完整列表。 + +Systemd 的时间精度默认为一分钟。也就是说,它会在设定时刻的一分钟内运行单元,但不一定精确到那一秒。这么做是基于电源管理方面的原因,但如果您需要一个没有任何延时且精确到毫秒的定时器,您可以添加以下一行: + + AccuracySec=1us + +另外, **WakeSystem** 选项(可以被设置为 true 或 false)决定了定时器是否可以唤醒处于休眠状态的机器。 + +![Image](http://www.linuxvoice.com/wp-content/uploads/2015/10/systemd_gui-large.jpg) + +*有一个 Systemd 的图形界面程序,即便它已有多年未被积极维护。* + +### 日志文件:向 journald 问声好 ### + +Systemd 的第二个主要部分是 journal 。这是个日志系统,类似于 syslog 但也有些显著区别。如果您是个 Unix 日志管理模式的粉丝,准备好出离愤怒吧:这是个二进制日志,因此您不能使用常规的命令行文本处理工具来解析它。这个设计决定不出意料地在网上引起了激烈的争论,但它的确有些优点。例如,日志可以被更系统地组织,带有更多的元数据,因此可以更容易地根据可执行文件名和进程号等过滤出信息。 + +要查看整个 journal,输入以下命令: + + journalctl + +像许多其他的 Systemd 命令一样,该命令将输出通过管道的方式引向 `less` 程序,因此您可以使用空格键向下滚动,键入`/`(斜杠)查找,以及其他熟悉的快捷键。您也能在此看到少许颜色,像红色的警告及错误信息。 + +以上命令会输出很多信息。为了限制其只输出本次启动的消息,使用如下命令: + + journalctl -b + +这就是 Systemd 大放异彩的地方!您想查看自上次启动以来的全部消息吗?试试 **journalctl -b -1** 吧。再上一次的?用 **-2** 替换 **-1** 吧。那自某个具体时间,例如2014年10月24日16:38以来的呢? + + journalctl -b --since=”2014-10-24 16:38” + +即便您对二进制日志感到遗憾,那依然是个有用的特性,并且对许多系统管理员来说,构建类似的过滤器比起写正则表达式而言容易多了。 + +我们已经可以根据特定的时间来准确查找日志了,那可以根据特定程序吗?对单元而言,试试这个: + + journalctl -u gdm.service + +(注意:这是个查看 X server 产生的日志的好办法。)那根据特定的进程号? + + journalctl _PID=890 + +您甚至可以请求只看某个可执行文件产生的消息: + + journalctl /usr/bin/pulseaudio + +若您想将输出的消息限制在某个优先级,可以使用 **-p** 选项。该选项参数为 0 的话只会显示紧急消息(也就是说,是时候向 **$DEITY** 祈求保佑了)(LCTT 译注: $DEITY 是一个计算机方面的幽默,DEITY 是指广义上的“神”,$前缀表示这是一个变量),为 7 的话会显示所有消息,包括调试消息。请查看手册 (`man journalctl`) 获取更多关于优先级的信息。 + +值得指出的是,您也可以将多个选项结合在一起,若想查看在当前启动中由 GDM 服务输出的优先级数小于等于 3 的消息,请使用下述命令: + + journalctl -u gdm.service -p 3 -b + +最后,如果您仅仅想打开一个随 journal 持续更新的终端窗口,就像在没有 Systemd 时使用 `tail` 命令实现的那样,输入 `journalctl -f` 就好了。 + +![](http://www.linuxvoice.com/wp-content/uploads/2015/10/journal-large.jpg) + +*二进制日志并不流行,但 journal 的确有它的优点,如非常方便的信息查找及过滤。* + +### 没有 Systemd 的生活?### + +如果您就是完全不能接受 Systemd,您仍然有一些主流发行版中的选择。尤其是 Slackware,作为历史最为悠久的发行版,目前还没有做出改变,但它的主要开发者并没有将其从未来规划中移除。一些不出名的发行版也在坚持使用 SysVinit 。 + +但这又将持续多久呢?Gnome 正越来越依赖于 Systemd,其他的主流桌面环境也会步其后尘。这也是引起 BSD 社区一阵恐慌的原因:Systemd 与 Linux 内核紧密相连,导致在某种程度上,桌面环境正变得越来越不可移植。一种折衷的解决方案也许会以 Uselessd ([http://uselessd.darknedgy.net][3]) 的形式到来:一种裁剪版的 Systemd,纯粹专注于启动和监控进程,而不消耗整个基础系统。 + +![Image](http://www.linuxvoice.com/wp-content/uploads/2015/10/gentoo-large.jpg) + +若您不喜欢 Systemd,可以尝试一下 Gentoo 发行版,它将 Systemd 作为初始化工具的一种选择,但并不强制用户使用 Systemd。 + +-------------------------------------------------------------------------------- + +via: http://www.linuxvoice.com/linux-101-get-the-most-out-of-systemd/ + +作者:[Mike Saunders][a] +译者:[Ricky-Gong](https://github.com/Ricky-Gong) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxvoice.com/author/mike/ +[1]:http://tinyurl.com/poorlennart +[2]:http://tinyurl.com/m2e7mv8 +[3]:http://uselessd.darknedgy.net/ diff --git a/published/201601/20151123 Assign Multiple IP Addresses To One Interface On Ubuntu 15.10.md b/published/201601/20151123 Assign Multiple IP Addresses To One Interface On Ubuntu 15.10.md new file mode 100644 index 0000000000..9c1465d255 --- /dev/null +++ b/published/201601/20151123 Assign Multiple IP Addresses To One Interface On Ubuntu 15.10.md @@ -0,0 +1,236 @@ +在 Ubuntu 15.10 上为单个网卡设置多个 IP 地址 +================================================================================ + +有时候你可能想在你的网卡上使用多个 IP 地址。遇到这种情况你会怎么办呢?买一个新的网卡并分配一个新的 IP?不,没有这个必要(至少在小型网络中)。现在我们可以在 Ubuntu 系统中为一个网卡分配多个 IP 地址。想知道怎么做到的?跟着我往下看,其实并不难。 + +这个方法也适用于 Debian 以及它的衍生版本。 + +### 临时添加 IP 地址 ### + +首先,让我们找到网卡的 IP 地址。在我的 Ubuntu 15.10 服务器版中,我只使用了一个网卡。 + +运行下面的命令找到 IP 地址: + + sudo ip addr + +**样例输出:** + + 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever + inet6 ::1/128 scope host + valid_lft forever preferred_lft forever + 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 + link/ether 08:00:27:2a:03:4b brd ff:ff:ff:ff:ff:ff + inet 192.168.1.103/24 brd 192.168.1.255 scope global enp0s3 + valid_lft forever preferred_lft forever + inet6 fe80::a00:27ff:fe2a:34e/64 scope link + valid_lft forever preferred_lft forever + +或 + + sudo ifconfig + +**样例输出:** + + enp0s3 Link encap:Ethernet HWaddr 08:00:27:2a:03:4b + inet addr:192.168.1.103 Bcast:192.168.1.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:fe2a:34e/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:186 errors:0 dropped:0 overruns:0 frame:0 + TX packets:70 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:21872 (21.8 KB) TX bytes:9666 (9.6 KB) + lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:65536 Metric:1 + RX packets:217 errors:0 dropped:0 overruns:0 frame:0 + TX packets:217 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:38793 (38.7 KB) TX bytes:38793 (38.7 KB) + +正如你在上面输出中看到的,我的网卡名称是 **enp0s3**,它的 IP 地址是 **192.168.1.103**。 + +现在让我们来为网卡添加一个新的 IP 地址,例如说 **192.168.1.104**。 + +打开你的终端并运行下面的命令添加额外的 IP。 + + sudo ip addr add 192.168.1.104/24 dev enp0s3 + +用命令检查是否启用了新的 IP: + + sudo ip address show enp0s3 + +**样例输出:** + + 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 + link/ether 08:00:27:2a:03:4e brd ff:ff:ff:ff:ff:ff + inet 192.168.1.103/24 brd 192.168.1.255 scope global enp0s3 + valid_lft forever preferred_lft forever + inet 192.168.1.104/24 scope global secondary enp0s3 + valid_lft forever preferred_lft forever + inet6 fe80::a00:27ff:fe2a:34e/64 scope link + valid_lft forever preferred_lft forever + +类似地,你可以添加任意数量的 IP 地址,只要你想要。 + +让我们 ping 一下这个 IP 地址验证一下。 + + sudo ping 192.168.1.104 + +**样例输出** + + PING 192.168.1.104 (192.168.1.104) 56(84) bytes of data. + 64 bytes from 192.168.1.104: icmp_seq=1 ttl=64 time=0.901 ms + 64 bytes from 192.168.1.104: icmp_seq=2 ttl=64 time=0.571 ms + 64 bytes from 192.168.1.104: icmp_seq=3 ttl=64 time=0.521 ms + 64 bytes from 192.168.1.104: icmp_seq=4 ttl=64 time=0.524 ms + +好极了,它能工作! + +要删除 IP,只需要运行: + + sudo ip addr del 192.168.1.104/24 dev enp0s3 + +再检查一下是否删除了 IP。 + + sudo ip address show enp0s3 + +**样例输出:** + + 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 + link/ether 08:00:27:2a:03:4e brd ff:ff:ff:ff:ff:ff + inet 192.168.1.103/24 brd 192.168.1.255 scope global enp0s3 + valid_lft forever preferred_lft forever + inet6 fe80::a00:27ff:fe2a:34e/64 scope link + valid_lft forever preferred_lft forever + +可以看到已经没有了!! + +正如你所知,重启系统后这些设置会失效。那么怎么设置才能永久有效呢?这也很简单。 + +### 添加永久 IP 地址 ### + +Ubuntu 系统的网卡配置文件是 **/etc/network/interfaces**。 + +让我们来看看上面文件的具体内容。 + + sudo cat /etc/network/interfaces + +**输出样例:** + + # This file describes the network interfaces available on your system + # and how to activate them. For more information, see interfaces(5). + source /etc/network/interfaces.d/* + # The loopback network interface + auto lo + iface lo inet loopback + # The primary network interface + auto enp0s3 + iface enp0s3 inet dhcp + +正如你在上面输出中看到的,网卡启用了 DHCP。 + +现在,让我们来分配一个额外的地址,例如 **192.168.1.104/24**。 + +编辑 **/etc/network/interfaces**: + + sudo nano /etc/network/interfaces + +如下添加额外的 IP 地址。 + + # This file describes the network interfaces available on your system + # and how to activate them. For more information, see interfaces(5). + source /etc/network/interfaces.d/* + # The loopback network interface + auto lo + iface lo inet loopback + # The primary network interface + auto enp0s3 + iface enp0s3 inet dhcp + iface enp0s3 inet static + address 192.168.1.104/24 + +保存并关闭文件。 + +运行下面的命令使更改无需重启即生效。 + + sudo ifdown enp0s3 && sudo ifup enp0s3 + +**样例输出:** + + Killed old client process + Internet Systems Consortium DHCP Client 4.3.1 + Copyright 2004-2014 Internet Systems Consortium. + All rights reserved. + For info, please visit https://www.isc.org/software/dhcp/ + Listening on LPF/enp0s3/08:00:27:2a:03:4e + Sending on LPF/enp0s3/08:00:27:2a:03:4e + Sending on Socket/fallback + DHCPRELEASE on enp0s3 to 192.168.1.1 port 67 (xid=0x225f35) + Internet Systems Consortium DHCP Client 4.3.1 + Copyright 2004-2014 Internet Systems Consortium. + All rights reserved. + For info, please visit https://www.isc.org/software/dhcp/ + Listening on LPF/enp0s3/08:00:27:2a:03:4e + Sending on LPF/enp0s3/08:00:27:2a:03:4e + Sending on Socket/fallback + DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0xdfb94764) + DHCPREQUEST of 192.168.1.103 on enp0s3 to 255.255.255.255 port 67 (xid=0x6447b9df) + DHCPOFFER of 192.168.1.103 from 192.168.1.1 + DHCPACK of 192.168.1.103 from 192.168.1.1 + bound to 192.168.1.103 -- renewal in 35146 seconds. + +**注意**:如果你从远程连接到服务器,把上面的两个命令放到**一行**中**非常重要**,因为第一个命令会断掉你的连接。而采用这种方式可以保留你的 ssh 会话。 + +现在,让我们用下面的命令来检查一下是否添加了新的 IP: + + sudo ip address show enp0s3 + +**输出样例:** + + 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 + link/ether 08:00:27:2a:03:4e brd ff:ff:ff:ff:ff:ff + inet 192.168.1.103/24 brd 192.168.1.255 scope global enp0s3 + valid_lft forever preferred_lft forever + inet 192.168.1.104/24 brd 192.168.1.255 scope global secondary enp0s3 + valid_lft forever preferred_lft forever + inet6 fe80::a00:27ff:fe2a:34e/64 scope link + valid_lft forever preferred_lft forever + +很好!我们已经添加了额外的 IP。 + +再次 ping IP 地址进行验证。 + + sudo ping 192.168.1.104 + +**样例输出:** + + PING 192.168.1.104 (192.168.1.104) 56(84) bytes of data. + 64 bytes from 192.168.1.104: icmp_seq=1 ttl=64 time=0.137 ms + 64 bytes from 192.168.1.104: icmp_seq=2 ttl=64 time=0.050 ms + 64 bytes from 192.168.1.104: icmp_seq=3 ttl=64 time=0.054 ms + 64 bytes from 192.168.1.104: icmp_seq=4 ttl=64 time=0.067 ms + +好极了!它能正常工作。就是这样。 + +想知道怎么给 CentOS/RHEL/Scientific Linux/Fedora 系统添加额外的 IP 地址,可以点击下面的链接。 + +- [在CentOS 7上给一个网卡分配多个IP地址][1] + +工作愉快! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/assign-multiple-ip-addresses-to-one-interface-on-ubuntu-15-10/ + +作者:[SK][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/sk/ +[1]:https://linux.cn/article-5127-1.html diff --git a/published/201601/20151123 How to Configure Apache Solr on Ubuntu 14 or 15.md b/published/201601/20151123 How to Configure Apache Solr on Ubuntu 14 or 15.md new file mode 100644 index 0000000000..2f934be732 --- /dev/null +++ b/published/201601/20151123 How to Configure Apache Solr on Ubuntu 14 or 15.md @@ -0,0 +1,131 @@ +如何在 Ubuntu 14/15 上配置 Apache Solr +================================================================================ + +大家好,欢迎来阅读我们今天这篇 Apache Solr 的文章。简单的来说,Apache Solr 是一个最负盛名的开源搜索平台,配合运行在网站后端的 Apache Lucene,能够让你轻松创建搜索引擎来搜索网站、数据库和文件。它能够索引和搜索多个网站并根据搜索文本的相关内容返回搜索建议。 + +Solr 使用 HTTP 可扩展标记语言(XML),可以为 JSON、Python 和 Ruby 等提供应用程序接口(API)。根据Apache Lucene 项目所述,Solr 提供了非常多的功能,很受管理员们的欢迎: + +- 全文检索 +- 分面导航(Faceted Navigation) +- 拼写建议/自动完成 +- 自定义文档排序/排列 + +#### 前提条件: #### + +在一个使用最小化安装包的全新 Ubuntu 14/15 系统上,你仅仅需要少量的准备,就开始安装 Apache Solor. + +### 1)System Update 系统更新### + +使用一个具有 sudo 权限的非 root 用户登录你的 Ubuntu 服务器,在接下来的所有安装和使用 Solr 的步骤中都会使用它。 + +登录成功后,使用下面的命令,升级你的系统到最新的更新及补丁: + + $ sudo apt-get update + +### 2) 安装 JRE### + +要安装 Solr,首先需要安装 JRE(Java Runtime Environment)作为基础环境,因为 solr 和 tomcat 都是基于Java.所以,我们需要安装最新版的 Java 并配置 Java 本地环境. + +要想安装最新版的 Java 8,我们需要通过以下命令安装 Python Software Properties 工具包 + + $ sudo apt-get install python-software-properties + +完成后,配置最新版 Java 8的仓库 + + $ sudo add-apt-repository ppa:webupd8team/java + +现在你可以通过以下命令更新包源列表,使用‘apt-get’来安装最新版本的 Oracle Java 8。 + + $ sudo apt-get update + + $ sudo apt-get install oracle-java8-installer + +在安装和配置过程中,点击'OK'按钮接受 Java SE Platform 和 JavaFX 的 Oracle 二进制代码许可协议(Oracle Binary Code License Agreement)。 + +在安装完成后,运行下面的命令,检查是否安装成功以及查看安装的版本。 + + kash@solr:~$ java -version + java version "1.8.0_66" + Java(TM) SE Runtime Environment (build 1.8.0_66-b17) + Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode) + +执行结果表明我们已经成功安装了 Java,并达到安装 Solr 最基本的要求了,接着我们进行下一步。 + +### 安装 Solr### + +有两种不同的方式可以在 Ubuntu 上安装 Solr,在本文中我们只用最新的源码包来演示源码安装。 + +要使用源码安装 Solr,先要从[官网][1]下载最新的可用安装包。复制以下链接,然后使用 'wget' 命令来下载。 + + $ wget http://www.us.apache.org/dist/lucene/solr/5.3.1/solr-5.3.1.tgz + +运行下面的命令,将这个已归档的服务解压到 /bin 目录。 + + $ tar -xzf solr-5.3.1.tgz solr-5.3.1/bin/install_solr_service.sh --strip-components=2 + +运行脚本来启动 Solr 服务,这将会先创建一个 solr 的用户,然后将 Solr 安装成服务。 + + $ sudo bash ./install_solr_service.sh solr-5.3.1.tgz + +![Solr 安装](http://blog.linoxide.com/wp-content/uploads/2015/11/12.png) + +使用下面的命令来检查 Solr 服务的状态。 + + $ service solr status + +![Solr 状态](http://blog.linoxide.com/wp-content/uploads/2015/11/22.png) + +### 创建 Solr 集合: ### + +我们现在可以使用 Solr 用户添加多个集合。就像下图所示的那样,我们只需要在命令行中指定集合名称和指定其配置集就可以创建多个集合了。 + + $ sudo su - solr -c "/opt/solr/bin/solr create -c myfirstcollection -n data_driven_schema_configs" + +![创建集合](http://blog.linoxide.com/wp-content/uploads/2015/11/32.png) + +我们已经成功的为我们的第一个集合创建了新核心实例目录,并可以将数据添加到里面。要查看库中的默认模式文件,可以在这里找到: '/opt/solr/server/solr/configsets/data_driven_schema_configs/conf' 。 + +### 使用 Solr Web### + +可以使用默认的端口8983连接 Apache Solr。打开浏览器,输入 http://your\_server\_ip:8983/solr 或者 http://your-domain.com:8983/solr. 确保你的防火墙允许8983端口. + + http://172.25.10.171:8983/solr/ + +![Web访问Solr](http://blog.linoxide.com/wp-content/uploads/2015/11/42.png) + +在 Solr 的 Web 控制台左侧菜单点击 'Core Admin' 按钮,你将会看见我们之前使用命令行方式创建的集合。你可以点击 'Add Core' 按钮来创建新的核心。 + +![添加核心](http://blog.linoxide.com/wp-content/uploads/2015/11/52.png) + +就像下图中所示,你可以选择某个集合并指向文档来向里面添加内容或从文档中查询数据。如下显示的那样添加指定格式的数据。 + + { + "number": 1, + "Name": "George Washington", + "birth_year": 1989, + "Starting_Job": 2002, + "End_Job": "2009-04-30", + "Qualification": "Graduation", + "skills": "Linux and Virtualization" + } + +添加文件后点击 'Submit Document'按钮. + +![添加文档](http://blog.linoxide.com/wp-content/uploads/2015/11/62.png) + +### 总结### + +在 Ubuntu 上安装成功后,你就可以使用 Solr Web 接口插入或查询数据。如果你想通过 Solr 来管理更多的数据和文件,可以创建更多的集合。希望你能喜欢这篇文章并且希望它能够帮到你。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/configure-apache-solr-ubuntu-14-15/ + +作者:[Kashif][a] +译者:[taichirain](https://github.com/taichirain) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/kashifs/ +[1]:http://lucene.apache.org/solr/ diff --git a/published/201601/20151125 Running a mainline kernel on a cellphone.md b/published/201601/20151125 Running a mainline kernel on a cellphone.md new file mode 100644 index 0000000000..0de1daf0c4 --- /dev/null +++ b/published/201601/20151125 Running a mainline kernel on a cellphone.md @@ -0,0 +1,45 @@ +为什么主线内核不能运行在我的手机上? +================== + +对于自由软件来说,其最大的自由之一就是能够用一个更新或修改的版本来替换原始版本的程序。尽管如此,数千万使用那些手机里面装着所谓 Linux 的用户却很少能够在他们的手机上运行主线内核(mainline kernel),即使他们拥有替换内核代码的专业技能。可悲的是,我们必须承认目前仍然没有可以运行主线内核的主流手机。在由 Rob Herring 主持的2015届内核峰会(Kernel Summit)上,与会人员共同探讨了这个问题,并进一步谈论了他们应该怎么做才能解决这个问题。 + +当主持人提问的时候,在座的大多数开发人员都表示他们更乐意在他们的手机上面运行主线内核,然而也有少数人持相反的看法。在 Project Ara 的支持下,Rob 在这个问题上已经研究了近一年半的时间(参见:https://lwn.net/Articles/648400/ )。但是最新的研究成果并不理想。 + +Rob 表示,通常手机上运行了太多的过期(out-of-tree)代码;主线内核只是缺少能使手机正常运行所必须的驱动。每台常规的手机都在运行着100万行到300万行的过期(out-of-tree)代码。几乎所有的这些手机的内核版本都不超过3.10,有一些甚至更加古老。造成这种情况的原因有很多,但是有一点是很清楚的,在手机的世界里,一切都变化的太快以至于无法跟上内核社区的步伐。如果真是那样,他问到,我们还担心什么呢? + +Tim Bird 指出,第一台 Android 手机 Nexus 1 从来没有运行过任何一个主线内核,并且以后也不会。它打破了开源的承诺,也使得用户不可能做到将一个新的内核放到手机中。从这一点上来说,没有任何一款手机支持这种能力。Peter Zijlstra 想知道从一台手机到另一台手机到底复制了多少能够工作的过期代码;Rob表示,迄今为止,他已经见到了三个独立开发的热插拔 [Governors][1]。 + +Dirk Hohndel 提出了很少有人注意到的建议。他说,对于世界上的数以亿计的手机,大约只有他们27个人关心他们的手机是否运行着主线内核。剩下的用户仅仅只是想让他们的手机正常工作。或许那些关注手机是否在运行主线内核的开发者正在努力去解决这个令人不解的问题。 + +Chris Mason 说,那些手机厂商当前正面临着相同类型的问题,而这些问题也是那些 Linux 发行版过去所面临过的问题。他们疲于应付大量的无效且重复和能被复用的工作。一旦这些发行版决定将他们的工作配合主线内核而不是使用自己维护的内核,那么问题将会变得好解决的多。解决问题的关键就是去帮助手机制造商们认识到他们可以通过同样的方式获得便利,形成这种认识的关键并不是通过来自用户的压力。这样一来,问题就可以解决了。 + +Grant Likely 提出了对于安全问题的担忧,这种担忧来自于那些不能升级他们的手机系统的 android 设备。他说,我们需要的是一个真正专为手机设立的发行版。但是,只要手机厂商仍然掌控着手机中的应用软件,那么手机的同步更新将无法实现。我们接下来将面临一个很大的安全难题。Peter 补充说,随着 [Stagefright 漏洞][2]的出现,难题已经出现在我们面前了。 + +Ted Ts'o 说,运行主线内核并不是他的主要关注点。他很乐于见到这个假期中所售卖的手机能够运行3.18或者4.1的内核,而不是继续停留在3.10。他认为这是一个更可能被解决的问题。Steve Rostedt 认为,按照 Ted Ts'o 所说的那样去做并不能解决手机的安全问题,但是,Ted 认为使用一个更新一些的内核至少可以让漏洞修复变得更加容易。Grant 对此回应说,接下来的一年里,这一切都将再次发生。过渡到更新的内核也是一个渐进式的对系统的完善。Kees Cook 补充说,我们无法从修复旧版本的内核漏洞的过程中得到太多的益处,真正的问题是我们没有对 bug 的应对措施(他会在今天的另外一个对话中讲到这个话题)。 + +Rob 说,任何一种解决方案都需要得到当前市场上的手机供应商的支持。否则,由于厂商对安装到他们生产的手机上的操作系统的封锁,运行主线内核的策略将会陷入麻烦。Paolo Bonzini 提问说是否可以因为那些没有修复的安全漏洞而控告手机厂商,尤其当手机仍然处于保修期内。Grant 认为对于手机的可更新能力(upgradeability)的保证必须来源于市场需求,否则是无法实现的。而促使它实现的原因可能会是一个严重的安全问题,然后用户开始对手机的可更新能力提出要求。同时,内核开发人员必须不断朝着这个方向努力。Rob 表示,除了到目前为止指出的所有优点之外,运行主线内核也能帮助开发者对安卓设备上的新特性进行测试和验证。 + +Josh Triplett 提问说,如果手机厂商提出对主线内核提供支持的想法,那么内核社区又将采取什么措施呢?那样将会针对手机各方面的特性要求对内核进行大量的测试和验证;[Android 的兼容性测试套件][3]中出现的失败将不得不被再次回归到内核。Rob 提议这个问题可以在明年讨论,即先将最基本的功能做好。但是,Josh 强调说,如果这个需求出现了,我们就应该能够给出一个好的答案。 + +Tim 认为,当前,我们和厂商之间存在很大的脱节。厂商根本不会主动报告或者贡献任何反馈给社区。他们之间完全脱节了,这样的话永远不会有进步。Josh 表示,当厂商们开始报告他们正在使用的旧内核的相关 bug 时,双方之间的接受度将变得更加友好。Arnd Bergmann 认为,我们需要的是得到一个大芯片厂商对使用主线内核的认可,并且将该厂商的硬件提升到能够支持主线内核的运行的这样一个水平,而这样将会在其他方面增加负担。但是,他补充说,实现这个目标要求存在一个跟随硬件一起分发的自由 GPU 驱动程序——然而这种程序当前并不存在。 + +Rob 给存在问题的领域列了一个清单,但是现在已经没有太多的时间去讨论其中的细节了。WiFi 驱动仍然是一个问题,尤其是当这个新特性被添加到 Android 设备上的时候。Johannes Berg 对新特性仍然存在问题表示赞同;Android 的开发人员甚至在这些新特性被应用到 Android 设备上之前都不会去谈论它们是否存在问题。然而,对这些特性中的大多数的技术支持最终都会落实在主线内核中。 + +随着会议逐渐接近尾声,Ben Herrenschmidt 再次重申:实现在 Android 手机上运行主线内核的关键还是在于让厂商认识到使用主线内核是它们获得最大利润的最好选择。从长远看,使用主线内核能节省大量的工作。Mark Brown 认为,以前,当搭载在 Android 设备上的内核版本以更稳定的方式向前推进的时候,上游工作的好处对运营商来说更加明显。以现在的情况来看,手机上的内核版本似乎停留在了3.10,那种压力是不一样的。 + +这次谈话以开发者决定进一步改善当前的状况而结束,但是却并没有对如何改善提出一个明确的计划。 + +--------------------------------------------------------------------------------- + +via: https://lwn.net/Articles/662147/ + +作者:[Jonathan Corbet][a] +译者:[kylepeng93](https://github.com/kylepeng93) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://lwn.net/Articles/KernelSummit2015/ +[1]:http://androidmodguide.blogspot.com/p/blog-page.html +[2]:https://lwn.net/Articles/652728/ +[3]:https://source.android.com/compatibility/cts/index.html diff --git a/published/201601/20151126 How to Install Nginx as Reverse Proxy for Apache on FreeBSD 10.2.md b/published/201601/20151126 How to Install Nginx as Reverse Proxy for Apache on FreeBSD 10.2.md new file mode 100644 index 0000000000..bf97fc16d7 --- /dev/null +++ b/published/201601/20151126 How to Install Nginx as Reverse Proxy for Apache on FreeBSD 10.2.md @@ -0,0 +1,327 @@ +如何在 FreeBSD 10.2 上安装 Nginx 作为 Apache 的反向代理 +================================================================================ + +Nginx 是一款自由开源的 HTTP 和反向代理服务器,也可以用作 POP3/IMAP 的邮件代理服务器。Nginx 是一款高性能的 web 服务器,其特点是功能丰富,结构简单以及内存占用低。 第一个版本由 Igor Sysoev 发布于2002年,到现在有很多大型科技公司在使用,包括 Netflix、 Github、 Cloudflare、 WordPress.com 等等。 + +在这篇教程里我们会“**在 freebsd 10.2 系统上,安装和配置 Nginx 网络服务器作为 Apache 的反向代理**”。 Apache 将在8080端口上运行 PHP ,而我们会配置 Nginx 运行在80端口以接收用户/访问者的请求。如果80端口接收到用户浏览器的网页请求,那么 Nginx 会将该请求传递给运行在8080端口上的 Apache 网络服务器和 PHP。 + +#### 前提条件 #### + +- FreeBSD 10.2 +- Root 权限 + +### 步骤 1 - 更新系统 ### + +使用 SSH 认证方式登录到你的 FreeBSD 服务器,使用下面命令来更新你的系统: + + freebsd-update fetch + freebsd-update install + +### 步骤 2 - 安装 Apache ### + +Apache 是开源的、使用范围最广的 web 服务器。在 FreeBSD 里默认没有安装 Apache, 但是我们可以直接通过 /usr/ports/www/apache24 下的 ports 或软件包来安装,也可以直接使用 pkg 命令从 FreeBSD 软件库中安装。在本教程中,我们将使用 pkg 命令从 FreeBSD 软件库中安装: + + pkg install apache24 + +### 步骤 3 - 安装 PHP ### + +一旦成功安装 Apache,接着将会安装 PHP ,它来负责处理用户对 PHP 文件的请求。我们将会用到如下的 pkg 命令来安装 PHP: + + pkg install php56 mod_php56 php56-mysql php56-mysqli + +### 步骤 4 - 配置 Apache 和 PHP ### + +一旦所有都安装好了,我们将会配置 Apache 运行在8080端口上, 并让 PHP 与 Apache 一同工作。 要想配置Apache,我们可以编辑“httpd.conf”这个配置文件, 对于 PHP 我们只需要复制 “/usr/local/etc/”目录下的 PHP 配置文件 php.ini。 + +进入到“/usr/local/etc/”目录,并且复制 php.ini-production 文件到 php.ini : + + cd /usr/local/etc/ + cp php.ini-production php.ini + +下一步,在 Apache 目录下通过编辑“httpd.conf”文件来配置 Apache: + + cd /usr/local/etc/apache24 + nano -c httpd.conf + +端口配置在第**52**行 : + + Listen 8080 + +服务器名称配置在第**219**行: + + ServerName 127.0.0.1:8080 + +在第**277**行,添加 DirectoryIndex 文件,Apache 将用它来服务对目录的请求: + + DirectoryIndex index.php index.html + +在第**287**行下,配置 Apache ,添加脚本支持: + + + SetHandler application/x-httpd-php + + + SetHandler application/x-httpd-php-source + + +保存并退出。 + +现在用 sysrc 命令,来添加 Apache 为开机启动项目: + + sysrc apache24_enable=yes + +然后用下面的命令测试 Apache 的配置: + + apachectl configtest + +如果到这里都没有问题的话,那么就启动 Apache 吧: + + service apache24 start + +如果全部完毕,在“/usr/local/www/apache24/data”目录下创建一个 phpinfo 文件来验证 PHP 在 Apache 下顺利运行: + + cd /usr/local/www/apache24/data + echo "" > info.php + +现在就可以访问 freebsd 的服务器 IP : 192.168.1.123:8080/info.php 。 + +![Apache and PHP on Port 8080](http://blog.linoxide.com/wp-content/uploads/2015/11/Apache-and-PHP-on-Port-8080.png) + +Apache 及 PHP 运行在 8080 端口。 + +### 步骤 5 - 安装 Nginx ### + +Nginx 可以以较低内存占用提供高性能的 Web 服务器和反向代理服务器。在这个步骤里,我们将会使用 Nginx 作为Apache 的反向代理,因此让我们用 pkg 命令来安装它吧: + + pkg install nginx + +### 步骤 6 - 配置 Nginx ### + +一旦 Nginx 安装完毕,在“**nginx.conf**”文件里,我们需要做一个新的配置文件来替换掉原来的 nginx 配置文件。切换到“/usr/local/etc/nginx/”目录下,并且备份默认 nginx.conf 文件: + + cd /usr/local/etc/nginx/ + mv nginx.conf nginx.conf.oroginal + +现在就可以创建一个新的 nginx 配置文件了: + + nano -c nginx.conf + +然后粘贴下面的配置: + + user www; + worker_processes 1; + error_log /var/log/nginx/error.log; + + events { + worker_connections 1024; + } + + http { + include mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + access_log /var/log/nginx/access.log; + + sendfile on; + keepalive_timeout 65; + + # Nginx cache configuration + proxy_cache_path /var/nginx/cache levels=1:2 keys_zone=my-cache:8m max_size=1000m inactive=600m; + proxy_temp_path /var/nginx/cache/tmp; + proxy_cache_key "$scheme$host$request_uri"; + + gzip on; + + server { + #listen 80; + server_name _; + + location /nginx_status { + + stub_status on; + access_log off; + } + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/local/www/nginx-dist; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:8080 + # + location ~ \.php$ { + proxy_pass http://127.0.0.1:8080; + include /usr/local/etc/nginx/proxy.conf; + } + } + + include /usr/local/etc/nginx/vhost/*; + + } + +保存并退出。 + +下一步,在 nginx 目录下面,创建一个 **proxy.conf** 文件,使其作为反向代理 : + + cd /usr/local/etc/nginx/ + nano -c proxy.conf + +粘贴如下配置: + + proxy_buffering on; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + client_max_body_size 10m; + client_body_buffer_size 128k; + proxy_connect_timeout 90; + proxy_send_timeout 90; + proxy_read_timeout 90; + proxy_buffers 100 8k; + add_header X-Cache $upstream_cache_status; + +保存并退出。 + +最后一步,为 nginx 的高速缓存创建一个“/var/nginx/cache”的新目录: + + mkdir -p /var/nginx/cache + +### 步骤 7 - 配置 Nginx 的虚拟主机 ### + +在这个步骤里面,我们需要创建一个新的虚拟主机域“saitama.me”,其文档根目录为“/usr/local/www/saitama.me”,日志文件放在“/var/log/nginx”目录下。 + +我们必须做的第一件事情就是创建新的目录来存放虚拟主机配置文件,我们创建的新目录名为“**vhost**”。创建它: + + cd /usr/local/etc/nginx/ + mkdir vhost + +创建好 vhost 目录,然后我们就进入这个目录并创建一个新的虚拟主机文件。这里我取名为“**saitama.conf**”: + + cd vhost/ + nano -c saitama.conf + +粘贴如下虚拟主机的配置: + + server { + # Replace with your freebsd IP + listen 192.168.1.123:80; + + # Document Root + root /usr/local/www/saitama.me; + index index.php index.html index.htm; + + # Domain + server_name www.saitama.me saitama.me; + + # Error and Access log file + error_log /var/log/nginx/saitama-error.log; + access_log /var/log/nginx/saitama-access.log main; + + # Reverse Proxy Configuration + location ~ \.php$ { + proxy_pass http://127.0.0.1:8080; + include /usr/local/etc/nginx/proxy.conf; + + # Cache configuration + proxy_cache my-cache; + proxy_cache_valid 10s; + proxy_no_cache $cookie_PHPSESSID; + proxy_cache_bypass $cookie_PHPSESSID; + proxy_cache_key "$scheme$host$request_uri"; + + } + + # Disable Cache for the file type html, json + location ~* .(?:manifest|appcache|html?|xml|json)$ { + expires -1; + } + + # Enable Cache the file 30 days + location ~* .(jpg|png|gif|jpeg|css|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx)$ { + proxy_cache_valid 200 120m; + expires 30d; + proxy_cache my-cache; + access_log off; + } + + } + +保存并退出。 + +下一步,为 nginx 和虚拟主机创建一个新的日志目录“/var/log/”: + + mkdir -p /var/log/nginx/ + +如果一切顺利,在文件的根目录下创建目录 saitama.me 用作文档根: + + cd /usr/local/www/ + mkdir saitama.me + +### 步骤 8 - 测试 ### + +在这个步骤里面,我们只是测试我们的 nginx 和虚拟主机的配置。 + +用如下命令测试 nginx 的配置: + + nginx -t + +如果一切都没有问题,用 sysrc 命令添加 nginx 为开机启动项,并且启动 nginx 和重启 apache: + + sysrc nginx_enable=yes + service nginx start + service apache24 restart + +一切完毕后,在 saitama.me 目录下,添加一个新的 phpinfo 文件来验证 php 的正常运行: + + cd /usr/local/www/saitama.me + echo "" > info.php + +然后访问这个域名: **www.saitama.me/info.php**。 + +![Virtualhost Configured saitamame](http://blog.linoxide.com/wp-content/uploads/2015/11/Virtualhost-Configured-saitamame.png) + +Nginx 作为 Apache 的反向代理运行了,PHP 也同样工作了。 + +这是另一个结果: + +测试无缓存的 .html 文件。 + + curl -I www.saitama.me + +![html with no-cache](http://blog.linoxide.com/wp-content/uploads/2015/11/html-with-no-cache.png) + +测试有三十天缓存的 .css 文件。 + + curl -I www.saitama.me/test.css + +![css file 30day cache](http://blog.linoxide.com/wp-content/uploads/2015/11/css-file-30day-cache.png) + +测试缓存的 .php 文件: + + curl -I www.saitama.me/info.php + +![PHP file cached](http://blog.linoxide.com/wp-content/uploads/2015/11/PHP-file-cached.png) + +全部搞定。 + +### 总结 ### + +Nginx 是最受欢迎的 HTTP 和反向代理服务器,拥有丰富的功能、高性能、低内存/RAM 占用。Nginx 也用于缓存, 我们可以在网络上缓存静态文件使得网页加速,并且缓存用户请求的 php 文件。 Nginx 容易配置和使用,可以将它用作 HTTP 服务器或者 apache 的反向代理。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-nginx-reverse-proxy-apache-freebsd-10-2/ + +作者:[Arul][a] +译者:[KnightJoker](https://github.com/KnightJoker) +校对:[Caroline](https://github.com/carolinewuyan),[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arulm/ diff --git a/published/201601/20151127 Linux or UNIX grep Command Tutorial series 1--HowTo--Use grep Command In Linux or UNIX--Examples.md b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 1--HowTo--Use grep Command In Linux or UNIX--Examples.md new file mode 100644 index 0000000000..b48b9675a3 --- /dev/null +++ b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 1--HowTo--Use grep Command In Linux or UNIX--Examples.md @@ -0,0 +1,153 @@ +grep 命令系列:如何在 Linux/UNIX 中使用 grep 命令 +========================================== + +我该怎样在 Linux、Apple OS X 及其他类 UNIX 系统中使用 grep 命令,你能给我展示一些简单的例子吗? + +grep 命令用来搜索文本,或从给定的文件中搜索行内包含了给定字符串或单词的文件。通常来说,grep 显示匹配到的行。使用 grep 来搜索包括一个或多个正则表达式匹配到的文本行,然后只显示匹配到的行。grep 被视作在 Linux/ Unix 系统中最有用的命令之一。 + +### 你知道吗 ### + +grep 这个名字,来源于一个 Unix/Linux 中的古老的文本编辑器 ed 中执行相似操作的命令: + + g/re/p + +### grep 命令的语法 ### + +语法如下所示: + + grep 'word' 文件名 + grep 'word' 文件1 文件2 文件3 + grep '字符串1 字符串2' 文件名 + cat 某个文件 | grep '某个东西' + command | grep '某个东西' + command 选项1 | grep '数据' + grep --color '数据' 文件名 + +###怎么样使用 grep 来搜索一个文件### + +搜索 /etc/passwd 文件下的 boo 用户,输入: + + $ grep boo /etc/passwd + +输出内容: + + foo:x:1000:1000:foo,,,:/home/foo:/bin/ksh + +可以使用 grep 去强制忽略大小写。例如,使用 -i 选项可以匹配 boo, Boo, BOO 和其他组合: + + $ grep -i "boo" /etc/passwd + +### 递归使用 grep ### + +你可以递归地使用 grep 进行搜索。例如,在文件目录下面搜索所有包含字符串“192.168.1.5”的文件 + + $ grep -r "192.168.1.5" /etc/ + +或者是: + + $ grep -R "192.168.1.5" /etc/ + +示例输出: + + /etc/ppp/options:# ms-wins 192.168.1.50 + /etc/ppp/options:# ms-wins 192.168.1.51 + /etc/NetworkManager/system-connections/Wired connection 1:addresses1=192.168.1.5;24;192.168.1.2; + +你会看到搜索到 192.168.1.5 的结果每一行都前缀以找到匹配的文件名(例如:/etc/ppp/options)。输出之中包含的文件名可以加 -h 选项来禁止输出: + + $ grep -h -R "192.168.1.5" /etc/ + +或者 + + $ grep -hR "192.168.1.5" /etc/ + +示例输出: + + # ms-wins 192.168.1.50 + # ms-wins 192.168.1.51 + addresses1=192.168.1.5;24;192.168.1.2; + +### 使用 grep 去搜索文本 ### + +当你搜索 boo 时,grep 命令将会匹配 fooboo,boo123, barfoo35 和其他所有包含 boo 的字符串,你可以使用 -w 选项去强制只输出那些仅仅包含那个整个单词的行(LCTT译注:即该字符串两侧是英文单词分隔符,如空格,标点符号,和末端等,因此对中文这种没有断字符号的语言并不适用。)。 + + $ grep -w "boo" file + +### 使用 grep 命令去搜索两个不同的单词 ### + +使用 egrep 命令如下: + + $ egrep -w 'word1|word2' /path/to/file + +(LCTT 译注:这里使用到了正则表达式,因此使用的是 egrep 命令,即扩展的 grep 命令。) + +### 统计文本匹配到的行数 ### + +grep 命令可以通过加 -c 参数显示每个文件中匹配到的次数: + + $ grep -c 'word' /path/to/file + +传递 -n 选项可以输出的行前加入匹配到的行的行号: + + $ grep -n 'root' /etc/passwd + +示例输出: + + 1:root:x:0:0:root:/root:/bin/bash + 1042:rootdoor:x:0:0:rootdoor:/home/rootdoor:/bin/csh + 3319:initrootapp:x:0:0:initrootapp:/home/initroot:/bin/ksh + +### 反转匹配(不匹配) ### + +可以使用 -v 选项来输出不包含匹配项的内容,输出内容仅仅包含那些不含给定单词的行,例如输出所有不包含 bar 单词的行: + + $ grep -v bar /path/to/file + +### UNIX/Linux 管道与 grep 命令 ### + +grep 常常与管道一起使用,在这个例子中,显示硬盘设备的名字: + + # dmesg | egrep '(s|h)d[a-z]' + +显示 CPU 型号: + + # cat /proc/cpuinfo | grep -i 'Model' + +然而,以上命令也可以按照以下方法使用,不使用管道: + + # grep -i 'Model' /proc/cpuinfo + +示例输出: + + model : 30 + model name : Intel(R) Core(TM) i7 CPU Q 820 @ 1.73GHz + model : 30 + model name : Intel(R) Core(TM) i7 CPU Q 820 @ 1.73GHz + +### 如何仅仅显示匹配到内容的文件名字? ### + +使用 -l 选项去显示那些文件内容中包含 main() 的文件名: + + $ grep -l 'main' *.c + +最后,你可以强制 grep 以彩色输出: + + $ grep --color vivek /etc/passwd + +示例输出: + +![Grep command in action](http://files.cyberciti.biz/uploads/faq/2007/08/grep_command_examples.png) + + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/faq/howto-use-grep-command-in-linux-unix/ + +作者:Vivek Gite +译者:[zky001](https://github.com/zky001) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +校对者ID: +[1]:http://bash.cyberciti.biz/guide/Pipes \ No newline at end of file diff --git a/published/201601/20151127 Linux or UNIX grep Command Tutorial series 2--Regular Expressions In grep.md b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 2--Regular Expressions In grep.md new file mode 100644 index 0000000000..11e656c666 --- /dev/null +++ b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 2--Regular Expressions In grep.md @@ -0,0 +1,240 @@ +grep 命令系列:grep 中的正则表达式 +================================================================================ + +在 Linux 、类 Unix 系统中我该如何使用 Grep 命令的正则表达式呢? + +Linux 附带有 GNU grep 命令工具,它支持扩展正则表达式(extended regular expressions),而且 GNU grep 在所有的 Linux 系统中都是默认有的。Grep 命令被用于搜索定位存储在您服务器或工作站上的任何信息。 + +### 正则表达式 ### + +正则表达式就是用于匹配每行输入的一种模式,模式是指一串字符序列。下面是范例: + + ^w1 + w1|w2 + [^ ] + +#### grep 正则表达式示例 #### + +在 /etc/passswd 目录中搜索 'vivek' + + grep vivek /etc/passwd + +输出例子: + + vivek:x:1000:1000:Vivek Gite,,,:/home/vivek:/bin/bash + vivekgite:x:1001:1001::/home/vivekgite:/bin/sh + gitevivek:x:1002:1002::/home/gitevivek:/bin/sh + +搜索大小写任意的 vivek(即不区分大小写的搜索) + + grep -i -w vivek /etc/passwd + +搜索大小写任意的 vivek 或 raj + + grep -E -i -w 'vivek|raj' /etc/passwd + +上面最后的例子显示的,就是一个扩展的正则表达式的模式。 + +### 锚点 ### + +你可以分别使用 ^ 和 $ 符号来正则匹配输入行的开始或结尾。下面的例子搜索显示仅仅以 vivek 开始的输入行: + + grep ^vivek /etc/passwd + +输出例子: + + vivek:x:1000:1000:Vivek Gite,,,:/home/vivek:/bin/bash + vivekgite:x:1001:1001::/home/vivekgite:/bin/sh + +你可以仅仅只搜索出以单词 vivek 开始的行,即不显示 vivekgit、vivekg 等(LCTT 译注:即该单词后面是空格、符号等英文的单词分隔符。) + + grep -w ^vivek /etc/passwd + +找出以单词 word 结尾的行: + + grep 'foo$' 文件名 + +匹配仅仅只包含 foo 的行: + + grep '^foo$' 文件名 + +如下所示的例子可以搜索空行: + + grep '^$' 文件名 + +### 字符类 ### + +匹配 Vivek 或 vivek: + + grep '[vV]ivek' 文件名 + +或者 + + grep '[vV][iI][Vv][Ee][kK]' 文件名 + +也可以匹配数字 (即匹配 vivek1 或 Vivek2 等等): + + grep -w '[vV]ivek[0-9]' 文件名 + +可以匹配两个数字字符(即 foo11、foo12 等): + + grep 'foo[0-9][0-9]' 文件名 + +不仅仅局限于数字,也能匹配至少一个字母的: + + grep '[A-Za-z]' 文件名 + +显示含有 "w" 或 "n" 字符的所有行: + + grep [wn] 文件名 + +放在括号内的表达式,即包在 "[:" 和 ":]" 之间的字符类的名字,它表示的是属于此类的所有字符列表。标准的字符类名称如下: + +- [:alnum:] - 字母数字字符 +- [:alpha:] - 字母字符 +- [:blank:] - 空字符: 空格键符 和 制表符 +- [:digit:] - 数字: '0 1 2 3 4 5 6 7 8 9' +- [:lower:] - 小写字母: 'a b c d e f g h i j k l m n o p q r s t u v w x y z' +- [:space:] - 空格字符: 制表符、换行符、垂直制表符、换页符、回车符和空格键符 +- [:upper:] - 大写字母: 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z' + +在这个例子所示的是匹配所有大写字母: + + grep '[:upper:]' 文件名 + +### 通配符 ### + +你可以使用 "." 来匹配单个字符。例子中匹配以 "b" 开头以 "t" 结尾的3个字符的单词: + + grep '\' 文件名 + +在这儿, + +- `\<` 匹配单词前面的空字符串 +- `\>` 匹配单词后面的空字符串 + +打印出只有两个字符的所有行: + + grep '^..$' 文件名 + +显示以一个点和一个数字开头的行: + + grep '^\.[0-9]' 文件名 + +#### 点字符转义 #### + +下面要匹配到 IP 地址为 192.168.1.254 的正则式是不正确的:(LCTT 译注:可以匹配到该 IP 地址,但是也有可能匹配到间隔符号不是点的类似格式) + + grep '192.168.1.254' /etc/hosts + +三个点字符都需要转义: + + grep '192\.168\.1\.254' /etc/hosts + +下面的例子只能匹配出 IP 地址:(LCTT 译注:实际上由于 IP 地址中数字的取值范围,该正则表达式并不精确) + + egrep '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}' 文件名 + +### 怎么样搜索以 - 符号开头的匹配模式? ### + +要使用 -e 选项来搜索匹配 '--test--' 字符串,如果不使用 -e 选项,grep 命令会试图把 '--test--' 当作自己的选项参数来解析: + + grep -e '--test--' 文件名 + +### 怎么使用 grep 的“或”匹配? ### + +使用如下的语法: + + grep -E 'word1|word2' 文件名 + 或 + egrep 'word1|word2' 文件名 + +或者是 + + grep 'word1\|word2' 文件名 + +### 怎么使用 grep 的“和”匹配? ### + +使用下面的语法来显示既包含 'word1' 又包含 'word2' 的所有行 + + grep 'word1' 文件名 | grep 'word2' + +### 怎么样使用序列检测? ### + +使用如下的语法,您可以检测一个字符在序列中重复出现次数: + + {N} + {N,} + {min,max} + +要匹配字符 “v" 出现两次: + + egrep "v{2}" 文件名 + +下面的命令能匹配到 "col" 和 "cool" : + + egrep 'co{1,2}l' 文件名 + +下面的命令将会匹配出至少有三个 'c' 字符的所有行。 + + egrep 'c{3,}' 文件名 + +下面的例子会匹配 91-1234567890(即二个数字-十个数字) 这种格式的手机号。 + + grep "[[:digit:]]\{2\}[ -]\?[[:digit:]]\{10\}" 文件名 + +### 怎么样使 grep 命令高亮显示?### + +使用如下的语法: + + grep --color 正则表达式 文件名 + +### 怎么样仅仅只显示匹配出的字符,而不是匹配出的行? ### + +使用如下语法: + + grep -o 正则表达式 文件名 + +### 正则表达式限定符### + +| 限定符 | 描述| +|------|----| +|`.`|匹配任意的一个字符。| +|`?`|匹配前面的子表达式,最多一次。| +|`*`|匹配前面的子表达式零次或多次。| +|`+`|匹配前面的子表达式一次或多次。| +|`{N}`|匹配前面的子表达式 N 次。| +|`{N,}`|匹配前面的子表达式 N 次到多次。| +|`{N,M}`|匹配前面的子表达式 N 到 M 次,至少 N 次至多 M 次。| +|`-`|只要不是在序列开始、结尾或者序列的结束点上,表示序列范围。| +|`^`|匹配一行开始的空字符串;也表示字符不在要匹配的列表中。| +|`$`|匹配一行末尾的空字符串。| +|`\b`|匹配一个单词前后的空字符串。| +|`\B`|匹配一个单词中间的空字符串。| +|`\<`|匹配单词前面的空字符串。| +|`\>`|匹配单词后面的空字符串。| + +#### grep 和 egrep #### + +egrep 等同于 **grep -E** 。它会以扩展的正则表达式的模式来解释模式。下面来自 grep 的帮助页: + + 基本的正则表达式元字符 ?、+、 {、 |、 ( 和 ) 已经失去了它们原来的意义,要使用的话用反斜线的版本 \?、\+、\{、\|、\( 和 \) 来代替。 + 传统的 egrep 并不支持 { 元字符,一些 egrep 的实现是以 \{ 替代的,所以一个可移植的脚本应该避免在 grep -E 使用 { 符号,要匹配字面的 { 应该使用 [}]。 + GNU grep -E 试图支持传统的用法,如果 { 出在在无效的间隔规范字符串这前,它就会假定 { 不是特殊字符。 + 例如,grep -E '{1' 命令搜索包含 {1 两个字符的串,而不会报出正则表达式语法错误。 + POSIX.2 标准允许这种操作的扩展,但在可移植脚本文件里应该避免这样使用。 + +参考: + +- grep 和 regex 帮助手册页(7) +- grep 的 info 页 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/faq/grep-regular-expressions/ + +作者:Vivek Gite +译者:[runningwater](https://github.com/runningwater) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 \ No newline at end of file diff --git a/published/201601/20151127 Linux or UNIX grep Command Tutorial series 3--Search Multiple Words or String Pattern Using grep Command.md b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 3--Search Multiple Words or String Pattern Using grep Command.md new file mode 100644 index 0000000000..ed44522d70 --- /dev/null +++ b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 3--Search Multiple Words or String Pattern Using grep Command.md @@ -0,0 +1,42 @@ +grep 命令系列:使用 grep 命令来搜索多个单词 +================================================================================ + +要使用 grep 命令来搜索多个字符串或单词,我们该怎么做?例如我想要查找 /path/to/file 文件中的 word1、word2、word3 等单词,我怎么样命令 grep 查找这些单词呢? + +[grep 命令支持正则表达式][1]匹配模式。要使用多单词搜索,请使用如下语法: + + grep 'word1\|word2\|word3' /path/to/file + +下的例子中,要在一个名叫 /var/log/messages 的文本日志文件中查找 warning、error 和 critical 这几个单词,输入: + + $ grep 'warning\|error\|critical' /var/log/messages + +仅仅只是要匹配单词(即该词两侧是单词分界符,针对西方以空格分隔的语言而言)的话,可以加上 -w 选项参数: + + $ grep -w 'warning\|error\|critical' /var/log/messages + +egrep 命令可以跳过上面的语法格式,其使用的语法格式如下: + + $ egrep -w 'warning|error|critical' /var/log/messages + +我建义您们加上 -i (忽略大小写) 和 --color 选项参数,如下示: + + $ egrep -wi --color 'warning|error|critical' /var/log/messages + +输出示例: + +![Fig.01: Linux / Unix egrep Command Search Multiple Words Demo Output](http://s0.cyberciti.org/uploads/faq/2008/04/egrep-words-output.png) + +图一: Linux / Unix egrep 命令查找多个单词输出例子 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/faq/searching-multiple-words-string-using-grep/ + +作者:Vivek Gite +译者:[runningwater](https://github.com/runningwater) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://linux.cn/article-6941-1.html \ No newline at end of file diff --git a/published/201601/20151127 Linux or UNIX grep Command Tutorial series 4--Grep Count Lines If a String or Word Matches.md b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 4--Grep Count Lines If a String or Word Matches.md new file mode 100644 index 0000000000..081ecdb9b6 --- /dev/null +++ b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 4--Grep Count Lines If a String or Word Matches.md @@ -0,0 +1,34 @@ +grep 命令系列:用 grep 命令统计匹配字符串的行数 +================================================================================ + +在 Linux 或 UNIX 操作系统下,对于给定的单词或字符串,我们应该怎么统计它们在每个输入文件中存在的行数呢? + +您需要通过添加 -c 或者 --count 选项参数来抑制正常的输出。它将会显示对输入文件单词匹配的行数,如下所示: + + $ grep -c vivek /etc/passwd + +或者 + + $ grep -w -c vivek /etc/passwd + +输出的示例: + + 1 + +相反的,使用 -v 或者 --invert 选项参数可以统计出不匹配的输入文件行数,键入: + + $ grep -c vivek /etc/passwd + +输出的示例: + + 45 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/faq/grep-count-lines-if-a-string-word-matches/ + +作者:Vivek Gite +译者:[runningwater](https://github.com/runningwater) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 \ No newline at end of file diff --git a/published/201601/20151127 Linux or UNIX grep Command Tutorial series 5--Grep From Files and Display the File Name.md b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 5--Grep From Files and Display the File Name.md new file mode 100644 index 0000000000..4953cae431 --- /dev/null +++ b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 5--Grep From Files and Display the File Name.md @@ -0,0 +1,68 @@ +grep 命令系列:从文件中搜索并显示文件名 +================================================================================ + +我怎样从几个文件中搜索(grep),并只显示匹配到的文件的文件名? + +当你从不止一个的文件中搜索时,默认它将显示文件名: + + grep "word" 文件名 + grep root /etc/* + +示例输出: + + /etc/bash.bashrc: See "man sudo_root" for details. + /etc/crontab:17 * * * * root cd / && run-parts --report /etc/cron.hourly + /etc/crontab:25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) + /etc/crontab:47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) + /etc/crontab:52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) + /etc/group:root:x:0: + grep: /etc/gshadow: Permission denied + /etc/logrotate.conf: create 0664 root utmp + /etc/logrotate.conf: create 0660 root utmp + +每行开始的第一个部分是文件名(如:/etc/crontab、/etc/group)。使用 -l 选项可以只显示文件名: + + grep -l "string" filename + grep -l root /etc/* + +示例输出: + + /etc/aliases + /etc/arpwatch.conf + grep: /etc/at.deny: Permission denied + /etc/bash.bashrc + /etc/bash_completion + /etc/ca-certificates.conf + /etc/crontab + /etc/group + +你也可以逆转输出;使用 -L 选项来输出**那些不匹配的文件的文件名**: + + grep -L "word" filename + grep -L root /etc/* + +示例输出: + + /etc/apm + /etc/apparmor + /etc/apparmor.d + /etc/apport + /etc/apt + /etc/avahi + /etc/bash_completion.d + /etc/bindresvport.blacklist + /etc/blkid.conf + /etc/bluetooth + /etc/bogofilter.cf + /etc/bonobo-activation + /etc/brlapi.key + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/faq/grep-from-files-and-display-the-file-name/ + +作者:Vivek Gite +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 \ No newline at end of file diff --git a/published/201601/20151127 Linux or UNIX grep Command Tutorial series 6--How To Find Files by Content Under UNIX.md b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 6--How To Find Files by Content Under UNIX.md new file mode 100644 index 0000000000..5616548d54 --- /dev/null +++ b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 6--How To Find Files by Content Under UNIX.md @@ -0,0 +1,68 @@ +grep 命令系列:如何在 UNIX 中根据文件内容查找文件 +================================================================================ + +为了完成课程作业,我写了很多 C 语言代码并把它们保存为 /home/user/c/*.c 和 *.h。那么在 UNIX shell 窗口中我如何能通过字符串或者单词(例如函数名 main())文件内容来查找文件呢? + +你需要用到以下工具: + +[a] **grep 命令** : 输出匹配模式的行。 + +[b] **find 命令**: 在目录层次中查找文件。 + +### [使用 grep 命令根据内容查找文件][1] + +输入以下命令: + + grep 'string' *.txt + grep 'main(' *.c + grep '#include' *.c + grep 'getChar*' *.c + grep -i 'ultra' *.conf + grep -iR 'ultra' *.conf + +其中 + +- **-i** : 忽略模式(匹配字符串 valid、 VALID、 ValID )和输入文件(匹配 file.c FILE.c FILE.C)的大小写。 +- **-R** : 递归读取每个目录下的所有文件。 + + +### 高亮匹配到的模式 ### + +在搜索大量文件的时候你可以轻松地高亮模式: + + $ grep --color=auto -iR 'getChar();' *.c + +### 为查找到的模式显示文件名和行号 ### + +你也许需要显示文件名和行号: + + $ grep --color=auto -iRnH 'getChar();' *.c + +其中, + +- **-n** : 在输出的每行前面添加以 1 开始的行号。 +- **-H** : 为每个匹配打印文件名。要搜索多个文件时这是默认选项。 + + $grep --color=auto -nH 'DIR' * + +输出样例: + +![Fig.01: grep 命令显示搜索到的模式](http://www.cyberciti.biz/faq/wp-content/uploads/2008/09/grep-command.png) + +*Fig.01: grep 命令显示搜索到的模式* + +你也可以使用 find 命令: + + $ find . -name "*.c" -print | xargs grep "main(" + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/ + +作者:Vivek Gite +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.cyberciti.biz/faq/howto-search-find-file-for-text-string/ \ No newline at end of file diff --git a/published/201601/20151127 Linux or UNIX grep Command Tutorial series 7--Linux or UNIX View Only Configuration File Directives Uncommented Lines of a Config File.md b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 7--Linux or UNIX View Only Configuration File Directives Uncommented Lines of a Config File.md new file mode 100644 index 0000000000..28ae0b5122 --- /dev/null +++ b/published/201601/20151127 Linux or UNIX grep Command Tutorial series 7--Linux or UNIX View Only Configuration File Directives Uncommented Lines of a Config File.md @@ -0,0 +1,152 @@ +grep 命令系列:如何只查看配置文件中未被注释的有效配置行 +========================================================= + +大多数的Linux和类Unix系统的配置文件中都有许多的注释行,但是有时候我只想看其中的有效配置行。那我怎么才能只看到quid.conf或httpd.conf这样的配置文件中的非注释命令行呢?怎么去掉这些注释或者空行呢? + +我们可以使用 UNIX/BSD/OS X/Linux 这些操作系统自身提供的 grep,sed,awk,perl或者其他文本处理工具来查看配置文件中的有效配置命令行。 + +### grep 命令示例——去掉注释 ### + +可以按照如下示例使用grep命令: + + $ grep -v "^#" /path/to/config/file + $ grep -v "^#" /etc/apache2/apache2.conf + +示例输出: + + ServerRoot "/etc/apache2" + + LockFile /var/lock/apache2/accept.lock + + PidFile ${APACHE_PID_FILE} + + Timeout 300 + + KeepAlive On + + MaxKeepAliveRequests 100 + + KeepAliveTimeout 15 + + + + StartServers 5 + MinSpareServers 5 + MaxSpareServers 10 + MaxClients 150 + MaxRequestsPerChild 0 + + + + StartServers 2 + MinSpareThreads 25 + MaxSpareThreads 75 + ThreadLimit 64 + ThreadsPerChild 25 + MaxClients 150 + MaxRequestsPerChild 0 + + + + StartServers 2 + MaxClients 150 + MinSpareThreads 25 + MaxSpareThreads 75 + ThreadLimit 64 + ThreadsPerChild 25 + MaxRequestsPerChild 0 + + + User ${APACHE_RUN_USER} + Group ${APACHE_RUN_GROUP} + + + AccessFileName .htaccess + + + Order allow,deny + Deny from all + Satisfy all + + + DefaultType text/plain + + + HostnameLookups Off + + ErrorLog /var/log/apache2/error.log + + LogLevel warn + + Include /etc/apache2/mods-enabled/*.load + Include /etc/apache2/mods-enabled/*.conf + + Include /etc/apache2/httpd.conf + + Include /etc/apache2/ports.conf + + LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined + LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined + LogFormat "%h %l %u %t \"%r\" %>s %O" common + LogFormat "%{Referer}i -> %U" referer + LogFormat "%{User-agent}i" agent + + CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined + + + + Include /etc/apache2/conf.d/ + + Include /etc/apache2/sites-enabled/ + +想要跳过其中的空行,可以使用 [egrep 命令][1], 示例: + + egrep -v "^#|^$" /etc/apache2/apache2.conf + ## or pass it to the page such as more or less ## + egrep -v "^#|^$" /etc/apache2/apache2.conf | less + + ## Bash function ###################################### + ## or create function or alias and use it as follows ## + ## viewconfig /etc/squid/squid.conf ## + ####################################################### + viewconfig(){ + local f="$1" + [ -f "$1" ] && command egrep -v "^#|^$" "$f" || echo "Error $1 file not found." + } + +示例输出: + +![Fig.01: Unix/Linux Egrep Strip Out Comments Blank Lines](http://s0.cyberciti.org/uploads/faq/2008/05/grep-strip-out-comments-blank-lines.jpg) + +*图 01: Unix/Linux Egrep 除去注释行和空行* + +### 理解 grep/egrep 命令行选项 ### + +-v 选项,选择出不匹配的命令行。该选项适用于所有基于posix的系统。正则表达式 `^$` 匹配出所有的非空行, `^#` 匹配出所有的不以“#”开头的非注释行。 + +### sed 命令示例 ### + +可以按照如下示例使用 GNU 上的 sed 命令: + + $ sed '/ *#/d; /^ *$/d' /path/to/file + $ sed '/ *#/d; /^ *$/d' /etc/apache2/apache2.conf + +GNU 或 BSD 上的 sed 也可以修改配置文件。下面的命令的作用是原地编辑文件,并以特定(比如 .bak)备份文件: + + sed -i'.bak.2015.12.27' '/ *#/d; /^ *$/d' /etc/apache2/apache2.conf + +更多信息见参考手册 - [grep(1)][2], [sed(1)][3]。 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/faq/shell-display-uncommented-lines-only/ + +作者:Vivek Gite +译者:[sonofelice](https://github.com/sonofelice) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.cyberciti.biz/faq/grep-regular-expressions/ +[2]:http://www.manpager.com/linux/man1/grep.1.html +[3]:http://www.manpager.com/linux/man1/sed.1.html \ No newline at end of file diff --git a/published/201601/20151204 How to Install Laravel PHP Framework on CentOS 7 or Ubuntu 15.04.md b/published/201601/20151204 How to Install Laravel PHP Framework on CentOS 7 or Ubuntu 15.04.md new file mode 100644 index 0000000000..5b60ec5f1a --- /dev/null +++ b/published/201601/20151204 How to Install Laravel PHP Framework on CentOS 7 or Ubuntu 15.04.md @@ -0,0 +1,164 @@ +如何在 CentOS 7 / Ubuntu 15.04 上安装 PHP 框架 Laravel +================================================================================ + +大家好,这篇文章将要讲述如何在 CentOS 7 / Ubuntu 15.04 上安装 Laravel。如果你是一个 PHP Web 的开发者,你并不需要考虑如何在琳琅满目的现代 PHP 框架中选择,Laravel 是最轻松启动和运行的,它省时省力,能让你享受到 web 开发的乐趣。Laravel 信奉着一个普世的开发哲学,通过简单的指导创建出可维护代码具有最高优先级,你将保持着高速的开发效率,能够随时毫不畏惧更改你的代码来改进现有功能。 + +Laravel 安装并不繁琐,你只要跟着本文章一步步操作就能在 CentOS 7 或者 Ubuntu 15 服务器上安装。 + +### 1) 服务器要求 ### + +在安装 Laravel 前需要安装一些它的依赖前提条件,主要是一些基本的参数调整,比如升级系统到最新版本,sudo 权限和安装依赖包。 + +当你连接到你的服务器时,请确保你能通以下命令能成功的使用 EPEL 仓库并且升级你的服务器。 + +#### CentOS-7 #### + + # yum install epel-release + + # rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + # rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm + + # yum update + +#### Ubuntu #### + + # apt-get install python-software-properties + # add-apt-repository ppa:ondrej/php5 + + # apt-get update + + # apt-get install -y php5 mcrypt php5-mcrypt php5-gd + +### 2) 防火墙安装 ### + +系统防火墙和 SELinux 设置对于用于产品应用安全来说非常重要,当你使用测试服务器的时候可以关闭防火墙,用以下命令行设置 SELinux 成宽容模式(permissive)来保证安装程序不受它们的影响。 + + # setenforce 0 + +### 3) Apache, MariaDB, PHP 安装 ### + +Laravel 安装程序需要完成安装 LAMP 整个环境,需要额外安装 OpenSSL、PDO,Mbstring 和 Tokenizer 等 PHP 扩展。如果 LAMP 已经运行在你的服务器上你可以跳过这一步,直接确认一些必要的 PHP 插件是否安装好。 + +要安装完整 AMP 你需要在自己的服务器上运行以下命令。 + +#### CentOS #### + + # yum install httpd mariadb-server php56w php56w-mysql php56w-mcrypt php56w-dom php56w-mbstring + +要在 CentOS 7 上实现 MySQL / Mariadb 服务开机自动启动,你需要运行以下命令。 + + # systemctl start httpd + # systemctl enable httpd + + #systemctl start mysqld + #systemctl enable mysqld + +在启动 MariaDB 服务之后,你需要运行以下命令配置一个足够安全的密码。 + + #mysql_secure_installation + +#### Ubuntu #### + + # apt-get install mysql-server apache2 libapache2-mod-php5 php5-mysql + +### 4) 安装 Composer ### + +在我们安装 Laravel 前,先让我们开始安装 composer。安装 composer 是安装 Laravel 的最重要步骤之一,因为 composer 能帮我们安装 Laravel 的各种依赖。 + +#### CentOS/Ubuntu #### + +在 CentOS / Ubuntu 下运行以下命令来配置 composer 。 + + # curl -sS https://getcomposer.org/installer | php + # mv composer.phar /usr/local/bin/composer + # chmod +x /usr/local/bin/composer + +![composer installation](http://blog.linoxide.com/wp-content/uploads/2015/11/14.png) + +### 5) 安装 Laravel ### + +我们可以运行以下命令从 github 上下载 Laravel 的安装包。 + + # wget https://github.com/laravel/laravel/archive/develop.zip + +运行以下命令解压安装包并且移动 document 的根目录。 + + # unzip develop.zip + + # mv laravel-develop /var/www/ + +现在使用 compose 命令来安装目录下所有 Laravel 所需要的依赖。 + + # cd /var/www/laravel-develop/ + # composer install + +![compose laravel](http://blog.linoxide.com/wp-content/uploads/2015/11/25.png) + +### 6) 密钥 ### + +为了加密服务器,我们使用以下命令来生成一个加密后的 32 位的密钥。 + + # php artisan key:generate + + Application key [Lf54qK56s3qDh0ywgf9JdRxO2N0oV9qI] set successfully + +现在把这个密钥放到 'app.php' 文件,如以下所示。 + + # vim /var/www/laravel-develop/config/app.php + +![Key encryption](http://blog.linoxide.com/wp-content/uploads/2015/11/45.png) + +### 7) 虚拟主机和所属用户 ### + +在 composer 安装好后,分配 document 根目录的权限和所属用户,如下所示。 + + # chmod 775 /var/www/laravel-develop/app/storage + + # chown -R apache:apache /var/www/laravel-develop + +用任意一款编辑器打开 apache 服务器的默认配置文件,在文件最后加上虚拟主机配置。 + + # vim /etc/httpd/conf/httpd.conf + +---------- + + ServerName laravel-develop + DocumentRoot /var/www/laravel/public + + start Directory /var/www/laravel + AllowOverride All + Directory close + +现在我们用以下命令重启 apache 服务器,打开浏览器查看 localhost 页面。 + +#### CentOS #### + + # systemctl restart httpd + +#### Ubuntu #### + + # service apache2 restart + +### 8) Laravel 5 网络访问 ### + +打开浏览器然后输入你配置的 IP 地址或者完整域名(Fully qualified domain name)你将会看到 Laravel 5 的默认页面。 + +![Laravel Default](http://blog.linoxide.com/wp-content/uploads/2015/11/35.png) + +### 总结 ### + +Laravel 框架对于开发网页应用来说是一个绝好的的工具。所以,看了这篇文章你将学会在 Ubuntu 15 和 CentOS 7 上安装 Laravel, 之后你就可以使用这个超棒的 PHP 框架提供的各种功能和舒适便捷性来进行你的开发工作。 + +如果您有什么意见或者建议请在以下评论区中回复,我们将根据您宝贵的反馈来使我们的文章更加浅显易懂。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-laravel-php-centos-7-ubuntu-15-04/ + +作者:[Kashif][a] +译者:[NearTan](https://github.com/NearTan) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/kashifs/ diff --git a/published/201601/20151204 Install and Configure Munin monitoring server in Linux.md b/published/201601/20151204 Install and Configure Munin monitoring server in Linux.md new file mode 100644 index 0000000000..9845ad8503 --- /dev/null +++ b/published/201601/20151204 Install and Configure Munin monitoring server in Linux.md @@ -0,0 +1,162 @@ +在 Linux 上安装和配置 Munin 监控服务器 +================================================================================ +![](http://www.linuxnix.com/wp-content/uploads/2015/12/munin_page.jpg) + +Munin 是一款类似 [RRD tool][1] 的非常棒的系统监控工具,它能提供给你多方面的系统性能信息,例如 **磁盘、网络、进程、系统和用户**。这些是 Munin 默认监控的内容。 + +### Munin 如何工作? ### + +Munin 以客户端-服务器模式运行。主服务器上运行的 Munin 服务器进程会从本地运行的客户端守护进程(Munin 可以监控它自己的资源)或者远程客户端(Munin 可以监控上百台机器)收集数据,然后在它的 web 界面上以图形的方式显示出来。 + +### 在 nutshell 中配置 Munin ### + +要配置服务器端和客户端,我们需要完成以下两步。 + +1. 安装 Munin 服务器软件包并配置,使得它能从客户端收集数据。 +2. 安装 Munin 客户端,使得服务器能连接到客户端守护进程进行数据收集。 + +### 在 Linux 上安装 munin 服务器端 ### + +在基于 Ubuntu/Debian 的机器上安装 Munin 服务器: + + apt-get install munin apache2 + +在基于 Redhat/CentOS 的机器上安装 Munin 服务器: + +在基于 Redhat 的机器上安装 Munin 之前,你需要确保 [启用 EPEL 软件仓库][2],因为基于 Redhat 的机器的软件仓库默认没有 Munin。 + + yum install munin httpd + +### 在 Linux 上配置 Munin 服务器端 ### + +下面是我们要在服务器上启动 Munini 所进行的步骤: + +1. 在 /etc/munin/munin.conf 中添加需要监控的主机详情。 +2. 配置 apache web 服务器使其包括 munin 配置。 +3. 为 web 界面创建用户名和密码 +4. 重启 apache 服务器 + +####步骤 1#### + +在 **/etc/munin/munin.conf** 文件中添加主机条目。调到文件末尾添加要监控的客户端。在这个例子中,我添加了要监控的数据库服务器和它的 IP 地址。 + +示例: + + [db.linuxnix.com] + address 192.168.1.25 + use_node_name yes + +保存文件并退出。 + +####步骤 2#### + +在 /etc/apache2/conf.d 目录中编辑或创建文件 munin.conf 用于包括 Munin 和 Apache 相关的配置。另外注意一点,默认其它和 web 相关的 Munin 配置保存在 /var/www/munin 目录。 + + vi /etc/apache2/conf.d/munin.conf + +内容: + + Alias /munin /var/www/munin + + Order allow,deny + Allow from localhost 127.0.0.0/8 ::1 + AllowOverride None + Options ExecCGI FollowSymlinks + AddHandler cgi-script .cgi + DirectoryIndex index.cgi + AuthUserFile /etc/munin/munin.passwd + AuthType basic + AuthName "Munin stats" + require valid-user + + ExpiresActive On + ExpiresDefault M310 + + + +保存文件并退出。 + +####步骤 3#### + +现在为查看 munin 的图示而创建用户名和密码: + + htpasswd -c /etc/munin/munin-htpasswd munin + +**注意**:对于 Redhat/Centos 机器,要访问你的配置文件,需要在每个路径中用 “**httpd**” 替换 “**apache2**”。 + +####步骤 4#### + +重启 Apache 服务器,使得 Munin 配置生效。 + +基于 Ubuntu/Debian : + + service apache2 restart + +基于 Centos/Redhat : + + service httpd restart + +### 在 Linux 上安装和配置 Munin 客户端 ### + +####步骤 1#### + +在 Linux 上安装 Munin 客户端 + + apt-get install munin-node + +**注意**:如果你想监控你的 Munin 服务器端,你也需要在服务器端安装 munin-node。 + +####步骤 2#### + +编辑 munin-node.conf 文件配置客户端。 + + vi /etc/munin/munin-node.conf + +示例: + + allow ^127\.0\.0\.1$ + allow ^10\.10\.20\.20$ + +---------- + + # 监听到哪个地址上 + host * + +---------- + + # 以及哪个端口 + port 4949 + +**注意**: 10.10.20.20 是我的 Munin 服务器,它连接到客户端的 4949 端口获取数据。 + +####步骤 3#### + +在客户端机器中重启 munin-node: + + service munin-node restart + +### 测试连接 ### + +检查你是否能从服务器的连接到客户端的 4949 端口,如果不行,你需要在客户端机器中的防火墙打开该端口。 + + telnet db.linuxnix.com 4949 + +访问 Munin web 页面 + + http://munin.linuxnix.com/munin/index.html + +希望这些能对你配置基本的 Munin 服务器有所帮助。 + +-------------------------------------------------------------------------------- + +via: http://www.linuxnix.com/install-and-configure-munin-monitoring-server-in-linux/ + +作者:[Surendra Anne][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxnix.com/author/surendra/ +[1]:http://www.linuxnix.com/network-monitoringinfo-gathering-tools-in-linux/ +[2]:https://linux.cn/article-2324-1.html diff --git a/published/201601/20151204 Linux or Unix--jobs Command Examples.md b/published/201601/20151204 Linux or Unix--jobs Command Examples.md new file mode 100644 index 0000000000..70e5138862 --- /dev/null +++ b/published/201601/20151204 Linux or Unix--jobs Command Examples.md @@ -0,0 +1,172 @@ +jobs 命令示例 +================================================================================ + +我是个新的 Linux/Unix 用户。我该如何在 Linux 或类 Unix 系统中使用 BASH/KSH/TCSH 或者基于 POSIX 的 shell 来查看当前正在进行的作业(job)?在 Unix/Linux 上怎样显示当前作业的状态?(LCTT 译注:job,也常称为“任务”) + +作业控制是一种能力,可以停止/暂停进程(命令)的执行并按你的要求继续/恢复它们的执行。这是通过你的操作系统和诸如 bash/ksh 或 POSIX shell 等 shell 来执行的。 + +shell 会将当前所执行的作业保存在一个表中,可以用 jobs 命令来显示。 + +### 用途 ### + +> 在当前 shell 会话中显示作业的状态。 + +### 语法 ### + +其基本语法如下: + + jobs + +或 + + jobs jobID + +或者 + + jobs [options] jobID + +### 启动一些作业来进行示范 ### + +在开始使用 jobs 命令前,你需要在系统上先启动多个作业。执行以下命令来启动作业: + + ### 启动 xeyes, calculator, 和 gedit 文本编辑器 ### + xeyes & + gnome-calculator & + gedit fetch-stock-prices.py & + +最后,在前台运行 ping 命令: + + ping www.cyberciti.biz + +按 **Ctrl-Z** 键来挂起(suspend) ping 命令的作业。 + +### jobs 命令示例 ### + +要在当前 shell 显示作业的状态,请输入: + + $ jobs + +输出示例: + + [1] 7895 Running gpass & + [2] 7906 Running gnome-calculator & + [3]- 7910 Running gedit fetch-stock-prices.py & + [4]+ 7946 Stopped ping cyberciti.biz + +要显示名字以“p”开头的进程 ID 或作业名称,输入: + + $ jobs -p %p + +或者 + + $ jobs %p + +输出示例: + + [4]- Stopped ping cyberciti.biz + +字符 % 是一个指定任务的方法。在这个例子中,你可以使用作业名称开头字符串来来暂停它,如 %ping。 + +### 如何显示进程 ID 不包含其他正常的信息? ### + +通过 jobs 命令的 -l(小写的 L)选项列出每个作业的详细信息,运行: + + $ jobs -l + +示例输出: + +![Fig.01: Displaying the status of jobs in the shell](http://s0.cyberciti.org/uploads/faq/2013/02/jobs-command-output.jpg) + +*Fig.01: 在 shell 中显示 jobs 的状态* + +### 如何只列出最近一次状态改变的进程? ### + +首先,启动一个新的工作如下所示: + + $ sleep 100 & + +现在,只显示自从上次提示过停止或退出之后的作业,输入: + + $ jobs -n + +示例输出: + + [5]- Running sleep 100 & + +### 仅显示进程 ID(PID) ### + +通过 jobs 命令的 -p 选项仅显示 PID: + + $ jobs -p + +示例输出: + + 7895 + 7906 + 7910 + 7946 + 7949 + +### 怎样只显示正在运行的作业呢? ### + +通过 jobs 命令的 -r 选项只显示正在运行的作业,输入: + + $ jobs -r + +示例输出: + + [1] Running gpass & + [2] Running gnome-calculator & + [3]- Running gedit fetch-stock-prices.py & + +### 怎样只显示已经停止工作的作业? ### + +通过 jobs 命令的 -s 选项只显示停止工作的作业,输入: + + $ jobs -s + +示例输出: + + [4]+ Stopped ping cyberciti.biz + +要继续执行 ping cyberciti.biz 作业,输入以下 bg 命令: + + $ bg %4 + +### jobs 命令选项 ### + +摘自 [bash(1)][1] 命令 man 手册页: + +|选项|描述| +|---|------------------| +|`-l`| 列出进程 ID 及其它信息。| +|`-p`| 仅列出进程 ID。| +|`-n`| 仅列出自从上次输出了状态变化提示(比如显示有进程退出)后的发生了状态变化的进程。| +|`-r`| 仅显示运行中的作业。| +|`-s`| 仅显示停止的作业。| +|`-x`| 运行命令及其参数,并用新的命令的进程 ID 替代所匹配的原有作业的进程组 ID。| + +### 关于 /usr/bin/jobs 和 shell 内建的说明 ### + +输入以下 type 命令找出是否 jobs 命令是 shell 的内建命令或是外部命令还是都是: + + $ type -a jobs + +输出示例: + + jobs is a shell builtin + jobs is /usr/bin/jobs + +在几乎所有情况下,你都需要使用 BASH/KSH/POSIX shell 内建的jobs 命令。/usr/bin/jobs 命令不能被用在当前 shell 中。/usr/bin/jobs 命令工作在不同的环境中,并不共享其父 bash/ksh 的 shell 作业。 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/faq/unix-linux-jobs-command-examples-usage-syntax/ + +作者:Vivek Gite +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.manpager.com/linux/man1/bash.1.html diff --git a/published/201601/20151206 NetworkManager and privacy in the IPv6 internet.md b/published/201601/20151206 NetworkManager and privacy in the IPv6 internet.md new file mode 100644 index 0000000000..b20c8d93bf --- /dev/null +++ b/published/201601/20151206 NetworkManager and privacy in the IPv6 internet.md @@ -0,0 +1,56 @@ +IPv6 互联网中的隐私保护和网络管理器 +============================== + +IPv6 的使用量正在不断增加,让我们始料未及的是,伴随这个协议不断增加的使用量,大量的隐私问题涌现出来。互联网社区在积极发布相关解决方案。当前状况是怎样的呢?网络管理器(NetworkManager)又是如何跟上的呢?让我们来瞧瞧吧! + +![](https://blogs.gnome.org/lkundrak/files/2015/12/cameras1.jpg) + +## 通过 IPv6 方式连接的主机的特性 + +启用了 IPv6 的节点(LCTT 译注:节点在网络中指一个联网的设备)并不需要类似 IPv4 网络中 [DHCP](https://tools.ietf.org/html/rfc2132) 服务器的中央机构来配置他们的地址。它们发现(discover)自己所在的网络,然后通过生成主机部分来[自主生成地址](https://tools.ietf.org/html/rfc4862)。这种方式使得网络配置更加简单,并且能够更好的扩展到更大规模的网络。然而,这种方式也有一些缺点。首先,这个节点需要确保它的地址不会和网络上其他节点冲突。其次,如果这个节点在进入的每一个网络中使用相同的主机部分,它的运动就可以被追踪,如此一来,隐私便处于危险之中。 + +负责制定因特网标准的组织 Internet 工程任务组(Internet Engineering Task Force,IETF)[意识到了这个问题](https://tools.ietf.org/html/draft-iesg-serno-privacy-00),这个组织建议取消使用硬件序列号来识别网络上的节点。 + +但实际的实施情况是怎样的呢? + +地址唯一性问题可以通过[重复地址检测(Duplicate Address Detection, DAD)](https://tools.ietf.org/html/rfc4862#section-5.4)机制来解决。当节点为自身创建地址的时候,它首先通过[邻居发现协议(Neighbor Discovery Protocol)](https://tools.ietf.org/html/rfc4861)(一种不同于 IPv4 [ARP](https://tools.ietf.org/html/rfc826)协议的机制)来检查另一个节点是否使用了相同的地址。当它发现地址已经被使用,它必须抛弃掉这个地址。 + +解决另一个问题——隐私问题,有一点困难。一个 IP 地址(无论 IPv4 或 IPv6)由网络部分和主机部分组成(LCTT 译注:网络部分用来划分子网,主机部分用来从相应子网中找到具体的主机)。主机查找出相关的地址的网络部分,并且生成地址的主机部分。传统上它只使用了源自网络硬件(MAC)地址的接口识别器(Interface Identifier)。MAC 地址在硬件制造的时候就被设置好了,它可以唯一的识别机器。这样就确保了地址的稳定性和唯一性。这对避免地址冲突来说是件好事,但是对隐私来说一点也不好。主机部分在不同网络下保持恒定意味着机器在进入不同网络时可以被唯一的识别。这在协议制定的时候看起来无可非议,但是随着 IPv6 的流行,人们对于隐私问题的担忧也愈演愈烈。幸运的是,解决办法还是有的。 + +## 使用隐私扩展(privacy extensions) + +IPv4 的最大问题——地址枯竭,已经不是什么秘密。对 IPv6 来说,这一点不再成立,事实上,使用 IPv6 的主机能够相当大方的利用地址。多个 IPv6 地址对应一块网卡绝对没有任何不合适,正好相反,这是一种标准情形。最起码每个节点都有一个“本地连接(link-local)地址”,它被用来与同一物理链路的节点联络。当网络包含了一个连接其他网络的路由器,这个网络中的每个节点都有一个与每个直接连接的网络相联络的地址。如果主机在同一个网络有更多的地址,该节点(LCTT 译注:指路由器)将接受它们全部的传入流量。对于外发连接,它会把地址显示给远程主机,内核会挑选最适合的地址。但到底是哪一个呢? + +启用了隐私扩展,就像 [RFC4941](https://tools.ietf.org/html/rfc4941) 定义的那样,时常会生成带有随机主机部分的新地址。最新的那个被用于最新的外发连接,与此同时,那些不被使用了的旧地址将被丢弃。这是一个极好的策略——主机不会对外暴露其固定地址,因为它不用于外发连接,但它仍然会接受知道其固定地址的主机连接。 + +但这也存在美中不足之处——某些应用会把地址与用户识别绑定在一起。让我们来考虑一下这种情形,一个 web 应用在用户认证的时候生成一个 HTTP Cookie,但它只接受实施认证的地址的连接。当内核生成了一个新的临时地址,服务器会拒绝使用这个地址的请求,实际上相当于用户登出了。地址是不是建立用户认证的合适机制值得商榷,但这确实是现实中应用程序正在做的。 + +## 解救之道——隐私固定寻址(Privacy stable addressing) + +解决这个问题可能需要另辟蹊径。唯一的(当然咯)地址确实有必要,对于特定网络来说是稳定的,但当用户进入了另一个网络后仍然会变,这样的话追踪就变得几乎不可能。RFC7217 介绍了一种如上所述的机制。 + +创建隐私固定地址依赖于伪随机值,这个随机值只被主机本身知晓,它不会暴露给网络上的其他主机。这个随机值随后被一个密码安全算法加密,一起被加密的还有一些与网络连接的特定值。这些值包含:用以标识网卡的名称;网络地址;对于这个网络来说有可能的其他特殊值,例如无线网络的 SSID。使用这个安全密钥使其他主机很难预测结果地址,与此同时,当进入不同的网络时,网络的特殊数据会让地址变得不同。 + +这也巧妙的解决了地址重复问题。因为有随机值的存在,冲突也不太可能发生。万一发生了冲突,结果地址会得到重复地址检测失败的记录,这时会生成一个不同的地址而不会断开网络连接。看,这种方式很聪明吧。 + +使用隐私固定地址一点儿也不会妨碍隐私扩展。你可以在使用 RFC4941 所描述的临时地址的同时使用 [RFC7217](https://tools.ietf.org/html/rfc7217)中的固定地址。 + +## 网络管理器(NetworkManager)处于什么样的状况? + +我们已经在网络管理器1.0.4版本中实现了隐私扩展(privacy extensions)。在这个版本中,隐私扩展默认开启。你可以用 ipv6.ip6-privacy 参数来控制它。 + +在网络管理器1.2版本中,我们将会加入固定隐私寻址(stable privacy addressing)。应该指出的是,目前的隐私扩展还不符合这种需求。我们可以使用 ipv6.addr-gen-mode 参数来控制这个特性。如果它被设置成固定隐私,那么将会使用固定隐私寻址。设置成“eui64”或者干脆不设置它将会保持传统的默认寻址方式。 + +敬请期待2016年年初网络管理器1.2版本的发布吧!如果你想尝试一下最新的版本,不妨试试 Fedora Rawhide,它最终会变成 Fedora 24。 + +*我想感谢 Hannes Frederic Sowa,他给了我很有价值的反馈。如果没有他的帮助,这篇文章的作用将会逊色很多。另外,Hannes 也是 RFC7217 所描述机制的内核实现者,当网络管理器不起作用的时候,它将发挥作用。* + +-------------------------------------------------------------------------------- + +via: https://blogs.gnome.org/lkundrak/2015/12/03/networkmanager-and-privacy-in-the-ipv6-internet/ + +作者:Lubomir Rintel +译者:[itsang](https://github.com/itsang) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/201601/20151208 How to renew the ISPConfig 3 SSL Certificate.md b/published/201601/20151208 How to renew the ISPConfig 3 SSL Certificate.md new file mode 100644 index 0000000000..ea132d4185 --- /dev/null +++ b/published/201601/20151208 How to renew the ISPConfig 3 SSL Certificate.md @@ -0,0 +1,58 @@ +如何更新 ISPConfig 3 SSL 证书 +================================================================================ +本教程描述了如何在 ISPConfig 3控制面板中更新 SSL 证书。有两个可选的方法: + +- 用 OpenSSL 创建一个新的 OpenSSL 证书和 CSR。 +- 用 ISPConfig updater 更新 SSL 证书 + +我将从用手工的方法更新 SSL 证书开始。 + +### 1)用 OpenSSL 创建一个新的 ISPConfig 3 SSL 证书 ### + +用 root 用户登录你的服务器。在创建一个新的 SSL 证书之前,先备份现有的。SSL 证书是安全敏感的,因此我将它存储在 /root/ 目录下。 + + tar pcfz /root/ispconfig_ssl_backup.tar.gz /usr/local/ispconfig/interface/ssl + chmod 600 /root/ispconfig_ssl_backup.tar.gz + +> 现在创建一个新的 SSL 证书密钥,证书请求(CSR)和自签发证书。 + + cd /usr/local/ispconfig/interface/ssl + openssl genrsa -des3 -out ispserver.key 4096 + openssl req -new -key ispserver.key -out ispserver.csr + openssl x509 -req -days 3650 -in ispserver.csr \ + -signkey ispserver.key -out ispserver.crt + openssl rsa -in ispserver.key -out ispserver.key.insecure + mv ispserver.key ispserver.key.secure + mv ispserver.key.insecure ispserver.key + +重启 apache 来加载新的 SSL 证书 + + service apache2 restart + +### 2)用 ISPConfig 安装器来更新 SSL 证书 ### + +另一个获取新的 SSL 证书的替代方案是使用 ISPConfig 更新脚本。下载 ISPConfig 到 /tmp 目录下,解压包并运行脚本。 + + cd /tmp + wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz + tar xvfz ISPConfig-3-stable.tar.gz + cd ispconfig3_install/install + php -q update.php + +更新脚本会在更新时询问下面的问题: + + Create new ISPConfig SSL certificate (yes,no) [no]: + +这里回答“yes”,SSL 证书创建对话框就会启动。 + +-------------------------------------------------------------------------------- + +via: http://www.faqforge.com/linux/how-to-renew-the-ispconfig-3-ssl-certificate/ + +作者:[Till][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.faqforge.com/author/till/ diff --git a/published/201601/20151208 Top 5 open source community metrics to track.md b/published/201601/20151208 Top 5 open source community metrics to track.md new file mode 100644 index 0000000000..5b616f8116 --- /dev/null +++ b/published/201601/20151208 Top 5 open source community metrics to track.md @@ -0,0 +1,80 @@ +衡量开源社区的五大指标 +================================================================================ +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/yearbook2015-osdc-lead-1.png) + +如果你想要使用指标来追踪你的自由开源软件(FOSS)的社区。现在就面临着一个问题:我应该去追踪哪些指标呢? + +要回答这个问题,你必须知道你需要什么信息。比如,你可能想要知道一个项目社区的可持续性。一个社区对问题的应对速度有多快。一个社区怎么吸引、维护或者流失贡献者。一旦你知道需要哪类信息,你就可以找出哪些社区活动可以提供你想要知道的内容。幸运的是,自由开源软件(FOSS)遵从开放式开发模型,在其软件开发仓库里留下了大量的公共数据,我们可以对这些数据进行分析,并从中收集到一些有用的数据。 + +在这篇文章中,我会介绍一些指标,从而为你的项目社区提供一个多方位的视角分析。 + +### 1. 社区活动(Activity) ### + +一个社区的总体活动和这个社区怎样随着时间演变,是度量所有社区好坏的非常有用的指标。社区活动是评价一个社区工作量的第一印象,也可以用来追踪不同种类的活动。比如,提交次数,给人的第一印象就是跟开发工作量挂钩。通过提出的问题(tickets opened)我们可以大概知道提交了多少 bug 或者又提出了多少新特性。邮件列表中的邮件数量或者论坛帖子的数量可以让我们了解到有过多少次公开讨论。 + +![Activity metrics chart](https://opensource.com/sites/default/files/images/business-uploads/activity-metrics.png) + +[OpenStack 活动看板][1]上面显示的项目代码提交次数和代码评审之后代码合并次数随时间变化的趋势图(周数据)。 + + +### 2. 社区规模(Size) ### + +社区的规模指的是参与到这个社区的人数,但是,基于不同形式的参与人数也有很大的差别。好消息是,通常你只对积极活跃的贡献者比较感兴趣。活跃的贡献者会在项目的仓库留下一些线索。这意味着你可以通过查看git仓库存放的代码中**author**字段来统计积极贡献代码的人数,或者通过看积极参与问题解决的人数来统计活跃人数。 + +所谓活动(某些人做了某些事)可以扩展到很多方面。一种常见的跟踪活动的方式是看有多少人做了工作量相当可观的任务。比如,通常一个项目代码的贡献者是来自这个项目社区的一小部分人。了解了这一小部分人,就对核心的工作组(比如,领导这个社区的人)有一个基本的认识了。 + +![Size metrics chart](https://opensource.com/sites/default/files/images/business-uploads/size-metrics.png) + +[Xen 项目开发看板][2]上展示的该项目邮件列表上作者人数和提交人数随时间的变化趋势(每月数据) + +### 3. 社区表现(Performance) ### + +到目前为止,关注点主要集中在活动数量和贡献者数量的统计上了。你也可以分析流程还有用户的表现如何。比如,你可以测量某流程需要多久才能执行完成。解决或者关闭问题的时间可以表明一个需要及时响应的项目对新信息的应对如何,比如修复一个报告过来的 bug 或者实现一个新需求。代码评审花费的时间,即从代码修改提交到被通过的时间,可以看出更新一个提出的改变要达到社区期望的标准需要多久。 + +其他的一些指标主要与项目处理挂起的工作表现如何有关,比如新的和被关闭问题的比例,或者仍然没有完成的代码评审的队列。这些参数能告诉我们像投入到解决这些问题的资源是否充足这样的一些信息。 + +![Efficiency metrics chart](https://opensource.com/sites/default/files/images/business-uploads/efficiency-metrics.png) + +在[2015第三季度 OpenStack 开发报告][3]上显示的,每季度关闭与打开状态的问题数之比,接受与放弃的改变提案与最新的改变提案之比。 + +### 4. 社区人口特征(Demographics) ### + +随着贡献者的参与或者退出,社区也在不断改变。随着人们加入和退出社区,社区成员的会龄(从社区成员加入时算起)也各异。[社区会龄统计图表][4]很直观的展现了这些改变随时间的变化。图表是由一系列的水平条组成,每两条水平条代表加入到社区的一代人。对于每一代,吸引力(Attracted)水平条表示在相应的时间里有多少人加入到了社区。活跃度(Retained)水平条表示有多少人目前仍然活跃在社区。 + +代表一代人的两个水平条的关系就是滞留比例:依然在这个项目中的那一代人的一部分。吸引力(Attracted)水平条的完整集合表示这个项目在过去有多么受欢迎。活跃度(Retained)水平条的完整集合则表示社区目前的会龄结构。 + +![Demographics metrics chart](https://opensource.com/sites/default/files/images/business-uploads/demography-metrics.png) + +[Eclipse 开发看板][5]上显示的 Eclipse 社区的社区年龄表。每六个月定义一次。 + +### 5. 社区多样性(Diversity) ### + +多样性是一个社区保持弹性的很关键的因素。通常来说,一个社区越具有多样性(人或者组织参与的多元化),那么这个社区的弹性也就越大。比如,如果一个公司要决定离开一个自由开源社区,那么这个公司的员工贡献5%要远比贡献85%所可能引起的潜在问题要小很多。 + +[小马因素(Pony Factor)][6],是 [Daniel Gruno][7] 为“最少的开发者贡献了50%的代码提交量”这一现象定义的术语。基于小马因素,大象因素(Elephant Factor)则是指最少量的公司其员工贡献了50%的代码提交量。这两个数据提供了一种指示,即这个社区依赖多少人或者公司。 + +![Diversity metrics chart](https://opensource.com/sites/default/files/images/business-uploads/diversity-metrics.png) + +[2015开发云数量状态统计][8]显示的在云计算领域的几个自由开源社区项目的小马和大象因素。 + +还有许多其他的指标来衡量一个社区。在决定收集哪些指标时,可以考虑一下社区的目标,还有哪些指标能帮到你。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/business/15/12/top-5-open-source-community-metrics-track + +作者:[Jesus M. Gonzalez-Barahona][a] +译者:[sonofelice](https://github.com/sonofelice) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jgbarah +[1]:http://activity.openstack.org/ +[2]:http://projects.bitergia.com/xen-project-dashboard/ +[3]:http://activity.openstack.org/dash/reports/2015-q3/pdf/2015-q3_OpenStack_report.pdf +[4]:http://radar.oreilly.com/2014/10/measure-your-open-source-communitys-age-to-keep-it-healthy.html +[5]:http://dashboard.eclipse.org/demographics.html +[6]:https://ke4qqq.wordpress.com/2015/02/08/pony-factor-math/ +[7]:https://twitter.com/humbedooh +[8]:https://speakerdeck.com/jgbarah/the-quantitative-state-of-the-open-cloud-2015-edition \ No newline at end of file diff --git a/published/201601/20151215 Fix--Cannot establish FTP connection to an SFTP server.md b/published/201601/20151215 Fix--Cannot establish FTP connection to an SFTP server.md new file mode 100644 index 0000000000..02ce43fcf4 --- /dev/null +++ b/published/201601/20151215 Fix--Cannot establish FTP connection to an SFTP server.md @@ -0,0 +1,50 @@ +错误:无法与 SFTP 服务器建立 FTP 连接 +================================================================================ + +### 问题 ### + +有一天我要连接到我的 web 服务器。我使用 [FileZilla][1] 连接到 FTP 服务器。当我输入主机名和密码连接服务器后,我得到了下面的错误。 + +> Error: Cannot establish FTP connection to an SFTP server. Please select proper protocol. +> +> Error: Critical error: Could not connect to server + +![FileZilla Cannot establish FTP connection to an SFTP server](http://itsfoss.com/wp-content/uploads/2015/12/FileZilla_FTP_SFTP_Problem_1.jpeg) + +### 原因 ### + +看见错误信息后我意识到了我的错误是什么。我尝试与一台 **SFTP** 服务器建立一个 **[FTP][2]** 连接。很明显我没有使用一个正确的协议(应该是SFTP而不是FTP)。 + +如你在上图所见,FileZilla 默认使用的是FTP协议。 + +### 解决 “Cannot establish FTP connection to an SFTP server” 的方案 ### + +解决方案很简单。使用 SFTP 协议而不是 FTP。你要做的就是把协议修改成 SFTP。这就是我要告诉你的。 + +在 FileZilla 菜单中,进入 **文件->站点管理**。 + +![FileZilla Site Manager](http://itsfoss.com/wp-content/uploads/2015/12/FileZilla_FTP_SFTP_Problem_2.jpeg) + +在站点管理中,进入通用选项并选择 SFTP 协议。同样填上主机、端口号、用户密码等。 + +![Cannot establish FTP connection to an SFTP server](http://itsfoss.com/wp-content/uploads/2015/12/FileZilla_FTP_SFTP_Problem_3.png) + +我希望你从这里可以开始工作了。 + +我希望本篇教程可以帮助你修复 “Cannot establish FTP connection to an SFTP server. Please select proper protocol.”这个问题。在相关的文章中,你可以读[了解在 Linux 中如何设置 FTP][4]。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/fix-establish-ftp-connection-sftp-server/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:https://filezilla-project.org/ +[2]:https://en.wikipedia.org/wiki/File_Transfer_Protocol +[3]:https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol +[4]:http://itsfoss.com/set-ftp-server-linux/ diff --git a/published/201601/20151215 How to block network traffic by country on Linux.md b/published/201601/20151215 How to block network traffic by country on Linux.md new file mode 100644 index 0000000000..0a70e7d49b --- /dev/null +++ b/published/201601/20151215 How to block network traffic by country on Linux.md @@ -0,0 +1,111 @@ +如何在 Linux 中根据国家位置来阻断网络流量 +================================================================================ + +作为一名维护 Linux 生产服务器的系统管理员,你可能会遇到这样一些情形:你需要**根据地理位置,选择性地阻断或允许网络流量通过。** 例如你正经历一次由注册在某个特定国家的 IP 发起的 DoS 攻击;或者基于安全考虑,你想阻止来自未知国家的 SSH 登录请求;又或者你的公司对某些在线视频有分销权,它要求只能在特定的国家内合法发行;抑或是由于公司的政策,你需要阻止某个本地主机将文件上传至任意一个非美国的远程云端存储。 + +所有的上述情形都需要设置防火墙,使之具有**基于国家位置过滤流量**的功能。有几个方法可以做到这一点,其中之一是你可以使用 TCP wrappers 来为某个应用(例如 SSH,NFS, httpd)设置条件阻塞。但其缺点是你想要保护的那个应用必须以支持 TCP wrappers 的方式构建。另外,TCP wrappers 并不总是能够在各个平台中获取到(例如,Arch Linux [放弃了][2]对它的支持)。另一种方式是结合基于国家的 GeoIP 信息,设置 [ipset][3],并将它应用到 iptables 的规则中。后一种方式看起来更有希望一些,因为基于 iptables 的过滤器是与应用无关的,且容易设置。 + +在本教程中,我将展示 **另一个基于 iptables 的 GeoIP 过滤器,它由 xtables-addons 来实现**。对于那些不熟悉它的人来说, xtables-addons 是用于 netfilter/iptables 的一系列扩展。一个包含在 xtables-addons 中的名为 xt\_geoip 的模块扩展了 netfilter/iptables 的功能,使得它可以根据流量来自或流向的国家来进行过滤,IP 掩蔽(NAT)或丢包。若你想使用 xt\_geoip,你不必重新编译内核或 iptables,你只需要使用当前的内核构建环境(/lib/modules/\`uname -r`/build)以模块的形式构建 xtables-addons。同时也不需要进行重启。只要你构建并安装了 xtables-addons , xt\_geoip 便能够配合 iptables 使用。 + +至于 xt\_geoip 和 ipset 之间的比较,[xtables-addons 的官方网站][3] 上是这么说的: 相比于 ipset,xt\_geoip 在内存占用上更胜一筹,但对于匹配速度,基于哈希的 ipset 可能更有优势。 + +在教程的余下部分,我将展示**如何使用 iptables/xt\_geoip 来根据流量的来源地或流入的国家阻断网络流量**。 + +### 在 Linux 中安装 xtables-addons ### + +下面介绍如何在各种 Linux 平台中编译和安装 xtables-addons。 + +为了编译 xtables-addons,首先你需要安装一些依赖软件包。 + +#### 在 Debian,Ubuntu 或 Linux Mint 中安装依赖 #### + + $ sudo apt-get install iptables-dev xtables-addons-common libtext-csv-xs-perl pkg-config + +#### 在 CentOS,RHEL 或 Fedora 中安装依赖 #### + +CentOS/RHEL 6 需要事先设置好 EPEL 仓库(为 perl-Text-CSV\_XS 所需要)。 + + $ sudo yum install gcc-c++ make automake kernel-devel-`uname -r` wget unzip iptables-devel perl-Text-CSV_XS + +#### 编译并安装 xtables-addons #### + +从 `xtables-addons` 的[官方网站][4] 下载源码包,然后按照下面的指令编译安装它。 + + $ wget http://downloads.sourceforge.net/project/xtables-addons/Xtables-addons/xtables-addons-2.10.tar.xz + $ tar xf xtables-addons-2.10.tar.xz + $ cd xtables-addons-2.10 + $ ./configure + $ make + $ sudo make install + +需要注意的是,对于基于红帽的系统(CentOS、RHEL、Fedora),它们默认开启了 SELinux,所以有必要像下面这样调整 SELinux 的策略。否则,SELinux 将阻止 iptables 加载 xt\_geoip 模块。 + + $ sudo chcon -vR --user=system_u /lib/modules/$(uname -r)/extra/*.ko + $ sudo chcon -vR --type=lib_t /lib64/xtables/*.so + +### 为 xtables-addons 安装 GeoIP 数据库 ### + +下一步是安装 GeoIP 数据库,它将被 xt\_geoip 用来查询 IP 地址与国家地区之间的对应关系。方便的是,`xtables-addons` 的源码包中带有两个帮助脚本,它们被用来从 MaxMind 下载 GeoIP 数据库并将它转化为 xt\_geoip 可识别的二进制形式文件;它们可以在源码包中的 geoip 目录下找到。请遵循下面的指导来在你的系统中构建和安装 GeoIP 数据库。 + + $ cd geoip + $ ./xt_geoip_dl + $ ./xt_geoip_build GeoIPCountryWhois.csv + $ sudo mkdir -p /usr/share/xt_geoip + $ sudo cp -r {BE,LE} /usr/share/xt_geoip + +根据 [MaxMind][5] 的说明,他们的 GeoIP 数据库能够以 99.8% 的准确率识别出 ip 所对应的国家,并且每月这个数据库将进行更新。为了使得本地安装的 GeoIP 数据是最新的,或许你需要设置一个按月执行的 [cron job][6] 来时常更新你本地的 GeoIP 数据库。 + +### 阻断来自或流向某个国家的网络流量 ### + +一旦 xt\_geoip 模块和 GeoIP 数据库安装好后,你就可以在 iptabels 命令中使用 geoip 的匹配选项。 + + $ sudo iptables -m geoip --src-cc country[,country...] --dst-cc country[,country...] + +你想要阻断流量的那些国家是使用[2个字母的 ISO3166 代码][7] 来特别指定的(例如 US(美国)、CN(中国)、IN(印度)、FR(法国))。 + +例如,假如你想阻断来自也门(YE) 和 赞比亚(ZM)的流量,下面的 iptabels 命令便可以达到此目的。 + + $ sudo iptables -I INPUT -m geoip --src-cc YE,ZM -j DROP + +假如你想阻断流向中国(CN) 的流量,可以运行下面的命令: + + $ sudo iptables -A OUTPUT -m geoip --dst-cc CN -j DROP + +匹配条件也可以通过在 `--src-cc` 或 `--dst-cc` 选项前加 `!` 来达到相反的目的: + +假如你想在你的服务器上阻断来自所有非美国的流量,可以运行: + + $ sudo iptables -I INPUT -m geoip ! --src-cc US -j DROP + +![](https://c2.staticflickr.com/6/5654/23665427845_050241b03f_c.jpg) + +#### 对于使用 Firewall-cmd 的用户 #### + +某些发行版本例如 CentOS/RHEL7 或 Fedora 已经用 firewalld 替代了 iptables 来作为默认的防火墙服务。在这些系统中,你可以类似使用 xt\_geoip 那样,使用 firewall-cmd 来阻断流量。利用 firewall-cmd 命令,上面的三个例子可被重新写为: + + $ sudo firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -m geoip --src-cc YE,ZM -j DROP + $ sudo firewall-cmd --direct --add-rule ipv4 filter OUTPUT 0 -m geoip --dst-cc CN -j DROP + $ sudo firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -m geoip ! --src-cc US -j DROP + +### 总结 ### + +在本教程中,我展示了使用 iptables/xt\_geoip 来根据流量的来源地或流入的国家轻松地阻断网络流量。假如你有这方面的需求,把它部署到你的防火墙系统中可以使之成为一个实用的办法。作为最后的警告,我应该提醒你的是:在你的服务器上通过基于 GeoIP 的流量过滤来禁止特定国家的流量并不总是万无一失的。GeoIP 数据库本身就不是很准确或齐全,且流量的来源或目的地可以轻易地通过使用 VPN、Tor 或其他任意易受攻击的中继主机来达到欺骗的目的。基于地理位置的过滤器甚至可能会阻止本不该阻止的合法网络流量。在你决定把它部署到你的生产环境之前请仔细考虑这个限制。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/block-network-traffic-by-country-linux.html + +作者:[Dan Nanni][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:https://www.archlinux.org/news/dropping-tcp_wrappers-support/ +[2]:http://xmodulo.com/block-unwanted-ip-addresses-linux.html +[3]:http://xtables-addons.sourceforge.net/geoip.php +[4]:http://xtables-addons.sourceforge.net/ +[5]:https://support.maxmind.com/geoip-faq/geoip2-and-geoip-legacy-databases/how-accurate-are-your-geoip2-and-geoip-legacy-databases/ +[6]:http://ask.xmodulo.com/add-cron-job-linux.html +[7]:https://en.wikipedia.org/wiki/ISO_3166-1 diff --git a/published/201601/20151222 Turn Tor socks to http.md b/published/201601/20151222 Turn Tor socks to http.md new file mode 100644 index 0000000000..77415b8e82 --- /dev/null +++ b/published/201601/20151222 Turn Tor socks to http.md @@ -0,0 +1,92 @@ +将 Tor socks 转换成 http 代理 +================================================================================ +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/12/tor-593x445.jpg) + +你可以通过不同的 Tor 工具来使用 Tor 服务,如 Tor 浏览器、Foxyproxy 和其它东西,像 wget 和 aria2 这样的下载管理器不能直接使用 Tor socks 开始匿名下载,因此我们需要一些工具来将 Tor socks 转换成 http 代理,这样就能用它来下载了。 + +**注意**:本教程基于 Debian ,其他发行版会有些不同,因此如果你的发行版是基于 Debian 的,就可以直接使用下面的配置了。 + +### Polipo + +这个服务会使用 8123 端口和 127.0.0.1 的 IP 地址,使用下面的命令来在计算机上安装 Polipo: + + sudo apt install polipo + +现在使用如下命令打开 Polipo 的配置文件: + + sudo nano /etc/polipo/config + +在文件最后加入下面的行: + + proxyAddress = "::0" + allowedClients = 192.168.1.0/24 + socksParentProxy = "localhost:9050" + socksProxyType = socks5 + +用如下的命令来重启 Polipo: + + sudo service polipo restart + +现在 Polipo 已经安装好了!在匿名的世界里做你想做的吧!下面是使用的例子: + + pdmt -l "link" -i 127.0.01 -p 8123 + +通过上面的命令 PDMT(Persian 下载器终端)会匿名地下载你的文件。 + +### Proxychains + +在此服务中你可以设置使用 Tor 或者 Lantern 代理,但是在使用上它和 Polipo 和 Privoxy 有点不同,它不需要使用任何端口!使用下面的命令来安装: + + sudo apt install proxychains + +用这条命令来打开配置文件: + + sudo nano /etc/proxychains.conf + +现在添加下面的代码到文件底部,这里是 Tor 的端口和 IP: + + socks5 127.0.0.1 9050 + +如果你在命令的前面加上“proxychains”并运行,它就能通过 Tor 代理来运行: + + proxychains firefoxt + proxychains aria2c + proxychains wget + +### Privoxy + +Privoxy 使用 8118 端口,可以很轻松地通过 privoxy 包来安装: + + sudo apt install privoxy + +我们现在要修改配置文件: + + sudo nano /etc/pivoxy/config + +在文件底部加入下面的行: + + forward-socks5 / 127.0.0.1:9050 . + forward-socks4a / 127.0.0.1:9050 . + forward-socks5t / 127.0.0.1:9050 . + forward 192.168.*.*/ . + forward 10.*.*.*/ . + forward 127.*.*.*/ . + forward localhost/ . + +重启服务: + + sudo service privoxy restart + +服务已经好了!端口是 8118,IP 是 127.0.0.1,就尽情使用吧! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/turn-tor-socks-http/ + +作者:[Hossein heydari][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/hossein/ diff --git a/published/201601/20151223 How to Setup SSH Login Without Password CentOS or RHEL.md b/published/201601/20151223 How to Setup SSH Login Without Password CentOS or RHEL.md new file mode 100644 index 0000000000..6f9cb3e793 --- /dev/null +++ b/published/201601/20151223 How to Setup SSH Login Without Password CentOS or RHEL.md @@ -0,0 +1,105 @@ +如何在 CentOS / RHEL 上设置 SSH 免密码登录 +================================================================================ +![](http://www.ehowstuff.com/wp-content/uploads/2015/12/notebook-1071774_1280.jpg) + +作为系统管理员,你计划在 Linux 上使用 OpenSSH,完成日常工作的自动化,比如文件传输、备份数据库转储文件到另一台服务器等。为实现该目标,你需要从主机 A 能自动登录到主机 B。自动登录也就是说,要在 shell 脚本中使用ssh,而无需要输入任何密码。 + +本文会告诉你怎样在 CentOS/RHEL 上设置 SSH 免密码登录。自动登录配置好以后,你可以通过它使用 SSH (Secure Shell)和安全复制 (SCP)来移动文件。 + +SSH 是开源的,是用于远程登录的最为可靠的网络协议。系统管理员用它来执行命令,以及通过 SCP 协议在网络上向另一台电脑传输文件。 + +通过配置 SSH 免密码登录,你可以享受到如下的便利: + +- 用脚本实现日常工作的自动化。 +- 增强 Linux 服务器的安全性。这是防范虚拟专用服务器(VPS)遭受暴力破解攻击的一个推荐的方法,SSH 密钥单凭暴力破解是几乎不可攻破的。 + +### 什么是 ssh-keygen ### + +ssh-keygen 是一个用来生成、创建和管理 SSH 认证用的公私钥的工具。通过 ssh-keygen 命令,用户可以创建支持SSH1 和 SSH2 两个协议的密钥。ssh-keygen 为 SSH1 协议创建 RSA 密钥,SSH2 则可以是 RSA 或 DSA。 + +### 什么是 ssh-copy-id ### + +ssh-copy-id 是用来将本地公钥拷贝到远程的 authorized_keys 文件的脚本命令,它还会将身份标识文件追加到远程机器的 ~/.ssh/authorized_keys 文件中,并给远程主机的用户主目录适当的的权限。 + +### SSH 密钥 ### + +SSH 密钥为登录 Linux 服务器提供了更好且安全的机制。运行 ssh-keygen 后,将会生成公私密钥对。你可以将公钥放置到任意服务器,从持有私钥的客户端连接到服务器的时,会用它来解锁。两者匹配时,系统无需密码就能解除锁定。 + +### 在 CentOS 和 RHEL 上设置免密码登录 SSH ### + +以下步骤在 CentOS 5/6/7、RHEL 5/6/7 和 Oracle Linux 6/7 上测试通过。 + +节点1 : 192.168.0.9 +节点2 : 192.168.l.10 + +#### 步骤1 : #### + +测试节点1到节点2的连接和访问: + + [root@node1 ~]# ssh root@192.168.0.10 + The authenticity of host '192.168.0.10 (192.168.0.10)' can't be established. + RSA key fingerprint is 6d:8f:63:9b:3b:63:e1:72:b3:06:a4:e4:f4:37:21:42. + Are you sure you want to continue connecting (yes/no)? yes + Warning: Permanently added '192.168.0.10' (RSA) to the list of known hosts. + root@192.168.0.10's password: + Last login: Thu Dec 10 22:04:55 2015 from 192.168.0.1 + [root@node2 ~]# + +#### 步骤二: #### + +使用 ssh-key-gen 命令生成公钥和私钥,这里要注意的是可以对私钥进行加密保护以增强安全性。 + + [root@node1 ~]# ssh-keygen + Generating public/private rsa key pair. + Enter file in which to save the key (/root/.ssh/id_rsa): + Enter passphrase (empty for no passphrase): + Enter same passphrase again: + Your identification has been saved in /root/.ssh/id_rsa. + Your public key has been saved in /root/.ssh/id_rsa.pub. + The key fingerprint is: + b4:51:7e:1e:52:61:cd:fb:b2:98:4b:ad:a1:8b:31:6d root@node1.ehowstuff.local + The key's randomart image is: + +--[ RSA 2048]----+ + | . ++ | + | o o o | + | o o o . | + | . o + .. | + | S . . | + | . .. .| + | o E oo.o | + | = ooo. | + | . o.o. | + +-----------------+ + +#### 步骤三: #### + +用 ssh-copy-id 命令将公钥复制或上传到远程主机,并将身份标识文件追加到节点2的 ~/.ssh/authorized_keys 中: + + [root@node1 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.0.10 + root@192.168.0.10's password: + Now try logging into the machine, with "ssh '192.168.0.10'", and check in: + + .ssh/authorized_keys + + to make sure we haven't added extra keys that you weren't expecting. + +#### 步骤四: #### + +验证免密码 SSH 登录节点2: + + [root@node1 ~]# ssh root@192.168.0.10 + Last login: Sun Dec 13 14:03:20 2015 from www.ehowstuff.local + +我希望这篇文章能帮助到你,为你提供 SSH 免密码登录 CentOS / RHEL 的基本认知和快速指南。 + +-------------------------------------------------------------------------------- + +via: http://www.ehowstuff.com/ssh-login-without-password-centos/ + +作者:[skytech][a] +译者:[fw8899](https://github.com/fw8899) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.ehowstuff.com/author/skytech/ diff --git a/published/201601/20151223 How to Use Glances to Monitor System on Ubuntu.md b/published/201601/20151223 How to Use Glances to Monitor System on Ubuntu.md new file mode 100644 index 0000000000..08c03efb93 --- /dev/null +++ b/published/201601/20151223 How to Use Glances to Monitor System on Ubuntu.md @@ -0,0 +1,109 @@ +如何在 Ubuntu 上使用 Glances 监控系统 +================================================================================ + +![](https://www.maketecheasier.com/assets/uploads/2015/12/glances_featured.jpg) + +Glances 是一个用于监控系统的跨平台、基于文本模式的命令行工具。它是用 Python 编写的,使用 `psutil` 库从系统获取信息。你可以用它来监控 CPU、平均负载、内存、网络接口、磁盘 I/O,文件系统空间利用率、挂载的设备、所有活动进程以及消耗资源最多的进程。Glances 有很多有趣的选项。它的主要特性之一是可以在配置文件中设置阀值(careful[小心]、warning[警告]、critical[致命]),然后它会用不同颜色显示信息以表明系统的瓶颈。 + +### Glances 的功能 + +- CPU 平均负载 +- 不同状态(如活动、休眠)进程的数量 +- 所有内存信息,如物理内存、交换空间、空闲内存 +- CPU 信息 +- 网络连接的上行/下行速度 +- 磁盘 I/O 读/写速度详细信息 +- 当前挂载设备的磁盘使用情况 +- 消耗资源最多的进程和他们的 CPU/内存使用情况 + +### 安装 Glances + +Glances 在 Ubuntu 的软件仓库中,所以安装很简单。执行下面的命令安装 Glances: + + sudo apt-get install glances + +(LCTT 译注:若安装后无法正常使用,可考虑使用 pip 安装/升级 glances:`sudo pip install --upgrade glances`) + +### Glances 使用方法 + +安装完成后,可以执行下面的命令启动 Glances: + + glances + +你将看到类似下图的输出: + +![glances monitor system output](https://www.maketecheasier.com/assets/uploads/2015/12/glances_output1.png) + +要退出 Glances 终端,按 ESC 键或 `Ctrl + C`。 + +默认情况下,时间间隔(LCTT 译注:显示数据刷新的时间间隔)是 1s,不过你可以在从终端启动 Glances 时自定义时间间隔。 + +要把时间间隔设为 5s,执行下面的命令: + + glances -t 5 + +### Glances 中不同颜色含义 + +Glances 中不同颜色的含义: + +- `绿色`:正常(OK) +- `蓝色`:小心(careful) +- `紫色`:警告(warning) +- `红色`:致命(critical) + +默认设置下,Glances 的阀值设置是:careful=50,warning=70,critical=90。你可以通过 “/etc/glances/” 目录下的默认配置文件 glances.conf 来自定义这些阀值。 + +### Glances 的选项 + +Glances 提供了很多快捷键,可以在它运行时用来查找输出信息。 + +下面是一些常用的热键列表: + +- `m` : 按内存占用排序进程 +- `p` : 按进程名称排序进程 +- `c` : 按 CPU 占用率排序进程 +- `i` : 按 I/O 频率排序进程 +- `a` : 自动排序进程 +- `d` : 显示/隐藏磁盘 I/O 统计信息 +- `f` : 显示/隐藏文件系统统计信息 +- `s` : 显示/隐藏传感器统计信息 +- `y` : 显示/隐藏硬盘温度统计信息 +- `l` : 显示/隐藏日志 +- `n` : 显示/隐藏网络统计信息 +- `x` : 删除警告和严重日志 +- `h` : 显示/隐藏帮助界面 +- `q` : 退出 +- `w` : 删除警告记录 + +### 使用 Glances 监控远程系统 + +你也可以使用 Glances 监控远程系统。要在远程系统上使用它,使用下面的命令: + + glances -s + +你会看到类似下面的输出: + +![glances monitor remote system server](https://www.maketecheasier.com/assets/uploads/2015/12/glances_server.png) + +如你所见,Glances 运行在 61209 端口。 + +现在,到远程机器上执行下面的命令以连接到指定 IP 地址的 Glances 服务器上。假设 192.168.1.10 是你的 Glances 服务器 IP 地址。 + + glances -c -P 192.168.1.10 + +### 结论 + +对于每个 Linux 系统管理员来说,Glances 都是一个非常有用的工具。使用它,你可以轻松、高效地监控 Linux 系统。如果你有什么问题,自由地评论吧。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/glances-monitor-system-ubuntu/ + +作者:[Hitesh Jethva][a] +译者:[bianjp](https://github.com/bianjp) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/hiteshjethva/ + diff --git a/published/201601/20151223 Monitor Linux System Performance Using Nmon.md b/published/201601/20151223 Monitor Linux System Performance Using Nmon.md new file mode 100644 index 0000000000..26f3f3f1e2 --- /dev/null +++ b/published/201601/20151223 Monitor Linux System Performance Using Nmon.md @@ -0,0 +1,87 @@ +使用 Nmon 监控 Linux 的系统性能 +================================================================================ +Nmon(得名于 Nigel 的监控器)是IBM的员工 Nigel Griffiths 为 AIX 和 Linux 系统开发的一款计算机性能系统监控工具。Nmon 可以把操作系统的统计数据展示在屏幕上或者存储到一份数据文件里,来帮助了解计算机资源的使用情况、调整方向和系统瓶颈。这个系统基准测试工具只需要使用一条命令就能得到大量重要的性能数据。使用 Nmon 可以很轻松的监控系统的 CPU、内存、网络、硬盘、文件系统、NFS、高耗进程、资源和 IBM Power 系统的微分区的信息。 + +### Nmon 安装 ### + +Nmon 默认是存在于 Ubuntu 的仓库中的。你可以通过下面的命令安装 Nmon: + + sudo apt-get install nmon + +### 怎么使用Nmon来监控Linux的性能 ### + +安装完成后,通过在终端输入`nmon` 命令来启动 Nmon + + nmon + +你会看到下面的输出: + +![nmon-output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon-output.png) + +从上面的截图可以看到 nmon 命令行工具完全是交互式运行的,你可以使用快捷键来轻松查看对应的统计数据。你可以使用下面的 nmon 快捷键来显示不同的系统统计数据: + +- `q` : 停止并退出 Nmon +- `h` : 查看帮助 +- `c` : 查看 CPU 统计数据 +- `m` : 查看内存统计数据 +- `d` : 查看硬盘统计数据 +- `k` : 查看内核统计数据 +- `n` : 查看网络统计数据 +- `N` : 查看 NFS 统计数据 +- `j` : 查看文件系统统计数据 +- `t` : 查看高耗进程 +- `V` : 查看虚拟内存统计数据 +- `v` : 详细模式 + +### 核查 CPU 处理器 ### + +如果你想收集关于 CPU 性能相关的统计数据,你应该按下键盘上的`c`键,之后你将会看到下面的输出: + +![nmon_cpu_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_cpu_output.png) + +### 核查高耗进程统计数据 ### + +如果想收集系统正在运行的高耗进程的统计数据,按键盘上的`t`键,之后你将会看到下面的输出: + +![nmon_process_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_process_output.jpg) + +### 核查网络统计数据 ### + +如果想收集 Linux 系统的网络统计数据,按下`n`键,你将会看到下面输出: + +![n_network_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_network_output.png) + +### 硬盘 I/O 图表 ### + +使用`d` 键获取硬盘相关的信息,你会看到下面输出: + +![nmon_disk_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_disk_output.png) + +### 核查内核信息 ### + +Nmon 一个非常重要的快捷键是`k`键,用来显示系统内核相关的概要信息。按下`k`键之后,会看到下面输出: + +![nmon_kernel_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_kernel_output.png) + +### 获取系统信息 ### + +对每个系统管理员来说一个非常有用的快捷键是`r`键,可以用来显示计算机的系统结构、操作系统版本号和 CPU 等不同资源的信息。按下`r`键之后会看到下面输出: + +![nmon_system_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_system_output.png) + +### 总结 ### + +还有许多其他的工具做的和 Nmon 同样的工作,不过 Nmon 对一个 Linux 新手来说还是很友好的。如果你有什么问题,尽管评论。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/monitor-linux-system-performance/ + +作者:[Hitesh Jethva][a] +译者:[sonofelice](https://github.com/sonofelice) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/hiteshjethva/ + diff --git a/published/201601/20151223 Ten Biggest Linux Stories Of The Year 2015.md b/published/201601/20151223 Ten Biggest Linux Stories Of The Year 2015.md new file mode 100644 index 0000000000..0a844a4cd7 --- /dev/null +++ b/published/201601/20151223 Ten Biggest Linux Stories Of The Year 2015.md @@ -0,0 +1,127 @@ +2015年 Linux 世界的十个大事件 +====================== + +![2015年的大事件](http://itsfoss.com/wp-content/uploads/2015/12/Biggest-Linux-Stories-2015.jpg) + +2015年已经过去,我在这里(It's FOSS)发表《2015年的大事件》系列。这个系列的第一篇文章为《2015年 Linux 世界的十个大事件》。这些事件在 Linux 世界中产生了极大的影响,无论它们是积极的还是消极的。 + +我总结了2015发生的十件产生了最大影响的事件。让我们来看看: + +### 2015年度十大 Linux /开源相关事件 + +补充一句,以下这些事件没有按照时间顺序排列。 + +#### 微软与 Linux 的结盟 + +在9月下旬,所有人听到[微软构建了自己的 Linux 发行版][1]这个消息时都大吃一惊。其在后来被揭露,这其实是一个微软开发的用于它的 Azure cloud switches 的[软件][2]。 + +但故事还没结束。微软真的与 Canonical(Ubuntu Linux 的母公司)达成合作来开发 [HDInsight][3],这是微软在 Azure 上构建的 Hadoop 大数据服务。 Ubuntu 是[微软在其上部署应用][4]的第一个 Linux 系统。 + +微软会继续保持它与 Linux 的关系吗? 还是在使用 Linux 达到其目的(Azure)就会收手?只有时间能告诉我们一切。 + +#### 微软发布适用于 Linux 的 Visual Studio Code + +在微软发布 Linux 发行版引起喧嚣之前,微软扔下了另一枚炸弹——发布 [Linux 版 Visual Studio Code][27], 与其一并发布的还有 Windows 版以及 OS X 版。尽管 Visual Studio Code 并不是开源的,从某种意义上讲,发布 Linux 版本仍然是 Linux 用户的胜利。(LCTT 译注:此处原文消息有误,[Visual Studio Code 已开源][28]。)无论如何,Linus Torvalds 曾说过一句很著名的话:“如果微软给 Linux 开发过一款应用的话,这就意味着我已经赢了”。 + +你可以看这个教程来学习[如何在 Ubuntu 中安装 Visual Studio Code][5]。 + +#### 苹果公司开源编程语言 Swift + +在向 Linux 及开源“示爱”方面,苹果公司也不甘示弱。苹果用来制作 iOS 应用的首选编程语言 Swift,[现已开源][6]并移植到 Linux 中。虽然其还在测试中,但你已经可以轻易地[在 Ubuntu 中安装 Swift][7]。 + +但是,苹果就是苹果,它[开始吹嘘][8]其为“第一个视开源开发为公司关键的软件开发策略的计算机公司巨头(原文如此)”。 + +#### Ubuntu 手机终于发布 + +Ubuntu 手机终于在今年年初发布。因其早期使用者及开发者,Ubuntu 深受 Ubuntu 社区喜爱。主流智能机用户仍然回避它,主要是[因为该系统还在重度开发中][9]。对于 Ubuntu 手机的问世,2016年将成为决定性的一年。 + +#### Jolla 遭受经济危机 + +Jolla 是 Sailfish OS 这个基于 Linux 的智能手机系统的幕后公司,它遭受了严重的财政困难。这导致了[一半的Jolla 员工被裁][10]。 + +Jolla 在2014年针对它的平板电脑完成了一次非常[成功的众筹][11],显然,他们将大部分预算都花在了 Sailfish OS 的开发上,而在主要投资者退出后,公司正在挣扎以求生存。 + +不过有一个好消息,Jolla 成功拿到了一些雄厚的资金,而且他们[已经继续运营了][12]。 + +#### Firefox OS 已死 + +作为安卓的开源替代品,Mozila 的移动操作系统 Firefox OS 在去年底慢性死亡。本打算在发展中国家售卖低至25美金的智能手机,可基于 Firefox OS 的手机却一直没有流行起来。我认为主要原因是它的硬件配置不高,以及它缺少流行应用。 + +在十二月,[Mozilla 宣布][13]其将停止开发 Firefox OS,并停止出售 Firefox 智能手机。 + +虽然没有正式宣布过,我认为 [Tizen][14],这个 Linux 基金会旗下的基于 Linux 的移动操作系统,也已经消失了。我没有看到任何关于 Tizen 开发的消息,而且 Linux 基金会从未推动过它的开发。Tizen 何时死亡只是一个时间问题。(LCTT 译注:此处原文消息有误,[Tizen 在2015年发布了 3.0 版本][29]。) + +#### “Ubuntu 家族”内讧 + +五月份时,Kubuntu 项目的领导者 Jonathan Riddell [被 Ubuntu 社区委员会强制要求下台][15],这引起了很多激烈的讨论。Jonathan 曾质问 Ubuntu 所收捐款的使用情况,他抱怨 Kubuntu 从未见到过这些钱。 + +这导致了两方的互相谴责。最终。Ubuntu 的大老板,[Mark Shuttleworth 要求 Jonathan 下台][16]。 + +#### 女性 Linux 内核开发者因“野蛮的沟通方式”而退出 + +Linux 之父 Linus Torvalds 以其粗俗的语言而著称。Linux 内核开发者 [Sarah Sharp][17] 也因为嘴快心直而闻名。 + +Sarah Sharp 曾在2013年与 Linus Torvalds 公开争执,[建议 Linus 将“语言暴力”赶出邮件列表][18]。但 Linus 也没有[委婉地][19]回复她。 + +那是在2013年。2015年,Sarah 宣布她正在[逐步停止她在内核社区的工作][20],因为他们的交流方式缺乏基本礼仪,并且野蛮而充满亵渎。 + +这一举动让人们开始讨论 Linux 内核社区是否真的应该改变他们的行为方式,还是 Sarah 做的太过分了。 + +#### Unity 游戏编辑器移植到 Linux平台 + +尽管[在 Linux 上玩游戏][21]仍是 Linux 用户们的阿克琉斯之踵,而在游戏引擎 Unity 宣布其正在测试[Linux 下的游戏编辑器][22]时整个社区都沸腾了。因为在渲染图像时,Linux 是一个最流行的选择,所以我们推测这将使游戏开发者向 Linux 靠拢。不过,Unity 是否真的会推出一个最终版本的游戏编辑器,这个问题还未被证实。 + +#### 政府机构采用开源软件 + +欧洲数个城市的管理机构决定[抛弃先前的软件][23],并使用其开源的替代品。大多数城市管理机构将 Microsoft Office 替换为 LibreOffice 或 OpenOffice. 一些城市管理机构和[公立学校][24]也在跟进,将 Microsoft Windows 换成 Linux。 + +对于这一行为,削减成本是一个重要的因素,因为城市管理机构通过采用开源软件省下了无数欧元。 + +大学也并没有在采用开源软件的道路上落后。这一年,我们听到了[大学如何抛弃 Photoshop 改用 Krita][25] 以及[大学使用开源 Office 软件][26]的消息。 + +### 总结 + +与其他年一样,2015年同样有许多令 Linux 爱好者感到积极或消极的时刻。我们看到 Linux 的竞争者,如微软和苹果,向 Linux 靠拢,政府机构采用开源软件。同时,我们还见证了 Firefox 智能手机系统的失败。我想说,这真是喜忧参半的一年。 + +你认为呢?我希望你们分享你所认为对于 Linuxer 们来说最重要的新闻,和你们对这一年的整体感受。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/biggest-linux-stories-2015/ + +作者:[Abhishek][a] +译者:[StdioA](https://github.com/StdioA) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://itsfoss.com/author/abhishek/ +[1]: https://linux.cn/article-6269-1.html +[2]: http://arstechnica.com/information-technology/2015/09/microsoft-has-built-software-but-not-a-linux-distribution-for-its-software-switches/ +[3]: https://azure.microsoft.com/en-us/services/hdinsight/ +[4]: http://www.zdnet.com/article/microsoft-deploys-first-major-server-application-on-ubuntu-linux/ +[5]: https://linux.cn/article-5423-1.html +[6]: https://linux.cn/article-6689-1.html +[7]: https://linux.cn/article-6781-1.html +[8]: https://business.facebook.com/itsfoss/photos/pb.115098615297581.-2207520000.1450817108./634288916711879/?type=3&theater +[9]: http://www.engadget.com/2015/07/24/ubuntu-phone-review/ +[10]: https://linux.cn/article-6621-1.html +[11]: https://www.indiegogo.com/projects/jolla-tablet-world-s-first-crowdsourced-tablet#/ +[12]: https://linux.cn/article-6757-1.html +[13]: https://linux.cn/article-6800-1.html +[14]: https://www.tizen.org/ +[15]: https://linux.cn/article-5529-1.html +[16]: http://www.cio.com/article/2926838/linux/mark-shuttleworth-ubuntu-community-council-ask-kubuntu-developer-to-step-down-as-leader.html +[17]: http://sarah.thesharps.us/ +[18]: http://www.techeye.net/chips/linus-torvalds-and-intel-woman-in-sweary-spat +[19]: http://marc.info/?l=linux-kernel&m=137392506516022&w=2 +[20]: https://linux.cn/article-6361-1.html +[21]: https://linux.cn/article-6258-1.html +[22]: http://itsfoss.com/unity-gaming-engine-linux/ +[23]: https://linux.cn/article-6459-1.html +[24]: http://itsfoss.com/spanish-school-ditches-windows-ubuntu/ +[25]: http://itsfoss.com/french-university-dumps-adobe-photoshop-open-source-app-krita/ +[26]: http://itsfoss.com/hungarian-universities-switch-eurooffice/ +[27]: https://linux.cn/article-5376-1.html +[28]: https://linux.cn/article-6604-1.html +[29]: https://linux.cn/article-6261-1.html diff --git a/published/201601/20151223 What' s the Best File System for My Linux Install.md b/published/201601/20151223 What' s the Best File System for My Linux Install.md new file mode 100644 index 0000000000..6bb9dcd898 --- /dev/null +++ b/published/201601/20151223 What' s the Best File System for My Linux Install.md @@ -0,0 +1,97 @@ +哪个文件系统最适合你的 Linux 系统? +================================================================================ + +![](https://www.maketecheasier.com/assets/uploads/2015/05/file-systems-feature-image.jpg) + +文件系统: 它们不是世界上最激动人心的技术,但是仍然很重要。本文我们将细数那些流行的 Linux 文件系统 - 它们是什么,它们能够做什么,以及它们的目标用户。 + +### Ext4 ### + +![file-systems-ext4](https://www.maketecheasier.com/assets/uploads/2015/05/file-systems-ext4.png) + +如果你曾经安装过 Linux,你可能在安装过程中看到过“Ext4”字样。用它有一个不错的理由: 它是当前每个可用的 Linux 发行版所选择的文件系统。当然,还有其他的一些选择,但是不可否认的是,Ext4(Extended 4)几乎是所有 Linux 用户都会选择的文件系统。 + +#### 它能做什么? #### + +Ext4 拥有之前的文件系统(Ext2/Ext3)中你所期待的所有优点, 同时还带来了一些改进。还有很多内容可以发掘,这里列举出了 Ext4 为你带来的最好的部分: + +- 日志型文件系统 +- 日志校验 +- 多重块文件分配 +- 向后兼容 Ext2 && Ext3 +- 持续的空闲空间预分配 +- 改进的文件系统校验(相比于之前的版本) +- 当然,同时支持更大的文件 + +#### 目标用户 #### + +Ext4 针对那些寻找超级可靠的基础环境或者那些只需要能工作就行的用户。这个文件系统不会对你的系统做快照;它甚至没有最好的 SSD 支持,但是如果你不是太挑剔的话,你会觉得它也还不错。 + +### BtrFS ### + +![file-systems-btrFS](https://www.maketecheasier.com/assets/uploads/2015/05/file-systems-btrFS-e1450065697580.png) + +B 树(B-tree)文件系统 (也被当做是 butterFS,黄油文件系统) 是 Oracle 为 Linux 研发的一款文件系统。它是一个全新的文件系统,而且正处于主要开发阶段。Linux 社区认为其有时候使用上还有些不稳定。BtrFS 的核心原则是围绕着写时复制(copy-on-write)原则展开的。**写时复制**基本上意味着在写入数据完成前,这份数据的每一比特都有单独的一份副本。当数据写入完毕后,相当于它做了一份副本。 + +#### 它能做什么 #### + +除了支持写时复制之外,BtrFS 也能够胜任许多其他的事务 - 事实上,它可以一直列出各种特性。这里列举最值得一提的特性:支持只读快照、文件克隆、子卷、透明压缩、离线文件系统校验、从 ext3 & 4 原地转换到 BtrFS、在线碎片整理,还支持 RAID 0, RAID 1, RAID 5, RAID 6 和 RAID 10。 + +#### 目标用户 #### + +BtrFS 的开发者们许诺过,该文件系统是当前其他文件系统的新一代替代者。非常正确,虽然目前其处于开发中。它有很多面向高级用户的杀手级特性,对于基本用户也是这样(包括 SSD 上面的更佳性能)。这个文件系统针对那些想要从文件系统中获取更多(特性),以及那些想尝试用写时复制机制做一些事情的用户。 + +### XFS ### + +![file-systems-xfs](https://www.maketecheasier.com/assets/uploads/2015/05/file-systems-xfs.jpg) + +由 Silicon Graphics 公司创造开发,XFS 是一个高端文件系统,定位于速度和性能方面。处于对性能方面的专注,使得在并行 IO 方面,XFS 表现的尤其出色。XFS 文件系统能够处理数量庞大的数据,事实上某些 XFS 用户的数据接近300TB 以上。 + +#### 它能做什么 #### + +XFS 是一个经历良好测试的数据存储文件系统,它是为了高性能操作而诞生的。其特性包括: + +- RAID 阵列的条带化分配 +- 日志型文件系统 +- 块大小可变 +- 直接 I/O +- 指定速率(guaranteed-rate) I/O +- 快照 +- 在线碎片整理 +- 在线调整文件系统大小 + +#### 目标用户 #### + +XFS 针对那些想要一个坚如磐石的文件系统方案的用户。它始于1993年,并且随着时间的变迁它变得越来越好。如果你有一台家庭服务器,而且你苦恼于如何部署存储环境,那么可以考虑下 XFS。它拥有的众多特性(比如快照)能够有助于你的文件存储系统。尽管如此,它不局限于服务器端。如果你是一个相对高级一点的用户或者你对 BtrFS 所承诺的很多特性感兴趣的话,尝试一下 XFS。它实现了很多与 BtrFS 相似的特性,并且没有稳定性方面的问题。 + +### Reiser4 ### + +![file-system-riser4](https://www.maketecheasier.com/assets/uploads/2015/05/file-system-riser4.gif) + +Reiser4 是 ReiserFS 的继任者,由 Namesys 公司创造研发。它的诞生可以追溯到 Linspire 项目和 DARPA。它与众不同的地方在于众多的事务模式。并不止于单一的一种写入数据的方式;取而代之的是,有很多方式(来写入)。 + +#### 它能做什么 #### + +Reiser4 拥有着使用多种不同事务模式的独特能力。它能够使用写时复制模式 (像 BtrFS),任意位置写入(write-anywhere),日志,以及混合事务模式。它在 ReiserFS 的基础上做了许多的改进,包括更好的基于漫游日志的文件系统日志,对较小文件的支持更好,以及更快速的目录处理。Reiser4 提供了许多功能特性。还有更多的特性可以探讨,不过简单来讲,相比于 ReiserFS 它不但做了非常大的改进,而且增加了众多特性。 + +#### 目标用户 #### + +Resier4 适合那些想要将一个文件系统应用到多种场景下的用户。可能你想在一台机器上使用写时复制机制,在另一台机器上使用任意位置写入机制,还会在另一台机器上使用混合事务,而你又不希望使用多种不同类型的文件系统来完成这项任务。Reiser4 是适合这种情况的完美方案。 + +### 结论 ### + +Linux 上有许多可用的文件系统。每个文件系统都有其特定的用途,以便于特定用户解决不同的问题。本文的焦点集中在 Linux 平台上文件系统的主流选择。毫无疑问,其它的场景下还有一些别的选择。 + +你在 Linux 上最喜欢的文件系统是什么?在下面的评论区告诉我们吧! + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/best-file-system-linux/ + +作者:[Derrik Diener][a] +译者:[icecoobe](https://github.com/icecoobe) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/derrikdiener/ diff --git a/published/201601/20151225 What are the best plugins to increase productivity on Emacs.md b/published/201601/20151225 What are the best plugins to increase productivity on Emacs.md new file mode 100644 index 0000000000..8e063d3693 --- /dev/null +++ b/published/201601/20151225 What are the best plugins to increase productivity on Emacs.md @@ -0,0 +1,79 @@ +提升 emacs 生产力的十大最佳插件 +================================================================================ + +一年前的这个时候,我想要寻找[将 Vim 打造成一个成熟的全功能的 IDE][1] 的最好插件。有趣的是,那篇文章的很多评论提到了 Emacs 已经大部分有了这些内置插件,已经是一个很棒的 IDE 了。尽管我对 Emacs 的难以置信的多样化表示赞同,它依旧不是一个可以开箱即用的高级编辑器。还好,其庞大的插件库可以解决这个问题。但在过多的选择中,有时很难弄清该如何入手。因此,现在让我试着收集一个不可或缺的插件的简短列表,来提升你使用 Emacs 时的工作效率。 虽然我主要侧重于与编程相关的生产力提升,但是这些插件对所有人或不同用途都是有用的。 + +### 1. Ido-mode ### + +![](https://c2.staticflickr.com/6/5718/23311895573_c1fb34337c_c.jpg) + +Ido 或许是对新手最有用的一个插件,Ido 的意思是交互式工作(interactively do)。它取代了大部分的用花哨字符匹配菜单的枯燥提示。好比说,它用列出了当前目录所有文件的列表来取代了常规的打开文件提示符。输入一些字符,Ido 将尝试匹配最合适的文件。它通过可视化让你的操作变得更容易,这也是一个快速遍历所有文件都有相同前缀的文件夹的方法。 + +### 2. Smex ### + +![](https://c2.staticflickr.com/2/1517/23310442314_2a22a60c34_c.jpg) + +它不算最著名的一个、但却是一个替代 Ido-mode 的好选择:Smex 可以优雅的替代普通的`M-x`提示符,灵感大部分来自于 Ido-mode。它也给调用`M-x`后输入的命令带来了同样的交互搜索能力。它简单而有效,是一个为常用操作提升效率的最好方法。 + +### 3. Auto Complete ### + +![](https://c2.staticflickr.com/6/5794/23643004900_3042f77952_c.jpg) + +知道这个插件的存在之前,我在 Emacs 里面有一半的时间花在敲击 `M-/` 来补完单词上。现在,我有一个漂亮的弹出菜单可以为我做自动补全。无须多说,我们都需要它。 + +### 4. YASnippet ### + +![](https://c2.staticflickr.com/2/1688/23830403072_0d8df6ef4c_b.jpg) + +这是真正的程序员必备利器。总有一些代码片段会让我们觉得我们一辈子都在写它。对我来说,就是调试 PHP 时不断输入的 `var_dump(...);exit;`。经过一段时间一遍又一遍的输入`var_dump(...);exit;`,我觉得我可以预先把其做成录制好的、方便用到的代码片段。使用 YASnippets,可以很容易导入代码片段文件或者自己做个。之后,只要按下一个 tab 键,就可以将一个小的关键词扩展成一大段预先写好的代码,然后可以很方便地在里面修改。 + +### 5. Org-mode ### + +![](https://c2.staticflickr.com/6/5687/23570808789_d683c949e4.jpg) + +免责声明,我最近才开始使用 Org-mode,但它已经深深的吸引了我。从我看过数以百计的文章来说,Org-mode 可以改变你的生活。它背后的想法很简单:它是一种用普通文本做简单备注的模式,可以很容易地在任务列表和各种数据中转来转去,并进行一些比如按优先级或到期日期的过滤,或设置一个重复日期。然而,虽然思路简单,但你可以做到很多,用各种方法用于各种用途。与其去看一个长长的介绍,我觉得你可以去读读[现有教程][2],有很多视频可以看,自己去体验一下 Org-mode 是多么强大。 + +### 6. Helm ### + +![](https://c2.staticflickr.com/2/1489/23310442334_5e6db22b79_c.jpg) + +一些使用者喜欢它,但是其他人没有这么大的使用热情。我是后者的一部分。但在拥有这样一个庞大的追随者的情况下,是不能不提到它的。Helm 旨在完全变换你的 Emacs 使用体验。简单来说,Helm 是一个在 Emacs 中帮助你快速找到一个文件或命令的框架。根据你的输入,它将尝试使用词语自动完成来引导你将大脑的念头变为行动。起初感觉有点奇怪,但对一些人来说,Helm 本身就是一个信仰。虽然我不是 Helm 的粉丝,我欣赏 helm-occur 这一个伟大的工具可以在一个大文档搜索字符串并且在一个单独的缓冲区显示所有匹配结果,以便很容易在它们之间跳转。如果你正在寻找一个快速演示来了解 Helm 能做什么,我推荐[这篇文章][3]。 + +### 7. ace-jump-mode ### + +![](https://c2.staticflickr.com/2/1710/23856168871_6df1faa565_c.jpg) + +这是另一个有一大群追随者的插件,我正在试图成为 ace-jump-mode 的粉丝。掌握这个插件,你会体验到超越鼠标感受。简单描述一下,通过你选择的快捷方式触发 ace-jump-mode 后,你会被提示输入字符。输入一个字符,所有以该字符开头的单词中的那个字符就会替换成一个唯一字符并被高亮。输入一个屏幕上的高亮字符,你的光标会直接跳转到高亮显示的那个词。我不得不承认,这让我使用它时有点反应不过来,但是,一旦你掌握它,它将显著提升你在一个文档里的移动速度。(LCTT 译注:用文字描述比较困难,如截图中,你输入的是一个“i”,然后屏幕中所有以“i”开头的单词中的那个“i”都被替换成了从 a 到 z 的字符,并高亮;你可以输入这些高亮的字符直接跳转到那个位置。) + +### 8. find-file-in-project ### + +![](https://c2.staticflickr.com/2/1492/23570808809_96ec8454a9_c.jpg) + +如果你喜欢 Sublime text 以及它可以用非常方便的`Ctrl-p`模糊搜索来打开一个项目中的任何文件的功能,你将会喜欢上 find-file-in-project (简称 ffip)的。使用设置指定了您的版本控制的根文件夹后,您可以轻松地调出一个很酷的文本条,通过快速扫描和搜索你的代码,来根据你输入的名称找到匹配的文件。我喜欢把它绑定到键盘上的 F6 键。如果你不知道整个目录从上到下的复杂结构,这很简单,而且非常易用。 + +### 9. Flymake ### + +![](https://c2.staticflickr.com/6/5708/23310442354_cbba657ed3.jpg) + +对 IDE 的爱好者来说,我认为语法检查器是 IDE 最强大的特性之一,它非常适合初学者和方便了那些疲惫的程序员。感谢 Flymake,Emacs 用户也可以享受到了语法检查器。因为我工作中用 PHP 很多,Flymake 就不需要任何额外的配置。当我写代码的时候,它会自动检查我的代码和高亮任何一个包含问题的行。对于编译语言,Flymake 将寻找一个用于检查你的代码的 Makefile。真神奇。 + +### 10. electric-pair ### + +最后,但并非最不重要,在我看来,electric-pair 是最简单但最强大的插件之一。它会自动关闭你输入的括号。它起初看起来并不是很有用,但相信我,在被寻找配对括号折磨几百次之后,你会很高兴有这么一个插件,可以确保你所有的表达式的括号都是一一对应的。 + +总结一下,Emacs 是一个奇妙的工具。这可不是一个令人惊讶的说法。试试这些插件,看着你的效率直线飙升吧。这个列表当然不是详尽的列表。如果你想贡献你的建议,请在评论中这样做。我自己一直在寻找新的插件来试着发现 Emacs 的新体验。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/best-plugins-to-increase-productivity-on-emacs.html + +作者:[Adrien Brochard][a] +译者:[zky001](https://github.com/zky001) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/adrien +[1]:http://xmodulo.com/turn-vim-full-fledged-ide.html +[2]:http://orgmode.org/worg/org-tutorials/ +[3]:http://tuhdo.github.io/helm-intro.html diff --git a/published/201601/20151229 Grub 2--Heal your bootloader.md b/published/201601/20151229 Grub 2--Heal your bootloader.md new file mode 100644 index 0000000000..ef246a203a --- /dev/null +++ b/published/201601/20151229 Grub 2--Heal your bootloader.md @@ -0,0 +1,236 @@ +Grub 2:拯救你的 bootloader +================================================================================ + +**没有什么事情比 bootloader 坏掉更让气人的了。充分发挥 Grub 2 的作用,让 bootloader 安分工作吧。** + +为什么这么说? + +- Grub 2 是最受欢迎的 bootloader ,几乎用在所有 Linux 发行版上。 +- bootloader 是一个至关重要的软件,但是非常容易损坏。 +- Grub 2 是兼具扩展性和灵活性的一款引导加载程序,提供了大量可定制选项。 + +Grub 2 是一款精彩的功能强大的软件。它不是 bootloader 界的一枝独秀,但却最受欢迎,几乎所有主要的桌面发行版都在使用它。 Grub 的工作有两个。首先,它用一个菜单展示计算机上所有已经安装的操作系统供你选择。其次,当你从启动菜单中选择了一个 Linux 操作系统, Grub 便加载这个 Linux 的内核。 + +你知道,如果使用 Linux ,你就离不开 bootloader 。然而它却是 Linux 发行版内部最鲜为人知的部分。在这篇文章里,我们将带你熟悉 Grub 2 一些著名的特性,强化你相关技能,使你在 bootloader 跑飞的时候能够自行处理。 + +Grub 2 最重要的部分是一堆文本文件和两个脚本文件。首先需要了解的是 `/etc/default/grub` 。这是一个文本文件,你可以在里面设置通用配置变量和 Grub 2 菜单(见下方 “常见用户设置” )的其它特性。 + +Grub 2 另一个重要的部分是 `/etc/grub.d` 文件夹。定义每个菜单项的所有脚本都放置在这里。这些脚本的名称必须有两位的数字前缀。其目的是,在构建 Grub 2 菜单时定义脚本的执行顺序以及相应菜单项的顺序。文件 `00_header` 首先被读取,负责解析 `/etc/default/grub` 配置文件。然后是 Linux 内核的菜单项,位于 `10_linux` 文件中。这个脚本在默认的 `/boot` 分区为每个内核创建一个正规菜单项和一个恢复菜单项。 + +紧接着的是为第三方应用所用的脚本,如 `30_os-prober` 和 `40_custom` 。 **os-prober** 脚本为内核和其它分区里的操作系统创建菜单项。它能识别安装的 Linux、 Windows、 BSD 以及 Mac OS X 。 如果你的硬盘布局比较独特,使得 **os-prober** 无法找到已经安装的发行版,你可以在 `40_custom` 文件(见下方 “添加自定义菜单项”)中添加菜单项。 + +**Grub** 2 不需要你手动维护你的启动选项的配置文件:取而代之的是使用 `grub2-mkconfig` 命令产生 `/boot/grub/grub.cfg` 文件。这个功能会解析 `/etc/grub.d` 目录中的脚本以及 `/etc/default/grub` 设置文件来定义你的设置情况。 + +###图形化的引导修复### + +多亏了 Boot Repair 应用,只需要点击按钮,Grub 2 许许多多的问题都能轻易解决。这个漂亮小巧的应用有一个直观的用户界面,可以扫描并识别多种硬盘布局和分区方案,还能发现并正确识别安装在其中的操作系统。这个应用可以处理传统计算机里的主引导记录(Master Boot Record) (MBR),也可以处理新型 UEFI 计算机中的 GUID 分区表(GUID Partition Table)(GPT)。 + +Boot Repair 最简单的使用方式是安装到 Live Ubuntu 会话中。在一个 bootloader 损坏的机器上启动 Ubuntu Live 发行版,先通过添加它的 PPA 版本库来安装 Boot Repair ,命令如下: + + sudo add-apt-repository ppa:yannubuntu/Boot Repair + +然后刷新版本库列表: + + sudo apt-get update + +安装应用,如下: + + sudo apt-get install -y Boot Repair + +安装完毕后就启动应用。在显示它的界面(由一对按键组成)之前将会扫描你的硬盘。根据工具的指示,只需按下 Recommended Repair(推荐的修复)按钮,即可修复大部分坏掉的 bootloader 。修复 bootloader 之后,这个工具会输出一个短小的 URL ,你应该把它记录下来。这个 URL 包含了硬盘详尽的信息:分区信息以及重要的 Grub 2 文件(如 `/etc/default/grub` 和 `/boot/grub/grub.cfg` )的内容。如果工具不能解决 bootloader 的问题,可以把你这个 URL 共享在你的发行版的论坛上,让其他人可以分析你的硬盘布局以便给你建议。 + +![](http://www.linuxvoice.com/wp-content/uploads/2015/10/boot-repair-large.jpg) + +*Boot Repair 也可以让你定制 Grub 2 的选项。* + +### Bootloader 急救 ### + +Grub 2 引导问题会让系统处于几种不同状态。屏幕(如你所想,本该显示 bootloader 菜单的地方)所展示的文本会指示出系统的当前状态。如果系统中止于 **grub>** 提示符,表明 Grub 2 模块已经被加载,但是找不到 **grub.cfg** 文件。当前是完全版的 Grub 2 命令行 shell,你可以通过多种方式解决此问题。如果你看到的是 **grub rescue>** 提示符,表明 bootloader 不能找到 Grub 2 模块或者找不到任何引导文件( boot files )。然而,如果你的屏幕只显示 ‘GRUB’ 一词,表明 bootloader 找不到通常位于主引导记录( Master Boot Record )里的最基本的信息。 + +你可以通过使用 live CD 或者在 Grub 2 shell 中修正此类错误。如果你够幸运, bootloader 出现了 **grub>** 提示符,你就能获得 Grub 2 shell 的支配权,来帮助你排错。 + +接下来几个命令工作在 **grub>** 和 **grub rescue>** 提示符下。 **set pager=1** 命令设置显示分页( pager ),防止文本在屏幕上一滚而过。你还可以使用 **ls** 命令列出 Grub 识别出的所有分区,如下: + + grub> ls + (hd0) (hd0,msdos5) (hd0,msdos6) (hd1,msdos1) + +如你所见,这个命令列出分区的同时一并列出了分区表方案(即 msdos)。 + +你还可以在每个分区上面使用 **ls** 来查找你的根文件系统: + + grub> ls (hd0,5)/ + lost+found/ var/ etc/ media/ bin/ initrd.gz + boot/ dev/ home/ selinux/ srv/ tmp/ vmlinuz + +你可以不写上分区名的 **msdos** 部分。同样,如果你忘记了尾部的斜杠( trailing slash )只输入 `ls (hd0,5)` ,那你将获得分区的信息,比如文件系统类型、总体大小和最后修改时间。如果你有多个分区,可以使用 `cat` 读取 `/etc/issue` 文件中的内容,来确定发行版,格式如 `cat (hd0,5)/etc/issue` 。 + +假设你在 **(hd0,5)** 中找到根文件系统,请确保它包含 `/boot/grub` 目录,以及你想引导进入的内核镜像,如 **vmlinuz-3.13.0-24-generic** 。此时输入以下命令: + + grub> set root=(hd0,5) + grub> linux /boot/vmlinuz-3.13.0-24-generic root=/dev/sda5 + grub> initrd /boot/initrd.img-3.13.0-24-generic + +第一个命令把 Grub 指向我们想引导进入的发行版所在的分区。接着第二个命令告知 Grub 内核镜像在分区中的位置,以及根文件系统的位置。最后一行设置虚拟文件系统( initial ramdisk )文件的位置。你可以使用 tab 补全功能补全内核名字和虚拟文件系统( initrd: initial ramdisk )的名字,节省时间和精力。 + +输入完毕,在下一个 **grub>** 提示符后输入 `boot` , Grub 将会引导进入指定的操作系统。 + +如果你在 **grub rescue>** 提示符下,情况会有些许不同。因为 bootloader 未能够找到并加载任何必需的模块,你需要手动添加这些模块: + + grub rescue> set root=(hd0,5) + grub rescue> insmod (hd0,5)/boot/grub/normal.mod + grub rescue> normal + grub> insmod linux + +如上所示,跟之前一样,使用 `ls` 命令列出所有分区之后,使用 `set` 命令标记起来。然后添加 **normal** 模块,此模块激活时将会恢复到标准 **grub>** 模式。如果 linux 模块没加载,接下来的命令会进行添加。如果这个模块已经加载,你可以跟之前一样,把引导加载程序指向内核镜像和虚拟文件系统( initrd )文件,然后使用 `boot` 启动发行版,完美收官。 + +一旦成功启动发行版,别忘了为 Grub 重新产生新的配置文件,使用 + + grub-mkconfig -o /boot/grub/grub.cfg + +命令。你还需要往 MBR 里安装一份 bootloader 的拷贝,使用 + + sudo grub2-install /dev/sda + +命令。 + +![](http://www.linuxvoice.com/wp-content/uploads/2015/10/grub2-cfg-large.jpg) + +*想要禁用 `/etc/grub.d` 目录下的脚本,你只需移除其可执行位,比如使用 `chmod -x /etc/grub.d/20_memtest86+` 就能将 ‘Memory Test’ 选项从菜单中移除。* + +### Grub 2 和 UEFI ### + +在支持 UEFI 的机器(最近几年上市的机器大部分都是)调试坏掉的 Grub 2 增加了另一复杂的层次。恢复安装在 UEFI 机器上的 **Grub 2** 的和安装在非 UEFI 机器上的并没多大区别,只是新的固件处理方式不一样,从而导致了很多种恢复结果。 + +对于基于 UEFI 的系统,不要在 MBR 上安装任何东西。相反,你要在 EFI 系统分区(EFI System Partition)( ESP )里安装 Linux EFI bootloader,并且借助工具把它设置为 EFI 的默认启动程序,这个工具对于 Linux 用户是 `efibootmgr` ,对于 window 用户则是 `bcdedit` 。 + +照目前情况看,在安装任何与 Windows 8 兼容的主流桌面 Linux 发行版前,应该正确安装好 Grub 2。然而,如果 bootloader 损坏,你可以使用 live 发行版修复机器。在启动 live 介质之时,请确保是以 UEFI 模式启动。计算机每个可移动驱动器的启动菜单将会有两个: 一个普通的和一个以 EFI 标记的。使用后者会用到 **/sys/firmware/efi/** 文件中的 EFI 变量。 + +在 live 环境中,挂载教程前面所提的安装挂掉系统的根文件系统。除此之外,还需要挂载 ESP 分区。假设分区是 **/dev/sda1** ,你可以如下所示挂载: + + sudo mount /dev/sda1 /mnt/boot/efi + +接着在 chroot 到安装完毕的发行版前之前,使用 `modprobe efivars` 加载 **efivars** 模块。 + +在这里, Fedora 用户可以使用如下命令重新安装 bootloader + + yum reinstall grub2-efi shim + +但在此之前,需要使用 + + grub2-mkconfig -o /boot/grub2/grub.cfg + +来产生新的配置文件。 Ubuntu 用户则改用以下命令 + + apt-get install --reinstall grub-efi-amd64 + +一旦 bootloader 正确就位,退出 chroot ,卸载所有分区,重启到 Grub 2 菜单。 + +### 伙计,我的 Grub 哪去了? ### + +Grub 2 最好的特性是可以随时重新安装。因此,当其它像 Windows 之类的系统用它们自己的 bootloader 替换后,导致 Grub 2 丢失,你可以使用 live 发行版,寥寥数步即可重装 Grub 。假设你在 `/dev/sda5` 安装了一个发行版,若要重装 Grub ,你只需首先使用以下命令为发行版创建一个挂载目录: + + sudo mkdir -p /mnt/distro + +然后挂载分区,如下: + + mount /dev/sda5 /mnt/distro + +接着就能重装 Grub 了,如下: + + grub2-install --root-directory=/mnt/distro /dev/sda + +这个命令会改写 `/dev/sda` 设备上的 MBR 信息,指向当前 Linux 系统,并重写一些 Grub 2 文件,如 **grubenv** 和 **device.map** 。 + +另一个问题常见于装有多个发行版的计算机上。当你安装了新的 Linux 发行版,它的 bootloader 应当要能找到所有已经安装的发行版。一旦不行,只要引导进入新安装的发行版,并运行 + + grub2-mkconfig + +在运行这个命令之前,请确保启动菜单中缺失的发行版的 root 分区已经挂载。如果你想添加的发行版有单独的 `/root` 和 `/home` 分区,在运行 `grub2-mkconfig` 之前,只需挂载包含 `/root` 的分区。 + +虽然 Grub 2 能够找到大部分发行版,但是在 Ubuntu 中尝试添加安装的 Fedora 系统需要额外的一个步骤。如果你以默认设置安装了 Fedora ,则发行版的安装器已经创建了 LVM 分区。此时你需要使用发行版的包管理系统安装 **lvm2** 驱动,如下 + + sudo apt-get install lvm2 + +才能使得 Grub 2 的 `os-prober` 脚本能够找到并将 Fedora 添加进启动菜单。 + +### 常见用户设置 ### + +Grub 2 有很多可配置变量。 这里有一些 `/etc/default/grub` 文件中你最可能会修改到的常见变量。 **GRUB_DEFAULT** 变量指定默认的启动项,可以设置为数字值,比如 0 ,表示第一个菜单项,或者设置为 “saved” ,将指向上一次启动时选中的菜单项。 **GRUB\_TIMEOUT** 变量指定启动默认菜单项之前的停留时间。 **GRUB\_CMDLINE\_LINUX** 列出了要传递给所有 Linux 菜单项的内核命令行参数。 + +如果 **GRUB\_DISABLE\_RECOVERY** 变量设置为 **true** ,那么将不生成恢复模式菜单项。这些菜单项会以单用户模式启动发行版,这种模式下允许你利用命令行工具修复系统。 **GRUB_GFXMODE** 变量同样有用,它指定了菜单上文本显示的分辨率,它可以设置为你的显卡所支持的任何数值。 + +![](http://www.linuxvoice.com/wp-content/uploads/2015/10/grub2-cli-large.jpg) + +*Grub 2 有个命令行模式,通过在 bootloader 菜单上按 C 进入。* + +### 彻底的修复 ### + +如果 `grub2-install` 命令不能正常运作,使得你无法引导进入 Linux ,你需要完整地重装以及重新配置 bootloader 。为此目的,需要用到强大的 **chroot** 功能将运行环境从 live CD 环境切换至我们想修复的 Linux 的安装位置。任何拥有 **chroot** 工具的 Linux live CD 都可以实现这个目的。不过需要确保 live 介质的系统架构和硬盘上系统的架构一致。因此当你希望 **chroot** 到 64 位系统,你必须使用 amd64 live 发行版。 + +启动进入 live 发行版之后,首先需要检查机器上的分区。使用 `fdisk -l` 列出磁盘上所有分区,记录你想修复的 Grub 2 系统所在的分区。 + +假设我们希望从安装在 `/dev/sda5` 中的发行版中恢复 bootloader 。启动终端使用如下命令挂载分区: + + sudo mount /dev/sda5 /mnt + +此时需要绑定(bind)Grub 2 bootloader 需要进入的目录,以便检测其它操作系统: + + $ sudo mount --bind /dev /mnt/dev + $ sudo mount --bind /dev/pts /mnt/dev/pts + $ sudo mount --bind /proc /mnt/proc + $ sudo mount --bind /sys /mnt/sys + +此时可以离开 live 环境进入安装在 **/dev/sda5** 分区中的发行版了,通过 **chroot** : + + $ sudo chroot /mnt /bin/bash + +现在可以安装、检测、以及升级 Grub 了,跟之前一样,使用 + + sudo grub2-install /dev/sda + +命令来重装 bootloader 。因为 **grub2-install** 命令不能创建**grub.cfg** 文件,需要手动创建,如下 + + sudo grub-mkconfig -o /boot/grub/grub.cfg + +这样应该就可以了。现在你就有了 Grub 2 的一份全新拷贝,罗列了机器上所有的操作系统和发行版。在重启电脑之前,你需要依次退出 chroot 系统,卸载所有分区,如下所示: + + $ exit + $ sudo umount /mnt/sys + $ sudo umount /mnt/proc + $ sudo umount /mnt/dev/pts + $ sudo umount /mnt/dev + $ sudo umount /mnt + +现在你可以安全地重启电脑了,而它应该会回退到 Grub 2 的控制之中,你已经修好了这个 bootloader。 + +### 添加自定义菜单项 ### + +如果希望往 bootloader 菜单里添加菜单项,你需要在 **40_custom** 文件里添加一个启动段( boot stanza )。例如,你可以使用它展示一个菜单项来启动安装在可移动 USB 驱动里的 Linux 发行版。假设你的 USB 驱动器是 **sdb1** ,并且 vmlinuz 内核镜像和虚拟文件系统( initrd )都位于根 (/)目录下,在 **40_custom** 文件中添加以下内容: + + menuentry “Linux on USB” { + set root=(hd1,1) + linux /vmlinuz root=/dev/sdb1 ro quiet splash + initrd /initrd.img + } + +相比使用设备和分区名,使用它们的 UUID 可以获得更精确结果,比如 + + set root=UUID=54f22dd7-eabe + +使用 + + sudo blkid + +来获得所有已连接的驱动器和分区的 UUID 。你还可以为你磁盘上没被 os-prober 脚本找到的发行版添加菜单项,只要你知道该发行版的安装位置以及其内核和虚拟文件系统( initrd )的位置即可。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxvoice.com/grub-2-heal-your-bootloader/ + +作者:[Mayank Sharma][a] +译者:[soooogreen](https://github.com/soooogreen) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linuxvoice.com/author/mayank/ diff --git a/published/201601/20160104 How to Check Hardware Information on Linux Using Command Line.md b/published/201601/20160104 How to Check Hardware Information on Linux Using Command Line.md new file mode 100644 index 0000000000..cce96867e8 --- /dev/null +++ b/published/201601/20160104 How to Check Hardware Information on Linux Using Command Line.md @@ -0,0 +1,152 @@ +Linux 系统下查看硬件信息命令大全 +================================================================================ + +![](https://maketecheasier-holisticmedia.netdna-ssl.com/assets/uploads/2015/12/hdd_info_featured-1.png) + +有许多命令可以用来查看 Linux 系统上的硬件信息。有些命令只能够打印出像 CPU 和内存这一特定的硬件组件信息,另外一些命令可以查看多种硬件组件的信息。 + +这个教程可以带大家快速了解一下查看各种硬件设备的信息和配置详情的最常用的命令。 + +### lscpu ### + +`lscpu`命令能够查看 CPU 和处理单元的信息。该命令没有任何其他选项或者别的功能。 + + lscpu + +运行该命令会看到下面输出: + +![hdd_info_lscpu](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lscpu.png) + +### lspci ### + +`lspci`是另一个命令行工具,可以用来列出所有的 PCI 总线,还有与 PCI 总线相连的设备的详细信息,比如 VGA 适配器、显卡、网络适配器、usb 端口、SATA 控制器等。 + + lspci + +你可以看到类似下图的输出信息。 + +![hdd_info_lspci](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lspci-1.png) + +可以通过运行下面的命令来过滤出特定设备的信息: + + lspci -v | grep "VGA" -A 12 + +运行上面的命令可以看到类似下图的关于显卡的信息。 + +![hdd_info_lspci_vga](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lspci_vga.png) + +### lshw ### + +`lshw`是一个通用的工具,可以列出多种硬件单元的详细或者概要的信息,比如 CPU、内存、usb 控制器、硬盘等。`lshw`能够从各个“/proc”文件中提取出相关的信息。 + + lshw -short + +通过运行上面的命令可以看到下面的信息。 + +![hdd_info_lshw](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lshw.png) + +### lsscsi ### + +通过运行下面的命令可以列出像硬盘和光驱等 scsi/sata 设备的信息: + + lsscsi + +会得到类似下面的输出。 + +![hdd_info_lsscsi](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lsscsi-1.png) + +### lsusb ### + +`lsusb`命令能够列出 USB 控制器和与 USB 控制器相连的设备的详细信息。默认情况下,`lsusb`命令只打印出概要信息。可以通过使用-v参数打印每一个usb端口的详细信息。 + + lsusb + +可以看到下面输出。 + +![hdd_info_lsusb](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lsusb.png) + +### Inxi ### + +`Inxi`是一个 bash 脚本,能够从系统的多个来源和命令获取硬件信息,并打印出一个非技术人员也能看懂的友好的报告。 + +默认情况下,Ubuntu 上没有安装`inxi`。可以通过运行下面命令来安装`Inxi`: + + sudo apt-get install inxi + +安装完`Inxi`之后,通过运行下面命令能够得到硬件相关的信息: + + inxi -Fx + +能够得到类似下图的输出。 + +![hdd_info_inxi](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_inxi.jpg) + +### df ### + +`df`命令能够列出不同分区的概要信息、挂载点、已用的和可用的空间。 + +可以在使用`df`命令的时候加上`-H`参数。 + + df -H + +会得到下面的输出。 + +![hdd_info_df](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_df-1.png) + +### Free ### + +通过使用`free`命令可以查看系统中使用的、闲置的和 RAM 的总体数量。 + + free -m + +会看到下面输出。 + +![hdd_info_free](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_free.png) + +### Dmidecode ### + +`dmidecode`命令与其他命令不同。该命令是从硬件中的 DMI 表中读取信息的。 + +要查看处理器的信息,运行下面命令: + + sudo dmidecode -t processor + +![hdd_info_dmi_processor](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_dmi_processor.jpg) + +要查看内存的信息,运行下面命令: + + sudo dmidecode -t memory + +![hdd_info_dmi_memory](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_dmi_memory.png) + +要查看 bios 的信息,运行下面命令: + + sudo dmidecode -t bios + +![hdd_info_dmi_bios](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_dmi_bios.png) + +### Hdparm ### + +`hdparm`命令可以用来显示像硬盘这样的 sata 设备的信息。 + + sudo hdparm + +可以看到下面的输出。 + +![hdd_info_hdparm](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_hdparm.png) + +### 总结 ### + +每个命令都有不同的方式来获取硬件的信息。在查看特定的硬件信息的时候,可以尝试使用不同的方式。上面所有的命令行工具在大部分的 Linux 发行版本中都是可以使用的,可以很容易的从仓库中获取安装。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/check-hardware-information-linux/ + +作者:[Hitesh Jethva][a] +译者:[sonofelice](https://github.com/sonofelice) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/hiteshjethva/ diff --git a/published/201601/20160111 Open Source DJ Software Mixxx Version 2.0 Released.md b/published/201601/20160111 Open Source DJ Software Mixxx Version 2.0 Released.md new file mode 100644 index 0000000000..972d52e035 --- /dev/null +++ b/published/201601/20160111 Open Source DJ Software Mixxx Version 2.0 Released.md @@ -0,0 +1,75 @@ +开源 DJ 软件 Mixxx 2.0 版发布 +================================================================================ +![](http://itsfoss.com/wp-content/uploads/2016/01/DJ-Software-Mixxx-2-Released.jpg) + +时隔三年,开源 DJ 混音软件 [Mixxx][1] 再度发布一个大的版本更新----Mixxx 2.0。 + +Mixxx 是一个跨平台的自由、开源的 DJ 混音软件,它几乎提供了当你想自己混音时需要的一切功能。Mixxx 近几年在专业人士以及业余爱好者中都很火。 + +甚至在 Mixxx 中你能使用你的 iTunes 音乐库。它的强有力的引擎使它支持多种文件格式。Mixxx 默认即支持超过85种MIDI DJ 调节器以及少部分 HID 调节器。它也包含一个自动选项,可以让你在混音时休息一下。 + +Mixxx 的完整功能列表可以在[这里][2]找到。在查看完整列表之前,让我们看看最新版有何更新。 + +### Mixxx 2.0更新 ### + +- 可动态调整大小的外观 +- 4 轨道混音并且和主轨道同步 +- 内置特效 +- 谐波混频(Harmonic Mixing)与音乐按键检测 +- RGB 音频波形 +- 4 个麦克风输入和 4 个音频输入,麦克风音量可调 +- 黑胶音源输入、输出 +- 支持自定义封面 +- 核心混音引擎改进 +- 更新的音乐库 +- 改进增强了 DJ 调节器 + +你可以在[这里][3]中看到所有的新功能。 + +### 在基于 Ubuntu 的发行版中安装 Mixxx 2.0 ### + +Mixxx 提供了他们自己的ppa源,这使得在基于 Ubuntu 的发行版,如 Linux Mint、elementary OS、 Zorin OS 上安装Mixxx 2.0 变得十分简单. + +打开终端,并输入如下命令: + + sudo add-apt-repository ppa:mixxx/mixxx + sudo apt-get update + sudo apt-get install mixxx + +使用如下命令卸载 Mixxx: + + sudo apt-get remove mixxx + sudo add-apt-repository --remove ppa:mixxx/mixxx + +如果你已经在使用旧版本的 Mixxx。它将很快升级到2.0版。 + +### 在其他发行版中安装 Mixxx 2.0 ### + +Archliunx + + sudo pacman -S mixxx + +对于其他发行版,你还可以从源码编译安装 Mixxx。从下列地址下载源代码: + +- [源码地址][4] + +由于 Mixxx 是个跨平台的应用,你也可以下载它的 Windows 版或者 Mac OS 版,请访问 Mixxx 下载页面找到对应的下载链接: + +- [下载地址][5] + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/dj-mixxx-2/ + +作者:[Abhishek][a] +译者:[name1e5s](https://github.com/name1e5s) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://mixxx.org/ +[2]:http://mixxx.org/features/ +[3]:http://mixxx.org/whats-new-in-mixxx-2-0/ +[4]:http://downloads.mixxx.org/mixxx-2.0.0/mixxx-2.0.0-src.tar.gz +[5]:http://mixxx.org/download/ diff --git a/published/201601/20160111 Ubuntu-‘Spyware’-Will-Be-Disabled-In-Ubuntu-16.04-LTS.md b/published/201601/20160111 Ubuntu-‘Spyware’-Will-Be-Disabled-In-Ubuntu-16.04-LTS.md new file mode 100644 index 0000000000..e1824fe0e6 --- /dev/null +++ b/published/201601/20160111 Ubuntu-‘Spyware’-Will-Be-Disabled-In-Ubuntu-16.04-LTS.md @@ -0,0 +1,80 @@ +Ubuntu 里的“间谍软件”将在 Ubuntu 16.04 LTS 中被禁用 +================================================================================ + +出于用户隐私的考虑,Ubuntu 阉割了一个有争议的功能。 + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2013/09/as2.jpg) + +**Unity 中有争议的在线搜索功能将在今年四月份发布的 Ubuntu 16.04 LTS 中被默认禁用** + +用户在 Unity 7 的 Dash 搜索栏里将**只能搜索到本地文件、文件夹以及应用**。这样,用户输入的关键词将不会被发送到 Canonical 或任何第三方内容提供商的服务器里。 + +> “现在,Unity 的在线搜索在默认状况下是关闭的” + +在目前 ubuntu 的支持版本中,Dash 栏会将用户搜索的关键词发送到 Canonical 运营的远程服务器中。它发送这些数据以用于从50多家在线服务获取搜索结果,这些服务包括维基百科、YouTube 和 The Weather Channel 等。 + +我们可以选择去**系统设置 > 隐私控制**关闭这项功能。但是,一些开源社区针对的是默认打开这个事情。 + +### Ubuntu 在线搜索引发的争议 ### + +> “Richard Stallman 将这个功能描述为 ‘间谍软件’” + +早在2012年,在 Ubuntu 搜索中整合了来自亚马逊的内容之后,开源社区就表示为其用户的隐私感到担忧。在2013年,“Smart Scopes 服务”全面推出后,开源社区再度表示担忧. + +风波如此之大,以至于开源界大神 [Richard Stallman 都称 Ubuntu 为"间谍软件"][1]。 + +[电子前哨基金会 (EFF)][2]也在一系列博文中表达出对此的关注,并且建议 Canonical 将这个功能做成用户自由选择是否开启的功能。Privacy International 比其他的组织走的更远,对于 Ubuntu 的工作,他们给 Ubuntu 的缔造者发了一个“[老大哥奖][3]”。 + +[Canonical][4] 坚称 Unity 的在线搜索功能所收集的数据是匿名的以及“不可识别是来自哪个用户的”。 + +在[2013年 Canoical 发布的博文中][5]他们解释道:“**(我们)会使用户了解我们收集哪些信息以及哪些第三方服务商将会在他们搜索时从 Dash 栏中给出结果。我们只会收集能够提升用户体验的信息。**” + +### Ubuntu 开始严肃对待的用户数据隐私### + +Canonical 在给新安装的 Ubuntu 14.04 LTS 以及以上版本中禁用了来自亚马逊的产品搜索结果(尽管来自其他服务商的搜索结果仍然在出现,直到你关闭这个选项) + +在下一个LTS(长期支持)版,也就是 Ubuntu 16.04 中,Canonical 完全关闭了这个有争议的在线搜索功能,这个功能在用户安装完后就是关闭的。就如同 EFF 在2012年建议他们做的那样。 + +“你搜索的关键词将不会逃出你的计算机。” [Ubuntu 桌面主管 Will Cooke][6]解释道,“对于搜索结果的更精细的控制”和 Unity 8 所提供的“更有针对性的结果添加不到 Unity 7 里”。 + +这也就是“[Unity 7]的在线搜索功能将会退役”的原因。 + +这个变化也会降低对 Unity 7 的支持以及对 Canonical 基础设施的压力。Unity 提供的搜索结果越少,Canonical 就能把时间和工程师放到更加振奋人心的地方,比如更早的发布 Unity 8 桌面环境。 + +### 在 Ubuntu 16.04 中你需要自己开启在线搜索功能 ### + +![Privacy settings in Ubuntu let you opt in to seeing online results](http://www.omgubuntu.co.uk/wp-content/uploads/2013/04/privacy.jpg) + +*在 Ubuntu 隐私设置中你可以打开在线搜索功能* + +禁用 Ubuntu 桌面的在线搜索功能的决定将获得众多开源/免费软件社区的欢呼。但是并不是每一个人都对 Dash 提供的语义搜索功能反感,如果你认为你失去了在搜索时预览天气、查看新闻或其他来自 Dash 在线搜索提供的内容所带来的效率的话,你只需要简单的点几下鼠标就可以**再次打开这个功能**,定位到 Ubuntu 的**系统设置 > 隐私控制 > 搜索**然后将选项调至“**开启**”。 + +这个选项不会自动把亚马逊的产品信息加入到搜索结果中。如果你想看产品信息的话,需要打开第二个可选项“shipping lens”才能看到来自 Amazon (和 Skimlinks)的内容。 + +### 总结 ### + + +- 默认情况下,Ubuntu 16.04 LTS 的 Dash 栏将不会搜索到在线结果 +- 可以手动打开在线搜索 +- **系统设置 > 隐私控制 > 搜索**中的第二个可选项允许你看到亚马逊的产品信息 +- 这个变动只会影响新安装的系统。从老版本升级的将会保留用户的喜好 + +你同意这个决定吗?抑或是 Cononical 可能降低了新用户的体验?在评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2016/01/ubuntu-online-search-feature-disabled-16-04 + +作者:[Joey-Elijah Sneddon][a] +译者:[name1e5s](https://github.com/name1e5s) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:http://arstechnica.com/information-technology/2012/12/richard-stallman-calls-ubuntu-spyware-because-it-tracks-searches/?utm_source=omgubuntu +[2]:https://www.eff.org/deeplinks/2012/10/privacy-ubuntu-1210-amazon-ads-and-data-leaks?utm_source=omgubuntu +[3]:http://www.omgubuntu.co.uk/2013/10/ubuntu-wins-big-brother-austria-privacy-award +[4]:http://blog.canonical.com/2012/12/07/searching-in-the-dash-in-ubuntu-13-04/ +[5]:http://blog.canonical.com/2012/12/07/searching-in-the-dash-in-ubuntu-13-04/?utm_source=omgubuntu +[6]:http://www.whizzy.org/2015/12/online-searches-in-the-dash-to-be-off-by-default?utm_source=omgubuntu diff --git a/published/201601/Learn with Linux--Learning Music.md b/published/201601/Learn with Linux--Learning Music.md new file mode 100644 index 0000000000..83f522bfba --- /dev/null +++ b/published/201601/Learn with Linux--Learning Music.md @@ -0,0 +1,154 @@ +与 Linux 一起学习:玩音乐 +================================================================================ +![](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-featured.png) + +[与 Linux 一起学习:][1]的所有文章: + +- [与 Linux 一起学习:学习打字][2] +- [与 Linux 一起学习:物理模拟][3] +- [与 Linux 一起学习:玩音乐][4] +- [与 Linux 一起学习:两款地理软件][5] +- [与 Linux 一起学习:掌握数学][6] + +引言:Linux 提供大量的教学软件和工具,面向各个年级段以及不同年龄段,提供大量学科的练习实践,其中大多数是可以与用户进行交互的。本“与 Linux 一起学习:”系列就来介绍一些教学软件。 + +学习音乐是一个很好的消遣方式。训练你的耳朵能识别音阶与和弦、掌握一门乐器、控制自己的嗓音,这些都需要大量的练习,以及会遇到很多困难。音乐理论非常博大精深,有太多东西需要记忆,你需要非常勤奋才能将这些东西变成你的“技术”。在你的音乐之路上,Linux 提供了杰出的软件来帮助你前行。它们不能让你立刻成为一个音乐家,但可以作为一个降低学习难度的好助手。 + +### Gnu Solfège ### + +[Solfège][7] 是一个世界流行的音乐教学工具,适用于各个级别的音乐教育。很多流行的教学方法(比如著名的柯达伊教学法)就使用 Solfège 作为它们的基础。相比于学到音乐知识,Solfège 更关注于让用户不断练习音乐。它预期的用户是那些已经有一些音乐基础,并且想不断练习音乐技巧的学生。 + +以下是 GNU 网站的开发者声明: + +> “当你在高校、学院、音乐学校中学习音乐,你一般要进行的一些听力训练,比如视唱,会比较简单,但是通常需要两个人配合,一个问,一个答。[...] GNU Solfège 尝试着解决这个问题,你可以在没有其他人的帮助下完成更多的简单机械式练习。只是别忘了这些练习只是整个音乐训练过程的一部分。” + +这款软件兑现了它的承诺,你可以在试听帮手的帮助下练习几乎所有音乐技巧。 + +Debian 和 Ubuntu 的仓库上有这款软件,在终端运行下面命令安装软件: + + sudo apt-get install solfege + +它开启的时候会出现一个简单的开始界面。 + +![learnmusic-solfege-main](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-solfege-main.png) + +这些选项几乎包含了所有种类,大多数链接里面都有子类,你可以从中选择独立的练习。 + +![learnmusic-solfege-scales](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-solfege-scales.png) + +![learnmusic-solfege-hun](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-solfege-hun.png) + +软件提供多种练习和测试项目,都能通过外接的 MIDI 设备(LCTT 译注:MIDI,Musical Instrument Digital Interface,乐器数字接口)或者声卡来播放音乐。这些练习还配合音符播放,以及支持慢动作回放功能。 + +很重要的一点是如果你在 Ubuntu 下使用 Solfège,默认情况下你可能没法听到声音(除非你有外接 MIDI 设备)。如果出现了这种情况,点击“File -> Prefernces -> Sound Setup”,选择合适的设备(一般情况下选 ALSA 都能解决问题)。 + +![learnmusic-solfege-midi](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-solfege-midi.png) + +Solfège 对你的日常练习非常有帮助,经常使用它,可以在你开始唱 do-re-mi 之前练好你的音乐听觉。 + +### Tete (听力训练) ### + +[Tete][8] (这款听力训练软件)是一款简单但有效的 JAVA 软件,用于[训练听力][9]。它通过在不同背景下播放不同和弦以及不同 MIDI 声音来训练你分辨不同的音阶。[从 SourceForge 下载][10],然后解压它。 + + unzip Tete-* + +进入解压出来的目录: + + cd Tete-* + +这里假设你的系统已经安装好了 JAVA,你可以使用下面的命令执行 Java 文件: + + java -jar Tete-[版本号] + +(可以在输入“Tete-”后按 Tab 键进行自动补全。) + +Tete 只有一个简单的界面,所有内容都在这里了。 + +![learnmusic-tete-main](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-tete-main.png) + +你可以选择表演音阶(见上图),和弦(下图), + +![learnmusic-tete-chords](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-tete-chords.png) + +或音程。 + +![learnmusic-tete-intervals](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-tete-intervals.png) + +你可以“精调”很多选项,包括 midi 乐器的声音、提升或降低音阶以及回放的快慢等等。SourceForge 网站上有关于 Tete 的非常有用的教程,介绍了这个软件的各个方面。 + +### JalMus ### + +Jalmus 是用 JAVA 写的键盘音符阅读训练器。可以外接 MIDI 键盘,也可以使用虚拟键盘。它提供很多简单的课程练习来训练你的音符阅读能力。虽然这个软件在2013年之后就不再更新了,但还是比较实用的。 + +进入 [sourceforge 页面][11]下载最后版本(v2.3)的 JAVA 安装器,或者在终端输入下面的命令下载: + + wget http://garr.dl.sourceforge.net/project/jalmus/Jalmus-2.3/installjalmus23.jar + +下载完成后,加载安装器: + + java -jar installjalmus23.jar + +跨平台的 JAVA 安装器会一步一步引导你完成安装的。 + +Jalmus 的主界面非常朴素。 + +![learnmusic-jalmus-main](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-jalmus-main.jpg) + +你可以在“Lessons”菜单中找到各种不同难度的课程,从非常简单(一行音符从左边向右滑过,键盘上相应的按键会高亮显示), + +![learnmusic-jalmus-singlenote](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-jalmus-singlenote.png) + +到非常困难(有多行音符从右向左滑过,你需要按顺序键入音符)。 + +![learnmusic-jalmus-multinote](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-jalmus-multinote.png) + +Jalmus 也包含一些阅读单个音符的训练,内容和课程相似,只是没有那些视觉上的提示了。当完成训练后,屏幕上会显示你的乐谱。它还提供不同难度的节拍训练,你能听到并看到这些训练里面播放的节拍。在多行乐谱同时播放时,一个节拍器(能听见能看见)可以帮你理解 + +![learnmusic-jalmus-rhythm](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-jalmus-rhythm.png) + +和阅读乐谱。 + +![learnmusic-jalmus-score](https://www.maketecheasier.com/assets/uploads/2015/07/learnmusic-jalmus-score.png) + +所有这些功能都是可配置的,你可以选择打开或者关闭它们。 + +总的来说,Jalmus 可能是节奏训练软件中属于功能最强的,虽然它不是学音乐必备的软件,但在节奏训练这个特殊的领域,它做得很出色。 + +### 号外 ### + +#### TuxGuitar #### + +对于吉他练习者,[TuxGuitar][12] 看起来很像 Windows 下面的 Guitar Pro 软件(它也可以读 Guitar Pro 格式的文件)。 + +#### PianoBooster #### + +[Piano Booster][13] 可以练习钢琴技巧,它能播放 MIDI 文件,你可以使用外接键盘来弹钢琴,同时还能查看屏幕上滑过的乐谱。 + +### 总结 ### + +Linux 提供很多优秀的工具供你学习,如果你对音乐感兴趣,你完全不用担心没有帮你练习音乐技术的软件。实际上,可供学习音乐的学生选择的优秀软件数量远比上面介绍的要多。如果你还知道其他的音乐训练软件,请在写下你的评论,让我们能够知道。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/linux-learning-music/ + +作者:[Attila Orosz][a] +译者:[bazz2](https://github.com/bazz2) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/attilaorosz/ +[1]:https://www.maketecheasier.com/series/learn-with-linux/ +[2]:https://www.maketecheasier.com/learn-to-type-in-linux/ +[3]:https://www.maketecheasier.com/linux-physics-simulation/ +[4]:https://www.maketecheasier.com/linux-learning-music/ +[5]:https://www.maketecheasier.com/linux-geography-apps/ +[6]:https://www.maketecheasier.com/learn-linux-maths/ +[7]:https://en.wikipedia.org/wiki/Solf%C3%A8ge +[8]:http://tete.sourceforge.net/index.shtml +[9]:https://en.wikipedia.org/wiki/Ear_training +[10]:http://sourceforge.net/projects/tete/files/latest/download +[11]:http://sourceforge.net/projects/jalmus/files/Jalmus-2.3/ +[12]:http://tuxguitar.herac.com.ar/ +[13]:http://www.linuxlinks.com/article/20090517041840856/PianoBooster.html diff --git a/published/201601/Learn with Linux--Learning to Type.md b/published/201601/Learn with Linux--Learning to Type.md new file mode 100644 index 0000000000..01c2dbc70d --- /dev/null +++ b/published/201601/Learn with Linux--Learning to Type.md @@ -0,0 +1,119 @@ +与 Linux 一起学习:学习打字 +================================================================================ +![](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-featured.png) + +[与 Linux 一起学习][1]的所有文章: + +- [与 Linux 一起学习:学习打字][2] +- [与 Linux 一起学习:物理模拟][3] +- [与 Linux 一起学习:玩音乐][4] +- [与 Linux 一起学习:两款地理软件][5] +- [与 Linux 一起学习: 使用这些 Linux 应用来征服你的数学学习][6] + +Linux 提供大量的教学软件和工具,面向各个年级以及不同年龄段,提供大量学科的练习实践,其中大多数是可以与用户进行交互的。本“与 Linux 一起学习”系列就来介绍一些教学软件。 + +很多人都要打字,操作键盘已经成为他们的第二天性。但是这些人中有多少是依然使用两个手指头来快速地按键盘的?即使学校有教我们使用键盘的方法,我们也会慢慢地抛弃正确的打字姿势,养成只用两个大拇指玩键盘的习惯。(LCTT 译注:呃,你确认是拇指而不是食指?) + +下面要介绍的两款软件可以帮你掌控你的键盘,然后你就可以让你的手指跟上你的思维,这样你的思维就不会被打断了。当然,还有很多更炫更酷的软件可供选择,但本文所选的这两款是最简单、最容易上手的。 + +### TuxType (或者叫 TuxTyping) ### + +TuxType 是给小孩子玩的。在一些有趣的游戏中,小学生们可以通过完成一些简单的练习来 Get “双手打字以示清白”的新技能。 + +Debian 及其衍生版本(包含所有 Ubuntu 衍生版本)的标准软件仓库都有 TuxType,使用下面的命令安装: + + sudo apt-get install tuxtype + +软件开始时有一个简单的 Tux 界面和一段难听的 midi 音乐,幸运的是你可以通过右下角的喇叭按钮把声音调低了。(LCTT 译注:Tux 就是那只 Linux 吉祥物,Linus 说它的表情被设计成刚喝完啤酒后的满足感,见《Just For Fun》。) + +![learntotype-tuxtyping-main](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-tuxtyping-main.jpg) + +最开始处的两个选项“Fish Cascade”和“Comet Zap”是打字游戏,当你开始游戏时,你就投入到了这个课程。 + +第3个选项为“Lessions”,提供40多个简单的课程,每个课程会增加一个字母让你来练习,练习过程中会给出一些提示,比如应该用哪个手指按键盘上的字母。 + +![learntotype-tuxtyping-exd1](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-tuxtyping-exd1.jpg) + +![learntotype-tuxtyping-exd2](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-tuxtyping-exd2.jpg) + +更高级点的,你可以练习输入句子。不知道为什么,句子练习被放在“Options”选项里。(LCTT 译注:句子练习第一句是“The quick brown fox jumps over the lazy dog”,包含了26个英文字母,可用于检测键盘是否坏键,也是练习英文打字的必备良药啊。) + +![learntotype-tuxtyping-phrase](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-tuxtyping-phrase.jpg) + +这个游戏让玩家打出单词来帮助 Tux 吃到小鱼或者干掉掉下来的流星,训练速度和精确度。 + +![learntotype-tuxtyping-fish](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-tuxtyping-fish.jpg) + +![learntotype-tuxtyping-zap](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-tuxtyping-zap.jpg) + +除了练习有趣外,这些游戏还可以训练玩家的拼写、速度、手眼配合能力,因为你如果认真在玩的话,必须盯着屏幕,不看键盘打字。 + +### GNU typist (gtype) ### + +对于成年人或有打字经验的人来说,GNU Typist 可能更合适,它是一个 GNU 项目,基于控制台操作。 + +GNU Typist 也在大多数 Debian 衍生版本的软件库中,运行下面的命令来安装: + + sudo apt-get install gtype + +你估计不能在应用菜单里找到它,只能在终端界面上执行下面的命令来启动: + + gtype + +界面简单,没有废话,直接提供课程内容,玩家选择就是了。 + +![learntotype-gtype-main](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-gtype-main.png) + +课程直截了当,内容详细。 + +![learntotype-gtype-lesson](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-gtype-lesson.png) + +在交互练习的过程中,如果你输入错误,会将错误位置高亮显示。不会像其他漂亮界面分散你的注意力,你可以专注于练习。每个课程的右下角都有一组统计数据来展示你的表现,如果你犯了很多错误,就可能无法通过关卡了。 + +![learntotype-gtype-mistake](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-gtype-mistake.png) + +简单练习只需要你重复输入一些字符,而高阶练习需要你输入整个句子。 + +![learntotype-gtype-warmup](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-gtype-warmup.png) + +下图的错误已经超过 3%,错误率太高了,你得降低些。 + +![learntotype-gtype-warmupfail](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-gtype-warmupfail.png) + +一些训练用于完成特殊目标,比如“平衡键盘训练(LCTT 译注:感觉是用来练习手感的)”。 + +![learntotype-gtype-balanceddrill](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-gtype-balanceddrill.png) + +下图是速度练习。 + +![learntotype-gtype-speed-simple](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-gtype-speed-simple.png) + +下图是要你输入一段经典文章。 + +![learntotype-gtype-speed-advanced](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-gtype-speed-advanced.png) + +如果你想练习其他语种,操作一下命令行参数就行。 + +![learntotype-gtype-more-lessons](https://www.maketecheasier.com/assets/uploads/2015/07/learntotype-gtype-more-lessons.png) + +### 总结 ### + +如果你想练练自己的打字水平,Linux 上有很多软件给你用。本文介绍的两款软件界面简单但内容丰富,能满足绝大多数打字爱好者的需求。如果你正在使用、或者听说过其他的优秀打字练习软件,请在评论栏贴出来,让我们长长姿势。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/learn-to-type-in-linux/ + +作者:[Attila Orosz][a] +译者:[bazz2](https://github.com/bazz2) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/attilaorosz/ +[1]:https://www.maketecheasier.com/series/learn-with-linux/ +[2]:https://www.maketecheasier.com/learn-to-type-in-linux/ +[3]:https://www.maketecheasier.com/linux-physics-simulation/ +[4]:https://www.maketecheasier.com/linux-learning-music/ +[5]:https://www.maketecheasier.com/linux-geography-apps/ +[6]:https://linux.cn/article-6546-1.html \ No newline at end of file diff --git a/published/201601/Learn with Linux--Physics Simulation.md b/published/201601/Learn with Linux--Physics Simulation.md new file mode 100644 index 0000000000..452ec3a9eb --- /dev/null +++ b/published/201601/Learn with Linux--Physics Simulation.md @@ -0,0 +1,112 @@ +与 Linux 一起学习:物理模拟 +================================================================================ +![](https://www.maketecheasier.com/assets/uploads/2015/07/physics-fetured.jpg) + +[与 Linux 一起学习][1]的所有文章: + +- [与 Linux 一起学习:学习打字][2] +- [与 Linux 一起学习:物理模拟][3] +- [与 Linux 一起学习:玩音乐][4] +- [与 Linux 一起学习:两款地理软件][5] +- [与 Linux 一起学习:掌握数学][6] + +Linux 提供大量的教学软件和工具,面向各个年级段以及不同年龄段,提供大量学科的练习实践,其中大多数是可以与用户进行交互的。本“与 Linux 一起学习”系列就来介绍一些教学软件。 + +物理是一个有趣的课题,证据就是任何物理课程都可以用具体的图片演示给你看。能看到物理变化过程是一个很妙的体验,特别是你不需要到教室就能体验到。Linux 上有很多很好的科学软件来为你提供这种美妙感觉,本篇文章只着重介绍其中几种。 + +### 1. Step ### + +[Step][7] 是一个交互型物理模拟器,属于 [KDEEdu][8](KDE 教育)项目的一部分。没人会比它的作者更了解它的作用。在项目官网主页上写着“[Step] 是这样玩的:你放点东西进来,添加一些力(地心引力或者弹簧),然后点击‘模拟(Simulate)’按钮,这款软件就会为你模拟这个物体在真实世界的物理定律影响下的运动状态。你可以改变物体或力的属性(允许在模拟过程中进行修改),然后观察不同属性下产生的现象。Step 可以让你从体验中学习物理!” + +Step 依赖 Qt 以及其他一些 KDE 所依赖的软件,正是由于像 KDEEdu 之类的项目存在,才使得 KDE 变得如此强大,当然,你可能需要忍受由此带来的庞大的桌面系统。 + +Debian 的源中包含了 step 软件,终端下运行以下命令安装: + + sudo apt-get install step + +在 KDE 环境下,它只需要很少的依赖,几秒钟就能安装完成。 + +Step 有个简单的交互界面,你进去后直接可以进行模拟操作。 + +![physics-step-main](https://www.maketecheasier.com/assets/uploads/2015/07/physics-step-main.png) + +你会发现所有物品在屏幕左边,包括不同的质点,空气,不同形状的物体,弹簧,以及不同的力(见区域1) 。如果你选中一个物体,屏幕右边会出现简短的描述信息(见区域2),以及你创造的世界的介绍(主要介绍这个世界中包含的物体)(见区域3),以及你当前选中的物体的属性(见区域4),以及你的操作历史(见区域5)。 + +![physics-step-parts](https://www.maketecheasier.com/assets/uploads/2015/07/physics-step-parts.png) + +一旦你放好了所有物体,点击下“模拟”按钮,可以看到物体与物体之间的相互作用。 + +![physics-step-simulate1](https://www.maketecheasier.com/assets/uploads/2015/07/physics-step-simulate1.png) + +![physics-step-simulate2](https://www.maketecheasier.com/assets/uploads/2015/07/physics-step-simulate2.png) + +![physics-step-simulate3](https://www.maketecheasier.com/assets/uploads/2015/07/physics-step-simulate3.png) + +想要更多了解 Step,按 F1 键,KDE 帮助中心会显示出详细的软件操作手册。 + +### 2. Lightspeed ### + +Lightspeed 是一个简单的基于 GTK+ 和 OpenGL 的模拟器,可以模拟一个高速移动的物体被观测到的现象。这个模拟器的理论基础是爱因斯坦的狭义相对论,在 Lightspeed 的 [srouceforge 页面][9]上,他们这样介绍:当一个物体被加速到几千公里每秒,它就会表现得扭曲和褪色;当物体被不断加速到接近光速(299,792,458 m/s)时,这个现象会越来越明显,并且在不同方向观察这个物体的扭曲方式,会得到完全不一样的结果。 + +受到相对速度影响的现象如下(LCTT 译注:都可以从“光速不变”理论推导出来): + +- **洛伦兹收缩(The Lorentz contraction)** —— 物体看起来变短了 +- **多普勒红移/蓝移(The Doppler red/blue shift)** —— 物体的颜色变了 +- **前灯效应(The headlight effect)** —— 物体的明暗变化(LCTT 译注:当物体接近光速移动时,会在它前进的方向强烈地辐射光子,从这个角度看,物体会变得很亮,相反,从物体背后观察,会发现它很暗) +- **光行差效应(Optical aberration)** —— 物体扭曲变形了 + +Lightspeed 有 Debian 的源,执行下面的命令来安装: + + sudo apt-get install lightspeed + +用户界面非常简单,里边有一个物体(你可以从 sourceforge 下载更多形状的物体)沿着 x 轴运动(按下 A 键或在菜单栏 object 项目的 Animation 选项设置,物体就会开始运动)。 + +![physics-lightspeed](https://www.maketecheasier.com/assets/uploads/2015/08/physics-lightspeed.png) + +你可以滑动右边的滑动条来控制物体移动的速度。 + +![physics-lightspeed-deform](https://www.maketecheasier.com/assets/uploads/2015/08/physics-lightspeed-deform.png) + +其他一些简单的控制器可以让你获得更多的视觉效果。 + +![physics-lightspeed-visual](https://www.maketecheasier.com/assets/uploads/2015/08/physics-lightspeed-visual.png) + +点击界面并拖动鼠标可以改变物体视角,在 Camera 菜单下可以修改背景颜色或者物体的图形模式,以及其他效果。 + +### 特别推荐: Physion ### + +Physion 是个非常有趣并且美观的物理模拟软件,比上面介绍的两款软件都好玩好看。 + +可以从它的[官网][10]下载: + +- [Linux][11] + +从他们放在 Youtube 上的视频来看,Physion 还是值得我们下载下来玩玩的。\ + +注:youtube 视频 + + +你有其他 Linux 下的好玩的物理模拟、演示、教学软件吗?如果有,请在评论处分享给我们。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/linux-physics-simulation/ + +作者:[Attila Orosz][a] +译者:[bazz2](https://github.com/bazz2) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/attilaorosz/ +[1]:https://www.maketecheasier.com/series/learn-with-linux/ +[2]:https://linux.cn/article-6902-1.html +[3]:https://www.maketecheasier.com/linux-physics-simulation/ +[4]:https://www.maketecheasier.com/linux-learning-music/ +[5]:https://www.maketecheasier.com/linux-geography-apps/ +[6]:https://linux.cn/article-6546-1.html +[7]:https://edu.kde.org/applications/all/step +[8]:https://edu.kde.org/ +[9]:http://lightspeed.sourceforge.net/ +[10]:http://www.physion.net/ +[11]:http://physion.net/en/downloads/linux/13-physion-linux-x8664/download \ No newline at end of file diff --git a/published/201601/Learn with Linux--Two Geography Apps.md b/published/201601/Learn with Linux--Two Geography Apps.md new file mode 100644 index 0000000000..bdbcb36a42 --- /dev/null +++ b/published/201601/Learn with Linux--Two Geography Apps.md @@ -0,0 +1,99 @@ +与 Linux 一起学习:学习地理 +================================================================================ +![](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-featured.png) + +[与 Linux 一起学习][1]的所有文章: + +- [与 Linux 一起学习:学习打字][2] +- [与 Linux 一起学习:物理模拟][3] +- [与 Linux 一起学习:玩音乐][4] +- [与 Linux 一起学习:学习地理][5] +- [与 Linux 一起学习:掌握数学][6] + +引言:Linux 提供大量的教学软件和工具,面向各个年级段以及各个年龄段,提供大量学科的练习实践,其中大多数是可以与用户进行交互的。本“与 Linux 一起学习”系列就来介绍一些教学软件。 + +地理是一门有趣的学科,我们每天都能接触到,虽然可能没有意识到,但当你打开 GPS、SatNav 或谷歌地图时,你就已经在使用这些软件提供的地理数据了;当你在新闻中看到一个国家的消息或听到一些金融数据时,这些信息都可以归于地理学范畴。Linux 提供了很多学习地理学的软件,可用于教学,也可用于自学。 + +### Kgeography ### + +在多数 Linux 发行版的软件库中,只有两个与地理有关的软件,两个都属于 KDE 阵营,或者说都属于 KDE 教育项目。Kgeopraphy 使用简单的彩色编码图来绘制被选中的国家。 + +Ubuntu 及衍生版在终端执行下面命令安装软件: + + sudo apt-get install kgeography + +界面很简单,给你一个选择界面,你可以选择不同的国家。 + +![learn-geography-kgeo-pick](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-kgeo-pick.png) + +点击地图上的某个区域,界面就会显示这个区域所在的国家和首都。 + +![learn-geography-kgeo-brit](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-kgeo-brit.png) + +以及给出不同的测试题来检测你的知识水平。 + +![learn-geography-kgeo-test](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-kgeo-test.png) + +这款软件以交互的方式测试你的地理知识,并且可以帮你为考试做好充足的准备。 + +### Marble ### + +Marble 是一个稍微高级一点的软件,无需 3D 加速就能提供全球视角。 + +![learn-geography-marble-main](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-marble-main.png) + +在 Ubuntu 及衍生版的终端输入下面的命令来安装 Marble: + + sudo apt-get install marble + +Marble 专注于地图绘制,它的主界面就是一张地图。 + +![learn-geography-marble-atlas](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-marble-atlas.jpg) + +你可以选择不同的投影方法,比如球状投影和麦卡托投影(LCTT 译注:把地球表面绘制在平面上的方法),在下拉菜单里你可以选择平面视角或外部视角,包括 Atlas 视角,OpenStreetMap 提供的成熟的离线地图, + +![learn-geography-marble-map](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-marble-map.jpg) + +以及卫星视角(由 NASA 提供), + +![learn-geography-marble-satellite](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-marble-satellite.jpg) + +以及政治上甚至是历史上的世界地图。 + +![learn-geography-marble-history](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-marble-history.jpg) + +除了有包含不同界面和大量数据的离线地图,Marble 还提供其他信息。你可以在菜单中打开或关闭不同的离线信息框 + +![learn-geography-marble-offline](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-marble-offline.png) + +和在线服务。 + +![learn-geography-marble-online](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-marble-online.png) + +一个有趣的在线服务是维基百科,点击下 Wiki 图标,会弹出一个界面来展示你选中区域的详细信息。 + +![learn-geography-marble-wiki](https://www.maketecheasier.com/assets/uploads/2015/07/learn-geography-marble-wiki.png) + +这款软件还提供定位追踪、路由规划、位置搜索和其他有用的功能。如果你喜欢地图学,Marble 可以让你长时间享受探索和学习的乐趣。 + +### 总结 ### + +Linux 提供大量优秀的教育软件,当然也包括地理学科。本文介绍的两款软件可以帮你学到很多地理知识,并且你可以以一种好玩的人机交互方式来测试你的知识量。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/linux-geography-apps/ + +作者:[Attila Orosz][a] +译者:[bazz2](https://github.com/bazz2) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/attilaorosz/ +[1]:https://www.maketecheasier.com/series/learn-with-linux/ +[2]:https://www.maketecheasier.com/learn-to-type-in-linux/ +[3]:https://www.maketecheasier.com/linux-physics-simulation/ +[4]:https://www.maketecheasier.com/linux-learning-music/ +[5]:https://www.maketecheasier.com/linux-geography-apps/ +[6]:https://www.maketecheasier.com/learn-linux-maths/ \ No newline at end of file diff --git a/published/201602/20150818 A Linux User Using Windows 10 After More than 8 Years--See Comparison.md b/published/201602/20150818 A Linux User Using Windows 10 After More than 8 Years--See Comparison.md new file mode 100644 index 0000000000..21e8fcb748 --- /dev/null +++ b/published/201602/20150818 A Linux User Using Windows 10 After More than 8 Years--See Comparison.md @@ -0,0 +1,345 @@ +一个八年的 Linux 老用户使用 Windows 10 的体验 +========================================================== + +Windows 10 是2015年7月29日上市的最新一代 Windows NT 系列系统,它是 Windows 8.1 的继任者。Windows 10 支持 Intel 32位平台,AMD64 以及 ARM v7 处理器。 + +![Windows 10 and Linux Comparison](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-vs-Linux.jpg) + +*对比:Windows 10与Linux* + +作为一个连续使用 linux 超过8年的用户,我想要去体验一下 Windows 10 ,因为有很多关于它的消息。这篇文章是我观察力的一个重大突破。我将从一个 linux 用户的角度去看待一切,所以这篇文章可能会有些偏向于 linux。尽管如此,本文也绝对不会有任何虚假信息。 + +1、用谷歌搜索“download Windows 10”并且点击第一个链接。 + +![Search Windows 10](http://www.tecmint.com/wp-content/uploads/2015/08/Search-Windows-10.jpg) + +*搜索 Windows 10* + +你也可以直接打开: [https://www.microsoft.com/en_us/software-download/Windows10[1] + +2、微软要求我从 Windows 10, Windows 10 KN, Windows 10 N 和 Windows 10 单语言版中选择一个版本。 + +![Select Windows 10 Edition](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Windows-10-Edition.jpg) + +*选择版本* + +以下是各个版本的简略信息: + +- Windows 10 - 包含微软提供给我们的所有软件 +- Windows 10N - 此版本不包含媒体播放器 +- Windows 10KN - 此版本没有媒体播放能力 +- Windows 10 单语言版 - 仅预装一种语言 + +3、我选择了第一个选项“Windows 10”并且单击“确认”。之后我要选择语言,我选择了“英语”。 + +微软给我提供了两个下载链接。一个是32位版,另一个是64位版。我单击了64位版--这与我的电脑架构相同。 + +![Download Windows 10](http://www.tecmint.com/wp-content/uploads/2015/08/Download-Windows-10.jpg) + +*下载 Windows 10* + +我的带宽是15M的,下载了整整3个小时。不幸的是微软没有提供系统的种子文件,否则整个过程会更加舒畅。镜像大小为 3.8 GB(LCTT译者注:就我的10M小水管,我使用迅雷下载用时50分钟)。 + +我找不到更小的镜像,微软并没有为 Windows 提供网络安装镜像。我也没有办法在下载完成后去校验哈希值。(LCTT 译注:你知道的,这对于 Linux 来说都是常识了) + +我十分惊讶,Windows 在这样的问题上居然如此漫不经心。为了验证这个镜像是否正确下载,我需要把它刻到光盘上或者复制到我的U盘上然后启动它,一直静静的看着它安装直到安装完成。 + +首先,我用 dd 命令将 win10 的 iso 镜像刻录到U盘上。 + + # dd if=/home/avi/Downloads/Win10_English_x64.iso of=/dev/sdb1 bs=512M; sync + +这需要一点时间。在此之后我重启系统并在 UEFI(BIOS)设置中选择从我的U盘启动。 + +#### 系统要求 #### + +升级 + +- 仅支持从 Windows 7 SP1 或者 Windows 8.1 升级 + +全新安装 + +- 处理器: 1GHz 以上 +- 内存: 1GB以上(32位),2GB以上(64位) +- 硬盘: 16GB以上(32位),20GB以上(64位) +- 显卡: 支持DirectX 9或更新 + WDDM 1.0 驱动 + +###Windows 10 安装过程### + +1、Windows 10启动成功了。他们又换了logo,但是仍然没有信息提示我它正在做什么。 + +![Windows 10 Logo](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-Logo.jpg) + +*Windows 10 Logo* + +2、选择安装语言,时区,键盘,输入法,点击下一步。 + +![Select Language and Time](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Language-and-Time.jpg) + +*选择语言和时区* + +3、点击“现在安装”。 + +![Install Windows 10](http://www.tecmint.com/wp-content/uploads/2015/08/Install-Windows-10.jpg) + +*安装Windows 10* + +4、下一步是输入密钥,我点击了“跳过”。 + +![Windows 10 Product Key](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-Product-Key.jpg) + +*Windows 10 产品密钥* + +5、从列表中选择一个系统版本。我选择了 Windows 10专业版。 + +![Select Install Operating System](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Install-Operating-System.jpg) + +*选择系统版本* + +6、到了协议部分,选中"我接受"然后点击下一步。 + +![Accept License](http://www.tecmint.com/wp-content/uploads/2015/08/Accept-License.jpg) + +*同意协议* + +7、下一步是选择(从 Windows 的老版本)升级到 Windows 10 或者安装 Windows。我搞不懂为什么微软要让我自己选择:“安装Windows”被微软建议为“高级”选项。但是我还是选择了“安装Windows”。 + +![Select Installation Type](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Installation-Type.jpg) + +*选择安装类型* + +8、选择驱动器,点击“下一步”。 + +![Select Install Drive](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Install-Drive.jpg) + +*选择安装盘* + +9、安装程序开始复制文件,准备文件,安装更新,之后进行收尾。如果安装程序能在安装时输出一堆字符来表示它在做什么就更好了。 + +![Installing Windows](http://www.tecmint.com/wp-content/uploads/2015/08/Installing-Windows.jpg) + +*安装 Windows* + +10、在此之后 Windows 重启了。它们说要继续的话,我们需要重启。 + +![Windows Installation Process](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-Installation-Process.jpg) + +*安装进程* + +11、我看到了一个写着“正在准备 Windows”的界面。它停了整整五分多钟!仍然没有说明它正在做什么。没有输出。 + +![Windows Getting Ready](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-Getting-Ready.jpg) + +*正在准备 Windows* + +12、又到了输入产品密钥的时间。我点击了“以后再说”,并使用快速设置。 + +![Enter Product Key](http://www.tecmint.com/wp-content/uploads/2015/08/Enter-Product-Key.jpg) + +*输入产品密钥* + +![Select Express Settings](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Express-Settings.jpg) + +*使用快速设置* + +13、又出现了三个界面,作为 Linux 用户我认为此处应有信息来告诉我安装程序在做什么,但是我想多了。 + +![Loading Windows](http://www.tecmint.com/wp-content/uploads/2015/08/Loading-Windows.jpg) + +*载入 Windows* + +![Getting Updates](http://www.tecmint.com/wp-content/uploads/2015/08/Getting-Updates.jpg) + +*获取更新* + +![Still Loading Windows](http://www.tecmint.com/wp-content/uploads/2015/08/Still-Loading-Windows.jpg) + +*还是载入 Windows* + +14、安装程序想要知道谁拥有这台机器,“我的组织”或者我自己。选择我自己并继续。 + +![Select Organization](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Organization.jpg) + +*选择组织* + +15、在单击继续之前,安装程序提示我加入“Aruze Ad”或者“加入域”。我选择了后者。 + +![Connect Windows](http://www.tecmint.com/wp-content/uploads/2015/08/Connect-Windows.jpg) + +*连接网络* + +16、安装程序让我新建一个账户。所以我输入了“user_name”就点击了下一步,我觉得我会收到一个要求我必须输入密码的信息。 + +![Create Account](http://www.tecmint.com/wp-content/uploads/2015/08/Create-Account.jpg) + +*新建账户* + +17、让我惊讶的是 Windows 甚至都没有显示一个警告或提示信息,告诉我必须创建密码。真粗心。不管怎样,现在我可以体验系统了。 + +![Windows 10 Desktop](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-Desktop.jpg) + +*Windows 10的桌面环境* + +#### Linux 用户(我)直到现在的体验 #### + +- 没有网络安装镜像 +- 镜像文件太臃肿了 +- 没有验证 iso 是否为正确的方法(官方没有提供哈希值) +- 启动与安装方式仍然与 XP,Win 7,Win 8 相同(可能吧...) +- 和以前一样,安装程序没有输出它正在干什么 - 正在复制什么和正在安装什么软件包 +- 安装程序比 Linux 发行版的更加傻瓜和简单 + +####测试 Windows 10#### + +18、默认桌面很干净,上面只有一个回收站图标。我们可以直接从桌面搜索网络。底部的快捷方式分别是任务预览、网络、微软应用商店。和以前的版本一样,消息栏在右下角。 + +![ ](http://www.tecmint.com/wp-content/uploads/2015/08/Deskop-Shortcut-icons.jpg) + +*桌面图标* + +19、IE 浏览器被换成了 Edge 浏览器。微软把他们的老IE换成了 Edge (斯巴达计划) + +![Microsoft Edge Browser](http://www.tecmint.com/wp-content/uploads/2015/08/Edge-browser.jpg) + +*Edge 浏览器* + +测试起来,这个浏览器至少比 IE 要快。他们有相同的用户界面。它的主页包含新闻更新。它还有一个搜索标题栏是“下一步怎么走”。由于浏览器的全面性能提升,它的加载速度非常快。Edge 的内存占用看起来正常。 + +![Windows Performance](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-Performance.jpg) + +*性能* + +Edge 也有小娜加成(智能个人助理)、支持 Chrome 扩展、支持笔记(在浏览网页时记笔记)、分享(在选项卡上右击而不必打开其他选项卡) + +#### Linux 用户(我)此时体验 #### + +20、微软确实提升了网页浏览体验。我绝对稳定性和质量还好。现在它并不落后。 + +21、对我来说,Edge 的内存占用不算太大。但是有很多用户抱怨它的内存占用太多。 + +22、很难说目前 Edge 已经准备好了与火狐或 Chrome竞争。让我们静观其变。 + +#### 更多的视觉体验 #### + +23、重新设计的开始菜单 -- 看起来很简洁高效。Merto 磁贴大部分都会动。预先放置了最通用的应用。 + +![Windows Look and Feel](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-Look.jpg) + +*Windows* + +而在 Linux 的 Gnome 桌面环境下。我仅仅需要按下 Win 键并输入应用名就可以搜索应用。 + +![Search Within Desktop](http://www.tecmint.com/wp-content/uploads/2015/08/Search-Within-Desktop.jpg) + +*桌面内进行搜索* + +24、文件浏览器 -- 设计的很简洁。左边是进入文件夹的快捷方式。 + +![Windows File Explorer](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-File-Explorer.jpg) + +*Windows 文件管理器* + +我们的 Gnome 下的文件管理也同样的简洁高效。从图标上移走了不需要的图形图像是个加分点。 + +![File Browser on Gnome](http://www.tecmint.com/wp-content/uploads/2015/08/File-Browser.jpg) + +*Gnome 的文件管理* + +25、设置 -- 尽管 Windows 10的设置有点精炼,但是我们还是可以把它与 linux 的设置进行对比。 + +**Windows 的设置** + +![Windows 10 Settings](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-Settings.jpg) + +*Windows 10 设置* + +**Linux Gnome 上的设置** + +![Gnome Settings](http://www.tecmint.com/wp-content/uploads/2015/08/Gnome-Settings.jpg) + +*Gnome 的设置* + +26、应用列表 -- 目前,Linux上的应用列表要好于之前的版本(据我所记,那时我还是一个普通的 Windows 用户),但是 Windows 10 的还比 Gnome 3 的差一点。 + +**Windows 的应用列表** + +![Application List on Windows 10](http://www.tecmint.com/wp-content/uploads/2015/08/Application-List-on-Windows-10.jpg) + +*Windows 10 的应用列表* + +**Gnome3 的应用列表** + +![Gnome Application List on Linux](http://www.tecmint.com/wp-content/uploads/2015/08/Gnome-Application-List-on-Linux.jpg) + +*Gnome3 的应用列表* + +27、虚拟桌面 -- Windows 10 上的虚拟桌面是近来被提及最多的特性之一。 + +这是 Windows 10 上的虚拟桌面。 + +![Windows Virtual Desktop](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-Virtual-Desktop.jpg) + +*Windows 的虚拟桌面* + +这是我们 Linux 用户使用了超过20年的虚拟桌面。 + +![Virtual Desktop on Linux](http://www.tecmint.com/wp-content/uploads/2015/08/Virtual-Desktop-on-Linux.jpg) + +*Linux 的虚拟桌面* + +#### Windows 10 的其他新特性 #### + +28、Windows 10 自带 wifi 感知。它会把你的 wifi 密码分享给他人。任何在你 wifi 范围内并且曾经通过 Skype, Outlook, Hotmail 或 Facebook与你联系的人都能够获得你的网络接入权。这个特性的本意是让用户可以省时省力的连接网络。 + +在微软对于 Tecmint 的问题的回答中,他们说道 -- 用户需要在每次到一个新的网络环境时自己去同意打开 wifi 感知。如果我们考虑到网络安全这将是很不安全的一件事。微软的说法并没有说服我。 + +29、从 Windows 7 和 Windows 8.1 升级可以省下买新版的花费。(家庭版 $119 专业版$199) + +30、微软发布了第一个累积更新,这个更新在一小部分设备上会让系统一直重启。Windows可能不知道这个问题或者不知道它发生的原因。 + +31、微软内建的“禁用/隐藏我不想要的更新”的功能在我这不起作用。这意味着一旦更新开始推送,你没有方法去禁用/隐藏他们。对不住啦,Windows 用户。 + +#### Windows 10 包含的来源于 Linux 的功能 #### + +Windows 10 有很多直接取自 Linux 的功能。如果 Linux 不以 GPL 发布的话,也许以下这些功能永远不会出现在 Windows上。 + +32、命令行的包管理器 -- 是的,你没有听错!Windows 10内建了一个包管理器。它只在 Power Shell 下工作。OneGet 是Windows 的官方包管理器。 + +![Windows 10 Package Manager](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-Package-Manager.jpg) + +*Windows 10的包管理器* + +- 无边窗口 +- 扁平化图标 +- 虚拟桌面 +- 离线/在线搜索一体化 +- 手机/桌面系统融合 + +### 总体印象### + +- 响应速度提升 +- 动画很好看 +- 资源占用少 +- 电池续航提升 +- Edge 浏览器很稳定 +- 支持树莓派 2 +- Windows 10 好的原因是 Windows 8/8.1 没有达到公众预期并且坏的可以 +- 旧瓶装新酒:Windows 10基本上就是以前的那一套换上新的图标 + +测试后我对 Windows 10 的评价是:Windows 10 在视觉和感觉上做了一些更新(就如同 Windows 经常做的那样)。我要为斯巴达计划、虚拟桌面、命令行包管理器、整合在线/离线搜索的搜索栏点赞。这确实是一个更新后的产品 ,但是认为 Windows 10 将是 Linux 的最后一个棺材钉的人错了。 + +Linux 走在 Windows 前面。它们的做事方法并不相同。在以后的一段时间里 Windows 不会站到 Linux这一旁。也没有什么让 Linux 用户值得去使用 Windows 10。 + +这就是我要说的。希望你喜欢本文。如果你们喜欢本篇文章我会再写一些你们喜欢读的有趣的文章。在下方留下你的有价值的评论。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/a-linux-user-using-Windows-10-after-more-than-8-years-see-comparison/ + +作者:[Avishek Kumar][a] +译者:[name1e5s](https://github.com/name1e5s) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:https://www.microsoft.com/en-us/software-download/Windows10ISO diff --git a/published/201602/20150824 Great Open Source Collaborative Editing Tools.md b/published/201602/20150824 Great Open Source Collaborative Editing Tools.md new file mode 100644 index 0000000000..aab783c627 --- /dev/null +++ b/published/201602/20150824 Great Open Source Collaborative Editing Tools.md @@ -0,0 +1,229 @@ +六款优秀的开源协作编辑工具 +================================================================================ + +简而言之,协作编辑(Collaborative Edit)就是多个人进行编辑。协作有好处也有风险。好处之一是更加全面/协调的方式,更好的利用现有资源和一个更加有力一致的声音。对于我来说,最大的好处是极大的透明度。那是当我需要采纳同事的观点。同事之间来来回回地传文件效率非常低,导致不必要的延误还让人(比如,我)对整个协作这件事都感到不满意。有个好的协作软件,我就能实时地或异步地分享笔记,数据和文件,并用评论来分享自己的想法。这样在文档、图片、视频、演示文稿上协作就不会那么的琐碎而无聊。 + +有很多种方式能在线进行协作,简直不能更简便了。这篇文章展示了我最喜欢的开源的实时文档协作编辑工具。 + +Google Docs 是个非常好的高效应用,有着大部分我所需要的功能。它可以作为一个实时地协作编辑文档的工具提供服务。文档可以被分享、打开并被多位用户同时编辑,用户还能看见其他协作者一个字母一个字母的编辑过程。虽然 Google Docs 对个人是免费的,但并不开源。 + +下面是我带来的最棒的开源协作编辑器,它们能帮你不被打扰的集中精力进行写作,而且是和其他人协同完成。 + +---------- + +### Hackpad ### + +![Hackpad in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Hackpad.png) + +Hackpad 是个开源的基于网页的实时 wiki,基于开源 EtherPad 协作文档编辑器。 + +Hackpad 允许用户实时分享你的文档,它还用彩色编码显示各个作者分别贡献了哪部分。它还允许插入图片、清单,由于提供了语法高亮功能,它还能用来写代码。 + +当2014年4月 Dropbox 收购了 Hackpad 后,就在这个月这款软件以开源的形式发布。让我们经历的等待非常值得。 + +特性: + +- 有类似 wiki 所提供的,一套非常完善的功能 +- 实时或者异步地记录协作笔记,共享数据和文件,或用评论分享你们的想法 +- 细致的隐私许可让你可以邀请单个朋友、一个十几人的团队或者上千的 Twitter 粉丝 +- 智能执行 +- 直接从流行的视频分享网站上插入视频 +- 表格 +- 可对使用广泛的包括 C, C#, CSS, CoffeeScript, Java, 以及 HTML 在内的编程语言进行语法高亮 + +- 网站:[hackpad.com][1] +- 源代码:[github.com/dropbox/hackpad][2] +- 开发者:[Contributors][3] +- 许可:Apache License, Version 2.0 +- 版本号: - + +---------- + +### Etherpad ### + +![Etherpad in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Etherpad.png) + +Etherpad 是个基于网页的开源实时协作编辑器,允许多个作者同时编辑一个文本文档,写评论,并与其他作者用群聊方式进行交流。 + +Etherpad 是用 JavaScript 编写的,运行在 AppJet 平台之上,通过 Comet 流实现实时的功能。 + +特性: + +- 尽心设计的斯巴达界面 +- 简单的格式化文本功能 +- “滑动时间轴”——浏览一个工程历史版本 +- 可以下载纯文本、 PDF、微软的 Word 文档、Open Document 和 HTML 格式的文档 +- 每隔一段很短的时间就会自动保存 +- 可个性化程度高 +- 有客户端插件可以扩展编辑的功能 +- 几百个支持 Etherpad 的扩展,包括支持 email 提醒,pad 管理,授权 +- 可访问性开启 +- 可从 Node 里或通过 CLI(命令行界面)和 EtherPad 的内容交互 + +- 网站: [etherpad.org][4] +- 源代码:[github.com/ether/etherpad-lite][5] +- 开发者:David Greenspan, Aaron Iba, J.D. Zamfiresc, Daniel Clemens, David Cole +- 许可:Apache License, Version 2.0 +- 版本号: 1.5.7 + +---------- + +### Firepad ### + +![Firepad in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Firepad.png) + +Firepad 是个开源的协作文本编辑器。它的设计目的是被嵌入到更大的网页应用中对几天内新加入的代码进行批注。 + +Firepad 是个全功能的文本编辑器,有解决冲突,光标同步,用户属性,用户在线状态检测功能。它使用 Firebase 作为后台,而且不需要任何服务器端的代码。他可以被加入到任何网页应用中。Firepad 可以使用 CodeMirror 编辑器或者 Ace 编辑器提交文本,它的操作转换代码是从 ot.js 上借鉴的。 + +如果你想要通过添加简单的文档和代码编辑器来扩展你的网页应用能力,Firepad 最适合不过了。 + +Firepad 已被多个编辑器使用,包括Atlassian Stash Realtime Editor、Nitrous.IO、LiveMinutes 和 Koding。 + +特性: + +- 纯正的协作编辑 +- 基于 OT 的智能合并及解决冲突 +- 支持多种格式的文本和代码的编辑 +- 光标位置同步 +- 撤销/重做 +- 文本高亮 +- 用户属性 +- 在线检测 +- 版本检查点 +- 图片 +- 通过它的 API 拓展 Firepad +- 支持所有现代浏览器:Chrome、Safari、Opera 11+、IE8+、Firefox 3.6+ + +- 网站: [www.firepad.io][6] +- 源代码:[github.com/firebase/firepad][7] +- 开发者:Michael Lehenbauer and the team at Firebase +- 许可:MIT +- 版本号:1.1.1 + +---------- + +### OwnCloud Documents ### + +![ownCloud Documents in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-ownCloud.png) + +ownCloud Documents 是个可以单独并/或协作进行办公室文档编辑 ownCloud 应用。它允许最多5个人同时在网页浏览器上协作进行编辑 .odt 和 .doc 文件。 + +ownCloud 是个自托管文件同步和分享服务器。他通过网页界面,同步客户端或 WebDAV 提供你数据的使用权,同时提供一个容易在设备间进行浏览、同步和分享的平台。 + +特性: + +- 协作编辑,多个用户同时进行文件编辑 +- 在 ownCloud 里创建文档 +- 上传文档 +- 在浏览器里分享和编辑文件,然后在 ownCloud 内部或通过公共链接进行分享这些文件 +- 有类似 ownCloud 的功能,如版本管理、本地同步、加密、恢复被删文件 +- 通过透明转换文件格式的方式无缝支持微软 Word 文档 + +- 网站:[owncloud.org][8] +- 源代码: [github.com/owncloud/documents][9] +- 开发者:OwnCloud Inc. +- 许可:AGPLv3 +- 版本号:8.1.1 + +---------- + +### Gobby ### + +![Gobby in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Gobby.png) + +Gobby 是个支持在一个会话内进行多个用户聊天并打开多个文档的协作编辑器。所有的用户都能同时在文件上进行工作,无需锁定。不同用户编写的部分用不同颜色高亮显示,它还支持多个编程和标记语言的语法高亮。 + +Gobby 允许多个用户在互联网上实时共同编辑同一个文档。它很好的整合了 GNOME 环境。它拥有一个客户端-服务端结构,这让它能支持一个会话开多个文档,文档同步请求,密码保护和 IRC 式的聊天方式可以在多个频道进行交流。用户可以选择一个颜色对他们在文档中编写的文本进行高亮。 + +还供有一个叫做 infinoted 的专用服务器。 + +特性: + +- 成熟的文本编辑能力包括使用 GtkSourceView 的语法高亮功能 +- 实时、无需锁定、通过加密(包括PFS)连接的协作文本编辑 +- 整合了群聊 +- 本地组撤销:撤销不会影响远程用户的修改 +- 显示远程用户的光标和选择区域 +- 用不同颜色高亮不同用户编写的文本 +- 适用于大多数编程语言的语法高亮,自动缩进,可配置 tab 宽度 +- 零冲突 +- 加密数据传输包括完美的正向加密(PFS) +- 会话可被密码保护 +- 通过 Access Control Lists (ACLs) 进行精密的权限保护 +- 高度个性化的专用服务器 +- 自动保存文档 +- 先进的查找和替换功能 +- 国际化 +- 完整的 Unicode 支持 + +- 网站:[gobby.github.io][10] +- 源代码: [github.com/gobby][11] +- 开发者: Armin Burgmeier, Philipp Kern and contributors +- 许可: GNU GPLv2+ and ISC +- 版本号:0.5.0 + +---------- + +### OnlyOffice ### + +![OnlyOffice in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-OnlyOffice.png) + +ONLYOFFICE(从前叫 Teamlab Office)是个多功能云端在线办公套件,整合了 CRM(客户关系管理)系统、文档和项目管理工具箱、甘特图以及邮件整合器 + +它能让你整理商业任务和时间表,保存并分享你的协作或个人文档,使用网络社交工具如博客和论坛,还可以和你的队员通过团队的即时聊天工具进行交流。 + +能在同一个地方管理文档、项目、团队和顾客关系。OnlyOffice 结合了文本,电子表格和电子幻灯片编辑器,他们的功能跟微软桌面应用(Word、Excel 和 PowerPoint)的功能相同。但是他允许实时进行协作编辑、评论和聊天。 + +OnlyOffice 是用 ASP.NET 编写的,基于 HTML5 Canvas 元素,并且被翻译成21种语言。 + +特性: + +- 当在大文档里工作、翻页和缩放时,它能与桌面应用一样强大 +- 文档可以在浏览/编辑模式下分享 +- 文档嵌入 +- 电子表格和电子幻灯片编辑器 +- 协作编辑 +- 评论 +- 群聊 +- 移动应用 +- 甘特图 +- 时间管理 +- 权限管理 +- Invoicing 系统 +- 日历 +- 整合了文件保存系统:Google Drive、Box、OneDrive、Dropbox、OwnCloud +- 整合了 CRM、电子邮件整合器和工程管理模块 +- 邮件服务器 +- 邮件整合器 +- 可以编辑流行格式的文档、电子表格和电子幻灯片:DOC、DOCX、ODT、RTF、TXT、XLS、XLSX、ODS、CSV、PPTX、PPT、ODP + +- 网站:[www.onlyoffice.com][12] +- 源代码:[github.com/ONLYOFFICE/DocumentServer][13] +- 开发者:Ascensio System SIA +- 许可:GNU GPL v3 +- 版本号:7.7 + +-------------------------------------------------------------------------------- + +via: http://www.linuxlinks.com/article/20150823085112605/CollaborativeEditing.html + +作者:Frazer Kline +译者:[H-mudcup](https://github.com/H-mudcup) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://hackpad.com/ +[2]:https://github.com/dropbox/hackpad +[3]:https://github.com/dropbox/hackpad/blob/master/CONTRIBUTORS +[4]:http://etherpad.org/ +[5]:https://github.com/ether/etherpad-lite +[6]:http://www.firepad.io/ +[7]:https://github.com/firebase/firepad +[8]:https://owncloud.org/ +[9]:http://github.com/owncloud/documents/ +[10]:https://gobby.github.io/ +[11]:https://github.com/gobby +[12]:https://www.onlyoffice.com/free-edition.aspx +[13]:https://github.com/ONLYOFFICE/DocumentServer diff --git a/published/201602/20150906 How to install Suricata intrusion detection system on Linux.md b/published/201602/20150906 How to install Suricata intrusion detection system on Linux.md new file mode 100644 index 0000000000..89eccf5650 --- /dev/null +++ b/published/201602/20150906 How to install Suricata intrusion detection system on Linux.md @@ -0,0 +1,198 @@ +如何在 Linux 系统上安装 Suricata 入侵检测系统 +================================================================================ + +随着安全威胁的不断发生,入侵检测系统(IDS)在如今的数据中心环境中显得尤为必要。然而,随着越来越多的服务器将他们的网卡升级到10GB/40GB以太网,对如此线路上的硬件进行计算密集型的入侵检测越来越困难。其中一种提升入侵检测系统性能的途径是**多线程入侵检测系统**,它将 CPU 密集型的深度包检测工作并行的分配给多个并发任务来完成。这样的并行检测可以充分利用多核硬件的优势来轻松提升入侵检测系统的吞吐量。在这方面有两个知名的开源项目,分别是 [Suricata][1] 和 [Bro][2]。 + +这个教程里,我会向大家演示**如何在 Linux 服务器上安装和配置 Suricata 入侵检测系统** + +### 在 Linux 上安装 Suricata IDS ### + +让我们从源文件来构建 Suricata,但在此之前,需要按如下所示先安装几个依赖包。 + +#### 在 Debian, Ubuntu 或者 Linux Mint 操作系统上安装依赖包 #### + + $ sudo apt-get install wget build-essential libpcre3-dev libpcre3-dbg automake autoconf libtool libpcap-dev libnet1-dev libyaml-dev zlib1g-dev libcap-ng-dev libjansson-dev + +#### 在 CentOS, Fedora 或者 RHEL 操作系统上安装依赖包 #### + + $ sudo yum install wget libpcap-devel libnet-devel pcre-devel gcc-c++ automake autoconf libtool make libyaml-devel zlib-devel file-devel jansson-devel nss-devel + +一旦将所有依赖包安装完毕,我们就可以继续安装 Suricata 了。 + +首先从 [http://suricata-ids.org/download/][3] 下载 Suricata 源代码,然后构建它。撰写这篇文章的时候,其最新版本号为 2.0.8 。 + + $ wget http://www.openinfosecfoundation.org/download/suricata-2.0.8.tar.gz + $ tar -xvf suricata-2.0.8.tar.gz + $ cd suricata-2.0.8 + $ ./configure --sysconfdir=/etc --localstatedir=/var + +以下是配置信息的样例。 + + Suricata Configuration: + AF_PACKET support: yes + PF_RING support: no + NFQueue support: no + NFLOG support: no + IPFW support: no + DAG enabled: no + Napatech enabled: no + Unix socket enabled: yes + Detection enabled: yes + + libnss support: yes + libnspr support: yes + libjansson support: yes + Prelude support: no + PCRE jit: yes + LUA support: no + libluajit: no + libgeoip: no + Non-bundled htp: no + Old barnyard2 support: no + CUDA enabled: no + +现在可以编译、安装了。 + + $ make + $ sudo make install + +Suricata 源代码带有默认的配置文件。按照如下方法安装这些默认配置文件即可。 + + $ sudo make install-conf + +正如你所料,如果没有IDS规则集的话,Suricata 什么用也没有。幸好 Makefile 为我们提供了 IDS 规则集的安装选项。安装方法如下。 + + $ sudo make install-rules + +以上的规则安装命令会从 [EmergingThreats.net][4] 上下载可用的社区规则集快照,并且将其存储在 /etc/suricata/rules 目录下。 + +![](https://farm1.staticflickr.com/691/20482669553_8b67632277_c.jpg) + +### 首次配置 Suricata IDS ### + +现在到了配置 Suricata 的时候了。配置文件的位置是 **/etc/suricata/suricata.yaml**。参照以下命令,用文本编辑器打开这个文件。 + + $ sudo vi /etc/suricata/suricata.yaml + +文件中有一些运行所需的基本配置。 + +为`default-log-dir`关键字指定 Suricata 日志文件所在的位置。 + + default-log-dir: /var/log/suricata/ + +在`vars`部分下方,你会发现几项对 Suricata 来说很重要变量。`HOME_NET`变量需要指定 Suricata 检查的网络。被分配给 `EXTERNAL_NET` 变量的 `!$HOME_NET` 代表除本地网络之外的其他网络。`XXX_PORTS`变量用来辨别不同服务所用到的端口号。需要注意的是无论使用什么端口,Suricata 都可以自动检测 HTTP 流量。所以是不是正确指定端口就显得没那么重要了。 + + vars: + HOME_NET: "[192.168.122.0/24]" + EXTERNAL_NET: "!$HOME_NET" + HTTP_PORTS: "80" + SHELLCODE_PORTS: "!80" + SSH_PORTS: 22 + +`host-os-policy` 部分用于防御利用操作系统网络栈的自身行为来逃避检测的一些知名攻击手段(例如:TCP reassembly)。作为对策,通过针对目标操作系统而对检测引擎算法进行微调,现代 IDC 提供了“基于目标”的检测手段。因此,如果你知道某台主机运行了什么操作系统的话,将这个信息提供给 Suricata 就可以大幅提高检测的成功率。这就是 `host-os-policy` 存在的意义。本例中,默认的 IDC 策略是 Linux 系统。如果针对某个 IP 地址没有指定操作系统信息,Suricata 会默认应用基于 Linux 系统的检测策略。如下,当捕获到对 192.168.122.0/28 和 192.168.122.155通讯时,Suricata 就会应用基于 Windows 系统的检测策略。 + + host-os-policy: + # These are Windows machines. + windows: [192.168.122.0/28, 192.168.122.155] + bsd: [] + bsd-right: [] + old-linux: [] + # Make the default policy Linux. + linux: [0.0.0.0/0] + old-solaris: [] + solaris: ["::1"] + hpux10: [] + hpux11: [] + irix: [] + macos: [] + vista: [] + windows2k3: [] + +在 `threading` 部分下,你可以为不同的 Suricata 线程指定 CPU 关联。默认状态下,[CPU 关联][5] 是被禁止使用的 (`set-cpu-affinity: no`),这意味着 Suricata 会分配其线程到所有可用的 CPU 核心上。Suricata 会默认为每一个 CPU 核心创建一个检测线程。你可以通过指定 `detect-thread-ratio: N` 来调整此行为。此处会创建 N*M 个检测线程,M 代表 CPU 核心总数。 + + threading: + set-cpu-affinity: no + detect-thread-ratio: 1.5 + +通过以上对线程的设置,Suricata 会创建 1.5*M 个检测线程,M 是系统的 CPU 核心总数。 + +如果你想对 Suricata 配置有更多的了解,可以去翻阅默认配置文件。里边配有有大量的注释以供你清晰理解。 + +### 使用 Suricata 进行入侵监控 ### + +现在是时候让 Suricata 跑起来了,但在这之前还有一个步骤需要去完成。 + +当你使用 pcap 捕获模式的时候,强烈建议关闭 Suricata 监听网卡上的任何的包卸载(例如 LRO/GRO)功能。这些功能会干扰包的实时捕获行为。 + +按照以下方法关闭 eth0 接口的 LRO/GRO 功能。 + + $ sudo ethtool -K eth0 gro off lro off + +这里要注意,在使用某些网卡的情况下,你会看到如下警告信息。忽略它们就行了,这些信息只不过告诉你你的网卡不支持 LRO 功能而已。 + + Cannot change large-receive-offload + +Suricata 支持许多运行模式。运行模式决定着 IDC 会使用何种线程。以下命令可以查看所有 [可用的运行模式][6]。 + + $ sudo /usr/local/bin/suricata --list-runmodes + +![](https://farm6.staticflickr.com/5730/20481140934_25080d04d7_c.jpg) + +Suricata 使用的默认运行模式是 autofp("auto flow pinned load balancing"==“自动流绑定负载均衡” 的缩写)。这个模式下,来自某一个流的包会被分配到一个单独的检测线程中。这些流会根据未被处理的包的最低数量来分配相应的线程。 + +最后,让我们将 Suricata 运行起来,看看它表现如何。 + + $ sudo /usr/local/bin/suricata -c /etc/suricata/suricata.yaml -i eth0 --init-errors-fatal + +![](https://farm1.staticflickr.com/701/21077552366_c577746e36_c.jpg) + +本例中,我们在一个8核心系统中监控 eth0 网络接口。如上所示,Suricata 创建了13个包处理线程和3个管理线程。包处理线程中包括一个 PCAP 包捕获线程,12个检测线程(由8*1.5得出)。这表示 IDS 内的1个包捕获线程均衡负载到12个检测线程中。管理线程包括1个流管理和2个计数/统计相关线程。 + +以下是一个关于Suricata处理的线程截图(由 [htop][7] 绘制)。 + +![](https://farm6.staticflickr.com/5775/20482669593_174f8f41cb_c.jpg) + +Suricata 检测日志存储在 /var/log/suricata 目录下。 + + $ tail -f /var/log/suricata/fast.log + +---------- + + 04/01/2015-15:47:12.559075 [**] [1:2200074:1] SURICATA TCPv4 invalid checksum [**] [Classification: (null)] [Priority: 3] {TCP} 172.16.253.158:22 -> 172.16.253.1:46997 + 04/01/2015-15:49:06.565901 [**] [1:2200074:1] SURICATA TCPv4 invalid checksum [**] [Classification: (null)] [Priority: 3] {TCP} 172.16.253.158:22 -> 172.16.253.1:46317 + 04/01/2015-15:49:06.566759 [**] [1:2200074:1] SURICATA TCPv4 invalid checksum [**] [Classification: (null)] [Priority: 3] {TCP} 172.16.253.158:22 -> 172.16.253.1:46317 + +日志也可以提供 Json 格式以便导入: + + $ tail -f /var/log/suricata/eve.json + +---------- + {"timestamp":"2015-04-01T15:49:06.565901","event_type":"alert","src_ip":"172.16.253.158","src_port":22,"dest_ip":"172.16.253.1","dest_port":46317,"proto":"TCP","alert":{"action":"allowed","gid":1,"signature_id":2200074,"rev":1,"signature":"SURICATA TCPv4 invalid checksum","category":"","severity":3}} + {"timestamp":"2015-04-01T15:49:06.566759","event_type":"alert","src_ip":"172.16.253.158","src_port":22,"dest_ip":"172.16.253.1","dest_port":46317,"proto":"TCP","alert":{"action":"allowed","gid":1,"signature_id":2200074,"rev":1,"signature":"SURICATA TCPv4 invalid checksum","category":"","severity":3}} + +### 总结 ### + +这篇教程中,我为大家演示了如何在一台多核 Linux 服务器上安装 Suricata 入侵检测系统。不同于单线程的 [Snort IDS][8] ,Suricata 可以很容易的从多核硬件的多进程特性所带来的好处中获益。定制 Suricata 来最大化其效能和检测范围是一个很好的主意。Suricata 的粉丝们维护着一个 [在线 Wiki][9],如果你打算将 Suricata 部署到你的环境中,我强烈建议你去那儿取取经。 + +如果你现在已经开始使用 Suricata 了的话,把你的经验也分享出来吧。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/install-suricata-intrusion-detection-system-linux.html + +作者:[Dan Nanni][a] +译者:[mr-ping](https://github.com/mr-ping) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://suricata-ids.org/ +[2]:https://www.bro.org/ +[3]:http://suricata-ids.org/download/ +[4]:http://rules.emergingthreats.net/ +[5]:http://xmodulo.com/run-program-process-specific-cpu-cores-linux.html +[6]:https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Runmodes +[7]:http://ask.xmodulo.com/view-threads-process-linux.html +[8]:http://xmodulo.com/how-to-compile-and-install-snort-from-source-code-on-ubuntu.html +[9]:https://redmine.openinfosecfoundation.org/projects/suricata/wiki diff --git a/published/201602/20151020 30 Years of Free Software Foundation--Best Quotes of Richard Stallman.md b/published/201602/20151020 30 Years of Free Software Foundation--Best Quotes of Richard Stallman.md new file mode 100644 index 0000000000..40a0607bef --- /dev/null +++ b/published/201602/20151020 30 Years of Free Software Foundation--Best Quotes of Richard Stallman.md @@ -0,0 +1,241 @@ +理查德·斯托曼经典语录集锦 +================================================================================ +注:youtube 视频 + + +**理查德·马修·斯托曼(Richard Matthew Stallman)** (RMS) – 神级程序员之一。他是一名程序员,是 GCC、GDB、Emacs 的构建者,软件自由的传教士,[GNU Project][1] 和 [FSF][2] 的创办人。 + +**GNU** 是 “GNU’s Not Unix!”的递归缩写。GNU 是一系列用于基于 Unix 的操作系统的自由软件集合。它能用于 GNU/Hurd 和 Linux 内核。于1983年9月27日公诸于众。常用组件有: + +- GNU Compiler Collection (GCC) +- GNU C library (glibc) +- GNU Core Utilities (coreutils) +- GNU Debugger (GDB) +- GNU Binary Utilities (binutils) +- GNU Bash shell +- GNOME desktop environment + +注:视频 + + +**自由软件基金会(Free Software Foundation)** (FSF) – 一个自由软件的非营利组织,致力于推进计算机用户的自由和捍卫他们的权力。于 1985年10月4日成立。阅读[更多][3]。 + +许多人不理解开源代码(open source code)和自由软件(free software)的区别。每个程序都应该是自由软件: + +- 与目的无关,随心运行程序的自由(自由0)。 +- 学习程序如何运作,并改变它为你所用的自由(自由1)。可以访问源码是这一条的前提。 +- 重新发布副本的自由,如此你便可以帮助你周围的人(自由 2)。 +- 发布自己修改版本给他人的自由(自由 3)。这样能让整个社区有机会从你的改变中受益。可以访问源码是这条的前提。 + +以上为自由软件的四项自由原则。 + +以下为理查德·斯托曼关于自由、软件、社交、哲学等方面的名言摘引。 + +**关于 Facebook:** + +> Facebook is not your friend, it is a surveillance engine. + +Facebook 不是你的朋友,是监控引擎。 + +**关于 Android:** + +> Android is very different from the GNU/Linux operating system because it contains very little of GNU. Indeed, just about the only component in common between Android and GNU/Linux is Linux, the kernel. + +Android 和 GNU/Linux 有很大的区别,因为其中几乎没有 GNU。的确,Android 和 GNU/Linux 之间仅有一个共同组件,那就是内核 - Linux。 + +**关于计算机行业:** + +> The computer industry is the only industry that is more fashion-driven than women's fashion. + +计算机行业是唯一一个比女性时尚业更容易受潮流影响的行业了。 + +**关于云计算:** + +> The interesting thing about cloud computing is that we've redefined cloud computing to include everything that we already do. + +关于云计算,有趣的是我们已经重新定义了云计算来包含我们曾干过的所有事。 + +**关于伦理:** + +> Whether gods exist or not, there is no way to get absolute certainty about ethics. Without absolute certainty, what do we do? We do the best we can. + +无论神存在与否,都没有绝对的伦理道德。没有这份理所当然,我们该如何?也唯有尽善吧。 + +**关于自由:** + +> Free software is software that respects your freedom and the social solidarity of your community. So it's free as in freedom. + +自由软件是尊重个人自由和社会团结的软件。所以才能如自由般自由自在。 + +**关于目标和理想:** + +> If you want to accomplish something in the world, idealism is not enough - you need to choose a method that works to achieve the goal. + +如果你想为这世界做些什么,仅有理想是不够的,你需要找条通往目标的道路并走完。 + +**关于分享:** + +> Sharing is good, and with digital technology, sharing is easy. + +分享很棒,而且数字化技术也使分享变得容易。 + +**关于 facebook(进阶版):** + +> Facebook mistreats its users. Facebook is not your friend; it is a surveillance engine. For instance, if you browse the Web and you see a 'like' button in some page or some other site that has been displayed from Facebook. Therefore, Facebook knows that your machine visited that page. + +Facebook 蹂躏它们的用户。它不是你们的朋友;它就是个监控引擎。举个例子,你是否曾在一些网页或网站上看到 Facebook 的 “like” 按键。对,Facebook 知道你的电脑曾访问过那些网页。 + +**关于 web 应用:** + +> One reason you should not use web applications to do your computing is that you lose control. + +给你个为什么不应该使用 web 应用的理由,因为你失去了计算机的控制权。 + +> If you use a proprietary program or somebody else's web server, you're defenceless. You're putty in the hands of whoever developed that software. + +如果你使用私有程序或他人的 web 服务器,那么你只能任人鱼肉。被软件的开发者轻易操纵。 + +**关于书:** + +> With paper printed books, you have certain freedoms. You can acquire the book anonymously by paying cash, which is the way I always buy books. I never use a credit card. I don't identify to any database when I buy books. Amazon takes away that freedom. + +印刷出来的书,当然是自由的。你可以付现金匿名买书,这也是我一直买书的方式。我绝不会使用信用卡,我买书时不会被任何数据库记下。是亚马逊把自由夺走了。 + +**关于 MPAA:** + +> Officially, MPAA stands for Motion Picture Association of America, but I suggest that MPAA stands for Malicious Power Attacking All. + +MPAA 其实是美国电影协会(Motion Picture Association of America),但我认为叫做攻击万物的邪恶力量(Malicious Power Attacking All)更为合适。 + +**关于金钱与职业:** + +> I could have made money this way, and perhaps amused myself writing code. But I knew that at the end of my career, I would look back on years of building walls to divide people, and feel I had spent my life making the world a worse place. + +我可以找份工作赚钱,并沉浸在编码的快乐中。但在职业生涯结束后,回首目睹自己筑就的高墙将人与人分隔开,我会觉得我耗尽毕生精力只换来了一个更糟糕的世界。 + +**关于私有软件:** + +> Proprietary software keeps users divided and helpless. Divided because each user is forbidden to redistribute it to others, and helpless because the users can't change it since they don't have the source code. They can't study what it really does. So the proprietary program is a system of unjust power. + +私有软件使用户孤立、无助。因为禁止将软件给他人使用所以孤立,因为无法改变源码所以无助。他们不能学习其中真正的工作方式,所以整个私有软件体系就是一种不公的力量。 + +**关于智能手机:** + +> A smartphone is a computer - it's not built using a computer - the job it does is the job of being a computer. So, everything we say about computers, that the software you run should be free - you should insist on that - applies to smart phones just the same. And likewise to those tablets. + +智能手机就是电脑 —— 虽然做的和常用的电脑不同 —— 但是却能干电脑能干的活。所以我们所说的一切有关于电脑上的软件应该能自由运行 —— 必须坚持这一点 —— 在智能手机上也是这样,当然也包括平板。 + +**关于 CD 和数字内容:** + +> CD stores have the disadvantage of an expensive inventory, but digital bookshops would need no such thing: they could write copies at the time of sale on to memory sticks, and sell you one if you forgot your own. + +CD 商店有一个弱势就是需要昂贵的库存,但是电子商店就没有这方面的需求:他们只需要将售卖的副本写入记忆棒,并在你忘带自己的记忆棒时卖你一个就是了。 + +**关于竞争范式(paradigm of competition):** + +> The paradigm of competition is a race: by rewarding the winner, we encourage everyone to run faster. When capitalism really works this way, it does a good job; but its defenders are wrong in assuming it always works this way. + +竞争范式就像是赛跑:奖励胜者,鼓励每一个跑得更快的人。当资本主义真的这样运作时,当然是件好事;但是维护它的人若是假设它一直这样运作的话那就大错特错了。 + +**关于 vi 和 emacs:** + +> People sometimes ask me if it is a sin in the Church of Emacs to use vi. Using a free version of vi is not a sin; it is a penance. So happy hacking. + +有时会有人问我在 Emacs 的阵营使用 vi 是不是一种罪过。使用自由版的 vi 并不是一种罪过;是一种自我惩罚。所以好好享受其中乐趣吧。 + +**关于自由和历史:** + +> Value your freedom or you will lose it, teaches history. 'Don't bother us with politics', respond those who don't want to learn. + +历史告诉我们不珍惜自由便失去自由,然而有的人不懂吸取教训,只知道说“别拿政治烦我们”。 + +**关于专利:** + +> Fighting patents one by one will never eliminate the danger of software patents, any more than swatting mosquitoes will eliminate malaria. + +和专利一个一个的战斗并不能解决软件专利带来的危害,就像打再多的蚊子也消灭不了疟疾一样。 + +> Software patents are dangerous to software developers because they impose monopolies on software ideas. + +软件专利对于软件的开发者来说十分危险,因为它们加剧了对于软件理念的垄断。 + +**关于版权:** + +> In practice, the copyright system does a bad job of supporting authors, aside from the most popular ones. Other authors' principal interest is to be better known, so sharing their work benefits them as well as readers. + +其实,版权制度对作者也没有什么好处,撇开最受欢迎的那个,其他作者的主旨可能更好理解,所以分享无论对他们还是你的读者都是一件好事。 + +**关于工作与报酬:** + +> There is nothing wrong with wanting pay for work, or seeking to maximize one's income, as long as one does not use means that are destructive. + +劳有所得,或寻求收入的最大化并没有什么错,只要不是不择手段。 + +**关于 Chrome OS:** + +> In essence, Chrome OS is the GNU/Linux operating system. However, it is delivered without the usual applications, and rigged up to impede and discourage installing applications. + +Chrome OS 确实是 GNU/Linux 的操作系统。但是,它在发布时没有安装常用应用,并为安装他们设置了阻碍。 + +**关于 Linux 用户:** + +> Many users of the GNU/Linux system will not have heard the ideas of free software. They will not be aware that we have ideas, that a system exists because of ethical ideals, which were omitted from ideas associated with the term 'open source.' + +许多的 GNU/Linux 用户并没有听过自由软件。他们并没有意识到,这个系统是因为道德理想才存在的,与此一起被忽视的还有所谓的“开源”。 + +**关于 facebook 的隐私:** + +> If there is a Like button in a page, Facebook knows who visited that page. And it can get IP address of the computer visiting the page even if the person is not a Facebook user. + +如果页面上有 “like” 按键,Facebook 就能知道谁访问了页面。即使不是 Facebook 的用户,也可以得到访问该页面电脑的 IP 地址。 + +**关于编程:** + +> Programming is not a science. Programming is a craft. + +编程不是科学,编程是手艺。 + +> My favorite programming languages are Lisp and C. However, since around 1992 I have worked mainly on free software activism, which means I am too busy to do much programming. Around 2008 I stopped doing programming projects. + +Lisp 和 C 语言是我的最爱。然自 1992 年以来我主要工作在自由软件活动上,导致我太忙了,没法做更多的编程。大概在 2008 年我便停止了做编程项目。 + +> C++ is a badly designed and ugly language. It would be a shame to use it in Emacs. + +C++ 设计的真糟糕、真丑陋。在 Emacs 上用它应该觉得羞愧。 + +**关于钻研(hacking)和学习编程:** + +> People could no longer learn hacking the way I did, by starting to work on a real operating system, making real improvements. In fact, in the 1980s I often came across newly graduated computer science majors who had never seen a real program in their lives. They had only seen toy exercises, school exercises, because every real program was a trade secret. They never had the experience of writing features for users to really use, and fixing the bugs that real users came across. The things you need to know to do real work. + +(时过境迁,)人们没法再像我当初那样通过改进实实在在的操作系统来学习编程了。上世纪 80 年代,我常遇见计算机专业的毕业生,有生以来没见过真正的程序。他们接触的到的只有小玩意和学校的作业,因为每一个程序都是商业机密。他们没有机会为用户去写真正实用的特性,修复用户真正遭遇的问题。而这些正是真正的工作中你需要掌握的(东西)。 + +> It is hard to write a simple definition of something as varied as hacking, but I think what these activities have in common is playfulness, cleverness, and exploration. Thus, hacking means exploring the limits of what is possible, in a spirit of playful cleverness. Activities that display playful cleverness have "hack value". + +对于如“hacking”这般多样化的东西真的很难简单的下定义,不过在我看来诸如此类的行为都会有以下的这些共同点:嬉乐、智慧和探索。因此,hacking 意味着对可能的极限的探索,一颗向往快乐与智慧的心。能带来快乐与智慧的行为就有 “hack 的价值” 。 + +**关于浏览网页:** + +> For personal reasons, I do not browse the web from my computer. (I also have no net connection much of the time.) To look at page I send mail to a daemon which runs wget and mails the page back to me. It is very efficient use of my time, but it is slow in real time. + +出于个人原因,我不会在我的电脑上浏览网页。(大部分时间处于没有网络连接的状态。)要浏览网页,我需要给一个守护进程发 mail,然后它会运行 wget 并把页面通过 mail 发还给我。这对我而言已经是最效率了,但那真的比实时慢太多了。 + +**关于音乐共享:** + +> Friends share music with each other, they don't allow themselves to be divided by a system that says that nobody is supposed to have copies. + +朋友之间彼此分享音乐,绝不会希望因为系统的一句:“禁止私下拷贝!”而生分。 + +-------------------------------------------------------------------------------- + +via: https://tlhp.cf/fsf-richard-stallman/ + +作者:[Pavlo Rudyi][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://tlhp.cf/fsf-richard-stallman/ +[1]:http://www.gnu.org/ +[2]:http://www.fsf.org/ +[3]:https://www.fsf.org/about/ \ No newline at end of file diff --git a/published/201602/20151030 80 Linux Monitoring Tools for SysAdmins.md b/published/201602/20151030 80 Linux Monitoring Tools for SysAdmins.md new file mode 100644 index 0000000000..b78c23fa41 --- /dev/null +++ b/published/201602/20151030 80 Linux Monitoring Tools for SysAdmins.md @@ -0,0 +1,604 @@ +最全列表: 80 多个 Linux 系统管理员必备的监控工具 +================================================================================ + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/linux-monitoring.jpg) + +随着互联网行业的不断发展,各种监控工具多得不可胜数。这里列出网上最全的监控工具。让你可以拥有超过80种方式来管理你的机器。在本文中,我们主要包括以下方面: + +- 命令行工具 +- 网络相关内容 +- 系统相关的监控工具 +- 日志监控工具 +- 基础设施监控工具 + +监控和调试性能问题是一个艰巨的任务,但用对了正确的工具有时也是很容易的。下面是一些你可能听说过的工具,也有可能没有听说过——何不赶快开始试试? + +### 八大系统监控工具 ### + +#### 1. top #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/top.jpg) + +这是一个被预装在许多 UNIX 系统中的小工具。当你想要查看在系统中运行的进程或线程时:top 是一个很好的工具。你可以对这些进程以不同的方式进行排序,默认是以 CPU 进行排序的。 + +#### 2. [htop][1] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/htop.jpg) + +htop 实质上是 top 的一个增强版本。它更容易对进程排序。它看起来上更容易理解,并且已经内建了许多通用操作。它也是完全交互式的。 + +#### 3. [atop][2] #### + +atop 和 top,htop 非常相似,它也能监控所有进程,但不同于 top 和 htop 的是,它可以按日记录进程的日志供以后分析。它也能显示所有进程的资源消耗。它还会高亮显示已经达到临界负载的资源。 + +#### 4. [apachetop][3] #### + +apachetop 会监控 apache 网络服务器的整体性能。它主要是基于 mytop。它会显示当前的读取进程、写入进程的数量以及请求进程的总数。 + +#### 5. [ftptop][4] #### + +ftptop 给你提供了当前所有连接到 ftp 服务器的基本信息,如会话总数,正在上传和下载的客户端数量以及客户端是谁。 + +#### 6. [mytop][5] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/mytop.jpg) + +mytop 是一个很简洁的工具,用于监控 mysql 的线程和性能。它能让你实时查看数据库以及正在处理哪些查询。 + +#### 7. [powertop][6] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/powertop.jpg) + +powertop 可以帮助你诊断与电量消耗和电源管理相关的问题。它也可以帮你进行电源管理设置,以实现对你服务器最有效的配置。你可以使用 tab 键切换选项卡。 + +#### 8. [iotop][7] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/iotop.jpg) + +iotop 用于检查 I/O 的使用情况,并为你提供了一个类似 top 的界面来显示。它按列显示读和写的速率,每行代表一个进程。当发生交换或 I/O 等待时,它会显示进程消耗时间的百分比。 + +### 与网络相关的监控 ### + +#### 9. [ntopng][8] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/ntopng.jpg) + +ntopng 是 ntop 的升级版,它提供了一个能通过浏览器进行网络监控的图形用户界面。它还有其他用途,如:地理定位主机,显示网络流量和 ip 流量分布并能进行分析。 + +#### 10. [iftop][9] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/iftop.jpg) + +iftop 类似于 top,但它主要不是检查 cpu 的使用率而是监听所选择网络接口的流量,并以表格的形式显示当前的使用量。像“为什么我的网速这么慢呢?!”这样的问题它可以直接回答。 + +#### 11. [jnettop][10] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/jnettop.jpg) + +jnettop 以相同的方式来监测网络流量但比 iftop 更形象。它还支持自定义的文本输出,并能以友好的交互方式来深度分析日志。 + +#### 12. [bandwidthd][11] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/bandwidthd.jpg) + +BandwidthD 可以跟踪 TCP/IP 网络子网的使用情况,并能在浏览器中通过 png 图片形象化地构建一个 HTML 页面。它有一个数据库系统,支持搜索、过滤,多传感器和自定义报表。 + +#### 13. [EtherApe][12] #### + +EtherApe 以图形化显示网络流量,可以支持更多的节点。它可以捕获实时流量信息,也可以从 tcpdump 进行读取。也可以使用 pcap 格式的网络过滤器来显示特定信息。 + +#### 14. [ethtool][13] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/ethtool.jpg) + +ethtool 用于显示和修改网络接口控制器的一些参数。它也可以用来诊断以太网设备,并获得更多的统计数据。 + +#### 15. [NetHogs][14] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/nethogs.jpg) + +NetHogs 打破了网络流量按协议或子网进行统计的惯例,它以进程来分组。所以,当网络流量猛增时,你可以使用 NetHogs 查看是由哪个进程造成的。 + +#### 16. [iptraf][15] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/iptraf.jpg) + +iptraf 收集的各种指标,如 TCP 连接数据包和字节数,端口统计和活动指标,TCP/UDP 通信故障,站内数据包和字节数。 + +#### 17. [ngrep][16] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/ngrep.jpg) + +ngrep 就是网络层的 grep。它使用 pcap ,允许通过指定扩展正则表达式或十六进制表达式来匹配数据包。 + +#### 18. [MRTG][17] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/mrtg.jpg) + +MRTG 最初被开发来监控路由器的流量,但现在它也能够监控网络相关的东西。它每五分钟收集一次,然后产生一个 HTML 页面。它还具有发送邮件报警的能力。 + +#### 19. [bmon][18] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/bmon.jpg) + +bmon 能监控并帮助你调试网络。它能捕获网络相关的统计数据,并以友好的方式进行展示。你还可以与 bmon 通过脚本进行交互。 + +#### 20. traceroute #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/traceroute.jpg) + +traceroute 是一个内置工具,能显示路由和测量数据包在网络中的延迟。 + +#### 21. [IPTState][19] #### + +IPTState 可以让你观察流量是如何通过 iptables,并通过你指定的条件来进行排序。该工具还允许你从 iptables 的表中删除状态信息。 + +#### 22. [darkstat][20] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/darkstat.jpg) + +darkstat 能捕获网络流量并计算使用情况的统计数据。该报告保存在一个简单的 HTTP 服务器中,它为你提供了一个非常棒的图形用户界面。 + +#### 23. [vnStat][21] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/vnstat.jpg) + +vnStat 是一个网络流量监控工具,它的数据统计是由内核进行提供的,其消耗的系统资源非常少。系统重新启动后,它收集的数据仍然存在。有艺术感的系统管理员可以使用它的颜色选项。 + +#### 24. netstat #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/netstat.jpg) + +netstat 是一个内置的工具,它能显示 TCP 网络连接,路由表和网络接口数量,被用来在网络中查找问题。 + +#### 25. ss #### + +比起 netstat,使用 ss 更好。ss 命令能够显示的信息比 netstat 更多,也更快。如果你想查看统计结果的总信息,你可以使用命令 `ss -s`。 + +#### 26. [nmap][22] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/nmap.jpg) + +Nmap 可以扫描你服务器开放的端口并且可以检测正在使用哪个操作系统。但你也可以将其用于 SQL 注入漏洞、网络发现和渗透测试相关的其他用途。 + +#### 27. [MTR][23] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/mtr.jpg) + +MTR 将 traceroute 和 ping 的功能结合到了一个网络诊断工具上。当使用该工具时,它会限制单个数据包的跳数,然后监视它们的到期时到达的位置。然后每秒进行重复。 + +#### 28. [Tcpdump][24] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/tcpdump.jpg) + +Tcpdump 将按照你在命令行中指定的表达式输出匹配捕获到的数据包的信息。你还可以将此数据保存并进一步分析。 + +#### 29. [Justniffer][25] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/justniffer.jpg) + +Justniffer 是 tcp 数据包嗅探器。使用此嗅探器你可以选择收集低级别的数据还是高级别的数据。它也可以让你以自定义方式生成日志。比如模仿 Apache 的访问日志。 + +### 与系统有关的监控 ### + +#### 30. [nmon][26] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/nmon.jpg) + +nmon 将数据输出到屏幕上的,或将其保存在一个以逗号分隔的文件中。你可以查看 CPU,内存,网络,文件系统,前列 进程。数据也可以被添加到 RRD 数据库中用于进一步分析。 + +#### 31. [conky][27] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/cpulimit.jpg) + +Conky 能监视很多的操作系统数据。它支持 IMAP 和 POP3, 甚至许多流行的音乐播放器!出于方便不同的人,你可以使用自己的 Lua 脚本或程序来进行扩展。 + +#### 32. [Glances][28] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/glances.jpg) + +使用 Glances 监控你的系统,其旨在使用最小的空间为你呈现最多的信息。它可以在客户端/服务器端模式下运行,也有远程监控的能力。它也有一个 Web 界面。 + +#### 33. [saidar][29] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/saidar.jpg) + +Saidar 是一个非常小的工具,为你提供有关系统资源的基础信息。它将系统资源在全屏进行显示。重点是 saidar 会尽可能的简化。 + +#### 34. [RRDtool][30] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/rrdtool.jpg) + +RRDtool 是用来处理 RRD 数据库的工具。RRDtool 旨在处理时间序列数据,如 CPU 负载,温度等。该工具提供了一种方法来提取 RRD 数据并以图形界面显示。 + +#### 35. [monit][31] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/monit.jpg) + +如果出现故障时,monit 有发送警报以及重新启动服务的功能。它可以对各种数据进行检查,你可以为 monit 写一个脚本,它有一个 Web 用户界面来分担你眼睛的压力。 + +#### 36. [Linux process explorer][32] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/linux-process-monitor.jpg) + +Linux process explorer 是类似 OSX 或 Windows 的活动监视器。它比 top 或 ps 的使用范围更广。你可以查看每个进程的内存消耗以及 CPU 的使用情况。 + +#### 37. df #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/df.jpg) + +df 是 disk free 的缩写,它是所有 UNIX 系统预装的程序,用来显示用户有访问权限的文件系统的可用磁盘空间。 + +#### 38. [discus][33] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/discus.jpg) + +discus 类似于 df,它的目的是通过使用更吸引人的特性,如颜色,图形和数字来对 df 进行改进。 + +#### 39. [xosview][34] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/xosview.jpg) + +xosview 是一款经典的系统监控工具,它给你提供包括 IRQ 在内的各个不同部分的简单总览。 + +#### 40. [Dstat][35] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/dstat.jpg) + +dstat 旨在替代 vmstat,iostat,netstat 和 ifstat。它可以让你查实时查看所有的系统资源。这些数据可以导出为 CSV。最重要的是 dstat 允许使用插件,因此其可以扩展到更多领域。 + +#### 41. [Net-SNMP][36] #### + +SNMP 即“简单网络管理协议”,Net-SNMP 工具套件使用该协议可帮助你收集服务器的准确信息。 + +#### 42. [incron][37] #### + +incron 允许你监控一个目录树,然后对这些变化采取措施。如果你想在目录‘a’中出现新文件时,将其复制到目录‘b’,这正是 incron 能做的。 + +#### 43. [monitorix][38] #### + +Monitorix 是轻量级的系统监控工具。它可以帮助你监控单独一台机器,并为你提供丰富的指标。它也有一个内置的 HTTP 服务器,来查看图表和所有指标的报告。 + +#### 44. vmstat #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/vmstat.jpg) + +vmstat(virtual memory statistics)是一个小型内置工具,能监控和显示机器的内存。 + +#### 45. uptime #### + +这个小程序能快速显示你机器运行了多久,目前有多少用户登录和系统过去1分钟,5分钟和15分钟的平均负载。 + +#### 46. mpstat #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/mpstat.jpg) + +mpstat 是一个内置的工具,能监视 cpu 的使用情况。最常见的使用方法是 `mpstat -P ALL`,它给你提供 cpu 的使用情况。你也可以间歇性地更新 cpu 的使用情况。 + +#### 47. pmap #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/pmap.jpg) + +pmap 是一个内置的工具,报告一个进程的内存映射。你可以使用这个命令来找出导致内存瓶颈的原因。 + +#### 48. ps #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/ps.jpg) + +该命令将给你当前所有进程的概述。你可以使用 `ps -A` 命令查看所有进程。 + +#### 49. [sar][39] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/sar.jpg) + +sar 是 sysstat 包的一部分,可以帮助你收集、报告和保存不同系统的指标。使用不同的参数,它会给你提供 CPU、 内存和 I/O 使用情况及其他东西。 + +#### 50. [collectl][40] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/collectl.jpg) + +类似于 sar,collectl 收集你机器的性能指标。默认情况下,显示 cpu、网络和磁盘统计数据,但它实际收集了很多信息。与 sar 不同的是,collectl 能够处理比秒更小的单位,它可以被直接送入绘图工具并且 collectl 的监控过程更广泛。 + +#### 51. [iostat][41] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/iostat.jpg) + +iostat 也是 sysstat 包的一部分。此命令用于监控系统的输入/输出。其报告可以用来进行系统调优,以更好地调节你机器上硬盘的输入/输出负载。 + +#### 52. free #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/free.jpg) + +这是一个内置的命令,用于显示你机器上可用的内存大小以及已使用的内存大小。它还可以显示某时刻内核所使用的缓冲区大小。 + +#### 53. /proc 文件系统 #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/procfile.jpg) + +proc 文件系统可以让你查看内核的统计信息。从这些统计数据可以得到你机器上不同硬件设备的详细信息。看看这个 [proc 文件统计的完整列表][42]。 + +#### 54. [GKrellM][43] #### + +GKrellm 是一个图形应用程序,用来监控你硬件的状态信息,像CPU,内存,硬盘,网络接口以及其他的。它也可以监视并启动你所选择的邮件阅读器。 + +#### 55. [Gnome 系统监控器][44] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/gnome-system-monitor.jpg) + +Gnome 系统监控器是一个基本的系统监控工具,其能通过一个树状结构来查看进程的依赖关系,能杀死进程及调整进程优先级,还能以图表形式显示所有服务器的指标。 + +### 日志监控工具 ### + +#### 56. [GoAccess][45] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/goaccess.jpg) + +GoAccess 是一个实时的网络日志分析器,它能分析 apache, nginx 和 amazon cloudfront 的访问日志。它也可以将数据输出成 HTML,JSON 或 CSV 格式。它会给你一个基本的统计信息、访问量、404 页面,访客位置和其他东西。 + +#### 57. [Logwatch][46] #### + +Logwatch 是一个日志分析系统。它通过分析系统的日志,并为你所指定的部分创建一个分析报告。它每天给你一个报告,以便让你花费更少的时间来分析日志。 + +#### 58. [Swatch][47] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/swatch.jpg) + +像 Logwatch 一样,Swatch 也监控你的日志,但不是给你一个报告,它会匹配你定义的正则表达式,当匹配到后会通过邮件或控制台通知你。它可用于检测入侵者。 + +#### 59. [MultiTail][48] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/multitail.jpg) + +MultiTail 可帮助你在多个窗口之下监控日志文件。你可以将这些日志文件合并到一个窗口。它可以通过正则表达式的帮助,使用不同的颜色来显示日志文件以方便你阅读。 + +### 系统工具 ### + +#### 60. [acct or psacct][49] #### + +acct 也称 psacct(取决于如果你使用 apt-get 还是 yum)可以监控所有用户执行的命令,包括 CPU 时间和内存占用。一旦安装完成后你可以使用命令 `sa` 来查看统计。 + +#### 61. [whowatch][50] #### + +类似 acct,这个工具监控系统上所有的用户,并允许你实时查看他们正在执行的命令及运行的进程。它将所有进程以树状结构输出,这样你就可以清楚地看到到底发生了什么。 + +#### 62. [strace][51] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/strace.jpg) + +strace 被用于诊断、调试和监控程序之间的相互调用过程。最常见的做法是用 strace 打印系统调用的程序列表,其可以看出程序是否像预期那样被执行了。 + +#### 63. [DTrace][52] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/dtrace.jpg) + +DTrace 可以说是 strace 的大哥。它动态地跟踪与检测代码实时运行的指令。它允许你深入分析其性能和诊断故障。但是,它并不简单,关于这个话题有1200本书之多。 + +#### 64. [webmin][53] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/webmin.jpg) + +Webmin 是一个基于 Web 的系统管理工具。它不需要手动编辑 UNIX 配置文件,可以让你远程管理系统。它有一对监控模块用于连接它。 + +#### 65. stat #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/stat.jpg) + +Stat 是一个内置的工具,用于显示文件和文件系统的状态信息。它会显示文件何时被修改、访问或更改。 + +#### 66. ifconfig #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/ifconfig.jpg) + +ifconfig 是一个内置的工具,用于配置网络接口。大多数网络监控工具背后都使用 ifconfig 将网卡设置成混乱模式来捕获所有的数据包。你可以手动执行 `ifconfig eth0 promisc` 进入混乱模式,使用 `ifconfig eth0 -promisc` 返回正常模式。 + +#### 67. [ulimit][54] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/unlimit.jpg) + +ulimit 是一个内置的工具,可监控系统资源,并可以限制任何监控资源不得超标。比如做一个 fork 炸弹,如果使用 ulimit 正确配置了将完全不受影响。 + +#### 68. [cpulimit][55] #### + +CPULimit 是一个小工具,用于监控并限制进程对 CPU 的使用率。其特别可以用于将批处理作业对 CPU 的使用率保持在一定范围。 + +#### 69. lshw #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/lshw.jpg) + +lshw 是一个小的内置工具,能提取关于本机硬件配置的详细信息。它可以输出 CPU 版本和主板配置。 + +#### 70. w #### + +w 是一个内置命令,用于显示当前登录用户的信息及他们所运行的进程。 + +#### 71. lsof #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/lsof.jpg) + +lsof 是一个内置的工具,可让你列出所有打开的文件和网络连接。从那里你可以看到文件是由哪个进程打开的,基于进程名可找到其特定的用户,或杀死属于某个用户的所有进程。 + +### 基础架构监控工具 ### + +#### 72. Server Density #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/server-density-monitoring.png) + +我们的 [服务器监控工具][56] 它有一个 web 界面,使你可以进行报警设置并可以通过图表来查看所有系统的网络指标。你还可以设置监控的网站,无论是否在线。Server Density 允许你设置用户的权限,你可以根据我们的插件或 api 来扩展你的监控。该服务已经支持 Nagios 的插件了。 + +#### 73. [OpenNMS][57] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/opennms.jpg) + +OpenNMS 主要有四个功能区:事件管理和通知;发现和配置;服务监控和数据收集。其设计为可被在多种网络环境中定制。 + +#### 74. [SysUsage][58] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/sysusage.jpg) + +SysUsage 通过 Sar 和其他系统命令持续监控你的系统。一旦达到阈值它也可以进行报警通知。SysUsage 本身也可以收集所有的统计信息并存储在一个地方。它有一个 Web 界面可以让你查看所有的统计数据。 + +#### 75. [brainypdm][59] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/brainypdm.jpg) + +brainypdm 是一个数据管理和监控工具,它能收集来自 nagios 或其它常规来源的数据并以图表显示。它是跨平台的,其基于 Web 并可自定义图形。 + +#### 76. [PCP][60] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/pcp.jpg) + +PCP 可以收集来自多个主机的指标,并且效率很高。它也有一个插件框架,所以你可以让它收集对你很重要的指标。你可以通过任何一个 Web 界面或 GUI 访问图形数据。它比较适合大型监控系统。 + +#### 77. [KDE 系统守护][61] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/kdesystemguard.jpg) + +这个工具既是一个系统监控器也是一个任务管理器。你可以通过工作表来查看多台机器的服务指标,如果需要杀死一个进程或者你需要启动一个进程,它可以在 KDE 系统守护中来完成。 + +#### 78. [Munin][62] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/munin.jpg) + +Munin 既是一个网络也是系统监控工具,当一个指标超出给定的阈值时它会提供报警机制。它运用 RRDtool 创建图表,并且它也有 Web 界面来显示这些图表。它更强调的是即插即用的功能并且有许多可用的插件。 + +#### 79. [Nagios][63] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/nagios.jpg) + +Nagios 是系统和网络监控工具,可帮助你监控多台服务器。当发生错误时它也有报警功能。它的平台也有很多的插件。 + +#### 80. [Zenoss][64] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/zenoss.jpg) + +Zenoss 提供了一个 Web 界面,使你可以监控所有的系统及网络指标。此外,它能自动发现网络资源和修改网络配置。并且会提醒你采取行动,它也支持 Nagios 的插件。 + +#### 81. [Cacti][65] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/cacti.jpg) + +(和上一个一样!) Cacti 是一个网络图形解决方案,其使用 RRDtool 进行数据存储。它允许用户在预定的时间间隔进行投票服务并将结果以图形显示。Cacti 可以通过 shell 脚本扩展来监控你所选择的来源。 + +#### 82. [Zabbix][66] #### + +![](https://serverdensity-wpengine.netdna-ssl.com/wp-content/uploads/2015/02/zabbix-monitoring.png) + +Zabbix 是一个开源的基础设施监控解决方案。它使用了许多数据库来存放监控统计信息。其核心是用 C 语言编写,并在前端中使用 PHP。如果你不喜欢安装代理端,Zabbix 可能是一个最好选择。 + +### 附加部分: ### + +感谢您的建议。这是我们的一个附加部分,由于我们需要重新编排所有的标题,鉴于此,这是在最后的一个简短部分,根据您的建议添加的一些 Linux 监控工具: + +#### 83. [collectd][67] #### + +Collectd 是一个 Unix 守护进程,用来收集所有的监控数据。它采用了模块化设计并使用插件来填补一些缺陷。这样能使 collectd 保持轻量级并可进行定制。 + +#### 84. [Observium][68] #### + +Observium 是一个自动发现网络的监控平台,支持大量硬件平台和操作系统。Observium 专注于提供一个优美、功能强大、简单直观的界面来显示网络的健康和状态。 + +#### 85. Nload #### + +这是一个命令行工具来监控网络的吞吐量。它很整洁,因为它使用两个图表和其他一些类似传输的数据总量这样的有用数据来对进出站流量进行可视化。你可以使用如下方法安装它: + + yum install nload + +或者 + + sudo apt-get install nload + +#### 86. [SmokePing][69] #### + +SmokePing 可以跟踪你网络延迟,并对他们进行可视化。有各种为 SmokePing 开发的延迟测量插件。如果图形用户界面对你来说非常重要,现在有一个正在开发中的插件来实现此功能。 + +#### 87. [MobaXterm][70] #### + +如果你整天在 windows 环境下工作。你可能会觉得 Windows 下终端窗口的限制。MobaXterm 正是由此而来的,它允许你使用多个通常出现在 Linux 中的命令。这将会极大地帮助你在监控方面的需求! + +#### 88. [Shinken monitoring][71] #### + +Shinken 是一个监控框架,其是采用 python 对 Nagios 进行了完全重写。它的目的是增强灵活性和管理更大环境。但仍保持所有的 nagios 配置和插件。 + +-------------------------------------------------------------------------------- + +via: https://blog.serverdensity.com/80-linux-monitoring-tools-know/ + +作者:[Jonathan Sundqvist][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + + +[a]:https://www.serverdensity.com/ +[1]:http://hisham.hm/htop/ +[2]:http://www.atoptool.nl/ +[3]:https://github.com/JeremyJones/Apachetop +[4]:http://www.proftpd.org/docs/howto/Scoreboard.html +[5]:http://jeremy.zawodny.com/mysql/mytop/ +[6]:https://01.org/powertop +[7]:http://guichaz.free.fr/iotop/ +[8]:http://www.ntop.org/products/ntop/ +[9]:http://www.ex-parrot.com/pdw/iftop/ +[10]:http://jnettop.kubs.info/wiki/ +[11]:http://bandwidthd.sourceforge.net/ +[12]:http://etherape.sourceforge.net/ +[13]:https://www.kernel.org/pub/software/network/ethtool/ +[14]:http://nethogs.sourceforge.net/ +[15]:http://iptraf.seul.org/ +[16]:http://ngrep.sourceforge.net/ +[17]:http://oss.oetiker.ch/mrtg/ +[18]:https://github.com/tgraf/bmon/ +[19]:http://www.phildev.net/iptstate/index.shtml +[20]:https://unix4lyfe.org/darkstat/ +[21]:http://humdi.net/vnstat/ +[22]:http://nmap.org/ +[23]:http://www.bitwizard.nl/mtr/ +[24]:http://www.tcpdump.org/ +[25]:http://justniffer.sourceforge.net/ +[26]:http://nmon.sourceforge.net/pmwiki.php +[27]:http://conky.sourceforge.net/ +[28]:https://github.com/nicolargo/glances +[29]:https://packages.debian.org/sid/utils/saidar +[30]:http://oss.oetiker.ch/rrdtool/ +[31]:http://mmonit.com/monit +[32]:http://sourceforge.net/projects/procexp/ +[33]:http://packages.ubuntu.com/lucid/utils/discus +[34]:http://www.pogo.org.uk/~mark/xosview/ +[35]:http://dag.wiee.rs/home-made/dstat/ +[36]:http://www.net-snmp.org/ +[37]:http://inotify.aiken.cz/?section=incron&page=about&lang=en +[38]:http://www.monitorix.org/ +[39]:http://sebastien.godard.pagesperso-orange.fr/ +[40]:http://collectl.sourceforge.net/ +[41]:http://sebastien.godard.pagesperso-orange.fr/ +[42]:http://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html +[43]:http://members.dslextreme.com/users/billw/gkrellm/gkrellm.html +[44]:http://freecode.com/projects/gnome-system-monitor +[45]:http://goaccess.io/ +[46]:http://sourceforge.net/projects/logwatch/ +[47]:http://sourceforge.net/projects/swatch/ +[48]:http://www.vanheusden.com/multitail/ +[49]:http://www.gnu.org/software/acct/ +[50]:http://whowatch.sourceforge.net/ +[51]:http://sourceforge.net/projects/strace/ +[52]:http://dtrace.org/blogs/about/ +[53]:http://www.webmin.com/ +[54]:http://ss64.com/bash/ulimit.html +[55]:https://github.com/opsengine/cpulimit +[56]:https://www.serverdensity.com/server-monitoring/ +[57]:http://www.opennms.org/ +[58]:http://sysusage.darold.net/ +[59]:http://sourceforge.net/projects/brainypdm/ +[60]:http://www.pcp.io/ +[61]:https://userbase.kde.org/KSysGuard +[62]:http://munin-monitoring.org/ +[63]:http://www.nagios.org/ +[64]:http://www.zenoss.com/ +[65]:http://www.cacti.net/ +[66]:http://www.zabbix.com/ +[67]:https://collectd.org/ +[68]:http://www.observium.org/ +[69]:http://oss.oetiker.ch/smokeping/ +[70]:http://mobaxterm.mobatek.net/ +[71]:http://www.shinken-monitoring.org/ diff --git a/published/201602/20151104 How to Install SQLite 3.9.1 with JSON Support on Ubuntu 15.04.md b/published/201602/20151104 How to Install SQLite 3.9.1 with JSON Support on Ubuntu 15.04.md new file mode 100644 index 0000000000..fcb65c6344 --- /dev/null +++ b/published/201602/20151104 How to Install SQLite 3.9.1 with JSON Support on Ubuntu 15.04.md @@ -0,0 +1,123 @@ +如何在 Ubuntu 15.04 上安装带 JSON 支持的 SQLite 3.9.1 +================================================================================ +欢迎阅读我们关于SQLite 的文章,SQLite 是当今世界上使用最广泛的 SQL 数据库引擎,它基本不需要配置,不需要设置或管理就可以运行。SQLite 是一个是开放领域(public-domain)的软件,是一个关系型数据库管理系统(RDBMS),用来在一个大数据表中存储用户定义的记录。对于数据存储和管理来说,数据库引擎要处理复杂的查询命令,这些命令可能会从多个表获取数据然后生成报告和数据总结。 + +SQLite 是一个非常小、轻量级,不需要独立的服务进程或系统。它可以运行在 UNIX,Linux,Mac OS-X,Android,iOS 和 Windows 上,已经被大量的软件程序使用,如 Opera, Ruby On Rails, Adobe System, Mozilla Firefox, Google Chrome 和 Skype。 + +### 1) 基本需求: ### + +在绝大部分支持 SQLite 的平台上安装 SQLite 基本上并没有复杂的要求。 + +让我们在 CLI 或者 Secure Shell 上使用 sudo 或者 root 权限登录 Ubuntu 服务器。然后更新系统,这样子就可以让操作系统的软件更新到新版本。 + +在 Ubuntu 上,使用如下的命令来更新系统的软件源。 + + # apt-get update + +如果你要在新安装的 Ubuntu 上部署 SQLite,那么你需要安装一些基础的系统管理工具,如 wget, make, unzip, gcc。 + +要安装 wget,可以使用下面的命令,如果系统提示的话,输入 Y : + + # apt-get install wget make gcc + +### 2) 下载 SQLite ### + +要下载 SQLite ,最好是在 [SQLite 官网][1]下载,如下所示 + +![SQLite download](http://blog.linoxide.com/wp-content/uploads/2015/10/Selection_014.png) + +你也可以直接复制资源的连接然后在命令行使用 wget 下载,如下所示: + + # wget https://www.sqlite.org/2015/sqlite-autoconf-3090100.tar.gz + +![wget SQLite](http://blog.linoxide.com/wp-content/uploads/2015/10/23.png) + +下载完成之后,解压缩安装包,切换工作目录到解压缩后的 SQLite 目录,使用下面的命令。 + + # tar -zxvf sqlite-autoconf-3090100.tar.gz + +### 3) 安装 SQLite ### + +现在我们要开始安装、配置刚才下载的 SQLite。在 Ubuntu 上编译、安装 SQLite,运行配置脚本: + + root@ubuntu-15:~/sqlite-autoconf-3090100# ./configure –prefix=/usr/local + +![SQLite Installation](http://blog.linoxide.com/wp-content/uploads/2015/10/35.png) + +配置要上面的安装位置前缀(prefix)之后,运行下面的命令编译安装包。 +``` +root@ubuntu-15:~/sqlite-autoconf-3090100# make +source='sqlite3.c' object='sqlite3.lo' libtool=yes \ +DEPDIR=.deps depmode=none /bin/bash ./depcomp \ +/bin/bash ./libtool --tag=CC --mode=compile gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.9.1\" -DPACKAGE_STRING=\"sqlite\ 3.9.1\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.9.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -c -o sqlite3.lo sqlite3.c +``` + +运行完上面的命令之后,要在 Ubuntu 上完成 SQLite 的安装得运行下面的命令。 + + # make install + +![SQLite Make Install](http://blog.linoxide.com/wp-content/uploads/2015/10/44.png) + +### 4) 测试 SQLite 安装 ### + +要保证 SQLite 3.9 安装成功了,运行下面的命令。 + + # sqlite3 + +SQLite 的版本会显示在命令行。 + +![Testing SQLite Installation](http://blog.linoxide.com/wp-content/uploads/2015/10/53.png) + +### 5) 使用 SQLite ### + +SQLite 很容易上手。要获得详细的使用方法,在SQLite 控制台里输入下面的命令。 + + sqlite> .help + +这里会显示全部可用的命令和详细说明。 + +![SQLite Help](http://blog.linoxide.com/wp-content/uploads/2015/10/62.png) + +现在开始最后一部分,使用一点 SQLite 命令创建数据库。 + +要创建一个新的数据库需要运行下面的命令。 + + # sqlite3 test.db + +然后创建一张新表。 + + sqlite> create table memos(text, priority INTEGER); + +接着使用下面的命令插入数据。 + + sqlite> insert into memos values('deliver project description', 15); + sqlite> insert into memos values('writing new artilces', 100); + +要查看插入的数据可以运行下面的命令。 + + sqlite> select * from memos; + deliver project description|15 + writing new artilces|100 + +或者使用下面的命令离开。 + + sqlite> .exit + +![Using SQLite3](http://blog.linoxide.com/wp-content/uploads/2015/10/73.png) + +### 结论 ### + +通过本文你可以了解如果安装支持 JSON1 的最新版的 SQLite,SQLite 从 3.9.0 开始支持 JSON1。这是一个非常棒的库,可以内嵌到应用程序,利用它可以很有效而轻量的管理资源。我们希望你能觉得本文有所帮助,请随意地向我们反馈你遇到的问题和困难。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/install-sqlite-json-ubuntu-15-04/ + +作者:[Kashif Siddique][a] +译者:[oska874](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/kashifs/ +[1]:https://www.sqlite.org/download.html diff --git a/published/201602/20151119 How to Install Revive Adserver on Ubuntu 15.04 or CentOS 7.md b/published/201602/20151119 How to Install Revive Adserver on Ubuntu 15.04 or CentOS 7.md new file mode 100644 index 0000000000..c7f5a5d71f --- /dev/null +++ b/published/201602/20151119 How to Install Revive Adserver on Ubuntu 15.04 or CentOS 7.md @@ -0,0 +1,237 @@ +在 Ubuntu 15.04 / CentOS 7 上安装广告服务器 Revive Adserver +================================================================================ +Revive Adserver是一个自由开源的广告管理系统,能使出版商,广告平台和广告商在网页、应用、视频上投放并管理广告的系统。Revive Adserver以前叫做OpenX Source,遵循GNU通用公共授权协议。它集广告管理、网站定位、地理定位和一个用于数据收集的跟踪系统于一体。能使网站站长管理内部的、付费的以及第三方来源的广告,如谷歌的AdSense。本教程中,将会教会你在Ubuntu 15.04或CentOS 7安装并运行Revive Adserver。 + +### 1. 安装LAMP### + +首先,Revive Adserver需要完整的LAMP环境才能运行,所以我们先安装LAMP。LAMP是Apache网页服务器,MySQL/MariaDB数据库和PHP模块的集合。要使Revive正常运行,需要安装PHP的众多模块,如apc, zlib, xml, pcre, mysql和mbstring。在不同的Linux发行版中,我们可以用下列命令进行LAMP的配置: + +#### 在Ubuntu 15.04下#### + + # apt-get install apache2 mariadb-server php5 php5-gd php5-mysql php5-curl php-apc zlibc zlib1g zlib1g-dev libpcre3 libpcre3-dev libapache2-mod-php5 zip + +#### 在CentOS 7下 #### + + # yum install httpd mariadb php php-gd php-mysql php-curl php-mbstring php-xml php-apc zlibc zlib1g zlib1g-dev libpcre3 libpcre3-dev zip + +### 2. 启动Apache Web和MariaDB服务 + +可以用下列命令启动刚刚安装好的Apache Web服务和MariaDB数据库服务。 + +#### 在Ubuntu 15.04下#### + +Ubuntu15.04使用Systemd作为默认初始系统,所以用下列命令启动Apache和MariaDB进程: + + # systemctl start apache2 mysql + +可以用下列命令使其开机自动运行: + + # systemctl enable apache2 mysql + + Synchronizing state for apache2.service with sysvinit using update-rc.d... + Executing /usr/sbin/update-rc.d apache2 defaults + Executing /usr/sbin/update-rc.d apache2 enable + Synchronizing state for mysql.service with sysvinit using update-rc.d... + Executing /usr/sbin/update-rc.d mysql defaults + Executing /usr/sbin/update-rc.d mysql enable + +#### 在CentOS 7下 + +CentOS 7同样是以Systemd作为默认初始系统,可以用下列命令启动: + + # systemctl start httpd mariadb + + ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service' + ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service' + +### 3. 配置MariaDB + +#### 在CentOS 7/Ubuntu 15.04下 #### + +当我们第一次启动MariaDB时,MariaDB是没有分配密码的,所以要先设置一个root密码。之后再创建一个新的数据库用来储存Revive Adserver的数据。 + +使用以下命令配置MariaDB并设置其root密码: + + # mysql_secure_installation + +这时会要我们输入root密码,但我们之前什么密码都没设置,所以按回车下一步。之后,要求设置root密码,这时我们输入Y,然后输入自己想要的密码。回车继续下一步。 + + …. + so you should just press enter here. + + Enter current password for root (enter for none): + OK, successfully used password, moving on… + + Setting the root password ensures that nobody can log into the MariaDB + root user without the proper authorisation. + + Set root password? [Y/n] y + New password: + Re-enter new password: + Password updated successfully! + Reloading privilege tables.. + … Success! + … + installation should now be secure. + Thanks for using MariaDB! + +![Configuring MariaDB](http://blog.linoxide.com/wp-content/uploads/2015/11/configuring-mariadb.png) + +### 4. 创建新的数据库 ### + +为MariaDB的root用户设置了密码之后,就可以创建用来储存Revive Adserver应用数据的数据库。首先通过以下命令登录MariaDB控制台: + + # mysql -u root -p + +这时要求输入root用户的密码,我们只要输入上一步设置好的密码。然后进入MariaDB控制台创建新的数据库,数据库用户及其密码,并且授予其创建、删除、编辑和存储表与数据的全部权限。 + + > CREATE DATABASE revivedb; + > CREATE USER 'reviveuser'@'localhost' IDENTIFIED BY 'Pa$$worD123'; + > GRANT ALL PRIVILEGES ON revivedb.* TO 'reviveuser'@'localhost'; + > FLUSH PRIVILEGES; + > EXIT; + +![Creating Mariadb Revive Database](http://blog.linoxide.com/wp-content/uploads/2015/11/creating-mariadb-revive-database.png) + +### 5. 下载Revive Adserver + +接下来下载Revive Adserver的最新版本Revive Adserver.3.2.2(写本文时)。可以使用wget命令从Revive Adserverde 官方网站下载压缩包,网址是:[http://www.revive-adserver.com/download/][1] 。命令如下: + + # cd /tmp/ + # wget http://download.revive-adserver.com/revive-adserver-3.2.2.zip + + --2015-11-09 17:03:48-- http://download.revive-adserver.com/revive-adserver-3.2.2.zip + Resolving download.revive-adserver.com (download.revive-adserver.com)... 54.230.119.219, 54.239.132.177, 54.230.116.214, ... + Connecting to download.revive-adserver.com (download.revive-adserver.com)|54.230.119.219|:80... connected. + HTTP request sent, awaiting response... 200 OK + Length: 11663620 (11M) [application/zip] + Saving to: 'revive-adserver-3.2.2.zip' + revive-adserver-3.2 100%[=====================>] 11.12M 1.80MB/s in 13s + 2015-11-09 17:04:02 (906 KB/s) - 'revive-adserver-3.2.2.zip' saved [11663620/11663620] + +解压到临时目录下: + + # unzip revive-adserver-3.2.2.zip + +把解压后的整个文件夹移动到Apache Web服务器的默认根目录/var/www/html/下: + + # mv revive-adserver-3.2.2 /var/www/html/reviveads + +### 6. 配置Apache Web服务 + +现在配置Apache服务使Revive正常运行。通过创建配置文件reviveads.conf来创建一个新的虚拟主机。这个目录在不同的Linux发行版上有所不同。 + +#### 在Ubuntu 15.04下 + + # touch /etc/apache2/sites-available/reviveads.conf + # ln -s /etc/apache2/sites-available/reviveads.conf /etc/apache2/sites-enabled/reviveads.conf + # nano /etc/apache2/sites-available/reviveads.conf + +在这个文件中添加下列几行文本: + + + ServerAdmin info@reviveads.linoxide.com + DocumentRoot /var/www/html/reviveads/ + ServerName reviveads.linoxide.com + ServerAlias www.reviveads.linoxide.com + + Options FollowSymLinks + AllowOverride All + + ErrorLog /var/log/apache2/reviveads.linoxide.com-error_log + CustomLog /var/log/apache2/reviveads.linoxide.com-access_log common + + +![Configuring Apache2 Ubuntu](http://blog.linoxide.com/wp-content/uploads/2015/11/configuring-apache2-ubuntu.png) + +保存并退出,重启Apache Web服务: + + # systemctl restart apache2 + +#### 在CentOS 7下 #### + +在CentOS下,我们直接在/etc/httpd/conf.d/ 目录下创建reviveads.conf : + + # nano /etc/httpd/conf.d/reviveads.conf + +在这个文件中添加下列几行文本: + + + ServerAdmin info@reviveads.linoxide.com + DocumentRoot /var/www/html/reviveads/ + ServerName reviveads.linoxide.com + ServerAlias www.reviveads.linoxide.com + + Options FollowSymLinks + AllowOverride All + + ErrorLog /var/log/httpd/reviveads.linoxide.com-error_log + CustomLog /var/log/httpd/reviveads.linoxide.com-access_log common + + +![Configuring httpd Centos](http://blog.linoxide.com/wp-content/uploads/2015/11/configuring-httpd-centos.png) + +保存并退出,重启Apache Web服务: + + # systemctl restart httpd + +### 7. 修复权限和所有权 + +现在我们修改安装路径下文件的权限和所有权。把安装目录的所有权改成Apache进程所有,以便Apache Web服务有文件和目录的编辑、创建和删除的完全权限。 + +#### 在Ubuntu 15.04下#### + + # chown www-data: -R /var/www/html/reviveads + +#### 在CentOS 7下 + + # chown apache: -R /var/www/html/reviveads + +### 8. 设置防火墙 + + 现在要配置防火墙,打开80端口使Apache Web服务运行的Revive Adserver能够被网络上的其他机器所访问。 + +#### 在Ubuntu 15.04/CentOS 7下 + +Ubuntu15.04/CentOS 7都使用Systemd作为默认初始系统,使用firewalld作为其防火墙。要打开80端口(http服务端口),执行以下命令: + + # firewall-cmd --permanent --add-service=http + + success + + # firewall-cmd --reload + + success + +### 9. 网站的安装 + +顺利的话我们能够使用浏览器进行交互,并可以将浏览器指向正在运行的网络服务器。只要在浏览器输入http://ip-address/ 或者 http://domain.com 。这里我们要访问 http://reviveads.linoxide.com/ + +打开后可以看到Revive Adserver的欢迎页面,上面还有作为它发行许可证的GNU通用公共许可证V2。点击 I agree 继续下一步安装。 + +在下一页中,我们要输入数据库信息以便把Revive Adserver和MariaDB数据库服务连接起来。要输入之前设置的数据库名称,用户名以及密码。在本教程中,我们分别输入数据库名称为revivedb,用户名为reviveuser,密码为Pa$$worD123,并且令主机名为localhost,点击continue继续。 + +![Configuring Revive Adserver](http://blog.linoxide.com/wp-content/uploads/2015/11/configuring-revive-adserver.png) + +输入要填的信息,如:管理员用户名,密码和邮箱。可以以这些信息登录Adserver的控制界面。然后跳到最后一页,可以看到Revive Adserver已经安装成功了。 + +接着,转到Adverstiser页面,添加新的广告管理。在控制界面添加新用户到adserver,为广告库户添加标题,网页,视频 +广告。 + +### 总结 ### + +本文中,我们学习了如何在Ubuntu 15.04和CentOS 7上安装并配置Revive Adserver。尽管Revive Adserver的原始代码是从OpenX那买的,但现在OpenX Enterprise和Revive Adserver已经完全分开了。可以从[http://www.adserverplugins.com/][2] 获得更多插件来扩展新特性。讲真,这个软件确实让网页,应用,视频上的广告管理变得容易了许多。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-revive-adserver-ubuntu-15-04-centos-7/ + +作者:[Arun Pyasi][a] +译者:[chisper](https://github.com/chisper) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://www.revive-adserver.com/download/ +[2]:http://www.adserverplugins.com/ diff --git a/published/201602/20151126 Linux Foundation Explains a 'World without Linux' and Open Source.md b/published/201602/20151126 Linux Foundation Explains a 'World without Linux' and Open Source.md new file mode 100644 index 0000000000..e86ee8b7f0 --- /dev/null +++ b/published/201602/20151126 Linux Foundation Explains a 'World without Linux' and Open Source.md @@ -0,0 +1,51 @@ +没有 Linux 和开源软件的世界会变得怎么样 +================================================================================ +> Linux 基金会针最近对人们关于 “没有 Linux 的世界” 系列短片所提出的问题做了回应,解答了包括没有 Linux 和其他的开源软件的因特网会变得怎么样等问题。 + +![](http://thevarguy.com/site-files/thevarguy.com/files/imagecache/medium_img/uploads/2015/11/hey_22.png) + +假如 Linux —— 这个开源的操作系统内核 —— 不曾出现过,我们现在的世界是否会是另一番景象。会不会没有了因特网,或者没有了电影?这些都是观看 [Linux 基金会][1] 正在连续播出的 “[没有 Linux 的世界][2]” 系列短片的观众提出来的问题。 + +假如你错过了观看这些短片也不要紧,“[没有 Linux 的世界][2]” 系列短片是一个搞笑短片的集合,里边描述了没有了 Linux (或者说没有开源软件)的世界发生的事情。这些短片强调了 Linux 在 [电影制作][3] 以及 [因特网服务][4] 中充当的角色。 + +为了揭示该系列短片的一些主张、倾向和隐藏元素,Linux 基金会副主席 Jennifer Cloer 最近在 The VAR Guy 上回应了关于该短片的一些问题。以下是她的原话解答。 + +### 最新一集短片 —— Sam 和 Annie 一起看电影。假如没有 Linux,我们现在的荧屏是不是也和短片中的一样? ### + +在第 4 集剧情中,我们恶搞了一下电影 “阿凡达(Avatar)”。不管你喜欢还是讨厌,现实中的 “阿凡达(Avatar)” 在荧屏上的效果还是让人记忆深刻的。在没有 Linux 的世界中,电影的效果就变得非常丑陋,但是我们并不知道它有多难看,因为那已经是最好的了。但实际上,“阿凡达(Avatar)” 是使用 Linux 来进行效果制作的。Weta 数码使用了当时世界上最大的 Linux 集群来给电影做效果渲染和 3D 建模。据报道,指环王(Lord of the Rings)、神奇四侠(Fantastic Four)和金刚(King Kong)等电影都用到了 Linux。我希望该短片能引起人们关注,因为它所做的这方面的工作还并不广为人知。 + +### 很多人对短片的原始剧情进行了批判,其中就包括“没有 Linux 将没有因特网”的剧情的指责。你对此持什么样的看法? ### + +我们很喜欢人们在短片刚上映就进行激烈的辩论。该短片上映当天就超过了 100,000 的观众,这引起了人们对 Linux 在社会中扮演的角色以及对全世界的社区贡献者和维护者的关注。当然了,没有 Linux 的话,因特网也是会出现的,只是不会像当前我们所熟知的互联网那么成熟而已。每一个短片都对 Linux 在我们每天生活中扮演的角色进行了大胆且有趣的描述。我们希望,这些短片能够把关于 Linux 的故事推广到全世界的人的心里去。 + +### 为什么 Sam 和 Annie 的那只猫叫做 String? ### + +该短片系列中没有一处剧情是随意的。仔细的观看的话,你就会发现其中关于 Linux 和极客们的各种玩笑。小猫 String 是我们的 Linux.com 主编 Libby Clark 以弦理论(string theory)亲自来命名的。在物理学里,弦理论(string theory)是一个理论框架,它用一个叫做弦(String)的一维对象替换了粒子物理学中粒子状的粒子。弦理论(string theory)描述了这些弦(String)如何在空间传播以及相互影响。就像 Sam、Annie 和 String 在那个没有 Linux 的世界里的关系那样。 + +### 我们期待已久的下两集是什么样的,特别是,最后那集什么时候上映? ### + +在第 5 集短片中,我们将到太空并体验一下没有 Linux 的世界对太空探索的影响。这就像是一场疯狂的骑行。在短片的最后,我们最终还是会见到没有 Linux 的世界里的 Linus。贯穿整个短片系列,里边已经给出关于结局的线索,我在这就不能给太多提示了,因为还有好多人在找线索比赛中继续寻找着。并且我也不能给你们说出关于结局短片的上映日期。你们要自己跟进 #WorldWithoutLinux 主题帖来获取更多信息。 + +### 你可给一些关于第 4 集短片相关线索的提示吗? ### + +在该短片中有另外一个关于免费汉堡餐厅(Free Burger Restaurant)的线索。在那个没有 Linux 的世界里,Linux 最后还是以一种很隐秘的方式出现了,可以说,就像是以另一种语言来解读 Linux。当然,这只是为了好玩,String 也以另外一个模样出现。 + +### 那么,该系列短片达到你所想要的效果了吗? ### + +是的,达到了。我们很高兴看到人们分享并参与到这些故事中去。我们希望向那些可能不知道 Linux 的人传达更多关于 Linux 的故事并了解到 Linux 在当今世界中是无处不在的。全部的短片就是为了把这些关于 Linux 的真相推广给大家,并感谢那些全球性社区的开发者和公司对 Linux 的支持,Linux 使得一切成为可能。 + +-------------------------------------------------------------------------------- + +via: http://thevarguy.com/open-source-application-software-companies/linux-foundation-explains-world-without-linux-and-open-so + +作者:[Christopher Tozzi][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://thevarguy.com/author/christopher-tozzi +[1]:http://linuxfoundation.org/ +[2]:http://www.linuxfoundation.org/world-without-linux +[3]:http://thevarguy.com/open-source-application-software-companies/new-linux-foundation-video-highlights-role-open-source-3d +[4]:http://thevarguy.com/open-source-application-software-companies/100715/would-internet-exist-without-linux-yes-without-open-sourc diff --git a/published/201602/20151201 Cinnamon 2.8 Review.md b/published/201602/20151201 Cinnamon 2.8 Review.md new file mode 100644 index 0000000000..ac84601cab --- /dev/null +++ b/published/201602/20151201 Cinnamon 2.8 Review.md @@ -0,0 +1,87 @@ +Cinnamon 2.8 新变化一览 +================================================================================ +![](https://www.maketecheasier.com/assets/uploads/2015/11/cinnamon-2-8-featured.jpg) + +除了Gnome和KDE外,Cinnamon是另一个很多人使用的桌面环境。它是由创作Linux Mint的团队制作的,并且可以被安装在许多其他发行版上。该桌面环境的最新版本 - Cinnamon 2.8 - 于去年底发布,此版本修复了许多的Bug、做了许多改进并添加了一些新功能。 + +我将仔细介绍该发行版本的主要改进,以及如何更新到Cinnamon 2.8或者第一次安装它。 + +### 对Applets的改进 ### + +在此版本中,对面板中已有的Applets做了若干的改进。 + +#### 声音 Applet #### + +![cinnamon-28-sound-applet](https://www.maketecheasier.com/assets/uploads/2015/11/rsz_cinnamon-28-sound-applet.jpg) + +声音Applet经过修正,目前可以显示音轨信息并且可以在音频文件的艺术家封面上面进行媒体控制。对于支持拖动的音乐播放器来说(例如Banshee),会有一个进度条显示同样的播放进度,您可以用它来改变音轨位置。在applet的面板上右击将显示对输入和输出设备静音的选项。 + +#### 电源 Applet #### + +电源applet则会使用电池制造商的数据而不是通用名称来显示每一个连接的电池和设备。 + +#### 窗口缩略图 #### + +![cinnamon-2.8-window-thumbnails](https://www.maketecheasier.com/assets/uploads/2015/11/cinnamon-2.8-window-thumbnails.png) + +在Cinnamon 2.8中,可以在鼠标悬停于面板里窗口列表时展示窗口缩略图。如果您不喜欢该功能,您还可以关闭该选项。 + +#### 工作区切换 Applet #### + +![cinnamon-2.8-workspace-switcher](https://www.maketecheasier.com/assets/uploads/2015/11/cinnamon-2.8-workspace-switcher.png) + +添加工作区切换applet到您的面板将为您显示一个代表该工作区的可视化图像,一些矩形嵌套显示在其中,代表您的窗口的位置。 + +#### 系统托盘 #### + +Cinnamon 2.8支持在系统托盘中显示应用程序指示器。您可以很容易地在设置中禁用它,这将强制应用程序到以前使用状态图标的方式。 + +### 视觉改进 ### + +Cinnamon 2.8还做了很多视觉上的改进。经典的切换器和Alt + Tab预览切换器都被精细打磨,有了显著的改进,同时修复了Alt + F2对话框的bug,并赋予了它更好的命令自动补全功能。 + +而且,传统的最小化窗口时动画效果的问题现已被解决,并可用于多个面板。 + +### Nemo 的改进 ### + +![cinnamon-2.8-nemo](https://www.maketecheasier.com/assets/uploads/2015/11/rsz_cinnamon-28-nemo.jpg) + +Cinnamon默认的文件管理器也修复了一些bug,并有了新的“快速重命名”的功能,用于重命名文件和文件夹。可以通过两次点击文件或文件夹并在两次点击之间进行简短的停顿以重命名文件。 + +Nemo也会自动地检测缩略图存在的问题,并提示您快速地修复它们。 + +### 其他值得注意的改进 ### + +- Applets如今会在它们被更新的时候自动地重新加载一次。 +- 对于多个监视器的支持有了显著的提高。 +- 对话框窗口有了改进,并且会附加到它的父窗口上。 +- HiDPI检测有了改进。 +- QT5应用程序现在看起来更加原生并使用了默认的GTK主题。 +- 窗口管理和渲染性能有了提升。 +- 修复了许多bug。 + +### 如何获得 Cinnamon 2.8 ### + +如果您在运行Linux Mint,您会在更新Linux Mint 17.3 “Rosa”Cinnamon版本的时候获得Cinnamon 2.8的更新。BETA版本现在已经放出,因此,如果您想立刻尝试新的软件,您可以试试。 + +对于Arch的用户来说,Cinnamon 2.8已经在Arch的官方仓库了,您可以通过更新软件包和系统级的更新获得Cinnamon的最新版本。 + +最后,对于Ubuntu用户来说,您可以通过下面的命令安装或更新Cinnamon 2.8: + + sudo add-apt-repository -y ppa:moorkai/cinnamon + sudo apt-get update + sudo apt-get install cinnamon + +您已经尝试了Cinnamon 2.8了么?感觉如何呢? + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/cinnamon-2-8-review/ + +作者:[Ayo Isaiah][a] +译者:[wwy-hust](https://github.com/wwy-hust) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/ayoisaiah/ diff --git a/published/201602/20151201 How to use Mutt email client with encrypted passwords.md b/published/201602/20151201 How to use Mutt email client with encrypted passwords.md new file mode 100644 index 0000000000..2c57a73d91 --- /dev/null +++ b/published/201602/20151201 How to use Mutt email client with encrypted passwords.md @@ -0,0 +1,135 @@ +如何 Mutt 邮件客户端中使用密文密码 +================================================================================ +Mutt 是一个 Linux/UNIX 终端环境下的开源的邮件客户端。Mutt 以及 [Alpine][1] 在 Linux 命令行爱好者中有着最忠诚的追随者,这不是没有原因的。想一下你所期待邮件客户端应有的功能,Mutt 拥有:多协议支持(例如,POP3、IMAP 和 SMTP),S/MIME 和 PGP/GPG 集成,会话线索,颜色标记,可定制宏/快捷键,等等。另外,基于命令行的 Mutt 相比粗重的基于浏览器的邮件客户端(如:Gmail,Ymail)或图形用户界面的邮件客户端(如:Thunderbird,MS Outlook)而言,是一个使用电子邮件的轻量级替代品。 + +当你想使用 Mutt 通过公司的 SMTP/IMAP 服务器访问或发送邮件,或取代网页邮件服务,可能所关心的一个问题是如何保护您的邮件凭据(如:SMTP/IMAP 密码),它们存储在一个纯文本 Mutt 配置文件(~/.muttrc)中。 + +对于这些人对安全的担忧,确实有一个容易的方法来**加密 Mutt 配置文件***,以防止这种风险。在这个教程中,我描述了如何加密 Mutt 敏感配置,比如使用 GnuPG(GPG)加密 SMTP/IMAP 密码,GPG 是一个开源的 OpenPGP 实现。 + +### 第一步 (可选):创建 GPG 密钥 ### + +因为我们将要使用 GPG 加密 Mutt 配置文件,如果你没有 GPG 密钥,第一步就是创建一个(公钥/私钥对)。如果有,请忽略这步。 + +创建一个新 GPG 密钥,输入下面命令: + + $ gpg --gen-key + +选择密钥类型(RSA),密钥长度(2048 bits),和过期时间(0 代表不过期)。当出现用户 ID 提示时,输入关联到该公钥/私钥对的名字(Dan Nanni) 和邮箱地址(myemail@email.com)。最后,输入一个密码来保护你的私钥。 + +![](https://c2.staticflickr.com/6/5726/22808727824_7735f11157_c.jpg) + +生成一个 GPG 密钥需要大量的随机字节来构成熵,所以在生成密钥期间确保在你的系统上执行一些随机行为(如:敲打键盘,移动鼠标或者读写磁盘)。根据密钥长度,生成 GPG 密钥要花几分钟或更多时间。 + +![](https://c1.staticflickr.com/1/644/23328597612_6ac5a29944_c.jpg) + +### 第二步:加密 Mutt 敏感配置 ### + +下一步,在 ~/.mutt 目录创建一个新的文本文件,然后把一些你想隐藏的 Mutt 敏感配置放进去。这个例子里,我指定了 SMTP/IMAP 密码。 + + $ mkdir ~/.mutt + $ vi ~/.mutt/password + +---------- + + set smtp_pass="XXXXXXX" + set imap_pass="XXXXXXX" + +现在通过 GPG 使用你的公钥加密这个文件如下: + + $ gpg -r myemail@email.com -e ~/.mutt/password + +这将创建 ~/.mutt/password.gpg,这是一个原始文件的 GPG 加密版本。 + +然后删除 ~/.mutt/password,只保留 GPG 加密版本。 + +### 第三步:创建完整 Mutt 配置文件 ### + +现在你已经在一个单独的文件放置了加密的 Mutt 敏感配置,你可以在 ~/.muttrc 指定其余的 Mutt 配置。然后增加下面这行在 ~/.muttrc 末尾。 + + source "gpg -d ~/.mutt/password.gpg |" + +当你启动 Mutt 时,这行将解密 ~/.mutt/password.gpg ,然后将解密内容应用到你的 Mutt 配置中。 + +下面展示一个完整 Mutt 配置例子,这可以让你通过 Mutt 访问 Gmail,而没有暴露你的 SMTP/IMAP 密码。用你的 Gmail ID 替代下面的 `yourgmailaccount`,此外你也需要在[你的 Goolgle 账户设置][3]中启用“支持不太安全的应用访问”。 + + set from = "yourgmailaccount@gmail.com" + set realname = "Your Name" + set smtp_url = "smtp://yourgmailaccount@smtp.gmail.com:587/" + set imap_user = "yourgmailaccount@gmail.com" + set folder = "imaps://imap.gmail.com:993" + set spoolfile = "+INBOX" + set postponed = "+[Google Mail]/Drafts" + set trash = "+[Google Mail]/Trash" + set header_cache =~/.mutt/cache/headers + set message_cachedir =~/.mutt/cache/bodies + set certificate_file =~/.mutt/certificates + set move = no + set imap_keepalive = 900 + + # encrypted IMAP/SMTP passwords + source "gpg -d ~/.mutt/password.gpg |" + +### 第四步(可选):配置 GPG 代理 ### + +这时候,你将可以使用加密了IMAP/SMTP 密码的 Mutt。然而,每次你运行 Mutt,你都要先被提示输入一个 GPG 密码来使用你的私钥解密 IMAP/SMTP 密码。 + +![](https://c2.staticflickr.com/6/5667/23437064775_20c874940f_c.jpg) + +如果你想避免这样的 GPG 密码提示,你可以部署一个 gpg-agent。它以后台守护进程方式运行,gpg-agent 可以安全地缓存你的 GPG 密码,无需手工干预,gpg 可以自动从 gpg-agent 获得你的 GPG 密码。如果你正在使用 Linux 桌面,你可以配置使用一些等同于 gpg-agent 的特定的桌面软件,例如,GNOME 桌面的 gnome-keyring-daemon。 + +你可以在基于 Debian 系统安装 gpg-agent: + + $ sudo apt-get install gpg-agent + +gpg-agent 在基于 Red Hat 的系统上是预装好的。 + +现在增加下面这些到你的 .bashrc 文件中。 + + envfile="$HOME/.gnupg/gpg-agent.env" + if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then + eval "$(cat "$envfile")" + else + eval "$(gpg-agent --daemon --allow-preset-passphrase --write-env-file "$envfile")" + fi + export GPG_AGENT_INFO + +重载 .bashrc,或简单的登出然后重新登录。 + + $ source ~/.bashrc + +现在确认 GPG_AGENT_INFO 环境变量已经设置妥当。 + + $ echo $GPG_AGENT_INFO + + /tmp/gpg-0SKJw8/S.gpg-agent:942:1 + +并且,当你输入 gpg-agent 命令时,你应该看到下面的信息。 + + $ gpg-agent + + gpg-agent: gpg-agent running and available + +一旦 gpg-agent 启动运行,它将会在第一次提示你输入密码时缓存你的 GPG 密码。随后你多次运行 Mutt ,都不会被提示要 GPG 密码(gpg-agent 一直开着,缓存就不会过期)。 + +![](https://c1.staticflickr.com/1/664/22809928093_3be57698ce_c.jpg) + +### 结论 ### + +在这个指导里,我提供一个使用 GnuPG 加密如 SMTP/IMAP 密码这样的 Mutt 敏感配置的方法。注意,如果你想在 Mutt 上使用 GnuPG 来加密或签名你的邮件,你可以参考[官方指南][2]关于 GPG 与 Mutt 结合的部分。 + +如果你知道任何使用 Mutt 的安全技巧,欢迎分享它。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/mutt-email-client-encrypted-passwords.html + +作者:[Dan Nanni][a] +译者:[wyangsun](https://github.com/wyangsun) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://xmodulo.com/gmail-command-line-linux-alpine.html +[2]:http://dev.mutt.org/trac/wiki/MuttGuide/UseGPG +[3]:https://www.google.com/settings/u/1/security \ No newline at end of file diff --git a/published/201602/20151206 Supporting secure DNS in glibc.md b/published/201602/20151206 Supporting secure DNS in glibc.md new file mode 100644 index 0000000000..25e1004b09 --- /dev/null +++ b/published/201602/20151206 Supporting secure DNS in glibc.md @@ -0,0 +1,51 @@ +通过修改 glibc 支持 DNS 加密 +======================== + +域名解析系统(DNS)是互联网安全的许多薄弱环节之一;可以将应用程序所访问的主机对应的 IP 地址误导到其它地方。也就是说,会连接到错误的位置,从而引发中间人(man-in-the-middle )攻击等等。而 [DNSSEC][1] 扩展协议则通过为 DNS 信息建立一条加密的可信通道来解决这个漏洞。在正确地配置好 DNSSEC 后,应用程序将可以得到可靠的主机查询信息。通过关于[尝试将 DNSSEC 更好地集成到 GNU C 库里][2]的讨论,我们知道,确保 DNS 查询信息安全这件事并不是那么简单。 + +从某种意义上来说,这个问题多年以前就解决了,我们可以配置一个本地域名服务实现完整的 DNSSEC 校验(verification)并允许应用程序通过 glibc 函数来使用该服务。DNSSEC 甚至还可以用于提高其他领域的安全性,比如,它可以携带 SSH 或 TLS 密钥指纹,让应用程序可以确认其在与正确的服务器对话。不过,当我们希望确认这条自称带有 DNSSEC 校验的 DNS 结果是不是真的已通过认证的时候 - 也就是说,当我们想依赖 DNSSEC 所承诺的安全的时候,事情变得有点复杂。 + +### /etc/resolv.conf 问题 + +从 glibc 的角度来看,这个问题一部分是因为 glibc 本身并没有做 DNSSEC 校验,而是引用 /etc/resolv.conf 文件,从该文件里读出的服务器来做解析以及校验,再将结果返回给应用程序。如果应用程序使用底层 res_query() 接口,那结果中将会包含“已认证数据(authenticated data)”(AD)标识(如果域名服务器设定了的话)以表示 DNSSEC 校验已经成功。但是 glibc 却完全不知道提供这些结果的域名服务器的信用,所以它其实并不能告诉应用程序结果是否真的可靠。 + +由 glibc 的维护者 Carlos O'Donell 提出的建议是在 resolv.conf 文件里增加一个选项(dns-strip-dnssec-ad-bit)告诉 glibc 无条件移除 AD 标识。这个选项可以由各发行版设定,表示 DNSSEC 级别的 DNS 查询结果并不可靠。而一旦建立好合适的环境可以获得可靠的查询结果后,再移除这个选项。这样一来,虽然问题还没有完全解决,至少应用程序有依据来评价从 glibc 获取的 DNS 查询结果的可靠性。 + +一个可靠的环境配置应该是什么样?标准情况应该和这个差不太多:有一个本地域名服务器,通过环路(loopback)接口访问,作为访问 /etc/resolv.conf 文件的唯一条目。这个域名服务器应该配置来做校验,而在校验失败后就只是简单地不返回任何结果。绝大多数情况下,应用程序就不再需要关心 AD 标识,如果结果不可靠,应用程序就根本看不到。一些发行版已经倾向于这种模型,不过情况仍然不像一些人所设想的那么简单。 + +其中一个问题是,这种方式将 /etc/resolv.conf 文件放到整个系统可信任度的中心。但是,在一个典型的 Linux 系统里,有无数的 DHCP 客户端、网络脚本以及其他更多的程序可以修改这个文件。就像 Paul Wouters 所[指出][3]的,在短时间内锁定这个文件是不可能的。有时候这种修改是必须的:在一个无盘系统启动的时候,在自身的域名服务器启动之前也是需要域名服务的;一个系统的整个 DNS 环境也会根据所连接的网络不同而有所改变;运行在容器里的系统也最好是配置成使用宿主机的域名服务器;等等。 + +所以,现在一般认为,现有系统里的 /etc/resolv.conf 文件并不可信。于是有人提出增加另一个配置文件(/etc/secure-resolv.conf 或其他什么),但这并没有从根本上解决问题。除此之外,有些参与者觉得就算有一个运行在环路接口上的域名服务器也不是真正可靠,比如 Zack Weinberg 甚至[建议][4]系统管理员可以有意禁用 DNSSEC 确认(validation)。 + +既然当前系统里的配置不足以信任,那可以这样推断,在情况有改善能够取得可信的结果后,glibc 需要有一种方式来通知应用程序。可以是上面讨论的屏蔽 AD 标识的方式(或者与之相反,增加一个显示的“此域名服务器可以信任”选项);当然,这都需要一定程度上锁定系统以免 /etc/resolv.conf 受到任何不可预计的修改。按 Petr Spacek 的[建议][5],还有一种引申方式,就是提供一种途径允许应用程序查询 glibc 当前通讯的是不是本地域名服务器。 + +### 在 glibc 里来处理? + +另一种方式是不管域名服务器,而是让 glibc 本身来做 DNSSEC 确认。不过,把这么大一坨加密相关代码放进 glibc 也是有很大阻力。这样将增加库本身的大小,从而感觉会增加使用它的应用程序的受攻击可能性。这个方向再引申一下,由 Zack 提出的[建议][6],可以把确认相关代码放到域名服务缓冲守护进程(nscd)里。因为 nscd 也是 glibc 的一部分,由 glibc 开发人员维护,因此在一定程度上可以相信能正确执行 DNSSEC 确认。而且 nscd 的通讯 socket 所在位置也是公开的,所以可以不考虑 /etc/resolv.conf 问题。不过,Carlos [担心][7]这种方式不能让那些不想使用 nscd 缓存功能的用户所接受;在他看来,基本可以排除 nscd 的方式。 + +所以,至少近期内,glibc 不太可能全部执行 DNSSEC 确认了的整个查询过程。这意味着,如果一个有安全考虑的应用要使用 glibc 库来查询域名,该库将需要提供一个标识来评价从独立域名服务器返回的结果有多大程度的可靠性。这几乎肯定需要发行版或系统管理员做出一些明确的改动。就像 Simo Sorce [说的][8]那样: + +> 如果 glibc 不使用明确的配置选项来通知应用程序它所用的域名解析是可信的,不会有什么用……不改一下还有很大弊端,因为应用程序开发者将马上认识到他们不能信任从 glibc 获取的任何信息,从而在处理 DNSSEC 相关信息时就简单地不用它。 + +要配置一个系统能正常使用 DNSSEC 需要改动该系统的很多组件 - 这是一个发行版范围的问题,需要时间来完全解决。在这个转变过程中 glibc 所扮演的角色很可能会比较小,但是很重要的一部分:如果应用程序不实现一套自己的域名解析代码,glibc 很可能是保证 DNS 结果可信的唯一方式。在一个系统中运行多个 DNSSEC 实现方式看起来不像是一种安全的方式,所以最好还是把事情做对了。 + +glibc 项目目前并没有确定用哪种方式来做这个事情,虽然从 /etc/resolv.conf 文件里的某些标记看上去快好了。这种改动应该需要发布新版本;考虑到 glibc 开发的保守天性,很可能来不及加入预计二月份发布的 2.23 版本了。所以 glibc 中暂时还不会有更高安全性的 DNSSEC ,不过在这个方向上也有一些进展了。 + +--------------------------- + +via: https://lwn.net/Articles/664776/ + +作者:Jonathan Corbet +译者:[zpl1025](https://github.com/zpl1025) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]: https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions +[2]: http://lwn.net/Articles/664790/ +[3]: http://lwn.net/Articles/664794/ +[4]: http://lwn.net/Articles/664782/ +[5]: http://lwn.net/Articles/664784/ +[6]: http://lwn.net/Articles/664796/ +[7]: http://lwn.net/Articles/664786/ +[8]: http://lwn.net/Articles/664787/ \ No newline at end of file diff --git a/published/201602/20151208 6 useful LibreOffice extensions.md b/published/201602/20151208 6 useful LibreOffice extensions.md new file mode 100644 index 0000000000..5fed70cb74 --- /dev/null +++ b/published/201602/20151208 6 useful LibreOffice extensions.md @@ -0,0 +1,79 @@ +LibreOffice 中的六大实用扩展组件 +================================================================================ +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/yearbook2015-osdc-lead-2.png) + +图片来源:Opensource.com + +LibreOffice 是最好的自由办公套件,并在所有的主要 Linux 发行版中得到应用。尽管 LibreOffice 已经拥有了大多数特性,它仍然可以通过添加一种叫做扩展(extension)的特定的附加组件来增加功能。 + +LibreOffice 的扩展组件的网站是 [extensions.libreoffice.org][1]。扩展组件只是一些工具,可以在安装主体上进行独立添加或者移除,以便增加新功能或者让已有功能更容易使用。 + +### 1. 多格式保存组件 ### + +多格式保存组件可以根据用户的设置,同时将文档保存为开源文档(OpenDocument)、微软 Office 文档或者 PDF 文档。在你需要将微软 Office 文档格式转为标准的[开源文档格式][2]的时候,这个组件就很实用了,因为该组件同时提供了两种选择:互操作性较强的 ODF 文档格式,以及微软 Office 文档格式,以便同所有需要使用老旧的文档格式的用户保持兼容性。这样使管理员的文档迁移过程变得更具弹性、更易于管理。 + +**[下载 多格式保存组件][3]** + +![Multiformatsave extension](https://opensource.com/sites/default/files/images/business-uploads/multiformatsave.png) + +### 2. Writer 中可备选使用的查找与替换组件(备选搜索 (AltSearch)) ### + +该组件向 Writer 中的查找与替换功能添加了许多新特性:可以查找和替换一段或多段文本;一次执行多个查找和替换;搜索:书签、笔记、文本字段、交叉引用和参考标志内容、名称或标志及其插入;搜索和插入脚注和尾注;通过名称来搜索表格对象、图像和文本框;搜索帮助手册页和分栏符以及创建和失活时间;根据光标位置搜索相同格式的文本。还可以保存/加载查找和替换参数,并在多个同时打开的文件中执行批处理。 + +**[下载 Writer 中可交替使用的查找与替换组件(交替搜索 (AltSearch))][4]** + +![Alternative Find&amp;Replace add-on](https://opensource.com/sites/default/files/images/business-uploads/alternativefindreplace.png) + +### 3. Pepito 清除组件 ### + +Pepito 清除组件是一个 LibreOffice 扩展,主要用来快速清除并修复旧式扫描件、导入的 PDF 以及每个电子文本文档的格式错误。通过点击 LibreOffice 工具栏中的 Pepito 图标,用户可以打开一个用于分析文档并按类型呈现文档错误。当你将 PDF 文档转换为 ODF 文档时,这个工具就非常有用了,它会自动清除转换过程中出现的错误。 + +**[下载 Pepito 清除组件][5]** + +![Pepito cleaner screenshot](https://opensource.com/sites/default/files/images/business-uploads/pepitocleaner.png) + +### 4. ImpressRunner 组件### + +Impress Runner 是将 [Impress][6] 文档转换成自动播放文件的扩展组件。该组件会添加两个图标,用以设置或移除自动开始播放的功能,我们还可以通过编辑 文件 | 属性 | 自定义属性 菜单来手动添加这两个图标,并将自动运行按钮添加到前四个文本域之一前面。在会议与组织活动时,如果幻灯片无人主持,这个扩展组件就变得非常有用。 + +**[下载 ImpressRunner 组件][7]** + +### 5. 导出为图像组件 ### + +导出为图像组件为 Impress 和 [Draw][8] 中文件菜单里增加了一个入口——“导出为图像...”,主要用于将所有的幻灯片和页面导出成 JPG、PNG、GIF、BMP 和 TIFF 等图像格式,并且允许用户自定义导出图像的名称、大小以及其他参数。 + +**[下载 导出为图像组件][9]** + +![Export as images extension](https://opensource.com/sites/default/files/images/business-uploads/exportasimages.png) + +### 6. Anaphraseus 组件### + +Anaphraseus 是一个 CAT(Computer-Aided Translation,计算机辅助翻译)工具组件,用来创建、管理双语翻译。Anaphraseus 是一个 LibreOffice 宏集合,可以作为扩展组件或者用在单独的文档中。最开始,Anaphraseus 支持快速翻译(Wordfast)格式,但现在它可以导入或者导出成 TMX 格式。其主要特性:分本分割、在翻译记录(Translation Memory)中模糊搜索、术语识别以及导入导出 TMX(OmegaT translation memory format,OmegaT 翻译存储格式)。 + +**[下载 Anaphraseus 组件][10]** + +![Anaphraseus screenshot](https://opensource.com/sites/default/files/images/business-uploads/anaphraseus.png) + +你是否也有自己喜欢和推荐的 LibreOffice 组件呢?在评论中告诉大家吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/business/15/12/6-useful-libreoffice-extensions + +作者:[Italo Vignoli][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/italovignoli +[1]:http://extensions.libreoffice.org/ +[2]:http://www.opendocumentformat.org/ +[3]:http://extensions.libreoffice.org/extension-center/multisave-1 +[4]:http://extensions.libreoffice.org/extension-center/alternative-dialog-find-replace-for-writer +[5]:http://pepitoweb.altervista.org/pepito_cleaner/index.php +[6]:https://www.libreoffice.org/discover/impress/ +[7]:http://extensions.libreoffice.org/extension-center/impressrunner +[8]:https://www.libreoffice.org/discover/draw/ +[9]:http://extensions.libreoffice.org/extension-center/export-as-images +[10]:http://anaphraseus.sourceforge.net/ diff --git a/published/201602/20151208 How to Install Bugzilla with Apache and SSL on FreeBSD 10.2.md b/published/201602/20151208 How to Install Bugzilla with Apache and SSL on FreeBSD 10.2.md new file mode 100644 index 0000000000..a60b5d7589 --- /dev/null +++ b/published/201602/20151208 How to Install Bugzilla with Apache and SSL on FreeBSD 10.2.md @@ -0,0 +1,268 @@ +在 FreeBSD 10.2 上如何通过配置 Apache 和 SSL 安装 Bugzilla +================================================================================ + +Bugzilla 是一款开源的 Web 应用,用于 bug 跟踪系统和测试工具,由 mozilla 开发,并采用 Mozilla 公共许可证授权(MPL)。它经常被一些高科技公司如 mozilla、红帽公司和 gnome 使用。Bugzilla 起初由 Terry Weissman开发于1998年,它用 perl 语言编写,用 MySQL 作为后端数据库。它是一款旨在帮助管理软件开发的服务器软件,它有丰富的功能、高度优化的数据库、卓越的安全性、高级的搜索工具、集成了邮件功能等等。 + +在本教程中,我们将安装 bugzilla 5.0 ,采用 apache 作为 Web 服务器,并为它启用 SSL,然后在 freebsd 10.2 上安装 mysql 5.1 来作为数据库系统。 + +#### 准备 #### + +- FreeBSD 10.2 - 64位 +- Root 权限 + +### 第一步 - 更新系统 ### + +用 ssh 登录 freebsd 服务器,并更新软件库: + + sudo su + freebsd-update fetch + freebsd-update install + +### 第二步 - 安装并配置 Apache ### + +在这一步我们将使用 pkg 命令从 freebsd 软件库中安装 apache,然后在 apache24 目录下编辑 "httpd.conf" 文件,来配置 apache 以启用 SSL 和 CGI 支持。 + +用 pkg 命令安装 apache: + + pkg install apache24 + +进入 apache 目录并用 nano 编辑器编辑"httpd.conf"文件: + + cd /usr/local/etc/apache24 + nano -c httpd.conf + +取消下面列出行的注释: + + #第70行 + LoadModule authn_socache_module libexec/apache24/mod_authn_socache.so + + #第89行 + LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so + + #第117行 + LoadModule expires_module libexec/apache24/mod_expires.so + + #第141行,启用SSL + LoadModule ssl_module libexec/apache24/mod_ssl.so + + #第162行,支持cgi + LoadModule cgi_module libexec/apache24/mod_cgi.so + + #第174行,启用mod_rewrite + LoadModule rewrite_module libexec/apache24/mod_rewrite.so + + #第219行,服务器名配置 + ServerName 127.0.0.1:80 + +保存并退出。 + +接着,我们需要从 freebsd 库中安装 mod perl,并启用它: + + pkg install ap24-mod_perl2 + +启用 mod_perl,编辑"httpd.conf"文件并添加"Loadmodule"行: + + nano -c httpd.conf + +添加该行: + + #第175行 + LoadModule perl_module libexec/apache24/mod_perl.so + +保存并退出。 + +在启用 apache 之前,用 sysrc 命令添加以下行作为开机启动项: + + sysrc apache24_enable=yes + service apache24 start + +### 第三步 - 安装并配置 MySQL 数据库 ### + +我们要用 mysql 5.1 来作为后端数据库并且支持 perl 模块。用 pkg 命令安装 mysql 5.1: + + pkg install p5-DBD-mysql51 mysql51-server mysql51-client + +现在我们要将 mysql 服务设置为开机启动,然后为 mysql 配置 root 密码。 + +运行以下命令来完成上述所有操作: + + sysrc mysql_enable=yes + service mysql-server start + mysqladmin -u root password aqwe123 + +注意: + +这里 mysql 密码为:aqwe123 + +![Configure MySQL Password](http://blog.linoxide.com/wp-content/uploads/2015/12/Configure-MySQL-Password.png) + +以上步骤都完成之后,我们用 root 登录 mysql shell,然后为 bugzilla 安装创建一个新的数据库和用户。 + +用以下命令登录 mysql shell: + + mysql -u root -p + password: aqwe123 + +添加数据库: + + create database bugzilladb; + create user bugzillauser@localhost identified by 'bugzillauser@'; + grant all privileges on bugzilladb.* to bugzillauser@localhost identified by 'bugzillauser@'; + flush privileges; + \q + +![Creating Database for Bugzilla](http://blog.linoxide.com/wp-content/uploads/2015/12/Creating-Database-for-Bugzilla.png) + +bugzilla 的数据库创建好了,名字为"bugzilladb",用户名和密码分别为"bugzillauser"和"bugzillauser@"。 + +### 第四步 - 生成新的 SSL 证书 ### + +在 bugzilla 站点的 "ssl" 目录里生成新的自签名 SSL 证书。 + +前往 apache24 目录并在此创建新目录 "ssl": + + cd /usr/local/etc/apache24/ + mkdir ssl; cd ssl + +接着,用 openssl 命令生成证书文件,然后更改其权限: + + sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /usr/local/etc/apache24/ssl/bugzilla.key -out /usr/local/etc/apache24/ssl/bugzilla.crt + chmod 600 * + +### 第五步 - 配置虚拟主机 ### + +我们将在 "/usr/local/www/bugzilla" 目录里安装 bugzilla,所以我们必须为它创建新的虚拟主机配置。 + +前往 apache 目录并为虚拟主机文件创建名为 "vhost" 的新目录: + + cd /usr/local/etc/apache24/ + mkdir vhost; cd vhost + +现在为虚拟主机文件创建新文件 "bugzilla.conf": + + nano -c bugzilla.conf + +将以下配置粘贴进去: + + + ServerName mybugzilla.me + ServerAlias www.mybuzilla.me + DocumentRoot /usr/local/www/bugzilla + Redirect permanent / https://mybugzilla.me/ + + + Listen 443 + + ServerName mybugzilla.me + DocumentRoot /usr/local/www/bugzilla + + ErrorLog "/var/log/mybugzilla.me-error_log" + CustomLog "/var/log/mybugzilla.me-access_log" common + + SSLEngine On + SSLCertificateFile /usr/local/etc/apache24/ssl/bugzilla.crt + SSLCertificateKeyFile /usr/local/etc/apache24/ssl/bugzilla.key + + + AddHandler cgi-script .cgi + Options +ExecCGI + DirectoryIndex index.cgi index.html + AllowOverride Limit FileInfo Indexes Options + Require all granted + + + +保存并退出。 + +上述都完成之后,为 bugzilla 安装创建新目录,并在 httpd.conf 文件添加虚拟主机配置来启用 bugzilla虚拟主机。 + +在 "apache24" 目录下运行以下命令: + + mkdir -p /usr/local/www/bugzilla + cd /usr/local/etc/apache24/ + nano -c httpd.conf + +文末,添加以下配置: + + Include etc/apache24/vhost/*.conf + +保存并退出。 + +现在用 "apachectl" 命令测试一下 apache 的配置并重启它: + + apachectl configtest + service apache24 restart + +### 第六步 - 安装 Bugzilla ### + +我们可以通过下载源来手动安装 bugzilla 了,或从 freebsd 库中安装也可以。在这一步中我们将用 pkg 命令从 freebsd 库中安装 bugzilla: + + pkg install bugzilla50 + +以上步骤都完成之后,前往 bugzilla 安装目录并安装所有 bugzilla 需要的 perl 模块。 + + cd /usr/local/www/bugzilla + ./install-module --all + +要等到所有都完成,这需要点时间。 + +下一步,在 bugzilla 的安装目录中执行 "checksetup.pl" 文件来生成配置文件 "localconfig"。 + + ./checksetup.pl + +你会看到一条关于数据库配置错误的消息,你得用 nano 编辑器编辑一下 "localconfig" 文件: + + nano -c localconfig + +现在添加第三步创建的数据库。 + + #第57行 + $db_name = 'bugzilladb'; + + #第60行 + $db_user = 'bugzillauser'; + + #第67行 + $db_pass = 'bugzillauser@'; + +保存并退出。 + +然后再次运行 "checksetup.pl": + + ./checksetup.pl + +你会收到输入邮箱名和管理员账号的提示,你只要输入你的邮箱、用户名和密码就行了。 + +![Admin Setup](http://blog.linoxide.com/wp-content/uploads/2015/12/Admin-Setup.png) + +最后,我们需要把安装目录的属主改成 "www",然后用服务命令重启 apache: + + cd /usr/local/www/ + chown -R www:www bugzilla + service apache24 restart + +现在 Bugzilla 已经安装好了,你可以通过访问 mybugzilla.me 来查看,并且将会重定向到 https 连接。 + +Bugzilla 首页: + +![Bugzilla Home](http://blog.linoxide.com/wp-content/uploads/2015/12/Bugzilla-Home.png) + +Bugzilla admin 面板: + +![Bugzilla Admin Page](http://blog.linoxide.com/wp-content/uploads/2015/12/Bugzilla-Admin-Page.png) + +### 结论 ### + +Bugzilla 是一个基于 web 的应用,并能帮助你管理软件开发,它用 perl 开发并以 MySQL 作为数据库系统。Bugzilla 帮助 mozilla、redhat、gnome 等公司完成软件开发工作。Bugzilla 有很多功能并易于配置和安装。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/tools/install-bugzilla-apache-ssl-freebsd-10-2/ + +作者:[Arul][a] +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arulm/ diff --git a/published/201602/20151214 Linux or Unix Desktop Fun--Christmas Tree For Your Terminal.md b/published/201602/20151214 Linux or Unix Desktop Fun--Christmas Tree For Your Terminal.md new file mode 100644 index 0000000000..48b6d23f18 --- /dev/null +++ b/published/201602/20151214 Linux or Unix Desktop Fun--Christmas Tree For Your Terminal.md @@ -0,0 +1,84 @@ +Linux/Unix 桌面趣事:终端上的圣诞树 +================================================================================ + +给你的Linux或Unix控制台创造一棵圣诞树玩玩吧。在此之前,需要先安装一个Perl模块,命名为Acme::POE::Tree。这是一棵很喜庆的圣诞树,我已经在Linux、OSX和类Unix系统上验证过了。 + +### 安装 Acme::POE::Tree ### + +安装perl模块最简单的办法就是使用CPAN(Perl综合典藏网(Comprehensive Perl Archive Network))。打开终端,把下面的指令敲进去便可安装Acme::POE::Tree。 + + ## 以root身份运行 ## + perl -MCPAN -e 'install Acme::POE::Tree' + +**示例输出:** + + Installing /home/vivek/perl5/man/man3/POE::NFA.3pm + Installing /home/vivek/perl5/man/man3/POE::Kernel.3pm + Installing /home/vivek/perl5/man/man3/POE::Loop.3pm + Installing /home/vivek/perl5/man/man3/POE::Resource.3pm + Installing /home/vivek/perl5/man/man3/POE::Filter::Map.3pm + Installing /home/vivek/perl5/man/man3/POE::Resource::SIDs.3pm + Installing /home/vivek/perl5/man/man3/POE::Loop::IO_Poll.3pm + Installing /home/vivek/perl5/man/man3/POE::Pipe::TwoWay.3pm + Appending installation info to /home/vivek/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/perllocal.pod + RCAPUTO/POE-1.367.tar.gz + /usr/bin/make install -- OK + RCAPUTO/Acme-POE-Tree-1.022.tar.gz + Has already been unwrapped into directory /home/vivek/.cpan/build/Acme-POE-Tree-1.022-uhlZUz + RCAPUTO/Acme-POE-Tree-1.022.tar.gz + Has already been prepared + Running make for R/RC/RCAPUTO/Acme-POE-Tree-1.022.tar.gz + cp lib/Acme/POE/Tree.pm blib/lib/Acme/POE/Tree.pm + Manifying 1 pod document + RCAPUTO/Acme-POE-Tree-1.022.tar.gz + /usr/bin/make -- OK + Running make test + PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t + t/01_basic.t .. ok + All tests successful. + Files=1, Tests=2, 6 wallclock secs ( 0.09 usr 0.03 sys + 0.53 cusr 0.06 csys = 0.71 CPU) + Result: PASS + RCAPUTO/Acme-POE-Tree-1.022.tar.gz + Tests succeeded but one dependency not OK (Curses) + RCAPUTO/Acme-POE-Tree-1.022.tar.gz + [dependencies] -- NA + +### 在Shell中显示圣诞树 ### + +只需要在终端上运行以下命令: + + perl -MAcme::POE::Tree -e 'Acme::POE::Tree->new()->run()' + +**示例输出** + +![Gif 01: An animated christmas tree in Perl](http://s0.cyberciti.org/uploads/cms/2015/12/perl-tree.gif) + +Gif 01: 一棵用Perl写的喜庆圣诞树 + +### 树的定制 ### + +以下是我的脚本文件tree.pl的内容: + + #!/usr/bin/perl + + use Acme::POE::Tree; + my $tree = Acme::POE::Tree->new( + { + star_delay => 1.5, # shimmer star every 1.5 sec + light_delay => 2, # twinkle lights every 2 sec + run_for => 10, # automatically exit after 10 sec + } + ); + $tree->run(); + +这样就可以通过修改star_delay、run_for和light_delay参数的值来自定义你的树了。一棵好玩的终端圣诞树就此诞生。 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/open-source/command-line-hacks/linux-unix-desktop-fun-christmas-tree-for-your-terminal/ + +作者:Vivek Gite +译者:[soooogreen](https://github.com/soooogreen) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201602/20160104 How to use KVM from the command line on Debian or Ubuntu.md b/published/201602/20160104 How to use KVM from the command line on Debian or Ubuntu.md new file mode 100644 index 0000000000..f631477721 --- /dev/null +++ b/published/201602/20160104 How to use KVM from the command line on Debian or Ubuntu.md @@ -0,0 +1,371 @@ +怎样在 ubuntu 和 debian 中通过命令行管理 KVM +================================================================================ + +有很多不同的方式去管理运行在 KVM 管理程序上的虚拟机。例如,virt-manager 就是一个流行的基于图形界面的前端虚拟机管理工具。然而,如果你想要在没有图形窗口的服务器环境下使用 KVM ,那么基于图形界面的解决方案显然是行不通的。事实上,你可以单纯使用包装了 kvm 命令行脚本的命令行来管理 KVM 虚拟机。作为替代方案,你可以使用 virsh 这个容易使用的命令行程序来管理客户虚拟机。在 virsh 中,它通过和 libvirtd 服务通信来达到控制虚拟机的目的,而 libvirtd 可以控制多个不同的虚拟机管理器,包括 KVM,Xen,QEMU,LXC 和 OpenVZ。 + +当你想要对虚拟机的前期准备和后期管理实现自动化操作时,像 virsh 这样的命令行管理工具是非常有用的。同样,virsh 支持多个管理器也就意味着你可以通过相同的 virsh 接口去管理不同的虚拟机管理器。 + +在这篇文章中,我会示范**怎样在 ubuntu 和 debian 上通过使用 virsh 命令行去运行 KVM**。 + +### 第一步:确认你的硬件平台支持虚拟化 ### + +第一步,首先要确认你的 CPU 支持硬件虚拟化扩展(e.g.,Intel VT 或者 AMD-V),这是 KVM 对硬件的要求。下面的命令可以检查硬件是否支持虚拟化。 + +``` + $ egrep '(vmx|svm)' --color /proc/cpuinfo +``` + +![](https://c2.staticflickr.com/2/1505/24050288606_758a44c4c6_c.jpg) + +如果在输出中不包含 vmx 或者 svm 标识,那么就意味着你的 cpu 不支持硬件虚拟化。因此你不能在你的机器上使用 KVM 。确认了 cpu 支持 vmx 或者 svm 之后,接下来开始安装 KVM。 + +对于 KVM 来说,它不要求运行在拥有 64 位内核系统的主机上,但是通常我们会推荐在 64 位系统的主机上面运行 KVM。 + +### 第二步:安装KVM ### + +使用 `apt-get` 安装 KVM 和相关的用户空间工具。 + +``` + $ sudo apt-get install qemu-kvm libvirt-bin +``` + +安装期间,libvirtd 用户组(在 debian 上是 libvirtd-qemu 用户组)将会被创建,并且你的用户 id 将会被自动添加到该组中。这样做的目的是让你可以以一个普通用户而不是 root 用户的身份去管理虚拟机。你可以使用 `id` 命令来确认这一点,下面将会告诉你怎么去显示你的组 id: + +``` + $ id +``` + +![](https://c2.staticflickr.com/6/5597/15432586092_64dfb867d3_c.jpg) + +如果因为某些原因,libvirt(在 debian 中是 libvirt-qemu)没有在你的组 id 中被找到,你也可以手动将你自己添加到对应的组中,如下所示: + +在 ubuntu 上: + +``` + $ sudo adduser [youruserID] libvirtd +``` + +在 debian 上: + +``` + $ sudo adduser [youruserID] libvirt-qemu +``` + +按照如下命令重新载入更新后的组成员关系。如果要求输入密码,那么输入你的登陆密码即可。 + +``` + $ exec su -l $USER +``` + +这时,你应该可以以普通用户的身份去执行 virsh 了。做一个如下所示的测试,这个命令将会以列表的形式列出可用的虚拟机(当前的列表是空的)。如果你没有遇到权限问题,那意味着到目前为止一切都是正常的。 + + $ virsh list + +---------- + + Id Name State +---------------------------------------------------- + +### 第三步:配置桥接网络 ### + +为了使 KVM 虚拟机能够访问外部网络,一种方法是通过在 KVM 宿主机上创建 Linux 桥来实现。创建之后的桥能够将虚拟机的虚拟网卡和宿主机的物理网卡连接起来,因此,虚拟机能够发送和接收由物理网卡传输的数据包。这种方式叫做网络桥接。 + +下面将告诉你如何创建并且配置网桥,我们创建一个网桥称它为 br0。 + +首先,安装一个必需的包,然后用命令行创建一个网桥。 + +``` + $ sudo apt-get install bridge-utils + $ sudo brctl addbr br0 +``` + +下一步就是配置已经创建好的网桥,即修改位于 `/etc/network/interfaces` 的配置文件。我们需要将该桥接网卡设置成开机启动。为了修改该配置文件,你需要关闭你的操作系统上的网络管理器(如果你在使用它的话)。跟随[操作指南][1]的说明去关闭网络管理器。 + +关闭网络管理器之后,接下来就是通过修改配置文件来配置网桥了。 + +``` + #auto eth0 + #iface eth0 inet dhcp + + auto br0 + iface br0 inet dhcp + bridge_ports eth0 + bridge_stp off + bridge_fd 0 + bridge_maxwait 0 +``` + +在上面的配置中,我假设 eth0 是主要网卡,它也是连接到外网的网卡,同样,我假设 eth0 将会通过 DHCP 协议自动获取 ip 地址。注意,之前在 `/etc/network/interfaces` 中还没有对 eth0 进行任何配置。桥接网卡 br0 引用了 eth0 的配置,而 eth0 也会受到 br0 的制约。 + +重启网络服务,并确认网桥已经被成功的配置好。如果成功的话,br0 的 ip 地址将会是 eth0 自动分配的 ip 地址,而且 eth0 不会被分配任何 ip 地址。 + +``` + $ sudo /etc/init.d/networking restart + $ ifconfig +``` + +如果因为某些原因,eth0 仍然保留了之前分配给了 br0 的 ip 地址,那么你可能必须手动删除 eth0 的 ip 地址。 + +![](https://c2.staticflickr.com/2/1698/23780708850_66cd7ba6ea_c.jpg) + +### 第四步:用命令行创建一个虚拟机 ### + +对于虚拟机来说,它的配置信息被存储在它对应的xml文件中。因此,创建一个虚拟机的第一步就是准备一个与虚拟机对应的 xml 文件。 + +下面是一个示例 xml 文件,你可以根据需要手动修改它。 + +``` + + alice + f5b8c05b-9c7a-3211-49b9-2bd635f7e2aa + 1048576 + 1048576 + 1 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/kvm + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + + + +``` + +上面的主机xml配置文件定义了如下的虚拟机内容。 + +- 1GB内存,一个虚拟cpu和一个硬件驱动 + +- 磁盘镜像:`/home/dev/images/alice.img` + +- 从 CD-ROM 引导(`/home/dev/iso/CentOS-6.5-x86_64-minomal.iso`) + +- 网络:一个桥接到 br0 的虚拟网卡 + +- 通过 VNC 远程访问 + +`` 中的 UUID 字符串可以随机生成。为了得到一个随机的 uuid 字符串,你可能需要使用 uuid 命令行工具。 + +``` + $ sudo apt-get install uuid + $ uuid +``` + +生成一个主机 xml 配置文件的方式就是通过一个已经存在的虚拟机来导出它的 xml 配置文件。如下所示。 + +``` + $ virsh dumpxml alice > bob.xml +``` + +![](https://c2.staticflickr.com/6/5808/23968234602_25e8019ec8_c.jpg) + +### 第五步:使用命令行启动虚拟机 ### + +在启动虚拟机之前,我们需要创建它的初始磁盘镜像。为此,你需要使用 qemu-img 命令来生成一个 qemu-kvm 镜像。下面的命令将会创建 10 GB 大小的空磁盘,并且它是 qcow2 格式的。 + +``` + $ qemu-img create -f qcow2 /home/dev/images/alice.img 10G +``` + +使用 qcow2 格式的磁盘镜像的好处就是它在创建之初并不会给它分配全部大小磁盘容量(这里是 10 GB),而是随着虚拟机中文件的增加而逐渐增大。因此,它对空间的使用更加有效。 + +现在,你可以通过使用之前创建的 xml 配置文件启动你的虚拟机了。下面的命令将会创建一个虚拟机,然后自动启动它。 + +``` + $ virsh create alice.xml + Domain alice created from alice.xml +``` + +**注意**: 如果你对一个已经存在的虚拟机执行了了上面的命令,那么这个操作将会在没有任何警告的情况下抹去那个已经存在的虚拟机的全部信息。如果你已经创建了一个虚拟机,你可能会使用下面的命令来启动虚拟机。 + +``` + $ virsh start alice.xml +``` + +使用如下命令确认一个新的虚拟机已经被创建并成功的被启动。 + +``` + $ virsh list +``` + + Id Name State + ---------------------------------------------------- + 3 alice running + +同样,使用如下命令确认你的虚拟机的虚拟网卡已经被成功的添加到了你先前创建的 br0 网桥中。 + + $ sudo brctl show + +![](https://c2.staticflickr.com/2/1546/23449585383_a371e9e579_c.jpg) + +### 远程连接虚拟机 ### + +为了远程访问一个正在运行的虚拟机的控制台,你可以使用VNC客户端。 + +首先,你需要使用如下命令找出用于虚拟机的VNC端口号。 + +``` + $ sudo netstat -nap | egrep '(kvm|qemu)' +``` + +![](https://c2.staticflickr.com/6/5633/23448144274_49045bc868_c.jpg) + +在这个例子中,用于 alice 虚拟机的 VNC 端口号是 5900。 然后启动一个VNC客户端,连接到一个端口号为5900的VNC服务器。在我们的例子中,虚拟机支持由CentOS光盘文件启动。 + +![](https://c2.staticflickr.com/2/1533/24076369675_99408972a4_c.jpg) + +### 使用 virsh 管理虚拟机 ### + +下面列出了 virsh 命令的常规用法: + +创建客户机并且启动虚拟机: + +``` + $ virsh create alice.xml +``` + +停止虚拟机并且删除客户机: + +``` + $ virsh destroy alice +``` + +关闭虚拟机(不用删除它): + +``` + $ virsh shutdown alice +``` + +暂停虚拟机: + +``` + $ virsh suspend alice +``` + +恢复虚拟机: + +``` + $ virsh resume alice +``` + +访问正在运行的虚拟机的控制台: + +``` + $ virsh console alice +``` + +设置虚拟机开机启动: + +``` + $ virsh autostart alice +``` + +查看虚拟机的详细信息: + +``` + $ virsh dominfo alice +``` + +编辑虚拟机的配置文件: + +``` + $ virsh edit alice +``` + +上面的这个命令将会使用一个默认的编辑器来调用主机配置文件。该配置文件中的任何改变都将自动被libvirt验证其正确性。 + +你也可以在一个virsh会话中管理虚拟机。下面的命令会创建并进入到一个virsh会话中: + +``` + $ virsh +``` + +在 virsh 提示中,你可以使用任何 virsh 命令。 + +![](https://c2.staticflickr.com/6/5645/23708565129_b1ef968b30_c.jpg) + +### 问题处理 ### + +1. 我在创建虚拟机的时候遇到了一个错误: + + error: internal error: no supported architecture for os type 'hvm' + + 如果你的硬件不支持虚拟化的话你可能就会遇到这个错误。(例如,Intel VT或者AMD-V),这是运行KVM所必需的。如果你遇到了这个错误,而你的cpu支持虚拟化,那么这里可以给你一些可用的解决方案: + + 首先,检查你的内核模块是否丢失。 + + ``` + $ lsmod | grep kvm + ``` + + 如果内核模块没有加载,你必须按照如下方式加载它。 + + ``` + $ sudo modprobe kvm_intel (for Intel processor) + $ sudo modprobe kvm_amd (for AMD processor) + ``` + + 第二个解决方案就是添加 `--connect qemu:///system` 参数到 `virsh` 命令中,如下所示。当你正在你的硬件平台上使用超过一个虚拟机管理器的时候就需要添加这个参数(例如,VirtualBox,VMware)。 + + ``` + $ virsh --connect qemu:///system create alice.xml + ``` + +2. 当我试着访问我的虚拟机的登陆控制台的时候遇到了错误: + + ``` + $ virsh console alice + error: internal error: cannot find character device + ``` + + 这个错误发生的原因是你没有在你的虚拟机配置文件中定义控制台设备。在 xml 文件中加上下面的内部设备部分即可。 + + ``` + + + + ``` + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/use-kvm-command-line-debian-ubuntu.html + +作者:[Dan Nanni][a] +译者:[kylepeng93](https://github.com/kylepeng93 ) +校对:[Ezio](https://github.com/oska874) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://xmodulo.com/disable-network-manager-linux.html diff --git a/published/201602/20160126 How to change from default to alternative Python version on Debian Linux.md b/published/201602/20160126 How to change from default to alternative Python version on Debian Linux.md new file mode 100644 index 0000000000..a33c0fcaaf --- /dev/null +++ b/published/201602/20160126 How to change from default to alternative Python version on Debian Linux.md @@ -0,0 +1,103 @@ +如何将 Debian Linux 中的默认的 Python 版本切换为替代版本 +==================================================== + +当你安装 Debian Linux 时,安装过程有可能同时为你提供多个可用的 Python 版本,因此系统中会存在多个 Python 的可执行二进制文件。你可以按照以下方法使用 `ls` 命令来查看你的系统中都有那些 Python 的二进制文件可供使用。 + +``` +$ ls /usr/bin/python* +/usr/bin/python /usr/bin/python2 /usr/bin/python2.7 /usr/bin/python3 /usr/bin/python3.4 /usr/bin/python3.4m /usr/bin/python3m +``` + +执行如下命令查看默认的 Python 版本信息: + +``` +$ python --version +Python 2.7.8 +``` + +###1、基于用户修改 Python 版本: + +想要为某个特定用户修改 Python 版本,只需要在其 home 目录下创建一个 `alias`(别名) 即可。打开该用户的 `~/.bashrc` 文件,添加新的别名信息来修改默认使用的 Python 版本。 + +``` +alias python='/usr/bin/python3.4' +``` + +一旦完成以上操作,重新登录或者重新加载 `.bashrc` 文件,使操作生效。 + +``` +$ . ~/.bashrc +``` + +检查当前的 Python 版本。 + +``` +$ python --version +Python 3.4.2 +``` + +###2、 在系统级修改 Python 版本 + +我们可以使用 `update-alternatives` 来为整个系统更改 Python 版本。以 root 身份登录,首先罗列出所有可用的 python 替代版本信息: + +``` +# update-alternatives --list python +update-alternatives: error: no alternatives for python +``` + +如果出现以上所示的错误信息,则表示 Python 的替代版本尚未被 `update-alternatives` 命令识别。想解决这个问题,我们需要更新一下替代列表,将 `python2.7` 和 `python3.4` 放入其中。 + +``` +# update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 +update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in auto mode +# update-alternatives --install /usr/bin/python python /usr/bin/python3.4 2 +update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python) in auto mode +``` + +`--install` 选项使用了多个参数用于创建符号链接。最后一个参数指定了此选项的优先级,如果我们没有手动来设置替代选项,那么具有最高优先级的选项就会被选中。这个例子中,我们为 `/usr/bin/python3.4` 设置的优先级为2,所以 `update-alternatives` 命令会自动将它设置为默认 Python 版本。 + +``` +# python --version +Python 3.4.2 +``` + +接下来,我们再次列出可用的 Python 替代版本。 + +``` +# update-alternatives --list python +/usr/bin/python2.7 +/usr/bin/python3.4 +``` + +现在开始,我们就可以使用下方的命令随时在列出的 Python 替代版本中任意切换了。 + +``` +# update-alternatives --config python +``` + +![](http://linuxconfig.org/images/change-python-alternative-version-debian-linux.png) + +``` +# python --version +Python 2.7.8 +``` + +###3、移除替代版本 + +一旦我们的系统中不再存在某个 Python 的替代版本时,我们可以将其从 `update-alternatives` 列表中删除掉。例如,我们可以将列表中的 python2.7 版本移除掉。 + +``` +# update-alternatives --remove python /usr/bin/python2.7 +update-alternatives: removing manually selected alternative - switching python to auto mode +update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python) in auto mode +``` + +-------------------------------------------------------------------------------- + +via: http://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux + +译者:[mr-ping](https://github.com/mr-ping) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + diff --git a/published/201602/20160218 Meizu PRO 5 Ubuntu Edition Announced and It's a Beast.md b/published/201602/20160218 Meizu PRO 5 Ubuntu Edition Announced and It's a Beast.md new file mode 100644 index 0000000000..9eb9e779b9 --- /dev/null +++ b/published/201602/20160218 Meizu PRO 5 Ubuntu Edition Announced and It's a Beast.md @@ -0,0 +1,37 @@ +魅族 Pro 5 Ubuntu 版即将发布 +======================================================== + +**Canonical 和魅族刚刚透露魅族 Pro 5 Ubuntu 版将在 2016 世界移动大会召开期间开始预售** + +自从上次听到魅族的消息到现在已经很久了,但是看起来 Canonical 和这个中国的硬件厂商之间的合作关系仍然存在。从表面来看,之前魅族的 MX4 Ubuntu 版只是进行了小范围的发布,所以只有很少的设备卖出去了。 + +我们仅仅希望魅族 Pro 5 Ubuntu 版可以提高供货量,尤其是因为它是魅族的一款相当新且还提供支持的手机。 + +最新的魅族 Pro 5 是第 5 个支持 Ubuntu Touch 的官方设备,2016 年我们可能会看到更多的手机甚至是平板都会预装这个操作系统。 + +## 魅族 Pro 5 Ubuntu 版将会非常震撼 + +Canonical 宣称 Pro 5 是目前已发布了的 Ubuntu 智能手机中最强大的一个,他们说的是对的,但还有一点没有被提及,即如果不考虑平板,它也是最大的 Ubuntu Touch 设备。魅族 Pro 5 采用了一颗 Exynos 7420 8 核处理器和 5.7 英寸分辨率为 1920x1080 的 AMOLED 屏,配备第三代康宁大猩猩玻璃以及 LPDDR4 内存技术。 + +很多人也许会问这个新手机的系统是否可以和桌面版系统一样,现在看起来真是如此。 + +该公司解释说,“Canonical 一直致力于通过向各种个人设备提供一个统一的自适应平台来重塑个人计算的视觉表现。因此尽管魅族 Pro 5 缺少 MHL 输出,但它运行的是最新的代码,这些代码与新近发布的平板和其它设备一样,可提供一种接近传统桌面的体验。” + +魅族 Pro 5 最初于 2015 年 9 月发布,拥有一个 2100 万像素的后置摄像头,可以拍摄 30fps 的 2160p 视频。同时它还带有一个指纹传感器和支持快速充电的 3050 mAh 的锂电池。 + +目前这款手机只在中国和欧洲有售,预定将从 2016 年 2 月 22 日至 25 日的世界移动大会期间开始。 + +![](http://i1-news.softpedia-static.com/images/fitted/620x/meizu-pro-5-ubuntu-edition-announced-and-it-s-a-beast-photos-500526-11.jpg) + + +------------------------------------------------------------------------------ + +via: http://news.softpedia.com/news/meizu-pro-5-ubuntu-edition-announced-and-it-s-a-beast-photos-500526.shtml + +作者:[Silviu Stahie][a] +译者:[osk874](https://github.com/osk874) +校对:[Yuking](https://github.com/Yuking-net) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://news.softpedia.com/editors/browse/silviu-stahie diff --git a/published/201602/20160218 Russia Announces Switch to Linux.md b/published/201602/20160218 Russia Announces Switch to Linux.md new file mode 100644 index 0000000000..9aa0ee327a --- /dev/null +++ b/published/201602/20160218 Russia Announces Switch to Linux.md @@ -0,0 +1,35 @@ +本周 Linux 新闻: 俄罗斯宣布政府电脑系统迁移到 Linux +========================================================================= + +本周 Linux 新闻包括:俄罗斯宣布可能会将系统迁移到 Linux 上、Jack Wallen 思考 2016 年对 Linux 桌面系统的重要性,等等。下面就让我们看看本周 Linux 界都有那些重要新闻。 + +1. 俄罗斯宣布有可能切换到 Linux , 以此来反击西方因克里米亚问题而实施的商业禁运。 + + [俄罗斯可能将成千上万台政府的电脑系统从 Windows 切换成 Linux](http://www.techradar.com/news/world-of-tech/russia-might-switch-thousands-of-government-computers-to-linux-to-spite-microsoft-1314762) - TechRadar + +2. Jack Wallen 写到:“对于 Linux 来说,占有桌面系统市场 1% 或者 99% 并不重要” + + [为了 Linux 桌面系统奋斗是否真的很重要?](http://www.techrepublic.com/article/should-the-fight-for-the-linux-desktop-really-matter/) - TechRepublic + +3. 自从去年 12 月以来,参与 Linux 基金会的 HYPERLEDGER 计划的合作伙伴有了显著的增加 + + [Linux 基金会的 HYPERLEDGER 计划已经有了 30 个合作伙伴](http://www.coindesk.com/linux-foundation-led-hyperledger-project-swells-to-30-members/) - CoinDesk + +4. Docker 的创始人和 CTO , Solomon Hykes 建议将 Alpine Linux 作为公司新的默认操作系统 + + [Docker 将会抛弃 Ubuntu 吗?](http://www.infoworld.com/article/3031847/open-source-tools/is-docker-ditching-ubuntu-linux-confusion-reigns.html) - InfoWorld + +5. Linux 基金会的合作项目 Node.js 基金会计划引入流行的第三方软件包“Express” + + [Node.js 基金会计划引入社区里最流行的框架软件 Express 进行孵化](http://thenextweb.com/dd/2016/02/10/the-node-js-foundation-plans-to-incubate-one-of-the-communitys-most-popular-packages/)- The Next Web + + +------------------------------------------------------------------------------ + +via: http://www.linux.com/news/software/applications/885174-this-week-in-linux-news-russia-announces-switch-to-linux-outdated-fight-for-the-linux-desktop-a-more + +作者:[linux.com][linux.com] +译者:[oska874](https://github.com/oska874) +校对:[Yuking_net](https://github.com/Yuking-net) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201602/20160218 The Best Linux Distros of 2016.md b/published/201602/20160218 The Best Linux Distros of 2016.md new file mode 100644 index 0000000000..bfd8ddd640 --- /dev/null +++ b/published/201602/20160218 The Best Linux Distros of 2016.md @@ -0,0 +1,118 @@ +2016:如何选择 Linux 发行版 +================================ + +![](http://www.linux.com/images/stories/66866/distro-opensuse.JPG) + +[不管是在企业级应用还是在消费者领域](http://www.cio.com/article/3017983/linux/2015s-most-exciting-linux-devices.html),2015 对于 Linux 来说都是极其重要的一年。作为一个从 2005 年就开始使用 Linux 的老用户,我有幸见证了 Linux 过去这 10 年里的重大发展,[并且,我相信它在 2016 年里会更加令人激动](http://www.cio.com/article/3017177/linux/11-predictions-for-linux-in-2016.html)。在这篇文章里,我会挑选几个将在 2016 年里大放光彩的最佳发行版给大家介绍一下。 + +## 强势归来的发行版:openSUSE + +SUSE 是 openSUSE 发行版背后的公司,同时也是起步最早的 Linux 公司;[它在 Linus Torvalds 发布 Linux 的第二年就成立了](http://www.linux.com/news/software/applications/866964-exclusive-interview-with-suse-president-nils-brauckmann)。该公司的成立实际上早于现在的 Linux 公司之王 —— Red Hat。同时 SUSE 也是 [openSUSE](https://www.opensuse.org/) 社区发行版的发起者和赞助商。 + +2015 年,openSUSE 的开发团队决定向 SUSE Linux 企业版 (SLE) 靠拢,以便让用户可以获得企业服务器特性的发行版——类似于 CentOS 和 Ubuntu 那样。因此,openSUSE 变成了 [openSUSE Leap](https://en.opensuse.org/Portal:Leap),一个直接基于 SLE SP1 的发行版。 + +两个发行版共用相同的基础代码,相互受益 —— SUSE 会选用 openSUSE 中好的代码,反之亦然。如此,openSUSE 也放弃了原本常规的发布周期,新版本与 SLE 同步发行。这意味着每个版本将会有更长的生命周期。 + +这样做的结果是,openSUSE 就成了一个非常重要的发行版,因为潜在的 SLE 用户现在可以使用 openSUSE Leap 了。不过,这还不是全部,openSUSE 同样也有发行版 [Tumbleweed](http://www.cio.com/article/3008856/open-source-tools/is-opensuse-tumbleweed-good-enough-for-a-seasoned-arch-user.html) —— 一个纯净的滚动式版本。所以,用户们可以选择使用很稳定的 openSUSE Leap 或者经常更新的 openSUSE Tumbleweed。 + +在我的记忆中,还没有其他的发行版做了这样一个令人印象深刻的强势归来。 + +## 最高可定制性的发行版:Arch Linux + +Arch Linux 是目前最好的滚动式更新的发行版。好吧,我可能有些偏见,因为我是一名 Arch Linux 用户 ( LCTT 译注:译者也是 Arch Linux 用户,它的定制性真的很好)。然而,我认为它好的真正原因是 Arch 在很多其他领域也都表现的非常优越,并且这才是我为什么用它作为主系统的原因。 + +- 对于那些想要学习 Linux 方方面面的用户来说,[Arch Linux](https://www.archlinux.org/) 无疑是一个绝佳的选择。因为你需要手动安装所有自己需要的东西,这样你会慢慢学到 Linux 系统的所有细节。 + +- Arch 是一个可高度定制发行版。任何桌面环境 (DE) 都没有了 “Arch” 的原味。你能够得到的只是一个基础系统,然后你可以在上边构建你所想要的发行版。无论好坏,也不像 openSUSE 或者 Ubuntu 那样,Arch 没有额外的补丁或者集成环境。你得到的基本就是上游开发者所创建的原始软件。 + +- Arch Linux 同时也是最好的滚动式更新的发行版之一。它需要经常保持着更新。用户所运行的基本上是最新的软件,当然,也可以通过非稳定仓库运行预发行版的软件。 + +- Arch 闻名于拥有为数众多的优秀文档。Arch Wiki 是我用以了解所有 Linux 相关事情的完整资源。 + +- Arch 中,我最喜欢的是,它提供了“任何”其他发行版中可用的的包和软件,同时还要感谢 AUR (Arch User Repository,Arch 用户仓库)。 + +## 最美观的发行版:elementary OS + +不同的发行版会有不同的关注点——多数情况下表现为技术的不同。在大多数的 Linux 发行版中,外观和用户感觉并非他们优先考虑的事情 —— 这通常是桌面环境需要考虑的事情。 + +[elementary OS](https://elementary.io/) 正在尝试改变这一事实。在这个发行版中,设计是占据重要位置,并且原因明显——这个发行版是由那些以在 Linux 世界创建漂亮图标而闻名的设计人员所开发的。 + +elementary OS 相当注重整体外观和用户感觉。开发者创建了他们自己的组件,包括桌面环境。此外,他们只会选择那些符合设计规范的应用来加入到软件仓库。你可以发现 elementary OS 有很浓重的 Mac OS X 气息。 + +## 最好的新晋发行版:Solus + +![](http://www.linux.com/images/stories/66866/distro-solus.JPG) + +[Solus](https://solus-project.com/) 最近获得非常大的关注程度。它是一个看起来中规中矩、从零开始构建的操作系统,它并非 Debian 或者 Ubuntu 的衍生版本。它使用的 Budgie 桌面环境同样是从零开始构建的,但它的目标是兼容 Gnome。Solus 和 Google 的 Chrome OS 一样——一切从简。 + +我个人没怎么玩过 Solus,但它看起来很有前途。Solus 实际上并不是一个 “新” 系统。它曾以不同的形式和名称存在了很长时间,但直到 2015 年整个项目才以现在这个新名称重归大众视野。 + +## 最好的云操作系统:Chrome OS + +[Chrome OS](https://www.chromium.org/chromium-os) 可能不会成为你的典型 Linux 发行版,毕竟它是基于浏览器的操作系统,主要用以在线使用。但由于它基于 Linux ,任何人都可以获取其源码进行编译,它同样是一个吸引人的系统。我每天都使用 Chrome OS,它是一个优秀、不用自己维护并且总是保持最新状态的系统,每个人都可以单纯地用它来进行 web 相关的用途。Chrome OS 和 Android 对于推动 Linux 在 PC 市场和移动市场的占有率有着不可或缺的功劳。 + +## 最好的笔记本计算机操作系统:Ubuntu MATE + +大多数的笔记本计算机都没有高端的硬件,假如你运行了一个很耗费资源的桌面环境,那么你可能没有足够的系统资源或电量来维持你的使用 —— 因为基本上被操作系统自身消耗了。于是我找到了 [Ubuntu MATE](http://www.cio.com/article/2848475/ubuntu-mate-enterprise-customers.html) 这个优秀的系统。它是轻量级的环境,但提供了能让你拥有不错体验的所有软件。也幸好它的轻量级设计,大部分的系统资源都留来给你的软件使用,让你依旧可以完成一些繁重的任务。我认为它对于低端硬件来说是最好的发行版。 + +## 为老旧硬件支持而生的发行版:Lubuntu + +假如你身边拥有一些过时的笔记本或 PC,给它安装 [Lubuntu](http://lubuntu.net/) 来获得重生吧。Lubuntu 使用的是 LXDE 桌面环境,但该项目与 Razor Qt 合并之后,变成了 LXQt。尽管最新的版本 15.04 依旧使用 LXDE,但之后的版本将会使用 LXQt。Lubuntu 对于老旧硬件来说是最合适不过的系统了。 + +## 为物联网 (IoT) 而生的发行版:Snappy Ubuntu Core + +![](http://www.linux.com/images/stories/66866/distro-ubuntu-studio.JPG) + +Snappy Ubuntu Core 是为物联网 (IoT) 及此类设备而生的 Linux 操作系统。该系统拥有巨大潜力,它可以将我们身边绝大多数的东西 —— 如路由器、咖啡机和无人机等——变成智能设备。让它更有趣的是,软件管理更新的方式以及为增加安全而提供的容器化支持。 + +## 为桌面系统而生的发行版:Linux Mint Cinnamon + +[Linux Mint Cinnamon](http://www.linux.com/news/software/applications/838569-review-linux-mint-172-release/) 对于台式机和一些有强大硬件的笔记本来说是最好的操作系统。我一般把它叫做 Linux 世界里的 Mac OS X。老实说,由于 Cinnamon 的不稳定,我在很长一段时间内并不是 Linux Mint 的忠实粉丝。但是,在开发者使用Ubuntu LTS (Long Term Support,长期支持)作为基础版本之后,该发行版就变得难以想象的稳定。因为开发者不必花费精力来跟上 Ubuntu 的开发进度,他们现在可以将所有精力放到提升 Cinnamon 上。 + +## 为游戏而生的发行版:Steam OS + +对于桌面版 Linux 来说,玩游戏同样是短板。很多用户为了能够玩游戏,安装了 Linux 和 Windows 双系统。而 Valve 则尝试改变这个局面。Valve 是一个游戏发行商,它提供一个可以在不同平台上运行游戏的客户端。并且,Valve 也同样创建了它自己的开源操作系统——[Steam OS](http://store.steampowered.com/steamos/)——为了创建一个基于 Linux 的游戏平台。截至 2015 年底,它的合作伙伴开始把搭载了 Steam OS 的机器推向市场。 + +## 为隐私而生的发行版:Tails + +在充斥着大量监控和营销者的跟踪 (对目标内容进行的匿名跟踪通常是可接受的)的岁月,隐私保护就变成了一个重要问题。如果你想脱离政府或者市场机构的监控和跟踪,那么你需要一款始终考虑到隐私问题的操作系统。 + +在出于保护隐私的考虑上,没有任何一款系统可以超越 [Tails](https://tails.boum.org/)。它是一款基于 Debian 的发行版,并且在设计之初就考虑了隐私和匿名的支持。Tails 非常优秀,而且据报道说,NSA 认为这是对他们的监控的主要威胁之一。 + +## 为多媒体制作而生的发行版:Ubuntu Studio + +基于 Linux 的操作系统有一个明显的弱点,那就是对多媒体制作的支持并不友好。所有专业级应用基本只能运行在 Windows 或者 Mac OS X 上。Linux 系统从来都不缺乏像样的音频/视频制作软件,但这样还是远远不够的。应该要有一款轻量级的桌面环境,使得那些宝贵的系统资源——如 CPU 和 RAM——尽量少占用,以便用于多媒体制作。目前,[Ubuntu Studio](https://ubuntustudio.org/tour/) 对多媒体制作的支持最好。它使用了 Xfce 桌面环境,并且有各种各样的音频、视频以及图像编辑应用。 + +## 最好的企业发行版:SLE/RHEL + +企业级用户并不会通过浏览像这样的文章来了解他们的服务器该运行什么发行版。他们通常非常明确地知道该到哪里获取信息:即 [Red Hat Enterprise Linux](https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux) 或 [SUSE Linux Enterprise](https://www.suse.com/)。这两个名字已经成了企业服务器的代名词了。同时,这些公司也都通过创新来推动将一切都容器化和变成软件定义的。 + +## 最好的服务器操作系统:Debian/CentOS + +假如你在考虑自己运行一台服务器,但有不希望支付 RHEL 或者 SLE 授权的费用,那么 [Debian](https://www.debian.org/) 或者 [CentOS](https://www.centos.org/) 将是你最好的选择。这两个发行版是社区主导的服务器操作系统,具有不可动摇的地位。并且它们有着长期支持,你不必担忧需要经常去升级系统。 + +## 最好的移动操作系统:Plasma Mobile + +尽管,基于 Linux 的 Android 系统称雄于移动操作系统市场,但是大多数的开源社区——也包括我在内——也仍然强烈希望能有一个发行版可以为移动设备提供传统 Linux 的桌面应用。同时,这样的一个发行版由开源社区来维护会比由商业公司来维护好的多,只有这样,用户才能成为这个发行版的关注点,而不是由公司的商业目标来决定这个发行版的发展趋势。KDE 的 [Plasma Mobile](https://community.kde.org/Plasma/Mobile) 刚好实现了我们的愿望。 + +这个基于 Kubuntu 的发行版始于 2015 年。因为 KDE 社区以坚守标准和为公众开发应用而闻名,我非常期待 Plasma Mobile 能够一直坚持下去。 + +## 为 ARM 设备而生的发行版:Arch Linux ARM + +随着 Android 系统的成功,我们的生活也围绕者越来越多的 ARM 设备——从树莓派 (Raspberry Pi) 到 Chromebook 以及 Nvidia Shield。为 Intel/AMD 架构的 CPU 而编写的传统发行版并不能够在这些 ARM 架构的设备上运行。而一些为 ARM 而编写的发行版却仅仅只能在特定的硬件上运行,比如只能运行在树莓派 (Raspberry Pi) 上的 Raspbian 系统。这就是为什么 [Arch Linux ARM](http://archlinuxarm.org/) (ALARM) 让人眼前一亮的原因。它是一个基于 Arch Linux 的纯粹由社区主导的发行版,可以在树梅派 (Raspberry Pi)、Chromebook、Android 设备以及 Nvidia Shield 等设备上运行。同时,更好的是,也由于 AUR,你可以安装很多在其他发行版可能无法获取的软件。 + +## 结论 + +在我写完本文的时候,连我自己都震惊了。能够在 Linux 的世界里为大家写点东西真的是很令人激动。不必去管 Linux 统治桌面电脑的时代是否会到来,我们都要一样享受自己使用 Linux 的每一刻快乐时光。 + +------------------------------------------------------------------------------ + +via: http://www.linux.com/news/software/applications/878620-the-best-linux-distros-of-2016 + +作者:[Swapnil Bhartiya][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[mudongliang](https://github.com/mudongliang),[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linux.com/community/forums/person/61003 diff --git a/published/201602/20160220 Linux Mint 18 Will Get Its Own Set Of Apps.md b/published/201602/20160220 Linux Mint 18 Will Get Its Own Set Of Apps.md new file mode 100644 index 0000000000..4872f4352a --- /dev/null +++ b/published/201602/20160220 Linux Mint 18 Will Get Its Own Set Of Apps.md @@ -0,0 +1,60 @@ +Linux Mint 18 将拥有自己的应用集 +============================================= + +![](http://itsfoss.com/wp-content/uploads/2016/01/Linux-Mint-apps.jpg) + +对于发行版开发者来说,创建和发布一系列专为他们发行版设计的应用是再平常不过的事情。一个最典型的例子就是 [elementary OS](https://elementary.io/) 。而在经过九年的努力后,Linux Mint 终于孤注一掷做了相同的事情。 + +[Linux Mint](http://www.linuxmint.com/) 是现今最著名的 Linux 发行版之一。其基于 Ubuntu 和 Debian,Linux Mint 努力去创建一个现代的、优雅的、舒适的操作系统,不但强大而且易用。(LCTT 译注:Linux Mint 基于 Ubuntu,而 Linux Mint Debian Edition 基于 Debian。)Linux Mint 背后的团队同时也积极参与 [MATE](http://itsfoss.com/install-mate-desktop-ubuntu-14-04/) 和 [Cinnamon](http://itsfoss.com/install-cinnamon-ubuntu-14-04/) 桌面环境开发。 + +## 前有 X 战警(X-men),后有 X 应用(X-Apps) + +周四, Linux Mint 项目领导者 Clement Lefebvre [宣布](http://blog.linuxmint.com/?p=2985) X-Apps 的创建。X-Apps 被设计为不依赖特定桌面环境,以便开发者可以直接更新它们而不必针对每一种桌面环境做调整。Lefebvre 声明这些 X-Apps 将会被作为 Cinnamon、MATE 和 Xfce 桌面环境的默认应用。 + +## Linux 是否需要更多的应用? + +据 Lefebvre 所述,X-Apps 的创建是因 GNOME 3.18 发布所需。对于 GNOME 3.18 的发布,他这样说: + +> “GTK 本身和一些 GNOME 应用都在 GNOME SHELL 上集成地很好,而且看起来风格很一致。坏消息就是它们在任何别的地方看起来很不相称。使事情变得更糟的是,Ubuntu 的旗舰产品 Unity 重度依赖 GTK、GNOME 应用及 GNOME 环境本身,所以我们这里不能在上游的 3.18 版本中处理,而这一系列的补丁会带来它们自己的问题(举一个例子,Ubuntu 在应用中重新引入菜单条和标题栏,但是不重写它们的头部栏..所以你有时会看到它们三者一起出现)。” + +在过去,Linux Mint 团队通过“应用降级(例如 Linux Mint 17 使用 gedit 2.30),给 GNOME 打补丁以及使用替代品(大部分在 MATE 和 Xfce)”来处理这个问题。 + +Lefebvre 也说为 Cinnamon 和 MATE 构建特定应用没有意义。这就是为什么他们选择开发那些通用的,可以完美地适应运行在 Cinnamon,MATE 和 Xfce(以及其他可能的桌面环境)的应用。 + +他进一步补充道: + +>“X-Apps 将会是一个通用的,使用传统的接口 GTK3 应用的集合。它能被用作 Cinnamon,MATE 和 Xfce 默认的桌面组件。在 Mint 18 中,“X apps” 将允许我们去维护一个本地风格及更高层面的集成。因为它们将会被用于替代看起来很不一致的 GNOME 桌面应用。长期来讲,X-App 项目将会允许我们去开发新的功能和改进应用本身(这是一些我们无法通过打补丁,临时分支或者特定桌面的分支做到的事情,比如说 MATE 桌面应用,因为它代价太高)。” + +## 将会有什么类型的应用? + +![](http://itsfoss.com/wp-content/uploads/2016/01/xedit.png) + +Lefebvre 只透露其中一个即将来临的 X-Apps:一个名为 xedit 的文本编辑器。下面是这个软件提供的一些特性: + +- 基于 Pluma,很容易学会使用 +- 使用 GTK3 +- 不依赖 GNOME 或 MATE + +## 何时呢? + +X-Apps 将会和 [Linux Mint 18](http://itsfoss.com/linux-mint-18-codenamed-sarah/) 一同到来。而 Linux Mint 18 将会在 Ubuntu 16.04 LTS 发布之后数月后发布。[Ubuntu 16.04 LTS 计划于四月发布。](http://itsfoss.com/ubuntu-1604-release-schedule/) + +## 总结 + +就我而言,无论何时当我听见某人发布一个新发行版特定的应用,我都会局促不安。Linux 世界本身已经难以想象的碎片化了。我们真的需要花费时间和精力去创建更多的重复的项目吗?但不要误解我,我喜欢桌面无关软件的想法。它将修复大量的一个桌面一个应用样子的问题。 + +使我发愁的问题是“它们是否会成功?”。正如我之前所说,Linux Mint 团队成员也在两种桌面环境工作。目前增加了应用开发就让这些混在一起了。我自己没有写过一个软件(除了 Hello World),但是我知道当你尝试且使一个项目复杂化,就会发生不好的事情。许多项目已经变成了不断膨胀的恶龙。我希望这样的事不要发生在这里。 + +你有不同的想法吗?在下方评论以便让我知道。 + +------------------------------------------------------------------------------ + +via: http://itsfoss.com/linux-mint-own-apps/ + +作者:[JOHN PAUL][a] +译者:[mudongliang](https://github.com/mudongliang) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/john/ diff --git a/published/201602/20160224 Can we tackle the Zika virus with rapid, open research.md b/published/201602/20160224 Can we tackle the Zika virus with rapid, open research.md new file mode 100644 index 0000000000..54cd0fe697 --- /dev/null +++ b/published/201602/20160224 Can we tackle the Zika virus with rapid, open research.md @@ -0,0 +1,28 @@ +我们能通过快速、开放的研究来战胜寨卡病毒吗? +============================================================ + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/OSDC_LifeScience_OpenScience_520x292_12268077_0614MM.png?itok=3ZD2Mce9) + +关于寨卡病毒,最主要的问题就是我们对于它了解的太少了。这意味着我们需要尽快对它作出很多研究。 + +寨卡病毒现已严重威胁到世界人民的健康。在 2015 年爆发之后,它就成为了全球性的突发公共卫生事件,并且这个病毒也可能与儿童的出生缺陷有关。根据[维基百科][4],在这个病毒在 40 年代末期被发现以后,早在 1952 年就被观测到了对于人类的影响。 + +在 2 月 10 日,开放杂志 PLoS [发布了一个声明][1],这个是声明是关于有关公众紧急状况的信息共享。在此之后,刊登在研究期刊 F1000 的一篇文章 [对于能治疗寨卡病毒的开源药物(Open drug)的研究][2],它讨论了寨卡病毒及其开放研究的状况。那篇来自 PLoS 的声明列出了超过 30 个开放了对于寨卡病毒的研究进度的数据的重要组织。并且世界卫生组织实施了一个特别规定,以[创作共用许可证][3]公布提交到他们那里的资料。 + +快速公布,无限制的重复利用,以及强调研究结果的传播是推动开放科研社区的战略性一步。看到我们所关注的突发公共卫生事件能够以这样的方式开始是很令人受鼓舞的。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/16/2/how-rapid-open-science-could-change-game-zika-virus + +作者:[Marcus D. Hanwell][a] +译者:[name1e5s](https://github.com/name1e5s) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mhanwell +[1]: http://blogs.plos.org/plos/2016/02/statement-on-data-sharing-in-public-health-emergencies/ +[2]: http://f1000research.com/articles/5-150/v1 +[3]: https://creativecommons.org/licenses/by/3.0/igo/ +[4]: https://en.wikipedia.org/wiki/Zika_virus \ No newline at end of file diff --git a/published/20160204 An Introduction to SELinux.md b/published/20160204 An Introduction to SELinux.md new file mode 100644 index 0000000000..777a4094a0 --- /dev/null +++ b/published/20160204 An Introduction to SELinux.md @@ -0,0 +1,127 @@ +SELinux 入门 +=============================== + +回到 Kernel 2.6 时代,那时候引入了一个新的安全系统,用以提供访问控制安全策略的机制。这个系统就是 [Security Enhanced Linux (SELinux)][1],它是由[美国国家安全局(NSA)][2]贡献的,它为 Linux 内核子系统引入了一个健壮的强制控制访问(Mandatory Access Control)架构。 + +如果你在之前的 Linux 生涯中都禁用或忽略了 SELinux,这篇文章就是专门为你写的:这是一篇对存在于你的 Linux 桌面或服务器之下的 SELinux 系统的介绍,它能够限制权限,甚至消除程序或守护进程的脆弱性而造成破坏的可能性。 + +在我开始之前,你应该已经了解的是 SELinux 主要是红帽 Red Hat Linux 以及它的衍生发行版上的一个工具。类似地, Ubuntu 和 SUSE(以及它们的衍生发行版)使用的是 AppArmor。SELinux 和 AppArmor 有显著的不同。你可以在 SUSE,openSUSE,Ubuntu 等等发行版上安装 SELinux,但这是项难以置信的挑战,除非你十分精通 Linux。 + +说了这么多,让我来向你介绍 SELinux。 + +### DAC vs. MAC + +Linux 上传统的访问控制标准是自主访问控制(Discretionary Access Control,DAC)。在这种形式下,一个软件或守护进程以 User ID(UID)或 Set owner User ID(SUID)的身份运行,并且拥有该用户的目标(文件、套接字、以及其它进程)权限。这使得恶意代码很容易运行在特定权限之下,从而取得访问关键的子系统的权限。 + +另一方面,强制访问控制(Mandatory Access Control,MAC)基于保密性和完整性强制信息的隔离以限制破坏。该限制单元独立于传统的 Linux 安全机制运作,并且没有超级用户的概念。 + +### SELinux 如何工作 + +考虑一下 SELinux 的相关概念: + +- 主体(Subjects) +- 目标(Objects) +- 策略(Policy) +- 模式(Mode) + +当一个主体(Subject,如一个程序)尝试访问一个目标(Object,如一个文件),SELinux 安全服务器(SELinux Security Server,在内核中)从策略数据库(Policy Database)中运行一个检查。基于当前的模式(mode),如果 SELinux 安全服务器授予权限,该主体就能够访问该目标。如果 SELinux 安全服务器拒绝了权限,就会在 /var/log/messages 中记录一条拒绝信息。 + +听起来相对比较简单是不是?实际上过程要更加复杂,但为了简化介绍,只列出了重要的步骤。 + +### 模式 + +SELinux 有三个模式(可以由用户设置)。这些模式将规定 SELinux 在主体请求时如何应对。这些模式是: + +- Enforcing (强制)— SELinux 策略强制执行,基于 SELinux 策略规则授予或拒绝主体对目标的访问 +- Permissive (宽容)— SELinux 策略不强制执行,不实际拒绝访问,但会有拒绝信息写入日志 +- Disabled (禁用)— 完全禁用 SELinux + +![](https://www.linux.com/images/stories/66866/jack2-selinux_a.png) + +*图 1:getenforce 命令显示 SELinux 的状态是 Enforcing 启用状态。* + +默认情况下,大部分系统的 SELinux 设置为 Enforcing。你要如何知道你的系统当前是什么模式?你可以使用一条简单的命令来查看,这条命令就是 `getenforce`。这个命令用起来难以置信的简单(因为它仅仅用来报告 SELinux 的模式)。要使用这个工具,打开一个终端窗口并执行 `getenforce` 命令。命令会返回 Enforcing、Permissive,或者 Disabled(见上方图 1)。 + +设置 SELinux 的模式实际上很简单——取决于你想设置什么模式。记住:**永远不推荐关闭 SELinux**。为什么?当你这么做了,就会出现这种可能性:你磁盘上的文件可能会被打上错误的权限标签,需要你重新标记权限才能修复。而且你无法修改一个以 Disabled 模式启动的系统的模式。你的最佳模式是 Enforcing 或者 Permissive。 + +你可以从命令行或 `/etc/selinux/config` 文件更改 SELinux 的模式。要从命令行设置模式,你可以使用 `setenforce` 工具。要设置 Enforcing 模式,按下面这么做: + +1. 打开一个终端窗口 +2. 执行 `su` 然后输入你的管理员密码 +3. 执行 `setenforce 1` +4. 执行 `getenforce` 确定模式已经正确设置(图 2) + +![](https://www.linux.com/images/stories/66866/jack-selinux_b.png) + +*图 2:设置 SELinux 模式为 Enforcing。* + +要设置模式为 Permissive,这么做: + +1. 打开一个终端窗口 +2. 执行 `su` 然后输入你的管理员密码 +3. 执行 `setenforce 0` +4. 执行 `getenforce` 确定模式已经正确设置(图 3) + +![](https://www.linux.com/images/stories/66866/jack-selinux_c.png) + +*图 3:设置 SELinux 模式为 Permissive。* + +注:通过命令行设置模式会覆盖 SELinux 配置文件中的设置。 + +如果你更愿意在 SELinux 命令文件中设置模式,用你喜欢的编辑器打开那个文件找到这一行: + + SELINUX=permissive + +你可以按你的偏好设置模式,然后保存文件。 + +还有第三种方法修改 SELinux 的模式(通过 bootloader),但我不推荐新用户这么做。 + +### 策略类型 + +SELinux 策略有两种: + +- Targeted — 只有目标网络进程(dhcpd,httpd,named,nscd,ntpd,portmap,snmpd,squid,以及 syslogd)受保护 +- Strict — 对所有进程完全的 SELinux 保护 + +你可以在 `/etc/selinux/config` 文件中修改策略类型。用你喜欢的编辑器打开这个文件找到这一行: + + SELINUXTYPE=targeted + +修改这个选项为 targeted 或 strict 以满足你的需求。 + +### 检查完整的 SELinux 状态 + +有个方便的 SELinux 工具,你可能想要用它来获取你启用了 SELinux 的系统的详细状态报告。这个命令在终端像这样运行: + + sestatus -v + +你可以看到像图 4 那样的输出。 + +![](https://www.linux.com/images/stories/66866/jack-selinux_d.png) + +*图 4:sestatus -v 命令的输出。* + +### 仅是皮毛 + +和你预想的一样,我只介绍了 SELinux 的一点皮毛。SELinux 的确是个复杂的系统,想要更扎实地理解它是如何工作的,以及了解如何让它更好地为你的桌面或服务器工作需要更加地深入学习。我的内容还没有覆盖到疑难解答和创建自定义 SELinux 策略。 + +SELinux 是所有 Linux 管理员都应该知道的强大工具。现在已经向你介绍了 SELinux,我强烈推荐你回到 Linux.com(当有更多关于此话题的文章发表的时候)或看看 [NSA SELinux 文档][3] 获得更加深入的指南。 + +LCTT - 相关阅读:[鸟哥的 Linux 私房菜——程序管理与 SELinux 初探][4] + + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/learn/docs/ldp/883671-an-introduction-to-selinux + +作者:[Jack Wallen][a] +译者:[alim0x](https://github.com/alim0x) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/community/forums/person/93 +[1]: http://selinuxproject.org/page/Main_Page +[2]: https://www.nsa.gov/research/selinux/ +[3]: https://www.nsa.gov/research/selinux/docs.shtml +[4]: http://vbird.dic.ksu.edu.tw/linux_basic/0440processcontrol_5.php diff --git a/published/20160225 The Tao of project management.md b/published/20160225 The Tao of project management.md new file mode 100644 index 0000000000..938484b498 --- /dev/null +++ b/published/20160225 The Tao of project management.md @@ -0,0 +1,200 @@ +《道德经》之项目管理 +================================= + + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BUSINESS_orgchart1.png?itok=DGsp6jB5) + +[道德经][1],[被认为][2]是由圣人[老子][3]于公元前六世纪时所编写,是现存最为广泛翻译的经文之一。从[宗教][4]到[关于约会的有趣电影][5]等方方面面,它都深深地影响着它们,作者们借用它来做隐喻,以解释各种各样的事情(甚至是[编程][6])。 + +在思考有关开放性组织的项目管理时,我的脑海中便立马浮现出上面的这段文字。 + +这听起来可能会有点奇怪。若要理解我的这种想法从何而来,你应该读读 *《开放性组织:点燃激情提升执行力》* 这本书,它是红帽公司总裁、首席执行官 Jim Whitehurst 所写的一本有关企业文化和新领导力范式的宣言。在这本书中,Jim(还有来自其他红帽人的一点帮助)解释了传统组织机构(一种 “自上而下” 的方式,来自高层的决策被传达到员工,而员工通过晋升和薪酬来激励)和开放性组织机构(一种 自下而上 的方式,领导专注于激励和鼓励,员工被充分授权以各尽其能)之间的差异。 + +在开放性组织中的员工都是被激情、目标和参与感所激励,这个观点正是我认为项目管理者所应该关注的。 + +要解释这一切,我将从*道德经*上寻找依据。 + +### 不要让工作职衔框住自身 + +> 道,可道也,(The tao that can be told) + +> 非恒道也。(is not the eternal Tao) + +> 名,可名也,(The name that can be named) + +> 非恒名也。(is not the eternal Name.) + +> “无”,名天地之始;(The unnameable is the eternally real.) + +> “有”,名万物之母。(Naming is the origin of all particular things.) +[[1]][7] + +项目管理到底是什么?作为一个项目管理者应该做些什么呢? + +如您所想,项目管理者的一部分工作就是管理项目:收集需求、与项目相关人员沟通、设置项目优先级、安排任务、帮助团队解决困扰。许多机构都可以教你如何做好项目管理,并且这些技能你值得拥有。 + +然而,在开放性组织中,字面上的项目管理技能仅仅只是项目管理者需要做到的一小部分,这些组织需要更多其他的东西:即勇气。如果你擅长于管理项目(或者是真的擅长于任何工作),那么你就进入了舒适区。这时候就是需要鼓起勇气开始尝试冒险之时。 + +您有勇气跨出舒适区吗?向权威人士提出挑战性的问题,可能会引发对方的不快,但也可能会开启一个更好的方法,您有勇气这样做吗?有确定需要做的下一件事,然后真正去完成它的勇气吗?有主动去解决因为交流的鸿沟而遗留下来的问题的勇气吗?有去尝试各种事情的勇气吗?有失败的勇气吗? + +道德经的开篇(上面引用的)就表明词语(words)、标签(labels)、名字(names)这些是有限制的,当然也包括工作职衔。在开放性组织中,项目经理不仅仅是执行管理项目所需的机械任务,而且要帮助团队完成组织的使命,尽管这已经被限定了。 + +### 联系起合适的人 + +> 三十辐共一轂,(We join spokes together in a wheel,) + +> 当其无,(but it is the center hole) + +> 有车之用。(that makes the wagon move.) +[[11]][8] + +当我过渡到项目管理的工作时,我必须学会的最为困难的一课是:并不是所有解决方案都是可完全地接受,甚至有的连预期都达不到。这对我来说是全新的一页。我*喜欢*全部都能解决。但作为项目管理者,我的角色更多的是与人沟通--使得那些确实有解决方案的人可以更高效地合作。 + +这并不是逃避责任或者不负责。这意味着可以很舒适的说,“我不知道,但我会给你找出答案”,然后就可迅速地结束这个循环。 + +想像一下马车的车轮,如果没有毂中的孔洞所提供的稳定性和方向,辐条便会失去支持,车轮也会散架。在一个开放性的组织中,项目管理者可以通过把合适的人凝聚在一起,培养正确的讨论话题来帮助团队保持持续向前的动力。 + +### 信任你的团队 + +>太上,不知有之;(When the Master governs, the people +are hardly aware that he exists.) + +> 其次,亲而誉之;(Next best is a leader who is loved.) + +> 其次,畏之;(Next, one who is feared.) + +> 其次,侮之。(The worst is one who is despised.) + +>信不足焉,(If you don't trust the people,) + +>有不信焉。(you make them untrustworthy.) + +>悠兮,其贵言。(The Master doesn't talk, he acts.) + +> 功成事遂,(When his work is done,) + +> 百姓皆谓:“我自然”。(the people say, "Amazing: +we did it, all by ourselves!") +[[17]][9] + +[Rebecca Fernandez][10] 曾经告诉我开放性组织的领导与其它组织的领导者最大的不同点在于,我们不是去取得别人的信任,而是信任别人。 + +开放性组织会雇佣那些非常聪明的,且对公司正在做的事情充满激情的人来做工作。为了能使他们能更好的工作,我们会提供其所需,并尊重他们的工作方式。 + +至于原因,我认为从道德经中摘出的上面一段就说的很清楚。 + +### 顺其自然 + +>上德无为而无以为;(The Master does nothing +yet he leaves nothing undone.) + +>下德为之而有以为。(The ordinary man is always doing things, +yet many more are left to be done.) +[[38]][11] + +你认识那类总是极其忙碌的人吗?认识那些因为有太多事情要做而看起来疲倦和压抑的人吗? + +不要成为那样的人。 + +我知道说比做容易。帮助我没有成为那类人的最重要的东西是:我时刻记着*大家都很忙*这件事。我没有一个那样无聊的同事。 + +但总需要有人成为在狂风暴雨中仍保持镇定的人。总需要有人能够宽慰团队告诉他们一切都会好起来,我们将在现实和一天中工作时间有限的情况下,找到方法使得任务能够完成(因为事实就是这样的,而且我们必须这样)。 + +成为那样的人吧。 + +对于上面这段道德经所说的,我的理解是那些总是谈论他或她正在做什么的人实际上并*没有时间*去做他们谈论的事。如果相比于你周围的人,你能把你的工作做的毫不费劲,那就说明你的工作做对了。 + +### 做一名文化传教士 + +>上士闻道,(When a superior man hears of the Tao,) + +> 勤而行之;(he immediately begins to embody it.) + +> 中士闻道,(When an average man hears of the Tao,) + +>若存若亡;(he half believes it, half doubts it.) + +> 下士闻道,(When a foolish man hears of the Tao,) + +> 大笑之。(he laughs out loud.) + +> 不笑不足以為道。(If he didn't laugh,it wouldn't be the Tao.) +[[41]][12] + +去年秋天,我和一群联邦雇员参加了一堂 MBA 的商业准则课程。当我开始介绍我们公司的文化、价值和伦理框架时,我得到的直接印象是:我的同学和教授都认为我就像一个天真可爱的小姑娘,做着许多关于公司应该如何运作的[甜美白日梦][13]。他们告诉我事情不可能是他们看起来的那样,他们还告诉我应该进一步考察。 + +所以我照做了。 + +然而我发现的是:事情*恰好*是他们看起来的那样。 + +在开放性组织,关于企业文化,人们应该随着企业的成长而时时维护那些文化,以使它随时精神焕发,充满斗志。我(和其它开源组织的成员)并不想过着如我同学们所描述的那样,“为生活而工作”。我需要有激情、有目标,需要明白自己的日常工作是如何对那些我所坚信的东西做贡献的。 + +作为一个项目管理者,你可能会认为在你的团队中,你的工作对培养你们公司的企业文化没有多少帮助。然而你的工作正是孕育文化本身。 + +### Kaizen (持续改善) + +>为学日益,(In pursuit of knowledge,every day something is added.) + +> 为道日损。(In the practice of the Tao,every day something is dropped.) + +> 损之又损,(Less and less do you need to force things,) + +> 以至于无为。(until finally you arrive at non-action. ) + +> 无为而无不为。(When nothing is done,nothing is left undone.) +[[48]][14] + +项目管理的常规领域都太过于专注最新、最强大的的工具,但对于应该使用哪种工具,这个问题的答案总是一致的:“最简单的”。 + +例如,我将任务列表放在桌面的一个文本文件中,因为它很单纯,不会受到不必要的干扰。您想介绍给团队的,无论是何种工具、流程和程序都应该是能提高效率,排除障碍的,而不是引入额外的复杂性。所以与其专注于工具,还不如专注于要使用这些工具来解决的*问题*。 + +作为一个项目经理,我最喜爱的部分是在敏捷世界中,我有自由抛弃那些没有成效的东西的权利。这与 [kaizen][16] 的概念相关,或叫 “持续改进”。不要害怕尝试和失败。失败是我们在探索什么能够起作用,什么不能起作用的过程中所用的标签,这是提高的唯一方式。 + +最好的过程都不是一蹴而就的。作为项目管理者,你应该通过支持他们,而不是强迫他们去做某些事来帮助你的团队。 + +### 实践 + +>天下皆谓我"道"大,(Some say that my teaching is nonsense.) + +> 似不肖。(Others call it lofty but impractical.) + +> 夫唯大,(But to those who have looked inside themselves,) + +> 故似不肖。(this nonsense makes perfect sense.) + +>若肖,(And to those who put it into practice,) + +> 久矣其细也夫!(this loftiness has roots that go deep.) +[[67]][15] + +我相信开放性组织正在做的事。开放性组织在管理领域的工作几乎与他们提供的产品和服务一样重要。我们有机会以身作则,激发他人的激情和目的,创造激励和充分授权的工作环境。 + +我鼓励你们找到办法把这些想法融入到自己的项目和团队中,看看会发生什么。了解你们组织的使命,知晓你的项目是如何为这个使命做贡献的。鼓起勇气,尝试某些看起来没有多少成效的事,同时不要忘记和我们的社区分享你所学到的经验,这样我们就可以继续改进。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/16/2/tao-project-management + +作者:[Allison Matlack][a] +译者:[runningwater](https://github.com/runningwater) +校对:[FSSlc](https://github.com/FSSlc) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/amatlack +[1]: http://acc6.its.brooklyn.cuny.edu/~phalsall/texts/taote-v3.html +[2]: https://en.wikipedia.org/wiki/Tao_Te_Ching +[3]: http://plato.stanford.edu/entries/laozi/ +[4]: https://en.wikipedia.org/wiki/Taoism +[5]: http://www.imdb.com/title/tt0234853/ +[6]: http://www.mit.edu/~xela/tao.html +[7]: http://acc6.its.brooklyn.cuny.edu/~phalsall/texts/taote-v3.html#1 +[8]: http://acc6.its.brooklyn.cuny.edu/~phalsall/texts/taote-v3.html#11 +[9]: http://acc6.its.brooklyn.cuny.edu/~phalsall/texts/taote-v3.html#17 +[10]: https://opensource.com/users/rebecca +[11]: http://acc6.its.brooklyn.cuny.edu/~phalsall/texts/taote-v3.html#38 +[12]: http://acc6.its.brooklyn.cuny.edu/~phalsall/texts/taote-v3.html#41 +[13]: https://opensource.com/open-organization/15/9/reflections-open-organization-starry-eyed-dreamer +[14]: http://acc6.its.brooklyn.cuny.edu/~phalsall/texts/taote-v3.html#48 +[15]: http://acc6.its.brooklyn.cuny.edu/~phalsall/texts/taote-v3.html#67 +[16]: https://www.kaizen.com/about-us/definition-of-kaizen.html \ No newline at end of file diff --git a/published/201603/20150820 Why did you start using Linux.md b/published/201603/20150820 Why did you start using Linux.md new file mode 100644 index 0000000000..c0a01c17a2 --- /dev/null +++ b/published/201603/20150820 Why did you start using Linux.md @@ -0,0 +1,143 @@ +年轻人,你为啥使用 linux +================================================================================ + +### 当初你为何使用 Linux? ### + +Linux 越来越流行,很多 OS X 或 Windows 用户都转移到 Linux 阵营了。但是你知道是什么让他们开始使用 Linux 的吗?一个 Reddit 用户在网站上问了这个问题,并且得到了很多有趣的回答。 + +一个名为 SilverKnight 的用户在 Reddit 的 Linux 版块上问了如下问题: + +> 我知道这个问题肯定被问过了,但我还是想听听年轻一代使用 Linux 的原因,以及是什么让他们坚定地成为 Linux 用户。 +> +> 我无意阻止大家讲出你们那些精彩的 Linux 故事,但是我还是对那些没有经历过什么精彩故事的新人的想法比较感兴趣。 +> +> 我27岁,半吊子 Linux 用户,这些年装过不少发行版,但没有投入全部精力去玩 Linux。我正在找更多的、能让我全身心投入到 Linux 潮流的理由,或者说激励。 +> +> [详见 Reddit][1] + +以下是网站上的回复: + +> **DoublePlusGood**:我12岁开始使用 Backtrack(现在改名为 Kali),因为我想成为一名黑客(LCTT 译注:原文“1337 haxor”,1337 是 leet 的火星文写法,意为'火星文',haxor 为 hackor 的火星文写法,意为'黑客',另一种写法是 1377 h4x0r,满满的火星文文化)。我现在一直使用 ArchLinux,因为它给我无限自由,让我对我的电脑可以为所欲为。 +> +> **Zack**:我记得是12、3岁的时候使用 Linux,现在15岁了。 +> +> 我11岁的时候就对 Windows XP 感到不耐烦,一个简单的功能,比如关机,TMD 都要让我耐心等着它慢慢完成。 +> +> 在那之前几个月,我在 freenode IRC 聊天室参与讨论了一个游戏,它是一个开源项目,大多数用户使用 Linux。 +> +> 我不断听到 Linux 但当时对它还没有兴趣。然而由于这些聊天频道(大部分在 freenode 上)谈论了很多编程话题,我就开始学习 python 了。 +> +> 一年后我尝试着安装 GNU/Linux (主要是 ubuntu)到我的新电脑(其实不新,但它是作为我的生日礼物被我得到的)。不幸的是它总是不能正常工作,原因未知,也许硬盘坏了,也许灰尘太多了。 +> +> 那时我放弃自己解决这个问题,然后缠着老爸给我的电脑装上 Ubuntu,他也无能为力,原因同上。 +> +> 在追求 Linux 一段时间后,我打算抛弃 Windows,使用 Linux Mint 代替 Ubuntu,本来没抱什么希望,但 Linux Mint 竟然能跑起来! +> +> 于是这个系统我用了6个月。 +> +> 那段时间我的一个朋友给了我一台虚拟机,跑 Ubuntu 的,我用了一年,直到我爸给了我一台服务器。 +> +> 6个月后我得到一台新 PC(现在还在用)。于是起想折腾点不一样的东西。 +> +> 我打算装 openSUSE。 +> +> 我很喜欢这个系统。然后在圣诞节的时候我得到树莓派,上面只能跑 Debian,还不能支持其它发行版。 +> +> **Cqz**:我9岁的时候有一次玩 Windows 98,结果这货当机了,原因未知。我没有 Windows 安装盘,但我爸的一本介绍编程的杂志上有一张随书附赠的光盘,这张光盘上刚好有 Mandrake Linux 的安装软件,于是我瞬间就成为了 Linux 用户。我当时还不知道自己在玩什么,但是玩得很嗨皮。这些年我虽然在电脑上装了多种 Windows 版本,但是 FLOSS 世界才是我的家(LCTT 译注:FLOSS —— Free/Libre and Open Source Software,自由/开源软件)。现在我只把 Windows 装在虚拟机上,用来玩游戏。 +> +> **Tosmarcel**:15岁那年对'编程'这个概念很好奇,然后我开始了哈佛课程'CS50',这个课程要我们安装 Linux 虚拟机用来执行一些命令。当时我问自己为什么 Windows 没有这些命令?于是我 Google 了 Linux,搜索结果出现了 Ubuntu,在安装 Ubuntu 的时候不小心把 Windows 分区给删了。。。当时对 Linux 毫无所知,适应这个系统非常困难。我现在16岁,用 ArchLinux,不想用回 Windows,我爱 ArchLinux。 +> +> **Micioonthet**:第一次听说 Linux 是在我5年级的时候,当时去我一朋友家,他的笔记本装的就是 MEPIS(Debian的一个比较老的衍生版),而不是 XP。 +> +> 原来是他爸爸是个美国的社会学家,而他全家都不信任微软。我对这些东西完全陌生,这系统完全没有我熟悉的软件,我很疑惑他怎么能使用。 +> +> 我13岁那年还没有自己的笔记本电脑,而我另一位朋友总是抱怨他的电脑有多慢,所以我打算把它买下来并修好它。我花了20美元买下了这台装着 Windows Vista 系统、跑满病毒、完全无法使用的惠普笔记本。我不想重装讨厌的 Windows 系统,记得 Linux 是免费的,所以我刻了一张 Ubuntu 14.04 光盘,马上把它装起来,然后我被它的高性能给震精了。 +> +> “我的世界(Minecraft)”(由于它允许运行在 JAVA 上,所以当时它是 Linux 下为数不多的几个游戏之一)在 Vista 上只能跑5帧每秒,而在 Ubuntu 上能跑到25帧。 +> +> 我到现在还会偶尔使用一下那台笔记本,Linux 可不会在乎你的硬件设备有多老。 +> +> 之后我把我爸也拉入 Linux 行列,我们会以很低的价格买老电脑,装上 Linux Mint 或其他轻量级发行版,这省了好多钱。 +> +> **Webtm**:我爹每台电脑都会装多个发行版,有几台是 opensuse 和 Debian,他的个人电脑装的是 Slackware。所以我记得很小的时候一直在玩 debian,但没有投入很多精力,我用了几年的 Windows,然后我爹问我有没有兴趣试试 debian。这是个有趣的经历,在那之后我一直使用 debian。而现在我不用 Linux,转投 freeBSD,5个月了,用得很开心。 +> +> 完全控制自己的系统是个很奇妙的体验。开源界有好多酷酷的软件,我认为在自己解决一些问题并且利用这些工具解决其他事情的过程是最有趣的。当然稳定和高效也是吸引我的地方。更不用说它的保密级别了。 +> +> **Wyronaut**:我今年18,第一次玩 Linux 是13岁,当时玩的 Ubuntu,为啥要碰 Linux?因为我想搭一个“我的世界”的服务器来和小伙伴玩游戏,当时“我的世界”可是个新鲜玩意儿。而搭个私服需要用 Linux 系统。 +> +> 当时我还是个新手,对着 Linux 的命令行有些傻眼,因为很多东西都要我自己处理。还是多亏了 Google 和维基,我成功地在多台老 PC 上部署了一些简单的服务器,那些早已无人问津的老古董机器又能发挥余热了。 +> +> 跑过游戏服务器后,我又开始跑 web 服务器,先是跑了几年 HTML,CSS 和 PHP,之后受 TheNewBoston 视频的误导转到了 JAVA。 +> +> 一周后放弃 JAVA 改用 Python,当时学习 Python 用的书名叫《Learn Python The Hard Way》,作者是 Zed A. Shaw。我花了两周学完 Python,然后开始看《C++ Primer》,因为我想做游戏开发。看到一半(大概500页)的时候我放弃了。那个时候我有点讨厌玩电脑了。 +> +> 这样中断了一段时间之后,我决定学习 JavaScript,读了2本书,试了4个平台,然后又不玩了。 +> +> 现在到了不得不找一所学校并决定毕业后找什么样工作的糟糕时刻。我不想玩图形界面编程,所以我不会进游戏行业。我也不喜欢画画和建模。然后我发现了一个涉及网络安全的专业,于是我立刻爱上它了。我挑了很多 C 语言的书来度过这个假期,并且复习了一下数学来迎接新的校园生活。 +> +> 目前我玩 archlinux,不同 PC 上跑着不同任务,它们运行很稳定。 +> +> 可以说 Linux 带我进入编程的世界,而反过来,我最终在学校要学的就是 Linux。我估计会终生感谢 Linux。 +> +> **Linuxllc**:你们可以学学像我这样的老头。 +> +> 扔掉 Windows!扔掉 Windows!扔掉 Windows!给自己一个坚持使用 Linux 的理由,那就是完全,彻底,远离,Windows。 +> +> 我在 2003 年放弃 Windows,只用了5天就把所有电脑跑成 Linux,包括所有的外围设备(LCTT 译注:比如打印机?)。我不玩 Windows 里的游戏,只玩 Linux 里的。 +> +> **Highclass**:我28岁,不知道还是不是你要找的年轻人类型。 +> +> 老实说我对电脑挺感兴趣的,当我还没接触'自由软件哲学'的时候,我认为 free 是免费的意思。我也不认为命令行界面很让人难以接受,因为我小时候就接触过 DOS 系统。 +> +> 我第一个发行版是 Mandrake,在我11岁还是12岁那年我把家里的电脑弄得乱七八糟,然后我一直折腾那台电脑,试着让我自己的技能提升一个台阶。现在我在一家公司全职使用 Linux。(请允许我耸个肩)。 +> +> **Matto**:我的电脑是旧货市场淘回来的,装 XP,跑得慢,于是我想换个系统。Google 了一下,发现 Ubuntu。当年我15、6岁,现在23了,就职的公司内部使用 Linux。 +> +> [更多评论移步 Reddit][2] + +### IBM 的 Linux 大型机 ### + +IBM 很久前就用 Linux 了。现在这家公司退推出一款机器专门使用 Ubuntu,机器名叫 LinuxOne。 + +Ron Miller 在 TecchCrunch 博客上说: + +> 新的大型机包括两款机型,都是以企鹅名称命名的(Linux 的吉祥物就是一只企鹅,懂18摸的命名用意了没?)第一款叫帝企鹅,使用 IBM z13 机型,我们早在1月份就介绍过了。另一款稍微小一点,名叫跳岩企鹅,供入门级买家使用。 +> +> 也许你会以为大型机就像恐龙一样早就灭绝了,但世界上许多大型机构中都还在使用它们,它们还健在。作为发展云技术战略的一部分,数据分析与安全有望于提升 Ubuntu 大型机的市场,这种大型机能提供一系列开源的企业级软件,比如 Apache Spark,Node.js,MongoDB,MariaDB,PostgreSQL 和 Chef。 +> +> 大型机还会存在于客户预置的数据中心中,但是市场的大小取决于会有多少客户使用这种类似于云服务的系统。Mauri 解释道,IBM 正在寻求增加大型机销量的途径,与 Canonical 公司合作,鼓励使用开源工具,都能为大型机打开一个小的,却能赚钱的市场。 +> +> +> [详情移步 TechCrunch][3] + +### 你为什么要放弃 Windows10 而选择 Linux ### + +自从 Windows10 出来以后,各种媒体都报道过它的隐藏间谍功能。ZDNet 列出了一些放弃 Windows10 的理由。 + +SJVN 在 ZDNet 的报告: + +> 你试试关掉 Windows10 的数据分享功能,坏消息来了:window10 会继续把你的数据分享给微软公司。请选择 Linux 吧。 +> +> 你可以有很多方法不让 Windows10 泄露你的秘密,但你不能阻止它交谈。Cortana,win10 小娜,语音助手,就算你把她关了,她也会把数据发给微软公司。这些数据包括你的电脑 ID,微软用它来识别你的 PC 机。 +> +> 所以如果这些泄密给你带来了烦恼,你可以使用老版本 Windows7,或者换到 Linux。然而,当 Windows7 不再提供技术支持的那天到来,如果你还想保留隐私,最终你还是只能选择 Linux。 +> +> 这里还有些小众的桌面系统能保护你的隐私,比如 BSD 家族的 FreeBSD,PCBSD,NetBSD,eComStation,OS/2。但是,最好的选择还是 Linux,它提供最低的学习曲线。 +> +> [详情移步 ZDNet][4] + +-------------------------------------------------------------------------------- + +via: http://www.itworld.com/article/2972587/linux/why-did-you-start-using-linux.html + +作者:[Jim Lynch][a] +译者:[bazz2](https://github.com/bazz2) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.itworld.com/author/Jim-Lynch/ +[1]:https://www.reddit.com/r/linux/comments/3hb2sr/question_for_younger_users_why_did_you_start/ +[2]:https://www.reddit.com/r/linux/comments/3hb2sr/question_for_younger_users_why_did_you_start/ +[3]:http://techcrunch.com/2015/08/16/ibm-teams-with-canonical-on-linux-mainframe/ +[4]:http://www.zdnet.com/article/sick-of-windows-spying-on-you-go-linux/ diff --git a/published/201603/20151020 18 Years of GNOME Design and Software Evolution--Step by Step.md b/published/201603/20151020 18 Years of GNOME Design and Software Evolution--Step by Step.md new file mode 100644 index 0000000000..6c579e0d5f --- /dev/null +++ b/published/201603/20151020 18 Years of GNOME Design and Software Evolution--Step by Step.md @@ -0,0 +1,200 @@ + +一步一脚印:GNOME十八年进化史 +================================================================================ +注:youtube 视频 + + +[GNOME][1] (GNU Object Model Environment)由两位墨西哥的程序员 Miguel de Icaza 和 Federico Mena 始创于1997年8月15日。GNOME 自由软件计划由志愿者和全职开发者来开发一个桌面环境及其应用程序。GNOME 桌面环境的所有部分都由开源软件组成,并且支持Linux, FreeBSD, OpenBSD 等操作系统。 + +现在就让我穿越到1997年来看看 GNOME 的第一个版本: + +### GNOME 1 ### + +![GNOME 1.0 - GNOME 发布的第一个重大版本](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/1.0/gnome.png) + +*GNOME 1.0 (1997) – GNOME 发布的第一个重大版本* + +![GNOME 1.2 Bongo](https://raw.githubusercontent.com/paulcarroty/Articles/master/GNOME_History/1.2/1361441938.or.86429.png) + +*GNOME 1.2 “Bongo”,2000* + +![GNOME 1.4 Tranquility](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/1.4/1.png) + +*GNOME 1.4 “Tranquility”, 2001* + +### GNOME 2 ### + +![GNOME 2.0](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.0/1.png) + +*GNOME 2.0, 2002* + +重大更新,基于 GTK+ 2。引入了人机界面指南(Human Interface Guidelines)。 + +![GNOME 2.2](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.2/GNOME_2.2_catala.png) + +*GNOME 2.2 2003* + +改进了多媒体和文件管理器。 + +![GNOME 2.4 Temujin](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.4/gnome-desktop.png) + +*GNOME 2.4 “Temujin”, 2003* + +首次发布 Epiphany 浏览器,增添了辅助功能(accessibility)。 + +![GNOME 2.6](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.6/Adam_Hooper.png) + +*GNOME 2.6, 2004* + +Nautilus 成为主要的文件管理工具,同时引入了新的 GTK+ 对话框。作为对这个版本中变化的结果,创建了一个存在时间不久的分叉版本:GoneME。 + +![GNOME 2.8](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.8/3.png) + +*GNOME 2.8, 2004* + +改良了对可移动设备的支持,并新增了 Evolution 邮件应用。 + +![GNOME 2.10](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.10/GNOME-Screenshot-2.10-FC4.png) + +*GNOME 2.10, 2005* + +减小了内存需求和提升了性能。增加了新的面板小应用(调制解调器控制、磁盘挂载器和回收站组件)以及 Totem 影片播放器和 Sound Juicer CD抓取工具。 + +![GNOME 2.12](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.12/gnome-livecd.jpg) + +*GNOME 2.12, 2005* + +改进了 Nautilus,改进了应用程序间的剪切/粘贴功能和 freedesktop.org 的整合。 新增 Evince PDF 阅读器;新默认主题 Clearlooks;菜单编辑器、钥匙环管理器和管理员工具。基于 GTK+2.8,支持 Cairo。 + +![GNOME 2.14](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.14/debian4-stable.jpg) + +*GNOME 2.14, 2006* + +性能提升(某些情况下超过 100%);增强用户界面的易用性;GStreamer 0.10 多媒体框架。增加了 Ekiga 视频会议应用、Deskbar 搜索工具、Pessulus 权限管理器、快速切换用户功能和 Sabayon 系统管理员工具。 + +![GNOME 2.16](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.16/Gnome-2.16-screenshot.png) + +*GNOME 2.16, 2006* + +性能提升。增加了 Tomboy 笔记应用、Baobab 磁盘用量分析应用、Orca 屏幕阅读器以及 GNOME 电源管理程序(延长了笔记本电池寿命)。改进了 Totem、Nautilus。Metacity 窗口管理器的合成(compositing)支持。新的图标主题。基于 GTK+ 2.0 的全新打印对话框。 + +![GNOME 2.18](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.18/Gnome-2.18.1.png) + +*GNOME 2.18, 2007* + +性能提升。增加了 Seahorse GPG 安全应用,可以对邮件和本地文件进行加密。Baobab 改进了环状图表显示方式的支持。Orca 屏幕阅读器。改进了 Evince、Epiphany、GNOME 电源管理、音量控制。增加了两款新游戏:GNOME 数独和 glChess 国际象棋。支持 MP3 和 AAC 音频解码。 + +![GNOME 2.20](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.20/rnintroduction-screenshot.png) + +*GNOME 2.20, 2007* + +发布十周年版本。Evolution 增加了备份功能。改进了 Epiphany、EOG、GNOME 电源管理。Seahorse 中的钥匙环密码管理功能。增加:在 Evince 中可以编辑PDF文档、文件管理界面中整合了搜索模块、自动安装多媒体解码器。 + +![GNOME 2.22, 2008](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.22/GNOME-2-22-2-Released-2.png) + +*GNOME 2.22, 2008* + +新增 Cheese 应用,它是一个可以截取网络摄像头和远程桌面图像的工具。Metacity 支持基本的窗口合成(compositing)。引入 GVFS(LCTT译注:GNOME Virtual file system,GNOME 虚拟文件系统)。改善了Totem 播放 DVD 和 YouTube 的效果,支持播放 MythTV。时钟小应用支持国际化。在 Evolution 中新增了谷歌日历以及为信息添加标签的功能。改进了 Evince、Tomboy、 Sound Juicer 和计算器。 + +![GNOME 2.24](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.24/gnome-224.jpg) + +*GNOME 2.24, 2008* + +新增了 Empathy 即时通讯软件。Ekiga 升级至3.0版本。Nautilus 支持标签式浏览,更好的支持了多屏幕显示方式和数字电视功能。 + +![GNOME 2.26](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.26/gnome226-large_001.jpg) + +*GNOME 2.26, 2009* + +新增光盘刻录应用 Brasero。简化了文件分享的流程。改进了媒体播放器的性能。支持多显示器和指纹识别器。 + +![GNOME 2.28](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.28/1.png) + +*GNOME 2.28, 2009* + +增加了 GNOME 蓝牙模块。改进了 Epiphany 网页浏览器、Empathy 即时通讯软件、时间追踪器和辅助功能。GTK+ 升级至2.18版本。 + +![GNOME 2.30](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.30/GNOME2.30.png) + +*GNOME 2.30, 2010* + +改进了 Nautilus 文件管理器、Empathy 即时通讯软件、Tomboy、Evince、时间追踪器、Epiphany 和 Vinagre。借助 GVFS 通过 libimobiledevice(LCTT 译注:支持iOS®设备跨平台使用的工具协议库)部分地支持了 iPod 和 iPod Touch 设备。 + +![GNOME 2.32](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/2.32/gnome-2-32.png.en_GB.png) + +*GNOME 2.32, 2010* + +新增 Rygel 媒体分享工具和 GNOME 色彩管理器。改进了 Empathy 即时通讯软件、Evince、Nautilus 文件管理器等。由于计划于2010年9月发布3.0版本,因此大部分开发者的精力都由2.3x转移至了3.0版本。 + +### GNOME 3 ### + +![GNOME 3.0](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/3.0/chat-3-0.png) + +*GNOME 3.0, 2011* + +引入 GNOME Shell,这是一个重新设计的、具有更简练更集中的选项的框架。基于 Mallard 标记语言的话题导向型帮助系统。支持窗口并列堆叠。启用新的视觉主题和默认字体。采用 GTK+ 3.0,具有更好的语言绑定、主题、触控以及多平台支持。去除了那些长期弃用的 API。 + +![GNOME 3.2](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/3.2/gdm.png) + +*GNOME 3.2、 2011* + +支持在线帐户、“浏览器”应用。新增通讯录应用和文档文件管理器。“文件管理器”支持快速预览。较大的整合,文档更完善,以及对外观的改善和各种性能提升。 + +![GNOME 3.4](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/3.4/application-view.png) + +*GNOME 3.4, 2012* + +全新外观的 GNOME 3 应用程序:“文件”、Epiphany(更名为“浏览器”)、“GNOME 通讯录”。可以在活动概览中搜索本地文件。支持应用菜单。焕然一新的界面元素:新的颜色拾取器、重新设计的滚动条、更易使用的旋钮以及可隐藏的标题栏。支持平滑滚动。全新的动态壁纸。在系统设置中改进了对 Wacom 数位板的支持。更简便的扩展应用管理。更好的硬件支持。面向主题的帮助文档。在 Empathy 中提供了对视频电话和动态信息的支持。更好的辅助功能:提升 Orca 整合度,增强高对比度模式,以及全新的缩放设置。大量的应用增强和对细节的改进。 + +![GNOME 3.6](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/3.6/gnome-3-6.png) + +*GNOME 3.6, 2012* + +全新设计的核心元素:新的应用按钮和改进的活动概览布局。新的登录和锁定界面。重新设计的通知栏。通知现在更智能,可见性更高,同时更容易关闭。改进了系统设置的界面和设定逻辑。用户菜单默认显示关闭电源操作。整合的输入方式。辅助功能一直开启。新的应用:Boxes 桌面虚拟化,曾在 GNOME 3.4中发布过预览版。Clocks 时钟,可以显示世界时间。更新了磁盘用量分析、Empathy 和字体查看器的外观。改进了 Orca 对布莱叶盲文的支持。 在“浏览器”中,用最常访问页面取代了之前的空白起始页,增添了更好的全屏模式并使用了 WebKit2 测试版引擎。 Evolution 开始使用 WebKit 显示邮件内容。 改进了“磁盘”功能。 改进了“文件”应用(即之前的 Nautilus),新增诸如最近访问的文件和搜索等功能。 + +![GNOME 3.8](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/3.8/applications-view.png) + +*GNOME 3.8, 2013* + +令人耳目一新的核心组件:新应用界面可以分别显示常用应用及全部应用。窗口布局得到全面改造。新的屏幕即现式(OSD)输入法开关。通知和信息现在会对屏幕边缘的点击作出回应。为那些喜欢传统桌面的用户提供了经典模式。重新设计了设置界面的工具栏。新的初始化引导流程。“GNOME 在线帐户”添加了对更多供应商的支持。“浏览器”正式启用 WebKit2 引擎,有了一个新的私密浏览模式。“文档”支持双页模式并且整合了 “Google 文档”。“通讯录”的 UI 升级。“GNOME 文件”、“GNOME Boxes”和“GNOME 磁盘”都得到了大幅改进。集成了 ownCloud。两款全新的 GNOME 核心应用:“GNOME 时钟”和“GNOME 天气”。 + +![GNOME 3.10](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/3.10/GNOME-3-10-Release-Schedule-2.png) + +*GNOME 3.10, 2013* + +全新打造的系统状态区,能够更直观的纵览全局。一系列新应用,包括 “GNOME 地图”、“GNOME 备忘录”、 “GNOME 音乐”和“GNOME 照片”。新的基于位置的功能,如自动时区和世界时钟。支持高分辨率及智能卡。 基于 GLib 2.38 提供了对 D-Bus 的支持。 + +![GNOME 3.12](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/3.12/app-folders.png) + +*GNOME 3.12, 2014* + +改进了概览中的键盘导航和窗口选择,基于易用性测试对初始设置进行了修改。有线网络图标重新回到了状态栏上,在“应用”视图中可以自定义应用文件夹。在大量应用的对话框中引入了新的 GTK+ 小工具,同时使用了新的 GTK+ 标签风格。“GNOME 视频”,“GNOME 终端”以及 Gedit 都改用了全新外观,更贴合 HIG(LCTT 译注:Human Interface Guidelines,人机界面指南)。在 GNOME Shell 的终端仿真器中提供了搜索预测功能。增强了对 “GNOME 软件”和高分辨率显示屏的支持。提供了新的录音工具。增加了新的桌面通知接口。在向 Wayland 移植的进度中达到了可用的程度,可用选择性地预览体验。 + +![GNOME 3.14](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/3.14/Top-Features-of-GNOME-3-14-Gallery-459893-2.jpg) + +*GNOME 3.14, 2014* + +更炫酷的桌面环境效果,改善了对触摸屏的支持。“GNOME 软件”可以管理安装的插件。在“GNOME 照片”中可以访问 “Google 相册”。重绘了 Evince、数独、扫雷和天气应用的用户界面,同时增加了一款叫做 Hitori 的 GNOME 游戏。 + +![GNOME 3.16](https://github.com/paulcarroty/Articles/raw/master/GNOME_History/3.16/preview-apps.png) + +*GNOME 3.16, 2015* + +33000 处改变。主要的修改包括 UI 的配色方案从黑色变成了炭黑色。 增加了即现式滚动条。通知窗口中整合了日历应用。对“文件”,图像查看器和“地图”等大量应用进行了微调。可以预览应用程序。进一步从 X11 向 Wayland 移植。 + +感谢 GNOME Project 及 [Wikipedia][2] 提供的变更日志!感谢阅读! + + +-------------------------------------------------------------------------------- + +via: https://tlhp.cf/18-years-of-gnome-evolution/ + +作者:[Pavlo Rudyi][a] +译者:[Haohong WANG](https://github.com/HaohongWANG) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://tlhp.cf/author/paul/ +[1]:https://www.gnome.org/ +[2]:https://en.wikipedia.org/wiki/GNOME diff --git a/published/201603/20151027 How to Install Ghost with Nginx on FreeBSD 10.2.md b/published/201603/20151027 How to Install Ghost with Nginx on FreeBSD 10.2.md new file mode 100644 index 0000000000..c961d47c8a --- /dev/null +++ b/published/201603/20151027 How to Install Ghost with Nginx on FreeBSD 10.2.md @@ -0,0 +1,296 @@ +如何在 FreeBSD 10.2 上安装使用 Nginx 的 Ghost +================================================================================ +Node.js 是用于开发服务器端应用程序的开源的运行时环境。Node.js 应用使用 JavaScript 编写,能在任何有 Node.js 运行时的服务器上运行。它跨平台支持 Linux、Windows、OSX、IBM AIX,也包括 FreeBSD。Node.js 是 Ryan Dahl 以及在 Joyent 工作的其他开发者于 2009 年创建的。它的设计目标就是构建可扩展的网络应用程序。 + +Ghost 是使用 Node.js 编写的博客平台。它不仅开源,而且有很漂亮的界面设计、对用户友好并且免费。它允许你快速地在网络上发布内容,或者创建你的混合网站。 + +在这篇指南中我们会在 FreeBSD 上安装使用 Nginx 作为 web 服务器的 Ghost。我们会在 FreeBSD 10.2 上安装 Node.js、Npm、nginx 和 sqlite3。 + +### 第一步 - 安装 Node.js npm 和 Sqlite3 ### + +如果你想在你的服务器上运行 ghost,你必须安装 node.js。在这一部分,我们会从 freebsd 移植软件库中安装 node.js,请进入库目录 "/usr/ports/www/node" 并通过运行命令 "**make**" 安装。 + + cd /usr/ports/www/node + make install clean + +如果你已经安装了 node.js,那就进入到 npm 目录并安装它。**npm** 是用于安装、发布和管理 node 程序的软件包管理器。 + + cd /usr/ports/www/npm/ + make install clean + +下一步,安装 sqlite3。默认情况下 ghost 使用 sqlite3 作为数据库系统,但它也支持 mysql/mariadb 和 postgresql。我们会使用 sqlite3 作为默认数据库。 + + cd /usr/ports/databases/sqlite3/ + make install clean + +如果安装完了所有软件,还有检查 node.js 和 npm 的版本: + + node --version + v0.12.6 + + npm --version + 2.11.3 + + sqlite3 --version + 3.8.10.2 + +![node 和 npm 版本](http://blog.linoxide.com/wp-content/uploads/2015/10/node-and-npm-version.png) + +### 第二步 - 添加 Ghost 用户 ### + +我们会以普通用户 "**ghost**" 身份安装和运行 ghost。用 "adduser" 命令添加新用户: + + adduser ghost + FILL With Your INFO + +![添加用户 Ghost](http://blog.linoxide.com/wp-content/uploads/2015/10/Add-user-Ghost.png) + +### 第三步 - 安装 Ghost ### + +我们会把 ghost 安装到 "**/var/www/**" 目录,首先新建目录然后进入到安装目录: + + mkdir -p /var/www/ + cd /var/www/ + +用 wget 命令下载最新版本的 ghost: + + wget --no-check-certificate https://ghost.org/zip/ghost-latest.zip + +把它解压到 "**ghost**" 目录: + + unzip -d ghost ghost-latest.zip + +下一步,更改属主为 "**ghost**",我们会以这个用户安装和运行它。 + + chown -R ghost:ghost ghost/ + +都做完了的话,通过输入以下命令切换到 "**ghost**" 用户: + + su - ghost + +然后进入到安装目录"/var/www/ghost/": + + cd /var/www/ghost/ + +在安装 ghost 之前,我们需要为 node.js 安装 sqlite3 模块,用 npm 命令安装: + + setenv CXX c++ ; npm install sqlite3 --sqlite=/usr/local + +**注意: 以 “ghost” 用户运行,而不是 root 用户。** + +现在,我们准备好安装 ghost 了,用 npm 命令安装: + + npm install --production + +下一步,复制配置文件 "config.example.js" 为 "**config.js**",用 nano 编辑器编辑: + + cp config.example.js config.js + nano -c config.js + +更改 server 模块的第 25 行: + + host: '0.0.0.0', + +保存并退出。 + +现在用下面的命令运行 ghost: + + npm start --production + +通过访问服务器 ip 和 2368 号端口验证一下。 + +![Ghost 安装完成](http://blog.linoxide.com/wp-content/uploads/2015/10/Ghost-Installed.png) + +以 “ghost” 用户在 "/var/www/ghost" 目录安装了 ghost。 + +### 第四步 - 作为 FreeBSD 服务运行 Ghost ### + +要在 freebsd 上以服务形式运行应用,你需要在 rc.d 目录添加脚本。我们会在 "**/usr/local/etc/rc.d/**" 目录为 ghost 创建新的服务脚本。 + +在创建服务脚本之前,为了以服务形式运行 ghost,我们需要安装一个 node.js 模块,用 npm 命令以 **sudo/root** 权限安装 forever 模块: + + npm install forever -g + +现在进入到 rc.d 目录并创建名为 ghost 的新文件: + + cd /usr/local/etc/rc.d/ + nano -c ghost + +粘贴下面的服务脚本: + + #!/bin/sh + + # PROVIDE: ghost + # KEYWORD: shutdown + PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" + + . /etc/rc.subr + + name="ghost" + rcvar="ghost_enable" + extra_commands="status" + + load_rc_config ghost + : ${ghost_enable:="NO"} + + status_cmd="ghost_status" + start_cmd="ghost_start" + stop_cmd="ghost_stop" + restart_cmd="ghost_restart" + + ghost="/var/www/ghost" + log="/var/log/ghost/ghost.log" + ghost_start() { + sudo -u ghost sh -c "cd $ghost && NODE_ENV=production forever start -al $log index.js" + } + + ghost_stop() { + sudo -u ghost sh -c "cd $ghost && NODE_ENV=production forever stop index.js" + } + + ghost_status() { + sudo -u ghost sh -c "NODE_ENV=production forever list" + } + + ghost_restart() { + ghost_stop; + ghost_start; + } + + run_rc_command "$1" + +保存并退出。 + +下一步,给 ghost 服务脚本添加可执行权限: + + chmod +x ghost + +为 ghost 日志创建新的目录和文件,并把属主修改为 ghost 用户: + + mkdir -p /var/www/ghost/ + touch /var/www/ghost/ghost.log + chown -R /var/www/ghost/ + +最后,如果你想运行 ghost 服务,你需要用 sysrc 命令添加 ghost 服务到开机启动应用程序: + + sysrc ghost_enable=yes + +用以下命令启动 ghost: + + service ghost start + +其它命令: + + service ghost stop + service ghost status + service ghost restart + +![Ghost 服务命令](http://blog.linoxide.com/wp-content/uploads/2015/10/Ghost-service-command.png) + +### 第五步 - 为 Ghost 安装和配置 Nginx ### + +默认情况下,ghost 会以独立模式运行,你可以不用 Nginx、apache 或 IIS web 服务器直接运行它。但在这篇指南中我们会安装和配置 nginx 和 ghost 一起使用。 + +用 pkg 命令从 freebsd 库中安装 nginx: + + pkg install nginx + +下一步,进入 nginx 配置目录并为 virtualhost 配置创建新的目录。 + + cd /usr/local/etc/nginx/ + mkdir virtualhost/ + +进入 virtualhost 目录,用 nano 编辑器创建名为 ghost.conf 的新文件: + + cd virtualhost/ + nano -c ghost.conf + +粘贴下面的 virtualhost 配置: + + server { + listen 80; + + #Your Domain + server_name ghost.me; + + location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|woff)$ { + access_log off; + expires 30d; + add_header Pragma public; + add_header Cache-Control "public, mustrevalidate, proxy-revalidate"; + proxy_pass http://127.0.0.1:2368; + } + + location / { + add_header X-XSS-Protection "1; mode=block"; + add_header Cache-Control "public, max-age=0"; + add_header Content-Security-Policy "script-src 'self' ; font-src 'self' ; connect-src 'self' ; block-all-mixed-content; reflected-xss block; referrer no-referrer"; + add_header X-Content-Type-Options nosniff; + add_header X-Frame-Options DENY; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass http://127.0.0.1:2368; + } + + location = /robots.txt { access_log off; log_not_found off; } + location = /favicon.ico { access_log off; log_not_found off; } + + location ~ /\.ht { + deny all; + } + + } + +保存并退出。 + +要启用 virtualhost 配置,你需要把那个文件添加到 **nginx.conf**。进入 nginx 配置目录并编辑 nginx.conf 文件: + + cd /usr/local/etc/nginx/ + nano -c nginx.conf + +在最后一行的前面,包含 virtualhost 配置目录: + + [......] + + include virtualhost/*.conf; + + } + +保存并退出。 + +用命令 "**nginx -t**" 测试 nginx 配置,如果没有错误,用 sysrc 添加 nginx 到开机启动: + + sysrc nginx_enable=yes + +并启动 nginx: + + service nginx start + +现在测试所有 nginx 和 virtualhost 配置。请打开你的浏览器并输入: ghost.me + +![ghost.me 成功运行](http://blog.linoxide.com/wp-content/uploads/2015/10/ghost.me-successfully.png) + +Ghost.me 正在成功运行。 + +如果你想要检查 nginx 服务器,可以使用 "**curl**" 命令。 + +![测试 ghost 和 nginx](http://blog.linoxide.com/wp-content/uploads/2015/10/ghost-and-nginx-test.png) + +Ghost 正在 nginx 上运行。 + +### 总结 ### + +Node.js 是 Ryan Dahl 为创建和开发可扩展服务器端应用程序创建的运行时环境。Ghost 是使用 node.js 编写的开源博客平台,它有漂亮的外观设计并且易于使用。默认情况下,ghost 是可以单独运行的 web 应用程序,并不需要类似 apache、nginx 或 IIS 之类的 web 服务器,但我们也可以和 web 服务器集成(在这篇指南中使用 Nginx)。Sqlite 是 ghost 默认使用的数据库,它还支持 msql/mariadb 和 postgresql。Ghost 能快速部署并且易于使用和配置。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-ghost-nginx-freebsd-10-2/ + +作者:[Arul][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arulm/ \ No newline at end of file diff --git a/published/201603/20151028 Bossie Awards 2015--The best open source networking and security software.md b/published/201603/20151028 Bossie Awards 2015--The best open source networking and security software.md new file mode 100644 index 0000000000..14eb07dee2 --- /dev/null +++ b/published/201603/20151028 Bossie Awards 2015--The best open source networking and security software.md @@ -0,0 +1,162 @@ +网络与安全方面的最佳开源软件 +================================================================================ +InfoWorld 在部署、运营和保障网络安全领域精选出了年度开源工具获奖者。 + +![](http://core0.staticworld.net/images/article/2015/09/bossies-2015-net-sec-100614459-orig.jpg) + +### 最佳开源网络和安全软件 ### + +[BIND](https://en.wikipedia.org/wiki/BIND), [Sendmail](https://en.wikipedia.org/wiki/Sendmail), [OpenSSH](https://en.wikipedia.org/wiki/OpenSSH), [Cacti](https://en.wikipedia.org/wiki/Cactus), [Nagios](https://en.wikipedia.org/wiki/Nagios), [Snort](https://en.wikipedia.org/wiki/Snort_%28software%29) -- 这些为了网络而生的开源软件,好些家伙们老而弥坚。今年在这个范畴的最佳选择中,你会发现中坚、支柱、新人和新贵云集,他们正在完善网络管理,安全监控,漏洞评估,[rootkit](https://en.wikipedia.org/wiki/Rootkit) 检测,以及很多方面。 + +![](http://core0.staticworld.net/images/article/2015/09/bossies-2015-icinga-100614482-orig.jpg) + +### Icinga 2 ### + +Icinga 起先只是系统监控应用 Nagios 的一个衍生分支。[Icinga 2][1] 经历了完全的重写,为用户带来了时尚的界面、对多数据库的支持,以及一个集成了众多扩展的 API。凭借着开箱即用的负载均衡、通知和配置文件,Icinga 2 缩短了在复杂环境下安装的时间。Icinga 2 原生支持 [Graphite](https://github.com/graphite-project/graphite-web)(系统监控应用),轻松为管理员呈现实时性能图表。不过真的让 Icinga 今年重新火起来的原因是 Icinga Web 2 的发布,那是一个支持可拖放定制的 仪表盘 和一些流式监控工具的前端图形界面系统。 + +管理员可以查看、过滤、并按优先顺序排列发现的问题,同时可以跟踪已经采取的动作。一个新的矩阵视图使管理员能够在单一页面上查看主机和服务。你可以通过查看特定时间段的事件或筛选事件类型来了解哪些事件需要立即关注。虽然 Icinga Web 2 有着全新界面和更为强劲的性能,不过对于传统版 Icinga 和 Web 版 Icinga 的所有常用命令还是照旧支持的。这意味着学习新版工具不耗费额外的时间。 + +-- Fahmida Rashid + +![](http://core0.staticworld.net/images/article/2015/09/bossies-2015-zenoss-100614465-orig.jpg) + +### Zenoss Core ### + +这是另一个强大的开源软件,[Zenoss Core][2] 为网络管理员提供了一个完整的、一站式解决方案来跟踪和管理所有的应用程序、服务器、存储、网络组件、虚拟化工具、以及企业基础架构的其他元素。管理员可以确保硬件的运行效率并利用 ZenPacks 中模块化设计的插件来扩展功能。 + +在2015年二月发布的 Zenoss Core 5 保留了已经很强大的工具,并进一步改进以增强用户界面和扩展 仪表盘。基于 Web 的控制台和 仪表盘 可以高度可定制并动态调整,而现在的新版本还能让管理员混搭多个组件图表到一个图表中。想来这应该是一个更好的根源分析和因果分析的工具。 + +Portlets 为网络映射、设备问题、守护进程、产品状态、监视列表和事件视图等等提供了深入的分析。而且新版 HTML5 图表可以从工具导出。Zenoss 的控制中心支持带外管理并且可监控所有 Zenoss 组件。Zenoss Core 现在拥有一些新工具,用于在线备份和恢复、快照和回滚以及多主机部署等方面。更重要的是,凭借对 Docker 的全面支持,部署起来更快了。 + +-- Fahmida Rashid + +![](http://core0.staticworld.net/images/article/2015/09/bossies-2015-opennms-100614461-orig.jpg) + +### OpenNMS ### + +作为一个非常灵活的网络管理解决方案,[OpenNMS][3] 可以处理任何网络管理任务,无论是设备管理、应用性能监控、库存控制,或事件管理。凭借对 IPv6 的支持、强大的警报系统和记录用户脚本来测试 Web 应用程序的能力,OpenNMS 拥有网络管理员和测试人员需要的一切。OpenNMS 现在变得像一款移动版 仪表盘,称之为 OpenNMS Compass,可让网络专家随时,甚至在外出时都可以监视他们的网络。 + +该应用程序的 IOS 版本,可从 [iTunes App Store][4] 上获取,可以显示故障、节点和告警。下一个版本将提供更多的事件细节、资源图表、以及关于 IP 和 SNMP 接口的信息。安卓版可从 [Google Play][5] 上获取,可在 仪表盘 上显示网络可用性,故障和告警,以及可以确认、提升或清除告警。移动客户端与 OpenNMS Horizon 1.12 或更高版本以及 OpenNMS Meridian 2015.1.0 或更高版本兼容。 + +-- Fahmida Rashid + +![](http://images.techhive.com/images/article/2015/09/bossies-2015-onion-100614460-orig.jpg) + +### Security Onion ### + +如同一个洋葱,网络安全监控是由许多层组成。没有任何一个单一的工具可以让你洞察每一次攻击,为你显示对你的公司网络中的每一次侦查或是会话的足迹。[Security Onion][6] 在一个简单易用的 Ubuntu 发行版中打包了许多久经考验的工具,可以让你看到谁留在你的网络里,并帮助你隔离这些坏家伙。 + +无论你是采取主动式的网络安全监测还是追查可能的攻击,Security Onion 都可以帮助你。Onion 由传感器、服务器和显示层组成,结合了基于网络和基于主机的入侵检测,全面的网络数据包捕获,并提供了所有类型的日志以供检查和分析。 + +这是一个众星云集的的网络安全工具链,包括用于网络抓包的 [Netsniff-NG](http://www.netsniff-ng.org/)、基于规则的网络入侵检测系统 Snort 和 [Suricata](https://en.wikipedia.org/wiki/Suricata_%28software%29),基于分析的网络监控系统 Bro,基于主机的入侵检测系统 OSSEC 和用于显示、分析和日志管理的 Sguil、Squert、Snorby 和 ELSA (企业日志搜索和归档(Enterprise Log Search and Archive))。它是一个经过精挑细选的工具集,所有的这些全被打包进一个向导式的安装程序并有完整的文档支持,可以帮助你尽可能快地上手监控。 + +-- Victor R. Garza + +![](http://images.techhive.com/images/article/2015/09/bossies-2015-kali-100614458-orig.jpg) + +### Kali Linux ### + +[Kali Linux][7] 背后的团队今年为这个流行的安全 Linux 发行版发布了新版本,使其更快,更全能。Kali 采用全新 4.0 版的内核,改进了对硬件和无线驱动程序的支持,并且界面更为流畅。最常用的工具都可从屏幕的侧边栏上轻松找到。而最大的改变是 Kali Linux 现在是一个滚动发行版,具有持续不断的软件更新。Kali 的核心系统是基于 Debian Jessie,而且该团队会不断地从 Debian 测试版拉取最新的软件包,并持续的在上面添加 Kali 风格的新特性。 + +该发行版仍然配备了很多的渗透测试,漏洞分析,安全审查,网络应用分析,无线网络评估,逆向工程,和漏洞利用工具。现在该发行版具有上游版本检测系统,当有个别工具可更新时系统会自动通知用户。该发行版还提过了一系列 ARM 设备的镜像,包括树莓派、[Chromebook](https://en.wikipedia.org/wiki/Chromebook) 和 [Odroid](https://en.wikipedia.org/wiki/ODROID),同时也更新了 Android 设备上运行的 [NetHunter](https://www.kali.org/kali-linux-nethunter/) 渗透测试平台。还有其他的变化:Metasploit 的社区版/专业版不再包括在内,因为 Kali 2.0 还没有 [Rapid7 的官方支持][8]。 + +-- Fahmida Rashid + +![](http://core0.staticworld.net/images/article/2015/09/bossies-2015-openvas-100614462-orig.jpg) + +### OpenVAS ### + +开放式漏洞评估系统(Open Vulnerability Assessment System) [OpenVAS][9],是一个整合多种服务和工具来提供漏洞扫描和漏洞管理的软件框架。该扫描器可以使用每周更新一次的网络漏洞测试数据,或者你也可以使用商业服务的数据。该软件框架包括一个命令行界面(以使其可以用脚本调用)和一个带 SSL 安全机制的基于 [Greenbone 安全助手][10] 的浏览器界面。OpenVAS 提供了用于附加功能的各种插件。扫描可以预定运行或按需运行。 + +可通过单一的主控来控制多个安装好 OpenVAS 的系统,这使其成为了一个可扩展的企业漏洞评估工具。该项目兼容的标准使其可以将扫描结果和配置存储在 SQL 数据库中,这样它们可以容易地被外部报告工具访问。客户端工具通过基于 XML 的无状态 OpenVAS 管理协议访问 OpenVAS 管理器,所以安全管理员可以扩展该框架的功能。该软件能以软件包或源代码的方式安装在 Windows 或 Linux 上运行,或者作为一个虚拟应用下载。 + +-- Matt Sarrel + +![](http://core0.staticworld.net/images/article/2015/09/bossies-2015-owasp-100614463-orig.jpg) + +### OWASP ### + +[OWASP][11](开放式 Web 应用程序安全项目(Open Web Application Security Project))是一个专注于提高软件安全性的在全球各地拥有分会的非营利组织。这个社区性的组织提供测试工具、文档、培训和几乎任何你可以想象到的开发安全软件相关的软件安全评估和最佳实践。有一些 OWASP 项目已成为很多安全从业者工具箱中的重要组件: + +[ZAP][12](ZED 攻击代理项目(Zed Attack Proxy Project))是一个在 Web 应用程序中寻找漏洞的渗透测试工具。ZAP 的设计目标之一是使之易于使用,以便于那些并非安全领域专家的开发人员和测试人员能便于使用。ZAP 提供了自动扫描和一套手动测试工具集。 + +[Xenotix XSS Exploit Framework][13] 是一个先进的跨站点脚本漏洞检测和漏洞利用框架,该框架通过在浏览器引擎内执行扫描以获取真实的结果。Xenotix 扫描模块使用了三个智能模糊器( intelligent fuzzers),使其可以运行近 5000 种不同的 XSS 有效载荷。它有个 API 可以让安全管理员扩展和定制漏洞测试工具包。 + +[O-Saft][14](OWASP SSL 高级审查工具(OWASP SSL advanced forensic tool))是一个查看 SSL 证书详细信息和测试 SSL 连接的 SSL 审计工具。这个命令行工具可以在线或离线运行来评估 SSL ,比如算法和配置是否安全。O-Saft 内置提供了常见漏洞的检查,你可以容易地通过编写脚本来扩展这些功能。在 2015 年 5 月加入了一个简单的图形用户界面作为可选的下载项。 + +[OWTF][15](攻击性 Web 测试框架(Offensive Web Testing Framework))是一个遵循 OWASP 测试指南和 NIST 和 PTES 标准的自动化测试工具。该框架同时支持 Web 用户界面和命令行,用于探测 Web 和应用服务器的常见漏洞,如配置失当和软件未打补丁。 + +-- Matt Sarrel + +![](http://core0.staticworld.net/images/article/2015/09/bossies-2015-beef-100614456-orig.jpg) + +### BeEF ### + +Web 浏览器已经成为用于针对客户端的攻击中最常见的载体。[BeEF][15] (浏览器漏洞利用框架项目(Browser Exploitation Framework Project)),是一种广泛使用的用以评估 Web 浏览器安全性的渗透工具。BeEF 通过浏览器来启动客户端攻击,帮助你暴露出客户端系统的安全弱点。BeEF 建立了一个恶意网站,安全管理员用想要测试的浏览器访问该网站。然后 BeEF 发送命令来攻击 Web 浏览器并使用命令在客户端机器上植入软件。随后管理员就可以把客户端机器看作不设防般发动攻击了。 + +BeEF 自带键盘记录器、端口扫描器和 Web 代理这样的常用模块,此外你可以编写你自己的模块或直接将命令发送到被控制的测试机上。BeEF 带有少量的演示网页来帮你快速入门,使得编写更多的网页和攻击模块变得非常简单,让你可以因地适宜的自定义你的测试。BeEF 是一个非常有价值的评估浏览器和终端安全、学习如何发起基于浏览器攻击的测试工具。可以使用它来向你的用户综合演示,那些恶意软件通常是如何感染客户端设备的。 + +-- Matt Sarrel + +![](http://images.techhive.com/images/article/2015/09/bossies-2015-unhide-100614464-orig.jpg) + +### Unhide ### + +[Unhide][16] 是一个用于定位开放的 TCP/UDP 端口和隐藏在 UNIX、Linux 和 Windows 上的进程的审查工具。隐藏的端口和进程可能是由于运行 Rootkit 或 LKM(可加载的内核模块(loadable kernel module)) 导致的。Rootkit 可能很难找到并移除,因为它们就是专门针对隐蔽性而设计的,可以在操作系统和用户前隐藏自己。一个 Rootkit 可以使用 LKM 隐藏其进程或冒充其他进程,让它在机器上运行很长一段时间而不被发现。而 Unhide 则可以使管理员们确信他们的系统是干净的。 + +Unhide 实际上是两个单独的脚本:一个用于进程,一个用于端口。该工具查询正在运行的进程、线程和开放的端口并将这些信息与系统中注册的活动比较,报告之间的差异。Unhide 和 WinUnhide 是非常轻量级的脚本,可以运行命令行而产生文本输出。它们不算优美,但是极为有用。Unhide 也包括在 [Rootkit Hunter][17] 项目中。 + +-- Matt Sarrel + +![](http://images.techhive.com/images/article/2015/09/bossies-2015-main-100614457-orig.jpg) + +### 查看更多的开源软件优胜者 ### + +InfoWorld 网站的 2015 年最佳开源奖由下至上表扬了 100 多个开源项目。通过以下链接可以查看更多开源软件中的翘楚: + +[2015 Bossie 评选:最佳开源应用程序][18] + +[2015 Bossie 评选:最佳开源应用程序开发工具][19] + +[2015 Bossie 评选:最佳开源大数据工具][20] + +[2015 Bossie 评选:最佳开源数据中心和云计算软件][21] + +[2015 Bossie 评选:最佳开源桌面和移动端软件][22] + +[2015 Bossie 评选:最佳开源网络和安全软件][23] + +-------------------------------------------------------------------------------- + +via: http://www.infoworld.com/article/2982962/open-source-tools/bossie-awards-2015-the-best-open-source-networking-and-security-software.html + +作者:[InfoWorld staff][a] +译者:[robot527](https://github.com/robot527) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.infoworld.com/author/InfoWorld-staff/ +[1]:https://www.icinga.org/icinga/icinga-2/ +[2]:http://www.zenoss.com/ +[3]:http://www.opennms.org/ +[4]:https://itunes.apple.com/us/app/opennms-compass/id968875097?mt=8 +[5]:https://play.google.com/store/apps/details?id=com.opennms.compass&hl=en +[6]:http://blog.securityonion.net/p/securityonion.html +[7]:https://www.kali.org/ +[8]:https://community.rapid7.com/community/metasploit/blog/2015/08/12/metasploit-on-kali-linux-20 +[9]:http://www.openvas.org/ +[10]:http://www.greenbone.net/ +[11]:https://www.owasp.org/index.php/Main_Page +[12]:https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project +[13]:https://www.owasp.org/index.php/O-Saft +[14]:https://www.owasp.org/index.php/OWASP_OWTF +[15]:http://www.beefproject.com/ +[16]:http://www.unhide-forensics.info/ +[17]:http://www.rootkit.nl/projects/rootkit_hunter.html +[18]:http://www.infoworld.com/article/2982622/bossie-awards-2015-the-best-open-source-applications.html +[19]:http://www.infoworld.com/article/2982920/bossie-awards-2015-the-best-open-source-application-development-tools.html +[20]:http://www.infoworld.com/article/2982429/bossie-awards-2015-the-best-open-source-big-data-tools.html +[21]:http://www.infoworld.com/article/2982923/bossie-awards-2015-the-best-open-source-data-center-and-cloud-software.html +[22]:http://www.infoworld.com/article/2982630/bossie-awards-2015-the-best-open-source-desktop-and-mobile-software.html +[23]:http://www.infoworld.com/article/2982962/bossie-awards-2015-the-best-open-source-networking-and-security-software.html diff --git a/published/201603/20151104 Optimize Web Delivery with these Open Source Tools.md b/published/201603/20151104 Optimize Web Delivery with these Open Source Tools.md new file mode 100644 index 0000000000..e2aed5c634 --- /dev/null +++ b/published/201603/20151104 Optimize Web Delivery with these Open Source Tools.md @@ -0,0 +1,204 @@ +五大开源 Web 代理软件横向比较:Squid、Privoxy、Varnish、Polipo、Tinyproxy +================================================================================ +Web 代理软件转发 HTTP 请求时并不会改变数据流量。它们可以配置成透明代理,而无需客户端配置。它们还可以作为反向代理放在网站的前端;这样缓存服务器可以为一台或多台 web 服务器提供无限量的用户服务。 + +网站代理功能多样,有着宽泛的用途:从缓存页面、DNS 和其他查询,到加速 web 服务器响应、降低带宽消耗。代理软件广泛用于大型高访问量的网站,比如纽约时报、卫报, 以及社交媒体网站如 Twitter、Facebook 和 Wikipedia。 + +页面缓存已经成为优化单位时间内所能吞吐的数据量的至关重要的机制。好的 Web 缓存还能降低延迟,尽可能快地响应页面,让终端用户不至于因等待内容的时间过久而失去耐心。它们还能将频繁访问的内容缓存起来以节省带宽。如果你需要降低服务器负载并改善网站内容响应速度,那缓存软件能带来的好处就绝对值得探索一番。 + +为深入探查 Linux 下可用的相关软件的质量,我列出了下边5个优秀的开源 web 代理工具。它们中有些功能完备强大,也有几个只需很低的资源就能运行。 + +### Squid ### + +Squid 是一个高性能、开源的代理缓存服务器和 Web 缓存进程,支持 FTP、Internet Gopher、HTTPS 和 SSL 等多种协议。它通过一个非阻塞的、I/O 事件驱动的单一进程处理所有的 IPV4 或 IPV6 协议请求。 + +Squid 由一个主服务程序 squid,和 DNS 查询程序 dnsserver,另外还有一些可选的请求重写、执行认证程序组件,及一些管理和客户端工具构成。 + +Squid 提供了丰富的访问控制、认证和日志环境, 用于开发 web 代理和内容服务网站应用。 + +其特性包括: + +- Web 代理: + - 通过缓存来降低访问时间和带宽使用 + - 将元数据和访问特别频繁的对象缓存到内存中 + - 缓存 DNS 查询 + - 支持非阻塞的 DNS 查询 + - 实现了失败请求的未果缓存 +- Squid 缓存可架设为层次结构,或网状结构以节省额外的带宽 +- 通过广泛的访问控制来执行网站访问策略 +- 隐匿请求,如禁用或修改客户端 HTTP 请求头特定属性 +- 反向代理 +- 媒体范围(media-range)限制 +- 支持 SSL +- 支持 IPv6 +- 错误页面的本地化 - Squid 可以根据访问者的语言选项对每个请求展示本地化的错误页面 +- 连接固定(Connection Pinning )(用于 NTLM Auth Passthrough) - 一种允许 Web 服务器通过 Web 代理使用Microsoft NTLM 安全认证替代 HTTP 标准认证的方案 +- 支持服务质量 (QoS, Quality of Service) 流 + - 选择一个 TOS/Diffserv 值来标记本地命中 + - 选择一个 TOS/Diffserv 值来标记对端命中 + - 选择性地仅标记同级或上级请求 + - 允许任意发往客户端的 HTTP 响应保持由远程服务器处响应的 TOS 值 + - 对收到的远程服务器的 TOS 值,在复制之前对指定位进行掩码操作,再发送到客户端 +- SSL Bump (用于 HTTPS 过滤和适配) - Squid-in-the-middle,在 CONNECT 方式的 SSL 隧道中,用配置化的客户端和服务器端证书,对流量进行解密和加密 +- 支持适配模块 +- ICAP 旁路和重试增强 - 通过完全的旁路和动态链式路由扩展 ICAP,来处理多多个适应性服务。 +- 支持 ICY 流式协议 - 俗称 SHOUTcast 多媒体流 +- 动态 SSL 证书生成 +- 支持 ICAP 协议 (Internet Content Adaptation Protocol) +- 完整的请求日志记录 +- 匿名连接 + +-- +- 网站: [www.squid-cache.org][1] +- 开发: 美国国家应用网络研究实验室(NLANR)和网络志愿者 +- 授权: GNU GPL v2 +- 版本号: 4.0.1 + +### Privoxy ### + +Privoxy (Privacy Enhancing Proxy) 是一个非缓存类 Web 代理软件,它自带的高级过滤功能可以用来增强隐私保护、修改页面内容和 HTTP 头部信息、访问控制,以及去除广告和其它招人反感的互联网垃圾。Privoxy 的配置非常灵活,能充分定制已满足各种各样的需求和偏好。它支持单机和多用户网络两种模式。 + +Privoxy 使用 action 规则来处理浏览器和远程站点间的数据流。 + +其特性包括: + +- 高度配置化——可以完全定制你的配置 +- 广告拦截 +- Cookie 管理 +- 支持“Connection: keep-alive”。可以无视客户端配置而保持外发的持久连接 +- 支持 IPv6 +- 标签化(Tagging),允许按照客户端和服务器的请求头进行处理 +- 作为拦截(intercepting)代理器运行 +- 巧妙的动作(action)和过滤机制用来处理服务器和客户端的 HTTP 头部 +- 可以与其他代理软件链式使用 +- 整合了基于浏览器的配置和控制工具,能在线跟踪规则和过滤效果,可远程开关 +- 页面过滤(文本替换、根据尺寸大小删除广告栏, 隐藏的“web-bugs”元素和 HTML 容错等) +- 模块化的配置使得标准配置和用户配置可以存放于不同文件中,这样安装更新就不会覆盖用户的个性化设置 +- 配置文件支持 Perl 兼容的正则表达式,以及更为精妙和灵活的配置语法 +- GIF 去动画 +- 旁路处理大量点击跟踪(click-tracking)脚本(避免脚本重定向) +- 大多数代理生成的页面(例如 "访问受限" 页面)可由用户自定义HTML模板 +- 自动监测配置文件的修改并重新读取 +- 大多数功能可以基于每个站点或每个 URL 位置来进行控制 + +-- + +- 网站: [www.privoxy.org][2] +- 开发: Fabian Keil(开发领导者), David Schmidt, 和众多其他贡献者 +- 授权: GNU GPL v2 +- 版本号: 3.4.2 + +### Varnish Cache ### + +Varnish Cache 是一个为性能和灵活性而生的 web 加速器。它新颖的架构设计能带来显著的性能提升。根据你的架构,通常情况下它能加速响应速度300-1000倍。Varnish 将页面存储到内存,这样 web 服务器就无需重复地创建相同的页面,只需要在页面发生变化后重新生成。页面内容直接从内存中访问,当然比其他方式更快。 + +此外 Varnish 能大大提升响应 web 页面的速度,用在任何应用服务器上都能使网站访问速度大幅度地提升。 + +按经验,Varnish Cache 比较经济的配置是1-16GB内存+ SSD 固态硬盘。 + +其特性包括: + +- 新颖的设计 +- VCL - 非常灵活的配置语言。VCL 配置会转换成 C,然后编译、加载、运行,灵活且高效 +- 能使用 round-robin 轮询和随机分发两种方式来负载均衡,两种方式下后端服务器都可以设置权重 +- 基于 DNS、随机、散列和客户端 IP 的分发器(Director) +- 多台后端主机间的负载均衡 +- 支持 Edge Side Includes,包括拼装压缩后的 ESI 片段 +- 重度多线程并发 +- URL 重写 +- 单 Varnish 能够缓存多个虚拟主机 +- 日志数据存储在共享内存中 +- 基本的后端服务器健康检查 +- 优雅地处理后端服务器“挂掉” +- 命令行界面的管理控制台 +- 使用内联 C 语言来扩展 Varnish +- 可以与 Apache 用在相同的系统上 +- 单个系统可运行多个 Varnish +- 支持 HAProxy 代理协议。该协议在每个收到的 TCP 请求——例如 SSL 终止过程中——附加一小段 http 头信息,以记录客户端的真实地址 +- 冷热 VCL 状态 +- 可以用名为 VMOD 的 Varnish 模块来提供插件扩展 +- 通过 VMOD 定义后端主机 +- Gzip 压缩及解压 +- HTTP 流的通过和获取 +- 神圣模式和优雅模式。用 Varnish 作为负载均衡器,神圣模式下可以将不稳定的后端服务器在一段时间内打入黑名单,阻止它们继续提供流量服务。优雅模式允许 Varnish 在获取不到后端服务器状态良好的响应时,提供已过期版本的页面或其它内容。 +- 实验性支持持久化存储,无需 LRU 缓存淘汰 + +-- + +- 网站: [www.varnish-cache.org][3] +- 开发: Varnish Software +- 授权: FreeBSD +- 版本号: 4.1.0 + +### Polipo ### + +Polipo 是一个开源的 HTTP 缓存代理,只需要非常低的资源开销。 + +它监听来自浏览器的 web 页面请求,转发到 web 服务器,然后将服务器的响应转发到浏览器。在此过程中,它能优化和整形网络流量。从本质来讲 Polipo 与 WWWOFFLE 很相似,但其实现技术更接近于 Squid。 + +Polipo 最开始的目标是作为一个兼容 HTTP/1.1 的代理,理论它能在任何兼容 HTTP/1.1 或更早的 HTTP/1.0 的站点上运行。 + +其特性包括: + +- HTTP 1.1、IPv4 & IPv6、流量过滤和隐私保护增强 +- 如确认远程服务器支持的话,则无论收到的请求是管道处理过的还是在多个连接上同时收到的,都使用 HTTP/1.1 管道(pipelining) +- 下载被中断时缓存起始部分,当需要续传时用区间(Range)请求来完成下载 +- 将 HTTP/1.0 的客户端请求升级为 HTTP/1.1,然后按照客户端支持的级别进行升级或降级后回复 +- 全面支持 IPv6 (作用域(链路本地)地址除外) +- 作为 IPv4 和 IPv6 网络的网桥 +- 内容过滤 +- 能使用 Poor Man 多路复用技术(Poor Man's Multiplexing)降低延迟 +- 支持 SOCKS 4 和 SOCKS 5 协议 +- HTTPS 代理 +- 扮演透明代理的角色 +- 可以与 Privoxy 或 tor 一起运行 + +-- + +- 网站: [www.pps.univ-paris-diderot.fr/~jch/software/polipo/][4] +- 开发: Juliusz Chroboczek, Christopher Davis +- 授权: MIT License +- 版本号: 1.1.1 + +### Tinyproxy ### + +Tinyproxy 是一个轻量级的开源 web 代理守护进程,其设计目标是快而小。它适用于需要完整 HTTP 代理特性,但系统资源又不足以运行大型代理的场景,比如嵌入式部署。 + +Tinyproxy 对小规模网络非常有用,这样的场合下大型代理会使系统资源紧张,或有安全风险。Tinyproxy 的一个关键特性是其缓冲连接的理念。从效果上看, Tinyproxy 对服务器的响应进行了高速缓冲,然后按照客户端能够处理的最高速度进行响应。该特性极大的降低了网络延滞带来的问题。 + +特性: + +- 易于修改 +- 隐匿模式 - 定义哪些 HTTP 头允许通过,哪些又会被拦截 +- 支持 HTTPS - Tinyproxy 允许通过 CONNECT 方法转发 HTTPS 连接,任何情况下都不会修改数据流量 +- 远程监控 - 远程访问代理统计数据,让你能清楚了解代理服务当前的忙碌状态 +- 平均负载监控 - 通过配置,当服务器的负载接近一定值后拒绝新连接 +- 访问控制 - 通过配置,仅允许指定子网或 IP 地址的访问 +- 安全 - 运行无需额外权限,减小了系统受到威胁的概率 +- 基于 URL 的过滤 - 允许基于域和URL的黑白名单 +- 透明代理 - 配置为透明代理,这样客户端就无需任何配置 +- 代理链 - 在流量出口处采用上游代理服务器,而不是直接转发到目标服务器,创建我们所说的代理链 +- 隐私特性 - 限制允许从浏览器收到的来自 HTTP 服务器的数据(例如 cookies),同时限制允许通过的从浏览器到 HTTP 服务器的数据(例如版本信息) +- 低开销 - 使用 glibc 内存开销只有2MB,CPU 负载按并发连接数线性增长(取决于网络连接速度)。 Tinyproxy 可以运行在老旧的机器上而无需担心性能问题。 + +-- + +- 网站: [banu.com/tinyproxy][5] +- 开发: Robert James Kaes和其他贡献者 +- 授权: GNU GPL v2 +- 版本号: 1.8.3 + +-------------------------------------------------------------------------------- + +via: http://www.linuxlinks.com/article/20151101020309690/WebDelivery.html + +译者:[fw8899](https://github.com/fw8899) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.squid-cache.org/ +[2]:http://www.privoxy.org/ +[3]:https://www.varnish-cache.org/ +[4]:http://www.pps.univ-paris-diderot.fr/%7Ejch/software/polipo/ +[5]:https://banu.com/tinyproxy/ diff --git a/published/201603/20151105 Linux FAQs with Answers--How to install Ubuntu desktop behind a proxy.md b/published/201603/20151105 Linux FAQs with Answers--How to install Ubuntu desktop behind a proxy.md new file mode 100644 index 0000000000..31ca37ab0b --- /dev/null +++ b/published/201603/20151105 Linux FAQs with Answers--How to install Ubuntu desktop behind a proxy.md @@ -0,0 +1,62 @@ +Linux 有问必答:如何通过代理服务器安装 Ubuntu 桌面版 +================================================================================ +> **问题**: 我的电脑通过 HTTP 代理连接到公司网络。当我尝试从 CD-ROM 在计算机上安装 Ubuntu 桌面时,在检索文件时安装程序会被挂起,检索则不会完成,这可能是由于代理造成的。然而问题是,Ubuntu 的安装程序从不要求我在安装过程中配置代理。那我该怎么使用代理来安装 Ubuntu 桌面? + +与 Ubuntu 服务器不太一样,安装 Ubuntu 桌面几乎都是自动安装,没有留下太多自定义的空间,如自定义磁盘分区,手动网络设置,包选择等等。尽管非常简单,一键安装被认为是用户友好的,它不需要用户寻找“高级安装模式”来定制自己的 Ubuntu 桌面。 + +此外,Ubuntu 默认桌面的安装程序中一个大问题是代理设置。如果你的计算机连接在一个代理上,你会发现 Ubuntu 安装时会卡在准备下载文件处。 + +![](https://c2.staticflickr.com/6/5683/22195372232_cea81a5e45_c.jpg) + +这篇文章描述了如何解决当使用代理时 Ubuntu **安装程序的限制和安装 Ubuntu 桌面**。 + +其基本思路如下。不是直接使用 Ubuntu 的安装程序开始安装,首先进入 live Ubuntu 桌面,配置代理服务器,最后从 live 桌面手动启动 Ubuntu 的安装程序。以下是程序的安装步骤。 + +从 CD/DVD 或 USB 启动 Ubuntu 桌面后,点击第一个欢迎屏幕上的"Try Ubuntu"。 + +![](https://c1.staticflickr.com/1/586/22195371892_3816ba09c3_c.jpg) + +一旦进入 live Ubuntu 桌面,点击左侧设置图标。 + +![](https://c1.staticflickr.com/1/723/22020327738_058610c19d_c.jpg) + +进入 Network 菜单。 + +![](https://c2.staticflickr.com/6/5675/22021212239_ba3901c8bf_c.jpg) + +手动配置代理服务器。 + +![](https://c1.staticflickr.com/1/735/22020025040_59415e0b9a_c.jpg) + +接下来,打开一个终端。 + +![](https://c2.staticflickr.com/6/5642/21587084823_357b5c48cb_c.jpg) + +通过输入以下命令切换到 root 用户: + + $ sudo su + +最后,在 root 用户下输入以下命令。 + + # ubiquity gtk_ui + +然后将启动基于 GUI 的 Ubuntu 安装程序。 + + +![](https://c1.staticflickr.com/1/723/22020025090_cc64848b6c_c.jpg) + +继续安装其余部分。 + +![](https://c1.staticflickr.com/1/628/21585344214_447020e9d6_c.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/install-ubuntu-desktop-behind-proxy.html + +作者:[Dan Nanni][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/published/201603/20151109 How to send email notifications using Gmail SMTP server on Linux.md b/published/201603/20151109 How to send email notifications using Gmail SMTP server on Linux.md new file mode 100644 index 0000000000..2661a64085 --- /dev/null +++ b/published/201603/20151109 How to send email notifications using Gmail SMTP server on Linux.md @@ -0,0 +1,156 @@ +如何在 Linux 上使用 Gmail SMTP 服务器发送邮件通知 +================================================================================ +假定你想配置一个 Linux 应用,用于从你的服务器或桌面客户端发送邮件信息。邮件信息可能是邮件简报、状态更新(如 [Cachet][1])、监控警报(如 [Monit][2])、磁盘时间(如 [RAID mdadm][3])等等。当你要建立自己的 [邮件发送服务器][4] 传递信息时 ,你可以替代使用一个免费的公共 SMTP 服务器,从而避免遭受维护之苦。 + +谷歌的 Gmail 服务就是最可靠的 **免费 SMTP 服务器** 之一。想要从应用中发送邮件通知,你仅需在应用中添加 Gmail 的 SMTP 服务器地址和你的身份凭证即可。 + +使用 Gmail 的 SMTP 服务器会遇到一些限制,这些限制主要用于阻止那些经常滥用服务器来发送垃圾邮件和使用邮件营销的家伙。举个例子,你一次只能给至多 100 个地址发送信息,并且一天不能超过 500 个收件人。同样,如果你不想被标为垃圾邮件发送者,你就不能发送过多的不可投递的邮件。当你达到任何一个限制,你的 Gmail 账户将被暂时的锁定一天。简而言之,Gmail 的 SMTP 服务器对于你个人的使用是非常棒的,但不适合商业的批量邮件。 + +说了这么多,是时候向你们展示 **如何在 Linux 环境下使用 Gmail 的 SMTP 服务器** 了。 + +### Google Gmail SMTP 服务器设置 ### + +如果你想要通过你的应用使用 Gmail 的 SMTP 服务器发送邮件,请牢记接下来的详细说明。 + +- **邮件发送服务器 (SMTP 服务器)**: smtp.gmail.com +- **使用认证**: 是 +- **使用安全连接**: 是 +- **用户名**: 你的 Gmail 账户 ID (比如 "alice" ,如果你的邮箱为 alice@gmail.com) +- **密码**: 你的 Gmail 密码 +- **端口**: 587 + +确切的配置根据应用会有所不同。在本教程的剩余部分,我将向你展示一些在 Linux 上使用 Gmail SMTP 服务器的应用示例。 + +### 从命令行发送邮件 ### + +作为第一个例子,让我们尝试最基本的邮件功能:使用 Gmail SMTP 服务器从命令行发送一封邮件。为此,我将使用一个称为 mutt 的命令行邮件客户端。 + +先安装 mutt: + +对于 Debian-based 系统: + + $ sudo apt-get install mutt + +对于 Red Hat based 系统: + + $ sudo yum install mutt + +创建一个 mutt 配置文件(~/.muttrc),并和下面一样,在文件中指定 Gmail SMTP 服务器信息。将 \ 替换成自己的 Gmail ID。注意该配置只是为了发送邮件而已(而非接收邮件)。 + + $ vi ~/.muttrc + +---------- + + set from = "@gmail.com" + set realname = "Dan Nanni" + set smtp_url = "smtp://@smtp.gmail.com:587/" + set smtp_pass = "" + +一切就绪,使用 mutt 发送一封邮件: + + $ echo "This is an email body." | mutt -s "This is an email subject" alice@yahoo.com + +想在一封邮件中添加附件,使用 "-a" 选项 + + $ echo "This is an email body." | mutt -s "This is an email subject" alice@yahoo.com -a ~/test_attachment.jpg + +![](https://c1.staticflickr.com/1/770/22239850784_5fb0988075_c.jpg) + +使用 Gmail SMTP 服务器意味着邮件将显示是从你 Gmail 账户发出的。换句话说,收件人将视你的 Gmail 地址为发件人地址。如果你想要使用自己的域名作为邮件发送方,你需要使用 Gmail SMTP 转发服务。 + +### 当服务器重启时发送邮件通知 ### + +如果你在 [虚拟专用服务器(VPS)][5] 上跑了些重要的网站,建议监控 VPS 的重启行为。作为一个更为实用的例子,让我们研究如何在你的 VPS 上为每一次重启事件建立邮件通知。这里假设你的 VPS 上使用的是 systemd,并向你展示如何为自动邮件通知创建一个自定义的 systemd 启动服务。 + +首先创建下面的脚本 reboot_notify.sh,用于负责邮件通知。 + + $ sudo vi /usr/local/bin/reboot_notify.sh + +---------- + + #!/bin/sh + + echo "`hostname` was rebooted on `date`" | mutt -F /etc/muttrc -s "Notification on `hostname`" alice@yahoo.com + +---------- + + $ sudo chmod +x /usr/local/bin/reboot_notify.sh + +在这个脚本中,我使用 "-F" 选项,用于指定系统级的 mutt 配置文件位置。因此不要忘了创建 /etc/muttrc 文件,并如前面描述的那样填入 Gmail SMTP 信息。 + +现在让我们创建如下一个自定义的 systemd 服务。 + + $ sudo mkdir -p /usr/local/lib/systemd/system + $ sudo vi /usr/local/lib/systemd/system/reboot-task.service + +---------- + + [Unit] + Description=Send a notification email when the server gets rebooted + DefaultDependencies=no + Before=reboot.target + + [Service] + Type=oneshot + ExecStart=/usr/local/bin/reboot_notify.sh + + [Install] + WantedBy=reboot.target + +在创建服务后,添加并启动该服务。 + + $ sudo systemctl enable reboot-task + $ sudo systemctl start reboot-task + +从现在起,在每次 VPS 重启时,你将会收到一封通知邮件。 + +![](https://c1.staticflickr.com/1/608/22241452923_2ace9cde2e_c.jpg) + +### 通过服务器使用监控发送邮件通知 ### + +作为最后一个例子,让我展示一个现实生活中的应用程序,[Monit][6],这是一款极其有用的服务器监控应用程序。它带有全面的 [VPS][7] 监控能力(比如 CPU、内存、进程、文件系统)和邮件通知功能。 + +如果你想要接收 VPS 上由 Monit 产生的任何事件的邮件通知,你可以在 Monit 配置文件中添加以下 SMTP 信息。 + + set mailserver smtp.gmail.com port 587 + username "" password "" + using tlsv12 + + set mail-format { + from: @gmail.com + subject: $SERVICE $EVENT at $DATE on $HOST + message: Monit $ACTION $SERVICE $EVENT at $DATE on $HOST : $DESCRIPTION. + + Yours sincerely, + Monit + } + + # the person who will receive notification emails + set alert alice@yahoo.com + +这是一个因为 CPU 负载超载而由 Monit 发送的邮件通知的例子。 + +![](https://c1.staticflickr.com/1/566/22873764251_8fe66bfd16_c.jpg) + +### 总结 ### + +如你所见,类似 Gmail 这样免费的 SMTP 服务器有着这么多不同的运用方式 。但再次重申,请牢记免费的 SMTP 服务器不适用于商业用途,仅仅适用于个人项目。无论你正在哪款应用中使用 Gmail SMTP 服务器,欢迎自由分享你的用例。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/send-email-notifications-gmail-smtp-server-linux.html + +作者:[Dan Nanni][a] +译者:[cposture](https://github.com/cposture) +校对:[martin2011qi](https://github.com/martin2011qi), [wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://xmodulo.com/setup-system-status-page.html +[2]:http://xmodulo.com/server-monitoring-system-monit.html +[3]:http://xmodulo.com/create-software-raid1-array-mdadm-linux.html +[4]:http://xmodulo.com/mail-server-ubuntu-debian.html +[5]:http://xmodulo.com/go/digitalocean +[6]:http://xmodulo.com/server-monitoring-system-monit.html +[7]:http://xmodulo.com/go/digitalocean diff --git a/published/201603/20151109 Install Android On BQ Aquaris Ubuntu Phone In Linux.md b/published/201603/20151109 Install Android On BQ Aquaris Ubuntu Phone In Linux.md new file mode 100644 index 0000000000..59946de678 --- /dev/null +++ b/published/201603/20151109 Install Android On BQ Aquaris Ubuntu Phone In Linux.md @@ -0,0 +1,125 @@ +在 Linux 上将 BQ Aquaris Ubuntu 手机刷成 Android 系统 +================================================================================ +![How to install Android on Ubuntu Phone](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/11/Install-Android-on-Ubuntu-Phone.jpg) + +如果你正好拥有全球第一支运行 Ubuntu 的手机并且希望将 **BQ Aquaris E4.5 自带的 Ubuntu 系统换成 Android **,那这篇文章能帮你点小忙。 + +有一万种理由来解释为什么要将 Ubuntu 换成主流 Android OS。其中最主要的一个,就是这个系统本身仍然处于非常早期的阶段,针对的目标用户仍然是开发者和爱好者。不管你的理由是什么,要谢谢 BQ 提供的工具,让我们能非常轻松地在 BQ Aquaris 上安装 Android OS。 + +下面让我们一起看下在 BQ Aquaris 上安装 Android 需要做哪些事情。 + +### 前提条件 ### + +- 可用的因特网连接,用来下载 Android 出厂固件以及安装刷机工具。 +- USB 数据线 +- 运行 Linux 的电脑 + +本文是基于 Ubuntu 15.10 操作的。但是这些步骤应该也可以应用于其他大多数 Linux 发行版。 + +### 将 BQ Aquaris E4.5 上的 Ubuntu 换成 Android ### + +#### 第一步:下载 Android 固件 #### + +首先是下载可以在 BQ Aquaris E4.5 上运行的 Android 固件。幸运的是我们可以在 BQ 的技术支持网站找到。可以从下面的链接直接下载,差不多 650 MB: + +- [下载为 BQ Aquaris E4.5 制作的 Android][1] + +是的,这个版本还支持 OTA 自动升级。目前,固件版本是 2.0.1,基于 Android Lolipop 开发。过一段时间,应该就会放出基于 Marshmallow 的新版本,上边的链接可能就无效了。 + +我建议去[ bq 的技术支持网站][2]下载最新的固件。 + +下载完成后解压。在解压后的目录里,找到一个名字是 **MT6582\_Android\_scatter.txt** 的文件。后面将要用到它。 + +#### 第二步:下载刷机工具 #### + +BQ 已经提供了自己的刷机工具,Herramienta MTK Flash Tool,可以轻松地给设备安装 Andriod 或者 Ubuntu 系统。你可以从下面的链接下载工具: + +- [下载 MTK Flash Tool][3] + +考虑到刷机工具在以后可能会升级,你总是可以从 [BQ 技术支持网站][4]上找到最新的版本。 + +下载完后解压。之后应该可以在目录里找到一个叫 **flash_tool** 的可执行文件。我们稍后会用到。 + +#### 第三步:移除冲突的软件包(可选) #### + +如果你正在用最新版本的 Ubuntu 或 基于 Ubuntu 的 Linux 发行版,稍后可能会碰到 “BROM ERROR : S\_UNDEFINED\_ERROR (1001)” 错误。 + +要避免这个错误,你需要卸载有冲突的软件包。可以使用下面的命令: + + sudo apt-get remove modemmanager + +用下面的命令重启 udev 服务: + + sudo service udev restart + +检查一下内核模块 cdc_acm 可能存在的副作用,运行下面的命令: + + lsmod | grep cdc_acm + +如果上面命令输出是空,你将需要重新加载一下这个内核模块: + + sudo modprobe cdc_acm + +#### 第四步:准备刷入 Android #### + +切换到下载好并解压完成的刷机工具目录(第二步)。请使用命令行来完成,这是因为将要用到 root 权限。 + +假设你保存在下载目录里,使用下面的命令切换目录(为那些不懂如何在命令行下切换目录的朋友考虑)。 + + cd ~/Downloads/SP_Flash* + +然后使用下面的命令以 root 权限启动刷机工具: + + sudo ./flash_tool + +然后你会看到一个像下面的窗口界面。不用在意 Download Agent 区域,它将会被自动填入。只要关心 Scatter-loading 区域。 + +![Replace Ubuntu with Android](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/11/Install-Android-bq-aquaris-Ubuntu-1.jpeg) + +还记得之前第一步里提到的 **MT6582\_Android\_scatter.txt** 文件吗?这个文本文件就在你第一步中下载的 Android 固件解压后的目录里。点击 Scatter-loading(上图中)然后选中 MT6582\_Android\_scatter.txt 文件。 + +之后,你将看到类似下面图片里的一些绿色线条: + +![Install-Android-bq-aquaris-Ubuntu-2](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/11/Install-Android-bq-aquaris-Ubuntu-2.jpeg) + +#### 第五步:刷入 Android #### + +已经差不多了。把你的手机关机,然后通过 USB 线连接到电脑上。 + +在下拉列表里选择 Firmware Upgrade,然后点击那个大的 Download 按钮。 + +![flash Android with Ubuntu](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/11/Install-Android-bq-aquaris-Ubuntu.jpeg) + +如果一切顺利,你应该可以在工具下方的状态栏里看到刷机状态: + +![Replace Ubuntu with Android](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/11/Install-Android-bq-aquaris-Ubuntu-3.jpeg) + +当所有过程都完成后,你将看到一个类似这样的提示: + +![Successfully flashed Android on bq qauaris Ubuntu Phone](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/11/Install-Android-bq-aquaris-Ubuntu-4.jpeg) + +将手机从电脑上移除然后开机。你应该看到屏幕上显示白色并在中间和底部有 AQUARIS 文字,还应该有 “powered by Android” 字样。差不多需要差不多十分钟,你才可以设置和开始使用 Android。 + +注意:如果中间出了什么问题,同时按下电源、音量加、音量减按键可以进入 fast boot 模式。然后再次关机并连接电脑。重复升级固件的过程。应该可以。 + +### 总结 ### + +要感谢厂商提供的工具,让我们可以轻松地 **在 BQ Ubuntu 手机上刷 Android**。当然,你可以使用相同的步骤将 Android 替换回 Ubuntu。只是下载的时候选 Ubuntu 固件而不是 Android。 + +希望这篇文章可以帮你将你的 bq 手机上的 Ubuntu 刷成 Android。如果有什么问题或建议,可以在下面留言区里讨论。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/install-android-ubuntu-phone/ + +作者:[Abhishek][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:https://storage.googleapis.com/otas/2014/Smartphones/Aquaris_E4.5_L/2.0.1_20150623-1900_bq-FW.zip +[2]:http://www.bq.com/gb/support/aquaris-e4-5 +[3]:https://storage.googleapis.com/otas/2014/Smartphones/Aquaris_E4.5/Ubuntu/Web%20version/Web%20version/SP_Flash_Tool_exe_linux_v5.1424.00.zip +[4]:http://www.bq.com/gb/support/aquaris-e4-5-ubuntu-edition diff --git a/published/201603/20151116 Linux FAQs with Answers--How to install Node.js on Linux.md b/published/201603/20151116 Linux FAQs with Answers--How to install Node.js on Linux.md new file mode 100644 index 0000000000..6482a87d2c --- /dev/null +++ b/published/201603/20151116 Linux FAQs with Answers--How to install Node.js on Linux.md @@ -0,0 +1,91 @@ +Linux 有问必答:如何在 Linux 上安装 Node.js +================================================================================ +> **问题**: 如何在你的 Linux 发行版上安装 Node.js? + +[Node.js][1] 是建立在谷歌的 V8 JavaScript 引擎服务器端的软件平台上。在构建高性能的服务器端应用程序上,Node.js 在 JavaScript 中已是首选方案。是什么让使用 Node.js 库和应用程序的[庞大生态系统][2]来开发服务器后台变得如此流行。Node.js 自带一个被称为 npm 的命令行工具可以让你轻松地安装它,进行版本控制并使用 npm 的在线仓库来管理 Node.js 库和应用程序的依赖关系。 + +在本教程中,我将介绍 **如何在主流 Linux 发行版上安装 Node.js,包括 Debian,Ubuntu,Fedora 和 CentOS** 。 + +Node.js 在一些发行版上有预构建的程序包(如,Fedora 或 Ubuntu),而在其他发行版上你需要通过源码安装。由于 Node.js 发展比较快,建议从源码安装最新版而不是安装一个过时的预构建的程序包。最新的 Node.js 自带 npm(Node.js 的包管理器),让你可以轻松的安装 Node.js 的外部模块。 + +### 在 Debian 上安装 Node.js on ### + +从 Debian 8 (Jessie)开始,Node.js 已被纳入官方软​​件仓库。因此,你可以使用如下方式安装它: + + $ sudo apt-get install npm + +在 Debian 7 (Wheezy) 以前的版本中,你需要使用下面的方式来源码安装: + + $ sudo apt-get install python g++ make + $ wget http://nodejs.org/dist/node-latest.tar.gz + $ tar xvfvz node-latest.tar.gz + $ cd node-v0.10.21 (replace a version with your own) + $ ./configure + $ make + $ sudo make install + +### 在 Ubuntu 或 Linux Mint 中安装 Node.js ### + +Node.js 被包含在 Ubuntu(13.04 及更高版本)。因此,安装非常简单。以下方式将安装 Node.js 和 npm。 + + $ sudo apt-get install npm + $ sudo ln -s /usr/bin/nodejs /usr/bin/node + +而 Ubuntu 中的 Node.js 可能版本比较老,你可以从 [其 PPA][3] 中安装最新的版本。 + + $ sudo apt-get install python-software-properties python g++ make + $ sudo add-apt-repository -y ppa:chris-lea/node.js + $ sudo apt-get update + $ sudo apt-get install npm + +### 在 Fedora 中安装 Node.js ### + +Node.js 被包含在 Fedora 的 base 仓库中。因此,你可以在 Fedora 中用 yum 安装 Node.js。 + + $ sudo yum install npm + +如果你想安装 Node.js 的最新版本,可以按照以下步骤使用源码来安装。 + + $ sudo yum groupinstall 'Development Tools' + $ wget http://nodejs.org/dist/node-latest.tar.gz + $ tar xvfvz node-latest.tar.gz + $ cd node-v0.10.21 (replace a version with your own) + $ ./configure + $ make + $ sudo make install + +### 在 CentOS 或 RHEL 中安装 Node.js ### + +在 CentOS 使用 yum 包管理器来安装 Node.js,首先启用 EPEL 软件库,然后运行: + + $ sudo yum install npm + +如果你想在 CentOS 中安装最新版的 Node.js,其安装步骤和在 Fedora 中的相同。 + +### 在 Arch Linux 上安装 Node.js ### + + +Node.js 在 Arch Linux 的社区库中可以找到。所以安装很简单,只要运行: + + $ sudo pacman -S nodejs npm + +### 检查 Node.js 的版本 ### + +一旦你已经安装了 Node.js,你可以使用如下所示的方法检查 Node.js 的版本。 + + $ node --version + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/install-node-js-linux.html + +作者:[Dan Nanni][a] +译者:[strugglingyou](https://github.com/strugglingyou) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://nodejs.org/ +[2]:https://www.npmjs.com/ +[3]:https://launchpad.net/~chris-lea/+archive/node.js diff --git a/published/201603/20151125 20 Years of GIMP Evolution--Step by Step.md b/published/201603/20151125 20 Years of GIMP Evolution--Step by Step.md new file mode 100644 index 0000000000..6da552aa39 --- /dev/null +++ b/published/201603/20151125 20 Years of GIMP Evolution--Step by Step.md @@ -0,0 +1,163 @@ +GIMP 过去的 20 年:一点一滴的进步 +================================================================================ +注:youtube 视频 + + +[GIMP][1](GNU 图像处理程序(GNU Image Manipulation Program))—— 一流的开源自由的图像处理程序。加州大学伯克利分校的 Peter Mattis 和 Spencer Kimball 早在 1995 年的时候开始了该程序的开发。到了 1997 年,该程序成为了 [GNU Project][2] 官方的一部分,并正式更名为 GIMP。时至今日,GIMP 已经成为了最好的图像编辑器之一,并有经常有 “GIMP vs Photoshop” 之争。 + +### 1995 年 11 月 21 日,首版发布### + +``` +From: Peter Mattis +Subject: ANNOUNCE: The GIMP +Date: 1995-11-21 +Message-ID: <48s543$r7b@agate.berkeley.edu> +Newsgroups: comp.os.linux.development.apps,comp.os.linux.misc,comp.windows.x.apps + +GIMP:通用图像处理程序 +------------------------------------------------ + +GIMP 是为各种图像编辑操作提供一个直观的图形界面而设计的。 +以下是 GIMP 的主要功能介绍: + 图像查看 + ------------- + + * 支持 8 位,15 位,16 位和 24 位颜色 + * 8 位色显示图像的排序和 Floyd-Steinberg 抖动算法 + * 以 RGB 色、灰度和索引色模式查看图像 + * 同时编辑多个图像 + * 实时缩放和全图查看 + * 支持 GIF、JPEG、PNG、TIFF 和 XPM 格式 + + 图像编辑 + ------------- + + * 选区工具:包括矩形、椭圆、自由、模糊、贝尔赛曲线以及智能 + * 变换工具:包括旋转、缩放、剪切和翻转 + * 绘画工具:包括油漆桶、笔刷、喷枪、克隆、卷积、混合和文本 + * 效果滤镜:如模糊和边缘检测 + * 通道和颜色操作:叠加、反相和分解 + * 组件功能:允许你方便的添加新的文件格式和效果滤镜 + * 多步撤销/重做功能 +``` + +### 1996 年,GIMP 0.54 版 ### + +![](https://github.com/paulcarroty/Articles/raw/master/GIMP%20History/054.png) + +GIMP 0.54 版需要具备 X11 显示、X-server 以及 Motif 1.2 组件,支持 8 位、15 位、16 位和 24 位的颜色深度和灰度,支持 GIF、JPEG、PNG、TIFF 和 XPM 图像格式。 + +基本功能:具备矩形、椭圆、自由、模糊、贝塞尔曲线和智能等选择工具,旋转、缩放、剪切、克隆、混合和翻转等变换工具。 + +扩展工具:文字添加、效果滤镜、通道和颜色操纵工具、撤销/重做功能。由于第一个版本支持组件扩展,才方便添加这些功能。 + +GIMP 0.54 版可以在 Linux、HP-UX、Solaris 和 SGI IRIX 中运行。 + +### 1997 年,GIMP 0.60 版 ### + +![](https://github.com/paulcarroty/Articles/raw/master/GIMP%20History/060.gif) + +这只是一个开发版本,并非面向用户发布的。GIMP 有了新的工具包——GDK(GIMP Drawing Kit,GIMP 绘图工具)和 GTK(GIMP Toolkit,GIMP 工具包),并弃用 Motif。GIMP 工具包随后也发展成为了 GTK+ 跨平台的微件工具包。新特性: + +- 基本的图层功能 +- 子像素取样 +- 笔刷间距 +- 改进剂喷枪功能 +- 绘制模式 + +### 1997 年,GIMP 0.99 版 ### + +![](https://github.com/paulcarroty/Articles/raw/master/GIMP%20History/099.png) + +从 0.99 版本开始,GIMP 有了宏脚本的支持。GTK 及 GDK 功能增强版正式更名为 GTK+。其他更新: + +- 支持大体积图像(大于 100M) +- 新增原生格式 – XCF +- 新的 API – 使得更加容易编写组件和扩展 + +### 1998 年,GIMP 1.0 版 ### + +![](https://github.com/paulcarroty/Articles/raw/master/GIMP%20History/100.gif) + +GIMP 和 GTK+ 开始分为两个不同的项目。GIMP 官网进行重构,包含新教程、组件和文档。新特性: + +- 基于瓦片式(tile)的内存管理 +- 组件 API 做了大量改变 +- XFC 格式现在支持图层、导航和选择 +- web 界面 +- 在线图像生成 + +### 2000 年,GIMP 1.2 版 ### + +新特性: + +- 进行了非英文语言翻译 +- 修复 GTK+ 和 GIMP 中的大量 bug +- 增加大量组件 +- 图像映射 +- 新工具:调整大小、测量、加亮、燃烧效果、颜色吸管和翻转等。 +- 图像管道 +- 保存前可以进行图像预览 +- 按比例缩放的笔刷进行预览 +- 通过路径进行递归选择 +- 新的导航窗口 +- 支持图像拖拽 +- 支持水印 + +### 2004 年,GIMP 2.0 版 ### + +![](https://github.com/paulcarroty/Articles/raw/master/GIMP%20History/200.png) + +重大更新 – 更新 GTK+ 2.x toolkit. + +### 2004 年,GIMP 2.2 版 ### + +![](https://github.com/paulcarroty/Articles/raw/master/GIMP%20History/220.png) + +修复大量 Bug 并支持图像拖拽 + +### 2007 年,GIMP 2.4 版 ### + +![](https://github.com/paulcarroty/Articles/raw/master/GIMP%20History/240.png) + +新特性: + +- 更好的图像拖拽体验 +- 使用新的脚本解释器 Script-Fu 替代了 旧的 Ti-Fu +- 新组件:影印效果、光晕效果、霓虹灯效果、卡通效果、小狗笔刷、水珠笔刷以及其他组件 + +### 2008 年,GIMP 2.6 版 ### + +新特性: + +- 更新了图形界面 +- 新的选择工具 +- 集成了 GEGL (GEneric Graphics Library,通用图形库) +- 为 MDI 行为实现了实用程序窗口提示 + +### 2012 年,GIMP 2.8 版 ### + +![](https://github.com/paulcarroty/Articles/raw/master/GIMP%20History/280.png) + +新特性: + +- GUI 在视觉上做了一些改变 +- 新的保存和导出菜单 +- 更新文本框工具 +- 支持图层群组 +- 支持 JPEG2000 和导出为 pdf +- 网页截图工具 + +-------------------------------------------------------------------------------- + +via: https://tlhp.cf/20-years-of-gimp-evolution/ + +作者:[Pavlo Rudyi][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://tlhp.cf/author/paul/ +[1]:https://gimp.org/ +[2]:http://www.gnu.org/ diff --git a/published/201603/20151204 Review EXT4 vs. Btrfs vs. XFS.md b/published/201603/20151204 Review EXT4 vs. Btrfs vs. XFS.md new file mode 100644 index 0000000000..aebbc485b1 --- /dev/null +++ b/published/201603/20151204 Review EXT4 vs. Btrfs vs. XFS.md @@ -0,0 +1,65 @@ +如何选择文件系统:EXT4、Btrfs 和 XFS +================================================================================ +![](http://1969324071.rsc.cdn77.org/wp-content/uploads/2015/09/1385698302_funny_linux_wallpapers.jpg) + +老实说,人们最不曾思考的问题之一是他们的个人电脑中使用了什么文件系统。Windows 和 Mac OS X 用户更没有理由去考虑,因为对于他们的操作系统,只有一种选择,那就是 NTFS 和 HFS+。相反,对于 Linux 系统而言,有很多种文件系统可以选择,现在默认的是广泛采用的 ext4。然而,现在也有改用一种称为 btrfs 文件系统的趋势。那是什么使得 btrfs 更优秀,其它的文件系统又是什么,什么时候我们又能看到 Linux 发行版作出改变呢? + +首先让我们对文件系统以及它们真正干什么有个总体的认识,然后我们再对一些有名的文件系统做详细的比较。 + +### 文件系统是干什么的? ### + +如果你不清楚文件系统是干什么的,一句话总结起来也非常简单。文件系统主要用于控制所有程序在不使用数据时如何存储数据、如何访问数据以及有什么其它信息(元数据)和数据本身相关,等等。听起来要编程实现并不是轻而易举的事情,实际上也确实如此。文件系统一直在改进,包括了更多的功能、更高效地完成它需要做的事情。总而言之,它是所有计算机的基本需求、但并不像听起来那么简单。 + +### 为什么要分区? ### + +由于每个操作系统都能创建或者删除分区,很多人对分区都有模糊的认识。Linux 操作系统即便使用标准安装过程,在同一块磁盘上仍使用多个分区,这看起来很奇怪,因此需要一些解释。拥有不同分区的一个主要目的就是为了在灾难发生时能获得更好的数据安全性。 + +通过将硬盘划分为分区,数据会被分隔以及重组。当事故发生的时候,只有存储在被损坏分区上的数据会被破坏,很大可能上其它分区的数据能得以保留。这个原因可以追溯到 Linux 操作系统还没有日志文件系统、任何电力故障都有可能导致灾难发生的时候。 + +使用分区也考虑到了安全和健壮性原因,因此操作系统部分损坏并不意味着整个计算机就有风险或者会受到破坏。这也是当前采用分区的一个最重要因素。举个例子,用户创建了一些会填满磁盘的脚本、程序或者 web 应用,如果该磁盘只有一个大的分区,如果磁盘满了那么整个系统就不能工作。如果用户把数据保存在不同的分区,那么就只有那个分区会受到影响,而系统分区或者其它数据分区仍能正常运行。 + +记住,拥有一个日志文件系统只能在掉电或者和存储设备意外断开连接时提供数据安全性,并不能在文件系统出现坏块或者发生逻辑错误时保护数据。对于这种情况,用户可以采用廉价磁盘冗余阵列(RAID:Redundant Array of Inexpensive Disks)的方案。 + +### 为什么要切换文件系统? ### + +ext4 文件系统由 ext3 文件系统改进而来,而后者又是从 ext2 文件系统改进而来。虽然 ext4 文件系统已经非常稳定,是过去几年中绝大部分发行版的默认选择,但它是基于陈旧的代码开发而来。另外, Linux 操作系统用户也需要很多 ext4 文件系统本身不提供的新功能。虽然通过某些软件能满足这种需求,但性能会受到影响,在文件系统层次做到这些能获得更好的性能。 + +### Ext4 文件系统 ### + +ext4 还有一些明显的限制。最大文件大小是 16 tebibytes(大概是 17.6 terabytes),这比普通用户当前能买到的硬盘还要大的多。使用 ext4 能创建的最大卷/分区是 1 exbibyte(大概是 1,152,921.5 terabytes)。通过使用多种技巧, ext4 比 ext3 有很大的速度提升。类似一些最先进的文件系统,它是一个日志文件系统,意味着它会对文件在磁盘中的位置以及任何其它对磁盘的更改做记录。纵观它的所有功能,它还不支持透明压缩、重复数据删除或者透明加密。技术上支持了快照,但该功能还处于实验性阶段。 + +### Btrfs 文件系统 ### + +btrfs 有很多不同的叫法,例如 Better FS、Butter FS 或者 B-Tree FS。它是一个几乎完全从头开发的文件系统。btrfs 出现的原因是它的开发者起初希望扩展文件系统的功能使得它包括快照、池化(pooling)、校验以及其它一些功能。虽然和 ext4 无关,它也希望能保留 ext4 中能使消费者和企业受益的功能,并整合额外的能使每个人,尤其是企业受益的功能。对于使用大型软件以及大规模数据库的企业,让多种不同的硬盘看起来一致的文件系统能使他们受益并且使数据整合变得更加简单。删除重复数据能降低数据实际使用的空间,当需要镜像一个单一而巨大的文件系统时使用 btrfs 也能使数据镜像变得简单。 + +用户当然可以继续选择创建多个分区从而无需镜像任何东西。考虑到这种情况,btrfs 能横跨多种硬盘,和 ext4 相比,它能支持 16 倍以上的磁盘空间。btrfs 文件系统一个分区最大是 16 exbibytes,最大的文件大小也是 16 exbibytes。 + +### XFS 文件系统 ### + +XFS 文件系统是扩展文件系统(extent file system)的一个扩展。XFS 是 64 位高性能日志文件系统。对 XFS 的支持大概在 2002 年合并到了 Linux 内核,到了 2009 年,红帽企业版 Linux 5.4 也支持了 XFS 文件系统。对于 64 位文件系统,XFS 支持最大文件系统大小为 8 exbibytes。XFS 文件系统有一些缺陷,例如它不能压缩,删除大量文件时性能低下。目前RHEL 7.0 文件系统默认使用 XFS。 + +### 总结 ### + +不幸的是,还不知道 btrfs 什么时候能到来。官方说,其下一代文件系统仍然被归类为“不稳定”,但是如果用户下载最新版本的 Ubuntu,就可以选择安装到 btrfs 分区上。什么时候 btrfs 会被归类到 “稳定” 仍然是个谜, 直到真的认为它“稳定”之前,用户也不应该期望 Ubuntu 会默认采用 btrfs。有报道说 Fedora 18 会用 btrfs 作为它的默认文件系统,因为到了发布它的时候,应该有了 btrfs 文件系统校验器。由于还没有实现所有的功能,另外和 ext4 相比性能上也比较缓慢,btrfs 还有很多的工作要做。 + +那么,究竟使用哪个更好呢?尽管性能几乎相同,但 ext4 还是赢家。为什么呢?答案在于易用性以及广泛性。对于桌面或者工作站, ext4 仍然是一个很好的文件系统。由于它是默认提供的文件系统,用户可以在上面安装操作系统。同时, ext4 支持最大 1 exabytes 的卷和 16 terabytes 的文件,因此考虑到大小,它也还有很大的进步空间。 + +btrfs 能提供更大的高达 16 exabytes 的卷以及更好的容错,但是,到现在为止,它感觉更像是一个附加的文件系统,而部署一个集成到 Linux 操作系统的文件系统。比如,尽管 btrfs 支持不同的发行版,使用 btrfs 格式化硬盘之前先要有 btrfs-tools 工具,这意味着安装 Linux 操作系统的时候它并不是一个可选项,即便不同发行版之间会有所不同。 + +尽管传输速率非常重要,评价一个文件系统除了文件传输速度之外还有很多因素。btrfs 有很多好用的功能,例如写复制(Copy-on-Write)、扩展校验、快照、清洗、自修复数据、冗余删除以及其它保证数据完整性的功能。和 ZFS 相比 btrfs 缺少 RAID-Z 功能,因此对于 btrfs, RAID 还处于实验性阶段。对于单纯的数据存储,和 ext4 相比 btrfs 似乎更加优秀,但时间会验证一切。 + +迄今为止,对于桌面系统而言,ext4 似乎是一个更好的选择,因为它是默认的文件系统,传输文件时也比 btrfs 更快。btrfs 当然值得尝试、但要在桌面 Linux 上完全取代 ext4 可能还需要一些时间。数据场和大存储池会揭示关于 ext4、XCF 以及 btrfs 不同的场景和差异。 + +如果你有不同或者其它的观点,在下面的评论框中告诉我们吧。 + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/review-ext4-vs-btrfs-vs-xfs/ + +作者:[M.el Khamlichi][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/pirat9/ diff --git a/published/201603/20151215 How to Install Light Table 0.8 in Ubuntu 14.04, 15.10.md b/published/201603/20151215 How to Install Light Table 0.8 in Ubuntu 14.04, 15.10.md new file mode 100644 index 0000000000..915466448b --- /dev/null +++ b/published/201603/20151215 How to Install Light Table 0.8 in Ubuntu 14.04, 15.10.md @@ -0,0 +1,104 @@ + 如何在 Ubuntu 中安装 Light Table 0.8 +================================================================================ +![](http://ubuntuhandbook.org/wp-content/uploads/2014/11/LightTable-IDE-logo-icon.png) + +Light Table 在经过一年以上的开发,已经推出了新的稳定发行版本。现在它只为 Linux 提供64位的二进制包。 + +LightTable 0.8.0的改动: + +- 更改: 我们从 NW.js 切换到了 Electron +- 更改: Light Table 的发行与自更新进程完全地公开在github上 +- 增加: Light Table 可以用提供的脚本在各个支持的平台上从源码构建 +- 增加: Light Table 大部分的 node 代码库将通过 npm 依赖来安装,以取代以前采用分叉库的方式 +- 增加: 有效文档。更多详情内容见下面 +- 修复: 版本号 >= OSX 10.10的系统下的主要的可用性问题 +- 更改: 官方不再提供 32位 Linux 软件包下载,不过仍然支持从源码构建 +- 修复: ClojureScript eval 支持 ClojureScript 的现代版本 +- 参阅更多 [github.com/LightTable/LightTable/releases][1] + +![LightTable 0.8.0](http://ubuntuhandbook.org/wp-content/uploads/2015/12/lighttable-08.jpg) + +### 如何在 Ubuntu 中安装 Light Table 0.8.0 ### + +下面的步骤会指导你怎么样在 Ubuntu 下安装官方的二进制包,在目前的 Ubuntu 发行版本中都适用(**仅仅针对64位**)。 + +在开始之前,如果你安装了之前的版本请做好备份。 + +**1.** 从以下链接下载 LightTable Linux 下的二进制文件: + +- [lighttable-0.8.0-linux.tar.gz][2] + +**2.** 从 dash 或是应用启动器,或者是 Ctrl+Alt+T 快捷键打开终端,并且在输入以下命令后敲击回车键: + + gksudo file-roller ~/Downloads/lighttable-0.8.0-linux.tar.gz + +![open-via-fileroller](http://ubuntuhandbook.org/wp-content/uploads/2015/12/open-via-fileroller.jpg) + +如果命令不工作的话从 Ubuntu 软件中心安装`gksu`。 + +**3.** 之前的命令使用了 root 用户权限通过档案管理器打开了下载好的存档。 + +打开它后,请做以下步骤: + +- 右击文件并且将其重命名为 **LightTable** +- 将其解压到 **Computer -> /opt/** 目录下。 + +![extract-lighttable](http://ubuntuhandbook.org/wp-content/uploads/2015/12/extract-lighttable.jpg) + +最终你应该安装好了 LightTable,可以在 /opt/ 目录下查看: + +![lighttable-in-opt](http://ubuntuhandbook.org/wp-content/uploads/2015/12/lighttable-in-opt.jpg) + +**4.** 创建一个启动器使你可以从 dash 工具或是应用启动器打开 LightTable。 + +打开终端,运行以下命令来创建与编辑一个 LightTable 的启动文件: + + gksudo gedit /usr/share/applications/lighttable.desktop + +通过 Gedit 文本编辑器打开文件后,粘贴下面的内容并保存: + + [Desktop Entry] + Version=1.0 + Type=Application + Name=Light Table + GenericName=Text Editor + Comment=Open source IDE that modify, from running programs to embed websites and games + Exec=/opt/LightTable/LightTable %F + Terminal=false + MimeType=text/plain; + Icon=/opt/LightTable/resources/app/core/img/lticon.png + Categories=TextEditor;Development;Utility; + StartupNotify=true + Actions=Window;Document; + + Name[en_US]=Light Table + + [Desktop Action Window] + Name=New Window + Exec=/opt/LightTable/LightTable -n + OnlyShowIn=Unity; + + [Desktop Action Document] + Name=New File + Exec=/opt/LightTable/LightTable --command new_file + OnlyShowIn=Unity; + +因此它看起来像: + +![lighttable-launcher](http://ubuntuhandbook.org/wp-content/uploads/2015/12/lighttable-launcher.jpg) + +最后,从 dash 工具或者是应用启动器打开 IDE,好好享受它吧! + +-------------------------------------------------------------------------------- + +via: http://ubuntuhandbook.org/index.php/2015/12/install-light-table-0-8-ubuntu-14-04/ + +作者:[Ji m][a] +译者:[zky001](https://github.com/zky001) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ubuntuhandbook.org/index.php/about/ +[1]:https://github.com/LightTable/LightTable/releases +[2]:https://github.com/LightTable/LightTable/releases/download/0.8.0/lighttable-0.8.0-linux.tar.gz diff --git a/published/201603/20151215 Linux Desktop Fun--Summon Swarms Of Penguins To Waddle About The Desktop.md b/published/201603/20151215 Linux Desktop Fun--Summon Swarms Of Penguins To Waddle About The Desktop.md new file mode 100644 index 0000000000..4577cb10cb --- /dev/null +++ b/published/201603/20151215 Linux Desktop Fun--Summon Swarms Of Penguins To Waddle About The Desktop.md @@ -0,0 +1,102 @@ +Linux/Unix 桌面趣事:召唤一群企鹅在桌面上行走 +================================================================================ +XPenguins 是一个在窗口播放可爱动物动画的程序。默认情况下,将会从屏幕上方掉落企鹅,沿着你的窗口顶部行走,在窗口漂浮起来,踩上滑板,和做其他类似的有趣的事情。现在,你可以把这些可爱的小企鹅大军入侵别人的桌面了。 + +### 安装XPenguins ### + +打开终端(选择程序->附件->终端),接着输入下面的命令来安装 XPenguins。首先,输入 `apt-get update` 通过请求配置的仓库刷新包的信息,接着安装需要的程序: + + $ sudo apt-get update + $ sudo apt-get install xpenguins + +### 我本地如何启动 XPenguins? ### + +输入下面的命令: + + $ xpenguins + +示例输出: + +![An army of cute little penguins invading the screen](http://files.cyberciti.biz/uploads/tips/2011/07/Workspace-1_002_12_07_2011.png) + +*一支可爱企鹅军队正在入侵屏幕。* + +![Linux: Cute little penguins walking along the tops of your windows](http://files.cyberciti.biz/uploads/tips/2011/07/Workspace-1_001_12_07_2011.png) + +*可爱的小企鹅沿着窗口的顶部行走。* + +![Xpenguins Screenshot](http://files.cyberciti.biz/uploads/tips/2011/07/xpenguins-screenshot.jpg) + +*Xpenguins 截图* + +移动窗口时小心点,小家伙们很容易被压坏。如果你发送中断程序(Ctrl-C),它们会爆炸。 + +### 主题 ### + +要列出主题,输入: + + $ xpenguins -l + +示例输出: + + Big Penguins + Bill + Classic Penguins + Penguins + Turtles + +你可以用下面的命令使用其他的主题: + + $ xpenguins --theme "Big Penguins" --theme "Turtles" + +你可以用下面的命令安装额外的主题: + + $ cd /tmp + $ wget http://xpenguins.seul.org/xpenguins_themes-1.0.tar.gz + $ tar -zxvf xpenguins_themes-1.0.tar.gz + $ mkdir ~/.xpenguins + $ mv -v themes ~/.xpenguins/ + $ xpenguins -l + +示例输出: + + Lemmings + Sonic the Hedgehog + The Simpsons + Winnie the Pooh + Worms + Big Penguins + Bill + Classic Penguins + Penguins + Turtles + +已一个随机主题开始,输入: + + $ xpenguins --random-theme + +要加载所有的主题并且同时运行,输入: + + $ xpenguins --all + +更多链接何信息: + +- [XPenguins][1] 主页。 +- man penguins +- 更多 Linux/Unix 桌面乐趣在[蒸汽火车][2]和[终端ASCII水族馆][3]。 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/tips/linux-cute-little-xpenguins-walk-along-tops-ofyour-windows.html + +作者:Vivek Gite +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://xpenguins.seul.org/ +[2]:http://www.cyberciti.biz/tips/displays-animations-when-accidentally-you-type-sl-instead-of-ls.html +[3]:http://www.cyberciti.biz/tips/linux-unix-apple-osx-terminal-ascii-aquarium.html + + diff --git a/published/201603/20160218 Best Linux Desktop Environments for 2016.md b/published/201603/20160218 Best Linux Desktop Environments for 2016.md new file mode 100644 index 0000000000..6ac25a27c5 --- /dev/null +++ b/published/201603/20160218 Best Linux Desktop Environments for 2016.md @@ -0,0 +1,90 @@ +2016:如何选择 Linux 桌面环境 +============================================= + +![](http://www.linux.com/images/stories/66866/DE-2.png) + +Linux 创建了一个友好的环境,为我们提供了选择的可能。比方说,现代大多数的 Linux 发行版都提供不同桌面环境给我们来选择。在本文中,我将挑选一些你可能会在 Linux 中见到的最棒的桌面环境来介绍。 + +## Plasma + +我认为,[KDE 的 Plasma 桌面](https://www.kde.org/workspaces/plasmadesktop/) 是最先进的桌面环境 (LCTT 译注:译者认为,没有什么是最好的,只有最合适的,毕竟每个人的喜好都不可能完全相同)。它是我见过功能最完善和定制性最高的桌面环境;在用户完全自主控制方面,即使是 Mac OS X 和 Windows 也无法与之比拟。 + +我爱 Plasma,因为它自带了一个非常好的文件管理器 —— Dolphin。而相对应 Gnome 环境,我更喜欢 Plasma 的原因就在于这个文件管理器。使用 Gnome 最大的痛苦就是,它的文件管理器——Files——使我无法完成一些基本任务,比如说,批量文件重命名操作。而这个操作对我来说相当重要,因为我喜欢拍摄,但 Gnome 却让我无法批量重命名这些图像文件。而使用 Dolphin 的话,这个操作就像在公园散步一样简单。 + +而且,你可以通过插件来增强 Plasma 的功能。Plasma 有大量的基础软件,如 Krita、Kdenlive、Calligra 办公套件、digiKam、Kwrite 以及由 KDE 社区开发维护的大量应用。 + +Plasma 桌面环境唯一的缺陷就是它默认的邮件客户端——Kmail。它的设置比较困难,我希望 Kmail 设置可以配置地址簿和日历。 + +包括 openSUSE 在内的多数主流发行版多使用 Plasma 作为默认桌面。 + +## GNOME + +[GNOME](https://www.gnome.org/) (GNU Network Object Model Environment,GNU 网络对象模型环境) 由 [Miguel de Icaza](https://en.wikipedia.org/wiki/Miguel_de_Icaza) 和 Federico Mena 在 1997 年的时候创立,这是因为 KDE 使用了 Qt 工具包,而这个工具包是使用专属许可证 (proprietary license) 发布的。不像提供了大量定制的 KDE,GNOME 专注于让事情变得简单。因为其自身的简单性和易用性,GNOME 变得相当流行。而我认为 GNOME 之所以流行的原因在于,Ubuntu——使用 GNOME 作为默认桌面的主流 Linux 发行版之一——对其有着巨大的推动作用。 + +随着时代变化,GNOME 也需要作出相应的改变了。因此,开发者在 GNOME 3 中推出了 GNOME 3 Shell,从而引出了它的全新设计规范。但这同时与 Canonical 的 Ubuntu 计划存在者一些冲突,所以 Canonical 为 GNOME 开发了叫做 Unity 的自己的 Shell。最初,GNOME 3 Shell 因很多争议 (issues) 而困扰不已——最明显的是,升级之后会导致很多扩展无法正常工作。由于设计上的重大改版以及各种问题的出现,GNOME 便产生了很多分支(fork),比如 Cinnamon 和 Mate 桌面。 + +另外,使得 GNOME 让人感兴趣的是,它针对触摸设备做了优化,所以,如果你有一台触屏笔记本电脑的话,GNOME 则是最合适你这台电脑的桌面环境。 + +在 3.18 版本中,GNOME 已经作出了一些令人印象深刻的改动。其中他们所做的最让人感兴趣的是集成了 Google Drive,用户可以把他们的 Google Drive 挂载为远程存储设备,这样就不必再使用浏览器来查看里边的文件了。我也很喜欢 GNOME 里边自带的那个优秀的邮件客户端,它带有日历和地址簿功能。尽管有这么多些优秀的特性,但它的文件管理器使我不再使用 GNOME ,因为我无法处理批量文件重命名。我会坚持使用 Plasma,一直到 GNOME 的开发者修复了这个小缺陷。 + +![](http://www.linux.com/images/stories/66866/DE-fig1.png) + +## Unity + +从技术上来说,[Unity](https://unity.ubuntu.com/) 并不是一个桌面环境,它只是 Canonical 为 Ubuntu 开发的一个图形化 Shell。Unity 运行于 GNOME 桌面之上,并使用很多 GNOME 的应用和工具。Ubuntu 团队分支了一些 GNOME 组件,以便更好的满足 Unity 用户的需求。 + +Unity 在 Ubuntu 的融合(convergence)计划中扮演着重要角色, 在 Unity 8 中,Canonical 公司正在努力将电脑桌面和移动世界结合到一起。Canonical 同时还为 Unity 开发了许多的有趣技术,比如 HUD (Head-up Display,平视显示)。他们还在 lenses 和 scopes 中通过一种独特的技术来让用户方便地找到特定内容。 + +即将发行的 Ubuntu 16.04,将会搭载 Unity 8,那时候用户就可以完全体验开发者为该开源软件添加的所有特性了。其中最大的争议之一,Unity 可选取消集成了 Amazon Ads 和其他服务。而在即将发行的版本,Canonical 从 Dash 移除了 Amazon ads,但却默认保证了系统的隐私性。 + +## Cinnamon + +最初,[Cinnamon](https://en.wikipedia.org/wiki/Cinnamon_(software\)) 由 [Linux Mint](http://www.linuxmint.com/) 开发 —— 这是 DistroWatch.com 上统计出来最流行的发行版。就像 Unity,Cinnamon 是 GNOME Shell 的一个分支。但最后进化为一个独立的桌面环境,这是因为 Linux Mint 的开发者分支了 GNOME 桌面中很多的组件到 Cinnamon,包括 Files ——以满足自身用户的需求。 + +由于 Linux Mint 基于普通版本的 Ubuntu,开发者仍需要去完成 Ubuntu 尚未完成的目标。结果,尽管前途光明,但 Cinnamon 却充满了 Bugs 和问题。随着 17.x 本版的发布,Linux Mint 开始转移到 Ubuntu 的 LTS 版本上,从而他们可以专注于开发 Cinnamon 的核心组件,而不必再去担心代码库。转移到 LTS 的好处是,Cinnamon 变得非常稳定并且基本没有 Bugs 出现。现在,开发者已经开始向桌面环境中添加更多的新特性了。 + +对于那些更喜欢在 GNOME 基础上有一个很好的类 Windows 用户界面的用户来说,Cinnamon 是他们最好的桌面环境。 + +## MATE 桌面 + +[MATE 桌面](http://mate-desktop.com/) 同样是 GNOME 的一个分支,然而,它并不像 Cinnamon 那样由 GNOME 3 分支而来,而是现在已经没有人维护的 GNOME 2 代码库的一个分支。MATE 桌面中的一些开发者并不喜欢 GNOME 3 并且想要“继续坚持” GNOME 2,所以他们使用这个代码库来创建来 MATE。为避免和 GNOME 3 的冲突,他们重命名了全部的包:Nautilus 改为 Caja、Gedit 改为 Pluma 以及 Evince 改为 Atril 等。 + +尽管 MATE 延续了 GNOME 2,但这并不意味着他们使用过时的技术;相反,他们使用了更新的技术来提供一个现代的 GNOME 2 体验。 + +拥有相当高的资源使用率才是 MATE 最令人印象深刻之处。你可将它运行在老旧硬件或者更新一些的但不太强大的硬件上,如树梅派 (Raspberry Pi) 或者 Chromebook Flip。使得它更有让人感兴趣的是,把它运行在一些强大的硬件上,可以节省大多数的资源给其他应用,而桌面环境本身只占用很少的资源。 + +## LXQt + +[LXQt](http://lxqt.org/) 继承了 LXDE ——最轻量级的桌面环境之一。它融合了 LXDE 和 Razor-Qt 两个开源项目。LXQt 的首个可用本版(v 0.9)发布于 2015 年。最初,开发者使用了 Qt4 ,之后为了加快开发速度,而放弃了兼容性,他们移动到 Qt5 和 KDE 框架上。我也在自己的 Arch 系统上尝试使用了 LXQt,它的确是一个非常好的轻量级桌面环境。但在完全接过 LXDE 的传承之前,LXQt 仍有一段很长的路需要走。 + +## Xfce + +[Xfce](http://www.xfce.org/) 早于 KDE 桌面环境,它是最古老和最轻量级的桌面环境。Xfce 的最新版本是 4.15,发布于 2015 年,使用了诸如 GTK+ 3 的大量的现代科技。很多发行版都使用了 Xfce 环境以满足特定需求,比如 Ubuntu Studio ——与 MATE 类似——尽量节省系统资源给其他的应用。并且,许多的著名的 Linux 发行版——包括 Manjaro Linux、PC/OS、Salix 和 Mythbuntu ——都把它作为默认桌面环境。 + +## Budgie + +[Budgie](https://solus-project.com/budgie/) 是一个新型的桌面环境,由 Solus Linux 团队开发和维护。Solus 是一个从零开始构建的新型发行版,而 Budgie 则是它的一个核心组件。Budgie 使用了大量的 GNOME 组件,从而提供一个华丽的用户界面。由于没有该桌面环境的更多信息,我特地联系了 Solus 的核心开发者—— Ikey Doherty。他解释说:“我们搭载了自己的桌面环境—— Budgie 桌面。与其他桌面环境不同的是,Budgie 并不是其他桌面的一个分支,它的目标是彻底融入到 GNOME 协议栈之中。它完全从零开始编写,并特意设计来迎合 Solus 提供的体验。我们会尽可能的和 GNOME 的上游团队协同工作,修复 Bugs,并提倡和支持他们的工作”。 + +## Pantheon + +我想,[Pantheon](https://elementary.io/) 不需要特别介绍了吧,那个优美的 elementary OS 就使用它作为桌面。类似于 Budgie,很多人都认为 Pantheon 也不是 GNOME 的一个分支。elementary OS 团队大多拥有良好的设计从业背景,所以他们会近距离关注每一个细节,这使得 Pantheon 成为一个非常优美的桌面环境。偶尔,它可能缺少像 Plasma 等桌面中的某些特性,但开发者实际上是尽其所能的去坚持设计原则。 + +![](http://www.linux.com/images/stories/66866/DE-3.png) + +## 结论 + +当我写完本文后,我突然意识到来开源和 Linux 的重大好处。总有一些东西适合你。就像 Jon “maddog” Hall 在最近的 SCaLE 14 上说的那样:“是的,现在有 300 多个 Linux 发行版。我可以一个一个去尝试,然后坚持使用我最喜欢的那一个”。 + +所以,尽情享受 Linux 的多样性吧,最后使用最合你意的那一个。 + +------------------------------------------------------------------------------ + +via: http://www.linux.com/news/software/applications/881107-best-linux-desktop-environments-for-2016 + +作者:[Swapnil Bhartiya][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linux.com/community/forums/person/61003 diff --git a/published/201603/20160218 Canonical's ZFS Plans Are Lining Up For Ubuntu 16.04.md b/published/201603/20160218 Canonical's ZFS Plans Are Lining Up For Ubuntu 16.04.md new file mode 100644 index 0000000000..5c5f44c803 --- /dev/null +++ b/published/201603/20160218 Canonical's ZFS Plans Are Lining Up For Ubuntu 16.04.md @@ -0,0 +1,24 @@ +Ubuntu 16.04 为更好支持容器化而采用 ZFS +======================================================= + +![](https://www.phoronix.com/assets/categories/ubuntu.jpg) + +Ubuntu 开发者正在为 [Ubuntu 16.04 加上 ZFS 支持](http://www.phoronix.com/scan.php?page=news_item&px=ZFS-For-Ubuntu-16.04) ,并且对该文件系统的所有支持都已经准备就绪。 + +Ubuntu 16.04 的默认安装将会继续是 ext4,但是 ZFS 支持将会自动构建进 Ubuntu 发布中,模块将在需要时自动加载,zfsutils-linux 将放到 Ubuntu 主分支内,并且通过 Canonical 对商业客户提供支持。 + +对于那些对 Ubuntu 中的 ZFS 感兴趣的人,Canonical 的 Dustin Kirkland 已经写了[一篇新的博客](http://blog.dustinkirkland.com/2016/02/zfs-is-fs-for-containers-in-ubuntu-1604.html),介绍了一些细节及为何“ZFS 是 Ubuntu 16.04 中面向容器使用的文件系统!” + +------------------------------------------------------------------------------ + +via: https://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-ZFS-Continues-16.04&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Phoronix+%28Phoronix%29 + +作者:[Michael Larabel][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.michaellarabel.com/ + + diff --git a/published/201603/20160218 Linux Kernel 4.1.18 LTS Is the Biggest in the Series with Hundreds of Changes.md b/published/201603/20160218 Linux Kernel 4.1.18 LTS Is the Biggest in the Series with Hundreds of Changes.md new file mode 100644 index 0000000000..595f245e3b --- /dev/null +++ b/published/201603/20160218 Linux Kernel 4.1.18 LTS Is the Biggest in the Series with Hundreds of Changes.md @@ -0,0 +1,29 @@ +Linux 4.1 系列的最大版本 4.1.18 LTS发布,带来大量修改 +================================================================================= +(LCTT 译注:这是一则过期的消息,但是为了披露更新内容,还是发布出来给大家参考) + +**著名的内核维护者Greg Kroah-Hartman貌似正在度假中,因为Sasha Levin2016年2月16日的早些时候来[宣布](http://lkml.iu.edu/hypermail/linux/kernel/1602.2/00520.html),第十八个Linux内核维护版本Linux Kernel 4.1 LTS通用版本正式发布。** + +作为长期支持的内核分支,Linux 4.1还会在几年内得到更新和补丁,而今天的维护构建版本也证明一点,就是内核开发者们正致力于保持该系列在所有使用该版本的GNU/Linux操作系统上稳定和可靠。Linux Kernel 4.1.18 LTS是一个大的发布版本,它带来了总计达228个文件修改,这些修改包含了多达5304个插入修改和1128个删除修改。 + +Linux Kernel 4.1.18 LTS更新了什么呢?好吧,首先是对ARM,ARM64(AArch64),MIPS,PA-RISC,m32r,PowerPC(PPC),s390以及x86等硬件架构的改进。此外,还有对Btrfs,CIFS,NFS,XFS,OCFS2,OverlayFS以及UDF文件系统的加强。对网络堆栈的修复,尤其是对mac80211的修复。同时,还有多核心、加密和mm等方面的改进和对声音的更新。 + +“我宣布4.1.18内核正式发布,所有4.1内核系列的用户都应当升级。”Sasha Levin说,“更新的4.1.y git树可以在这里找到:git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.1.y,并且可以在 kernel.org 的 git 网站上浏览:http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary 进行浏览。” + +### 大量驱动被更新 + +除了架构、文件系统、声音、网络、加密、mm和核心内核方面的改进之外,Linux Kernel 4.1.18 LTS更新了各个驱动,以提供更好的硬件支持,特别是像蓝牙、DMA、EDAC、GPU(主要是Radeon和Intel i915)、无限带宽技术、IOMMU、IRQ芯片、MD、MMC、DVB、网络(主要是无线)、PCI、SCSI、USB、散热、暂存和Virtio等此类东西。 + +和以往一样,我们鼓励所有基于Linux内核的操作系统平台的用户,凡是使用了Linux 4.1 LTS系列内核包的,尽快更新到今天的4.1.18版本。这些用户可以通过默认软件仓库安装更新,也可以手动编译源码包,这些包你现在就可以从[kernel.org](http://kernel.org/)网站或者[Softpedia](http://linux.softpedia.com/get/System/Operating-Systems/Kernels/Linux-Kernel-Stable-1960.shtml)下载。 + +------------------------------------------------------------------------------ + +via: http://news.softpedia.com/news/linux-kernel-4-1-18-lts-is-the-biggest-in-the-series-with-hundreds-of-changes-500500.shtml + +作者:[Marius Nestor][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://news.softpedia.com/editors/browse/marius-nestor diff --git a/published/201603/20160218 Mozilla contributor creates diabetes project for the masses.md b/published/201603/20160218 Mozilla contributor creates diabetes project for the masses.md new file mode 100644 index 0000000000..abaf2fe9d6 --- /dev/null +++ b/published/201603/20160218 Mozilla contributor creates diabetes project for the masses.md @@ -0,0 +1,38 @@ +Mozilla 贡献者为大众创建糖尿病项目 +================================================================ + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/myopensourcestory.png?itok=6TXlAkFi) + + +我的开源生涯从我还是一名高中生开始,我总想着自己能成为一名黑客,没有什么恶意的,只是喜欢钻研代码和硬件那种。我第一次接触开源是2001年,我安装了我的第一个Linux发行版[Lindows](https://en.wikipedia.org/wiki/Linspire)。当然,我也是[Mozilla Firefox](https://www.mozilla.org/en-US/firefox/new/?utm_source=firefox-com&utm_medium=referral)的早期用户。 + +由于我很早使用Linux,我用的第一个版本是 Lindows 1.0.4(如果我没记错的话),我就立即爱上了它。我没在Lindows上呆太久,而是活跃于多个发行版([Debian](https://www.debian.org/), +[Puppy Linux](http://puppylinux.org/main/Overview%20and%20Getting%20Started.htm), [SUSE](https://www.suse.com/), +[Slackware](http://www.slackware.com/), [Ubuntu](http://ubuntu.com/)),多年来我一直每天使用着开源软件,从青少年时候直到我成年。 + +最后,我坚持使用Ubuntu。大概是在Hardy Heron(LCTT 译注:Ubuntu8.04 LTS)发布时候,我开始第一次为Ubuntu做些贡献,在IRC频道和当地社区帮助那些需要帮助的用户。我是通过Ubuntu认识开源的,它在我心里总有着特殊的意义。Ubuntu背后的社区的是非常多样化的、热情的、友好的,每个人都做些共享,是他们共同的目标也是个人目标,这成为他们为开源贡献的动力。 + +在为Ubuntu贡献一段时间后,我开始了为一些上游项目作贡献,比如Debian、[GNOME](https://www.gnome.org/)、 [Ganeti](https://code.google.com/p/ganeti/),还有许多其他的开源项目。在过去的几年里,我为超过40个开源项目贡献过,有些小的,也有很大的。 + +在Ubuntu项目方向上有些变化之后,我最终觉得,这不仅对于我是一个尝试新东西的机遇,而且也是我给一些新东西贡献的时候。所以我在2009年参与了Mozilla项目,在IRC帮忙,最终通过参与[Mozilla WebFWD program](https://webfwd.org/),成为一名团队成员,然后是[Mozilla Reps Program](https://reps.mozilla.org/),[Mozilla DevRel Program](https://wiki.mozilla.org/Devrel),刚过两年时间,我成为了火狐社区的发布经理,负责监督Firefox Nightly和Firefox ESR的发布。相比其他开源项目,在为Mozilla贡献中会获得更多有益的经验。在所有我参与过的开源社区中,Mozilla是最不同的,最大的也是最友好的。 + +这些年来,关于开源我觉得,我越来越遵循自由软件价值观、捍卫隐私和许可协议合规,以及在开放的氛围下工作。我相信这三个主题对于开源来说是非常重要的,虽然许多人并没在意到提倡它们是很重要的。 + +今天在这,我已不再是别人的开源项目的全职贡献者。最近我被诊断出患有糖尿病,我看到了开源软件中健康软件不是很丰富这一缺口。确实,它不像其它开源软件应用如Linux发行版或浏览器那样活跃。 + +我最近创立了自己的开源项目[Glucosio](http://www.glucosio.org/),带给人们糖尿病管理和研究的开源软件。经过几年来对开源项目的贡献,和见识过的多种组织结构,使得我作为项目领导能够得心应手。我对于Glucosio的未来很兴奋,但最重要的是未来的开源将在医疗健康领域发展的如何。 + +医疗保健软件的创新具有很大潜力,我想我们很快就会看到用于改善医疗卫生保健的开源新方案。 + + +------------------------------------------------------------------------------ + +via: https://opensource.com/life/15/11/my-open-source-story-ben-kerensa + +作者:[Benjamin Kerensa][a] +译者:[ynmlml](https://github.com/ynmll) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/bkerensa diff --git a/published/201603/20160218 ST Releases Free Linux IDE for 32-Bit MCUs.md b/published/201603/20160218 ST Releases Free Linux IDE for 32-Bit MCUs.md new file mode 100644 index 0000000000..846fa1b035 --- /dev/null +++ b/published/201603/20160218 ST Releases Free Linux IDE for 32-Bit MCUs.md @@ -0,0 +1,54 @@ +意法半导体为 32 位微控制器发布了一款自由的 Linux 集成开发环境 +================================================= + +![](http://www.linux.com/images/stories/66866/STM32_Nucleo_expansion_board.jpg) + +32 位微控制器世界向 Linux 敞开大门。前一段时间,领先的 ARM Cortex-M 供应商意法半导体(ST)[发布了](http://www.st.com/web/en/press/p3781) 一款自由的 Linux 桌面版开发程序,该软件面向其旗下的 STM32 微控制单元(MCU)。包含了 ST 的 STM32CubeMX 配置器和初始化工具,以及其 STM32 [系统工作台(SW4STM32)](http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1533/PF261797) ,这个基于 Eclipse 的 IDE 由工具 Ac6 创建。支撑 SW4STM32 的工具链,论坛,博客以及技术会由 [openSTM32.org](http://www.openstm32.org/tiki-index.php?page=HomePage) 开发社区提供。 + +“Linux 社区以吸引富有创意的自由思想者而闻名,他们善于交流心得、高效地克服挑战。” Laurent Desseignes,意法半导体微控制器产品部,微控制器生态系统市场经理这么说道:“我们正着手做的是让他们能极端简单的借力 STM32 系列的特性和性能施展自己的才能,运用到富有想象力的新产品的创造中去。 + +Linux 是物联网(IoT)网关和枢纽,及高端 IoT 终端的领先平台。但是,大部分 IoT 革命,以及可穿戴设备市场基于小型的低功耗微控制器,对 Cortex-M 芯片的运用越来越多。虽然其中的一小部分可以运行精简的 uCLinux (见下文),却没能支持更全面的 Linux 发行版。取而代之的是实时操作系统(RTOS)们或者有时干脆不用 OS 来控制。固件的开发工作一般会在基于 Windows 的集成开发环境(IDE)上完成。 + +通过 ST 的自由工具,Linux 开发者们可以更容易的开疆拓土。ST 工具中的一些技术在第二季度应该会登录 Mac OS/X 平台,与 [STM32 Nucleo](http://www.st.com/web/en/catalog/tools/FM146/CL2167/SC2003?icmp=sc2003_pron_pr-stm32f446_dec2014&sc=stm32nucleo-pr5) 、开发套件、以及评估板同时面世。Nucleo 支持 32 针、64 针、和 144 针的版本,并且提供类似 Arduino 连接器这样的插件。 + +STM32CubeMX 配置器和 IDE SW4STM32 使 Linux 开发者能够配置微控制器并开发调试代码。SW4STM32 支持在 Linux 下通过社区更改版的 [OpenOCD](http://openocd.org/) 使用调试工具 ST-LINK/V2。 + +据 ST 称,软件兼容 STM32Cube 软件包及标准外设库中的微控制器固件。目标是囊括 ST 的全系列 MCU,从入门级的 Cortex-M0 内核到高性能的 M7 芯片,包括 M0+,M3 和 DSP 扩展的 M4 内核。 + +ST 并非首个为 Linux 准备 Cortex-M 芯片 IDE 的 32 位 MCU 供应商,但似乎是第一大自由的 Linux 平台。例如 NXP,MCU 的市场份额随着近期收购了 Freescale (Kinetis 系列 MCU,等)而增加,提供了一款 IDE [LPCXpresso IDE](http://www.nxp.com/pages/lpcxpresso-ide:LPCXPRESSO),支持 Linux 、Windows 和 Mac。然而,LPCXpresso 每份售价 $450。 + +在其 [SmartFusion FPGA 系统级芯片(SoC)](http://www.microsemi.com/products/fpga-soc/soc-processors/arm-cortex-m3)上集成了 Cortex-M3 芯片的 Microsemi,拥有一款 IDE [Libero IDE](http://www.linux.com/news/embedded-mobile/mobile-linux/884961-st-releases-free-linux-ide-for-32-bit-mcus#device-support),适用于 RHEL 和 Windows。然而,Libero 需要许可证才行,并且 RHEL 版缺乏如 FlashPro 和 SoftConsole 的插件。 + +### 为什么要学习 MCU? + +即便 Linux 开发者并没有计划在 Cortex-M 上使用 uClinux,但是 MCU 的知识总会派上用场。特别是牵扯到复杂的 IoT 工程,需要扩展 MCU 终端至云端。 + +对于原型和业余爱好者的项目,Arduino 板为其访问 MCU 提供了非常便利的接口。然而原型之外,开发者常常就会用更快的 32 位 Cortex-M 芯片以及所带来的附加功能来替代 Arduino 板和板上的那块 8 位 MCU ATmega32u4。这些附加功能包括改进的存储器寻址,用于芯片和各种总线的独立时钟设置,以及芯片 [Cortex-M7](http://www.electronicsnews.com.au/products/stm32-mcus-with-arm-cortex-m7-processors-and-graph) 自带的入门级显示芯片。 + +还有些可能需求 MCU 开发技术的地方包括可穿戴设备,低功耗、低成本和小尺寸给了 MCU 一席之地,还有机器人和无人机这些使用实时处理和电机控制的地方更为受用。在机器人上,你更是有可能看看 Cortex-A 与 Cortex-M 集成在同一个产品中的样子。 + +对于 SoC 芯片还有这样的一种温和的局势,即将 MCU 加入到 Linux 驱动的 Cortex-A 核心中,就如同 [NXP i.MX6 SoloX](http://linuxgizmos.com/freescales-popular-i-mx6-soc-sprouts-a-cortex-m4-mcu/)。虽然大多数的嵌入式项目并不使用这种混合型 SoC 或者说将应用处理器和 MCU 结合在同一产品中,但开发者会渐渐地发现自己工作的生产线、设计所基于的芯片正渐渐的从低端的 MCU 模块发展到 Linux 或安卓驱动的 Cortex-A。 + +### uClinux 是 Linux 在 MCU 领域的筹码 + +随着物联网的兴起,我们见到越来越多的 SBC 和模块计算机,它们在 32 位的 MCU 上运行着 uClinux。不同于其他的 Linux 发行版,uClinux 并不需要内存管理单元(MMU)。然而,uClinux 对市面上可见 MCU 有更高的内存需求。需求更高端的 Cortex-M4 和 Cortex-M4 微控制器内置内存控制器来支持外部 DRAM 芯片。 + +[Amptek](http://www.semiconductorstore.com/Amptek/) SBC 在 NXP LPC Cortex-M3 和 -M4 芯片上运行 uClinux,以提供常用的功能类似 WiFi、蓝牙、USB 等众多接口。Arrow 的 [SF2+](http://linuxgizmos.com/iot-dev-kit-runs-uclinux-on-a-microsemi-cortex-m3-fpga-soc/) 物联网开发套件将 uClinux 运行于 SmartFusion2 模块计算机的 Emcraft 系统上,该模块计算机是 Microsemi 的 166MHz Cortex-M3/FPGA SmartFusion2 混合 SoC。 + +[Emcraft](http://www.emcraft.com/) 销售基于 uClinux 的模块计算机,有 ST 和 NXP 的,也有 Microsemi 的 MCU,是 32 位 MCU 上积极推进 uClinux 的重要角色。日益频繁的 uClinux 开始了与 ARM 本身 [Mbed OS](http://linuxgizmos.com/arm-announces-mbed-os-for-iot-devices/)的对抗,至少在高端的 MCU 工程中需要无线通信和更为复杂的操作规则。Mbed 和 modern 的支持者,开源的 RTOS 们,类似 FreeRTOS 认为 uClinux 需要对 RAM 的需求太高以至于难以压低 IoT 终端的价格,然而 Emcraft 与其他 uCLinux 拥趸表示价格并没有如此夸张,而且扩展 Linux 的无线和接口也是相当值得的,即使只是在像 uClinux 这样的精简版上。 + +当被问及对于这次 ST 发布的看法,Emcraft 的主任工程师 Vladimir Khusainov 表示:“ST决定将这款开发工具 移植至 Linux 对于 Emcraft 是个好消息,它使得 Linux 用户能轻易的在嵌入式 STM MCU 上展开工作。我们希望那些有机会熟悉 STM 设备,使用 ST 配置器和嵌入式库的用户可能对在目标机上使用嵌入式 Linux (以 uClinux 的形式)感兴趣。” + +最近关于 Cortex-M4 上运行 uClinux 的概述,可以查看去年 Jim Huang 与 Jeff Liaws 在嵌入式 Linux 大会上使用的[幻灯片](http://events.linuxfoundation.org/sites/events/files/slides/optimize-uclinux.pdf)。更多关于 Cortex-M 处理器可以查看这里过的 [AnandTech 总结](http://www.anandtech.com/show/8400/arms-cortex-m-even-smaller-and-lower-power-cpu-cores)。 + +------------------------------------------------------------------------------ + +via: http://www.linux.com/news/embedded-mobile/mobile-linux/884961-st-releases-free-linux-ide-for-32-bit-mcus + +作者:[Arun Pyasi][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linux.com/community/forums/person/42808 diff --git a/published/201603/20160220 Former Kubuntu Head Unveils New KDE Project.md b/published/201603/20160220 Former Kubuntu Head Unveils New KDE Project.md new file mode 100644 index 0000000000..2d57885d46 --- /dev/null +++ b/published/201603/20160220 Former Kubuntu Head Unveils New KDE Project.md @@ -0,0 +1,33 @@ +前 Kubuntu 领袖发起了新的 KDE 项目 +============================================== + +如果你经常阅读 Linux 和[开源新闻](http://itsfoss.com/category/news/)的话应该会对 Jonathan Riddell 这人很熟悉。它是 [Kubuntu](http://www.kubuntu.org/) 发行版的创建者及长期的开发领导。他由于敢于质询 Canonical 基金会对 Kubuntu 的资金筹集情况[而被 Ubuntu 的老板 Mark Shuttleworth 所驱逐](http://www.cio.com/article/2926838/linux/mark-shuttleworth-ubuntu-community-council-ask-kubuntu-developer-to-step-down-as-leader.html) (据我所知,Canonical 从来没有真正回答过他的这个关于财务的问题。) + +![](http://itsfoss.com/wp-content/uploads/2016/02/kde-neon-e1454448724263.png) + +*KDE neon 标志* + +在周日,Riddell [宣布](https://dot.kde.org/2016/01/30/fosdem-announcing-kde-neon)了一个新项目:[KDE neon](http://neon.kde.org.uk/)。根据 Riddell 的声明,“Neon 将会提供一个在最新的 KDE 软件一发布就可以获得的途径。” + +在看了声明和网站后,**neon 似乎主要是一个“快速的软件更新仓库”,它让 KDE 粉丝可以用上最新的软件**。除了等上数月来等到开发者在他们的仓库中发布新的 KDE 软件外,你将可以在软件一出来就得到它。 + +KDE 的确在 [noen FAQ](http://neon.kde.org.uk/faq) 中声明过这不是一个 KDE 创建的发行版。事实上,他们说“KDE 相信与许多发行版协作是很重要的,因为它们每个都能给用户提供独特的价值和专长。这是 KDE 成千上万项目中的一个。” + +![](http://itsfoss.com/wp-content/uploads/2016/02/kde-neon-e1454448830870.jpg) + +然而,网站和公告显示 neon 会运行在 Ubuntu 15.10 中(直到有下个长期支持版本)并很快会有让我惊奇的情景。KDE 可能要让 Canonical 把此项目视作 Kubuntu 的竞争对手。如果他们发现 KDE neon 有前景,他们就能把它变成一个完整的发行版。网站和通告声称这是一个 KDE 孵化项目,因此未来可能会包含任何东西。 + +neon 听上去对你有用么,或者你是否对你当前的发行版的 KDE 发布速度满意?你认为是否还有其他 KDE 发行版的空间(如果 KDE 决定朝这个方向进发)?让我在评论栏知道你们的想法。 + +------------------------------------------------------------------------------ + +via: http://itsfoss.com/kde-neon-unveiled/ + +作者:[JOHN PAUL][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/john/ + diff --git a/published/201603/20160220 Manjaro Linux Is Coming To ARM With Manjaro-ARM.md b/published/201603/20160220 Manjaro Linux Is Coming To ARM With Manjaro-ARM.md new file mode 100644 index 0000000000..5b8ea027c9 --- /dev/null +++ b/published/201603/20160220 Manjaro Linux Is Coming To ARM With Manjaro-ARM.md @@ -0,0 +1,36 @@ +Manjaro Linux 即将推出支持 ARM 处理器的 Manjaro-ARM +=================================================== + +![](http://itsfoss.com/wp-content/uploads/2016/02/manjaro-arm.jpg) + +最近,Manjaro 的开发者为 ARM 处理器发布了一个 [alpha 版本](https://manjaro.github.io/Manjaro-ARM-launched/)。这是这个基于 Archlinux 的发行版的一大进步,在此之前,它只能在 32 位或者 64 位的个人电脑上运行。 + +根据公告, “[Manjaro Arm](http://manjaro-arm.org/) 项目致力于将简洁可定制的 Manjaro 移植到使用 [ARM 处理器](https://www.arm.com/)的设备上去。这些设备的数量越来越多并且应用范围广泛。这些设备中最出名的是树莓派和 BeagleBoard“。目前 Alpha 版本仅支持树莓派2,但是毫无疑问,支持的设备数量会随时间增长。 + +现在这个项目的开发者有 dodgejcr, Torei, Strit, 和 Ringo32。他们正在寻求更多的人来帮助这个项目发展。除了开发者,[他们还在寻找维护者,论坛版主,管理员,以及设计师](http://manjaro-arm.org/forums/website/looking-for-contributors/?PHPSESSID=876d5c11400e9c25eb727e9965300a9a)。 + +Manjaro-ARM 将会有四个版本: + +- 媒体版本将可以运行 Kodi 并且允许你用很少的配置就能创建一个媒体中心。 +- 服务器版将会预先配置好 SSH,FTP,LAMP ,你能把你的 ARM 设备当作服务器使用。 +- 基本版是一个桌面版本,自带一个 XFCE 桌面。 +- 如果你想自己从头折腾系统的话你可以选择迷你版,它没有任何预先配置的软件包,仅仅包含一个 root 用户。 + +### 我的想法 + +作为一个 Manjaro 的粉丝(我在 4 个电脑上都安了 Manjaro),听说他们分支出一个 ARM 版我很高兴。 ARM 处理器被用到了越来越多的设备当中。如同评论员 Robert Cringely 所说, [设备制造商开始注意到昂贵的因特尔、AMD 处理器之外的便宜的多的 ARM 处理器](http://www.cringely.com/2016/01/21/prediction-8-intel-starts-to-become-irrelevent/)。甚至微软(别打我)都开始考虑将自己的一些软件移植到 ARM 处理器上去。随着 ARM 处理器设备数量的增多,Manjaro 将会带给用户良好的体验。 + +对此,你怎样看?你希望更多的发行版支持 ARM 吗?或者你认为 ARM 将是昙花一现?在评论区告诉我们。 + +------------------------------------------------------------------------------ + +via: http://itsfoss.com/manjaro-linux-arm/ + +作者:[JOHN PAUL][a] +译者:[name1e5s](https://github.com/name1e5s) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/john/ + diff --git a/published/201603/20160220 [Free Download] Vi Cheat Sheet For Beginners.md b/published/201603/20160220 [Free Download] Vi Cheat Sheet For Beginners.md new file mode 100644 index 0000000000..6993d7ade1 --- /dev/null +++ b/published/201603/20160220 [Free Download] Vi Cheat Sheet For Beginners.md @@ -0,0 +1,78 @@ +初学者 Vi 备忘单 +================================================ + +![](http://itsfoss.com/wp-content/uploads/2016/01/VI.jpg) + +一直以来,我都在给你们分享我使用 Linux 的经验。今天我想分享我的 **Vi 备忘单**。这份备忘单节省了我很多时间,因为我再也不用使用 Google 去搜索这些命令了。 + +## 基本 Vi 命令 + +这并不是一个教你使用 [Vi 编辑器](https://en.wikipedia.org/wiki/Vi)的各个方面的详尽教程。事实上,这根本就不是一个教程。这仅仅是一些基本 Vi 命令以及这些命令简单介绍的集合。 + +命令|解释 +:--|:-- +`:x`|保存文件并退出 +`:q!`|退出但不保存文件 +`i`|在光标左侧插入 +`a`|在光标右侧插入 +`ESC`按键|退出插入模式 +光标键|移动光标 +`/text`|搜索字符串text(大小写敏感) +`n`|跳到下一个搜索结果 +`x`|删除当前光标处的字符 +`dd`|删除当前光标所在的行 +`u`|撤销上次改变 +`:0`(数字0)|将光标移动到文件开头 +`:n`|将光标移动到第n行 +`G`|将光标移动到文件结尾 +`^`|将光标移动到该行开头 +`$`|将光标移动到该行结尾 +`:set list`|查看文件中特殊字符 +`yy`|复制光标所在行 +`5yy`|复制从光标所在行开始的5行 +`p`|在光标所在行下面粘贴 + +你可以通过下面的链接下载 PDF 格式的 Vi 备忘录: + +[下载 Vi 备忘录](https://drive.google.com/file/d/0By49_3Av9sT1X3dlWkNQa3g2b2c/view?usp=sharing) + +你可以把它打印出来放到你的办公桌上,或者把它保存到你的电脑上来使用。 + +## 我为什么要建立这个 Vi 备忘录? + +几年前,当我刚刚接触 Linux 终端时,使用命令行编辑器这个主意使我一惊。我之前在我自己的电脑上使用过桌面版本的 Linux,所以我很乐意使用像 Gedit 这样的有图形界面的编辑器。但是在工作环境中,我不得不使用命令行,并且无法使用图形界面版的编辑器。 + +我就这么被强迫地使用 Vi 来对远程 Linux 终端上的文件做一些基本的编辑。从这时候我开始了解并钦佩 Vi 的强大之处。 + +因为在那时候我还是一个 Vi 新手,所以我经常对 Vi 一些操作很困惑。仍然记得第一次使用 Vi 的时候,由于我不知道如何退出 Vi,所以我都无法关闭某个文件。我也只能通过 Google 搜索来找到解决办法。我不得不接受这个尴尬的事实。 + +从那以后,我就决定制作一个列表来列出我经常会用到的基本 Vi 操作。这个列表,或者你可能称它为备忘录。在我早期使用 Vi 的时候,它对我非常有用。慢慢地,我对 Vi 更加熟悉,我已经可以熟记那些基本编辑命令。到现在,我甚至不需要再去查看我的 Vi 备忘录了。 + +## 你为什么需要 Vi 备忘录? + +我能理解一个刚刚接触 Vi 的人的感受。你最喜欢的 `Ctrl`+`S` 快捷键不能像在其他编辑器那样方便地保存文件。`Ctrl`+`C`和`Ctrl`+`V`理应是通用的用来复制和粘贴的快捷键,但是在 Vi 中却不是这样。 + +很多人都在使用类似的备忘录帮助他们熟悉各种编程语言或工具,以便让他们可以快速找到常用的下一步或命令。相信我,使用备忘录会给程序员日常工作带来很大便利。 + +如果你刚刚开始接触 Vi 或者你经常使用但是总是记不住 Vi 操作,那么这份 Vi 备忘录对于你来说是非常有用的。你可以把它保存下来留作以后查询使用。 + +## 你怎么看待这份备忘录? + +至今为止,我一直在克制我自己不要过于依赖终端。我想知道你是怎么发现这篇文章的?你是否想让我分享更多类似的备忘录出来以供你们下载?我很期待你的意见和建议。 + +------------------------------------------------------------------------------ + +via: http://itsfoss.com/download-vi-cheat-sheet/ + +作者:[ABHISHEK][a] +译者:[JonathanKang](https://github.com/JonathanKang) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ + + + + + diff --git a/published/201603/20160226 Development Release- Xubuntu 16.04 Beta 1.md b/published/201603/20160226 Development Release- Xubuntu 16.04 Beta 1.md new file mode 100644 index 0000000000..0e7c3d0673 --- /dev/null +++ b/published/201603/20160226 Development Release- Xubuntu 16.04 Beta 1.md @@ -0,0 +1,27 @@ +Xubuntu 16.04 Beta 1 开发者版本发布 +============================================ + +Ubuntu 发布团队宣布为选定的社区版本而准备的最新的 beta 测试镜像已经可以使用了。新的发布版本名称是 16.04 beta 1 ,这个版本只推荐给测试人员测试用,并不适合普通人进行日常使用。 + +![](https://www.linux.com/images/stories/66866/xubuntu-small.png) + +“这个 beta 特性的镜像主要是为 [Lubuntu][1], Ubuntu Cloud, [Ubuntu GNOME][2], [Ubuntu MATE][3], [Ubuntu Kylin][4], [Ubuntu Studio][5] 和 [Xubuntu][6] 这几个发布版准备的。Xenial Xerus (LCTT 译注: ubuntu 16.04 的开发代号)的这个预发布版本并不推荐那些需要稳定版本的人员使用,同时那些不希望在系统运行中偶尔或频繁的出现 bug 的人也不建议使用这个版本。这个版本主要还是推荐给那些喜欢 ubuntu 的开发人员,以及那些想协助我们测试、报告 bug 和修改 bug 的人使用,和我们一起努力让这个发布版本早日准备就绪。” 更多的信息可以从 [发布日志][7] 获取。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/software/applications/888731-development-release-xubuntu-1604-beta-1 + +作者:[DistroWatch][a] +译者:[Ezio](https://github.com/oska874) +校对:[Ezio](https://github.com/oska874) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/community/forums/person/284 +[1]: http://distrowatch.com/lubuntu +[2]: http://distrowatch.com/ubuntugnome +[3]: http://distrowatch.com/ubuntumate +[4]: http://distrowatch.com/ubuntukylin +[5]: http://distrowatch.com/ubuntustudio +[6]: http://distrowatch.com/xubuntu +[7]: https://lists.ubuntu.com/archives/ubuntu-devel-announce/2016-February/001173.html diff --git a/published/201603/20160229-OpenSSH-7.2-Out-Now-with-Support-for-RSA-Signatures-Using-SHA-256512 Algorithms.md b/published/201603/20160229-OpenSSH-7.2-Out-Now-with-Support-for-RSA-Signatures-Using-SHA-256512 Algorithms.md new file mode 100644 index 0000000000..4000153d0e --- /dev/null +++ b/published/201603/20160229-OpenSSH-7.2-Out-Now-with-Support-for-RSA-Signatures-Using-SHA-256512 Algorithms.md @@ -0,0 +1,30 @@ +OpenSSH 7.2发布,支持 SHA-256/512 的 RSA 签名 +======================================================== + +**2016.2.29,OpenBSD 项目很高兴地宣布 OpenSSH 7.2发布了,并且很块可在所有支持的平台下载。** + +根据内部[发布公告][1],OpenSSH 7.2 主要是 bug 修复,修改了自 OpenSSH 7.1p2 以来由用户报告和开发团队发现的问题,但是我们可以看到几个新功能。 + +这其中,我们可以提到使用了 SHA-256 或者 SHA-256 512 哈希算法的 RSA 签名;增加了一个 AddKeysToAgent 客户端选项,以添加用于身份验证的 ssh-agent 的私钥;和实现了一个“restrict”级别的 authorized_keys 选项,用于存储密钥限制。 + +此外,现在 ssh_config 中 CertificateFile 选项可以明确列出证书,ssh-keygen 现在能够改变所有支持的格式的密钥注释、密钥指纹现在可以来自标准输入,多个公钥可以放到一个文件。 + +### ssh-keygen 现在支持多证书 + +除了上面提到的,OpenSSH 7.2 增加了 ssh-keygen 多证书的支持,一个一行,实现了 sshd_config ChrootDirectory 及Foreground 的“none”参数,“-c”标志允许 ssh-keyscan 获取证书而不是文本密钥。 + +最后但并非最不重要的,OpenSSH 7.3 不再默认启用 rijndael-cbc(即 AES),blowfish-cbc、cast128-cbc 等古老的算法,同样的还有基于 MD5 和截断的 HMAC 算法。在 Linux 中支持 getrandom() 系统调用。[下载 OpenSSH 7.2][2] 并查看更新日志中的更多细节。 + +-------------------------------------------------------------------------------- + +via: http://news.softpedia.com/news/openssh-7-2-out-now-with-support-for-rsa-signatures-using-sha-256-512-algorithms-501111.shtml + +作者:[Marius Nestor][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://news.softpedia.com/editors/browse/marius-nestor +[1]: http://www.openssh.com/txt/release-7.2 +[2]: http://linux.softpedia.com/get/Security/OpenSSH-4474.shtml diff --git a/published/201603/20160301 More than 11 Million HTTPS Websites Imperiled by New Decryption Attack.md b/published/201603/20160301 More than 11 Million HTTPS Websites Imperiled by New Decryption Attack.md new file mode 100644 index 0000000000..d1878c81f9 --- /dev/null +++ b/published/201603/20160301 More than 11 Million HTTPS Websites Imperiled by New Decryption Attack.md @@ -0,0 +1,25 @@ +逾千万使用 https 的站点受到新型解密攻击的威胁 +=========================================================================== + +![](https://www.linux.com/images/stories/66866/drown-explainer.jpg) + + +低成本的 DROWN 攻击能在数小时内完成数据解密,该攻击对采用了 TLS 的邮件服务器也同样奏效。 + +一个国际研究小组于周二发出警告,据称逾 1100 万家网站和邮件服务采用的用以保证服务安全的 [传输层安全协议 TLS][1],对于一种新发现的、成本低廉的攻击而言异常脆弱,这种攻击会在几个小时内解密敏感的通信,在某些情况下解密甚至能瞬间完成。 前一百万家最大的网站中有超过 81,000 个站点正处于这种脆弱的 HTTPS 协议保护之下。 + +这种攻击主要针对依赖于 [RSA 加密系统][2]的 TLS 所保护的通信,密钥会间接的通过 SSLv2 暴露,这是一种在 20 年前就因为自身缺陷而退休了的 TLS 前代协议。该漏洞允许攻击者可以通过反复使用 SSLv2 创建与服务器连接的方式,解密截获的 TLS 连接。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/software/applications/889455--more-than-11-million-https-websites-imperiled-by-new-decryption-attack + +作者:[ArsTechnica][a] +译者:[Ezio](https://github.com/oska874) +校对:[martin2011qi](https://github.com/martin2011qi), [wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/community/forums/person/112 +[1]: https://en.wikipedia.org/wiki/Transport_Layer_Security +[2]: https://en.wikipedia.org/wiki/RSA_(cryptosystem) diff --git a/published/201603/20160316 What we learned in Seoul with AlphaGo.md b/published/201603/20160316 What we learned in Seoul with AlphaGo.md new file mode 100644 index 0000000000..d4e40ab488 --- /dev/null +++ b/published/201603/20160316 What we learned in Seoul with AlphaGo.md @@ -0,0 +1,49 @@ +AlphaGo 的首尔之战带来的启示 +================================================================================ +围棋并不仅仅是一个游戏——她是一伙活生生的玩家们,分析家们,爱好者们以及传奇大师们。在过去的十天里,在韩国首尔,我们有幸亲眼目睹那份难以置信的激动。我们也有幸也目睹了那前所未有的场景:[DeepMind][1] 的 AlphaGo 迎战并战胜了传奇围棋大师,李世石(职业9段,身负 18 个世界头衔),这是人工智能的里程碑。 + +![Pedestrians checking in on the AlphaGo vs. Lee Sedol Go match on the streets of Seoul (March 13)](https://1.bp.blogspot.com/-vfgUcjyMOmM/Vumk5gXD98I/AAAAAAAASDI/frbYidb1u6gTKGcvFOf8iQVsr9PLoRlBQ/s1600/Press%2BCenter%2BOutdoor%2BScreen%2B2.jpg) + +虽说围棋可能是存世的最为悠久的游戏之一了,但对于这五盘比赛的关注度还是大大的超出了我们的想象。搜索围棋规则和围棋盘的用户在美国迅速飙升。在中国,数以千万计的用户通过直播观看了这场比赛,并且新浪微博“人机围棋大战”话题的浏览量破 2 亿。韩国的围棋盘也销量[激增][2]。 + +然而我们如此公开的测试 AlphaGo,并不仅仅是为了赢棋而已。我们自 2010 年成立 DeepMind,为的是创造出具有独立学习能力的通用型人工智能(AI),并致力于将其作为工具协助解决,从气候变化到诊断疾病,这类最为棘手且急迫的问题为最终目标。 + +亦如许多前辈学者们一样,我们也是通过游戏来开发并测试我们的算法的。在一月份,我们第一次披露了 [AlphaGo][3]——作为第一个通过使用 [深度学习][4] 和 [强化学习][5],可以在人类发明的最为复杂的棋盘类游戏中击败职业选手的 AI 程序。而 AlphaGo 迎战过去十年间最厉害的围棋选手——李世石,绝对称得上是 [终极挑战][6]。 + +结果震惊了包括我们在内的每个人,AlphaGo 五战四胜。评论家指出了 AlphaGo 下出的许多前所未见、极富创意或者要用 [“漂亮”][7] 来形容的妙手。基于我们的数据分析,AlphaGo 在第 2 局中的 [37 手][8],在人类选手中出现的几率仅有万分之一。而李一反常态的创新下法,如第 4 局中的 [78 手][9]——也是既存下法中的万中之一的——这一手也最终造就了一场胜利。 + +最后比分定格在 4-1。我们为支持科学、技术、工程、数学(STEM)教育和围棋的组织,以及 UNICEF (联合国儿童基金会)赢得了 $1 百万的捐助。 + +经此一役,我们将收获总结成以下两点:第一,此次测试很好的预示了 AI 有解决其他问题的潜力。AlphaGo 在棋盘上能够做到兼顾“全局”——并找出人类已经被训化而不会走或想到的妙手。运用 AlphaGo 这类的技术,在人类目所不能及的领域中探索,会有很大的潜力。第二,虽说这场比赛已经被广泛的标榜成“人机大战”,但 AlphaGo 却是人类实实在在的成果。无论是李世石还是 AlphaGo 团队相互之间互相促进,产生了新的想法、观点和答案——并且长远来看,我们都将从中受益。 + +但正如韩国对于围棋的观点:“胜而不骄,是以常胜。”这只是使机器聪明的漫长道路中的一个小小而显著的一步而已。我们已经证明了尖端深度强化学习技术可以被用作制作强大的围棋选手和 [Atari][10] 玩家。深度神经网络在 Google 已经与 [图像识别][11],[语音识别][12] 以及 [搜索排名][13] 一样被应用到具体的任务中了。然而,从会学习的机器到可以像人一样全方位灵活实施智能任务——真正达到 [强人工智能][14] 的特性,此中的道路还很漫长。 + +![Demis and Lee Sedol hold up the signed Go board from the Google DeepMind Challenge Match](https://4.bp.blogspot.com/-LkxNvsR-e1I/Vumk5gmProI/AAAAAAAASDM/J55Y2psqzOwWZ3kau2Pgz6xmazo7XDj_Q/s1600/A26U6150.jpg) + +我们想通过这场比赛来测试 AlphaGo 的极限。李世石大师做的十分出色—我们在接下来的数周内会研究他与 AlphaGo 的对战细节。同时因为我们在 AlphaGo 中使用的机器学习方法是通用型的,我们十分希望在不久的将来,将这种技术应用于其他的挑战中。游戏开始! + +-------------------------------------------------------------------------------- + +via: https://googleblog.blogspot.com/2016/03/what-we-learned-in-seoul-with-alphago.html + +作者:[Demis Hassabis][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://demishassabis.com/ +[1]:https://deepmind.com/ +[2]:http://www.hankookilbo.com/m/v/3e7deaa26a834f76929a1689ecd388ea +[3]:https://googleblog.blogspot.com/2016/01/alphago-machine-learning-game-go.html +[4]:https://en.wikipedia.org/wiki/Deep_learning +[5]:https://en.wikipedia.org/wiki/Reinforcement_learning +[6]:https://deepmind.com/alpha-go.html +[7]:http://www.wired.com/2016/03/sadness-beauty-watching-googles-ai-play-go/ +[8]:https://youtu.be/l-GsfyVCBu0?t=1h17m50s +[9]:https://youtu.be/yCALyQRN3hw?t=3h10m25s +[10]:http://googleresearch.blogspot.sg/2015/02/from-pixels-to-actions-human-level.html +[11]:http://googleresearch.blogspot.sg/2013/06/improving-photo-search-step-across.html +[12]:http://googleresearch.blogspot.sg/2015/08/the-neural-networks-behind-google-voice.html +[13]:http://www.bloomberg.com/news/articles/2015-10-26/google-turning-its-lucrative-web-search-over-to-ai-machines +[14]:https://en.wikipedia.org/wiki/Artificial_general_intelligence diff --git a/published/201603/20160318 ownCloud Pi Device to Run on Snappy Ubuntu Core 16.04 LTS and Raspberry Pi 3.md b/published/201603/20160318 ownCloud Pi Device to Run on Snappy Ubuntu Core 16.04 LTS and Raspberry Pi 3.md new file mode 100644 index 0000000000..d49e0ef0f7 --- /dev/null +++ b/published/201603/20160318 ownCloud Pi Device to Run on Snappy Ubuntu Core 16.04 LTS and Raspberry Pi 3.md @@ -0,0 +1,36 @@ +ownCloud Pi 设备将运行在 Snappy Ubuntu Core 16.04 LTS 及树莓派3上 +=============================================================================== + + +我们去年[报道了][1] ownCloud 正与西部数据(Western Digital)实验室沟通,帮助他们开发一个社区项目,将给用户带来可以在家中自托管的云存储设备。 + +自托管设备背后的理念,是由 ownCloud 服务端软件承载的,它结合了树莓派和西数硬盘到一个易安装和开箱即用的容器中。 + +社区的反应看上去很积极,ownCloud Pi 项目收到了许多好的提议和点子。今天,我们收到了一个更好的消息,首个镜像可以[下载][2]了。 + +ownCloud Pi 基于最新的 Snappy Ubuntu Core 16.04 LTS 系统,它由 Canonical 为嵌入式和 物联网(Internet of Things)设备所设计,包括新的树莓派3 Model B。 + +ownCloud 的开发者在今天的[声明][3]中称:“我们正在寻求来自 ownCloud、Ubuntu、树莓派和西数实验室等社区的帮助来测试和提高它们,并且可以在下周发布首批30台设备”。 + +### 目前的阻碍、挑战及前进的路 + +目前团队正致力于在基于 Xenial Xerus 版本的 Snappy Ubuntu 内核上完成他们的 ownCloud Pi 设备方案。这样,新的64位树莓派3可以帮助它们克服之前在树莓派2上遇到的阻碍,比如支持大于2GB的文件。 + +由此看来,最终的 ownCloud Pi 将在今年春天发布预览版,它将会在树莓派3上运行。之后,我们应该就可以购买首批可用于产品环境版本的 ownCloud Pi 设备了。 + +-------------------------------------------------------------------------------- + +via: http://news.softpedia.com/news/owncloud-pi-device-to-run-on-snappy-ubuntu-core-16-04-lts-and-raspberry-pi-3-501904.shtml + +作者:[Marius Nestor][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://news.softpedia.com/editors/browse/marius-nestor +[1]: http://news.softpedia.com/news/owncloud-partnerships-with-wd-to-bring-self-hosted-cloud-storage-in-users-homes-497512.shtml +[2]: http://people.canonical.com/~kyrofa/owncloud-pi/ +[3]: https://owncloud.org/blog/wd-labs-raspberry-pi-owncloud-and-ubuntu/ + + diff --git a/published/201603/20160320 UbuntuBSD Brings Ubuntu And FreeBSD Together.md b/published/201603/20160320 UbuntuBSD Brings Ubuntu And FreeBSD Together.md new file mode 100644 index 0000000000..259fc347d1 --- /dev/null +++ b/published/201603/20160320 UbuntuBSD Brings Ubuntu And FreeBSD Together.md @@ -0,0 +1,66 @@ +将 Ubuntu 和 FreeBSD 融合在一起的发行版 :UbuntuBSD +======================================================== + +![](http://itsfoss.com/wp-content/uploads/2016/03/UbuntuBSD.jpg) + +不止是在 Linux 的内核上面你才能体验到 Ubuntu 的快捷方便,伙计们。UbuntuBSD 可以让你在 FreeBSD 的内核上面也能体验到那种方便快捷。 + +UbuntuBSD 称自己是 ‘Unix for human beings’,这一点也不人惊讶。如过你能想起来的话,Ubuntu 使用的标语是 ‘Linux for human beings’ 并且在过去的 11 年里它确实让一个‘正常人’有可能用上 Linux。 + +UbuntuBSD 有着同样的想法。它想让新手能够接触到 Unix ,以及能使用它——如果我能这样说的话。至少,这就是它的目标。 + +### 什么是 BSD ? 它和 Linux 有哪些不同? ### + +如果你是新手,那么你需要知道 [Unix 和 Linux 的区别][2]. + +在 Linux 出现之前,Unix 由 [AT&T][3] 的 [Ken Thompson][4]、 [Denis Ricthie][5] 以及他们的团队设计。这是在可以算作计算机上古时期的 1970 发生的事。当你知道 Unix 是一个闭源的,有产权的操作系统时你可能会感到惊讶。AT&T 给了很多第三方许可,包括学术机构和企业。 + +美国加州大学伯克利分校是其中一个拿到许可的学术机构。在那里开发的 Unix 系统叫做 [BSD (Berkeley Software Distribution)][6]。BSD 的最出名的开源分支是 [FreeBSD][7],另一个最流行的闭源分支是苹果的 Mac OS X。 + +在 1991 年。芬兰的计算机系大学生 Linus Torvalds 从头写了自己的 Unix 系统的复制品。这就是我们今天熟知的 Linux 内核。Linux 的发行版在内核的基础上添加了图形界面、GNU 的那一套(cp, mv, ls,date, bash 什么的)、安装/管理工具,GNU C/C++ 编译器以及很多应用。 + +### UbuntuBSD 不是这种发行版的开端 + +在你知道了 Linux,Unix,FreeBSD 之间的区别之后。我要告诉你的是 UbuntuBSD 不是第一个要在 FreeBSD 内核上作出类似 Linux 的感觉的发行版。 + +当 Debian 选择使用 [systemd][8] 之后,[Debian GNU/kFreeBSD][9]诞生了。它使用的不是通常的 Linux 内核,而是 将 Debian 移植到了 FreeBSD 内核上。 + +与 Debian GNU/kFreeBSD 类似,UbuntuBSD 是将 Ubuntu 移植到了 FreeBSD 内核上。 + +### UbuntuBSD Beta 版代号: Escape From SystemD + +UbuntuBSD 的第一个版本已经发布,代号为“Escape From SystemD ”。它基于 Ubuntu 15.10 和 FreeBSD 10.1. + +它的默认桌面环境为 [Xfce][10] ,桌面以及服务器均可使用。 对于 [ZFS][11] 的支持也包含在这个版本中。开发者还提供了一个文本界面的安装器。 + +### 想试试? + +我不建议任何人马上就去开心地去尝试这个系统。它仍在开发并且安装器还是文本界面的。不过如果你足够自信的话,直接去下载体验吧。但是如果你是新手的话,请等一段时间,至少不要现在就去尝试: + +[UbuntuBSD][12] + +你认为 UbuntuBSD 怎么样? 兹瓷不兹瓷它? + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/ubuntubsd-ubuntu-freebsd/ + +作者:[ABHISHEK][a] +译者:[name1e5s](https://github.com/name1e5s) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]: http://itsfoss.com/tag/linux/ +[2]: https://linux.cn/article-3159-1.html +[3]: https://en.wikipedia.org/wiki/AT%26T +[4]: https://en.wikipedia.org/wiki/Ken_Thompson +[5]: https://en.wikipedia.org/wiki/Dennis_Ritchie +[6]: http://www.bsd.org/ +[7]: https://www.freebsd.org/ +[8]: https://www.freedesktop.org/wiki/Software/systemd/ +[9]: https://www.debian.org/ports/kfreebsd-gnu/ +[10]: http://www.xfce.org/ +[11]: https://en.wikipedia.org/wiki/ZFS +[12]: https://sourceforge.net/projects/ubuntubsd/ diff --git a/published/201604/20151028 10 Tips for 10x Application Performance.md b/published/201604/20151028 10 Tips for 10x Application Performance.md new file mode 100644 index 0000000000..9641a2e546 --- /dev/null +++ b/published/201604/20151028 10 Tips for 10x Application Performance.md @@ -0,0 +1,276 @@ +将程序性能提高十倍的10条建议 +================================================================================ + +提高 web 应用的性能从来没有比现在更重要过。网络经济的比重一直在增长;全球经济超过 5% 的价值是在因特网上产生的(数据参见下面的资料)。这个时刻在线的超连接世界意味着用户对其的期望值也处于历史上的最高点。如果你的网站不能及时的响应,或者你的 app 不能无延时的工作,用户会很快的投奔到你的竞争对手那里。 + +举一个例子,一份亚马逊十年前做过的研究可以证明,甚至在那个时候,网页加载时间每减少100毫秒,收入就会增加1%。另一个最近的研究特别强调一个事实,即超过一半的网站拥有者在调查中承认它们会因为应用程序性能的问题流失用户。 + +网站到底需要多快呢?对于页面加载,每增加1秒钟就有4%的用户放弃使用。顶级的电子商务站点的页面在第一次交互时可以做到1秒到3秒加载时间,而这是提供最高舒适度的速度。很明显这种利害关系对于 web 应用来说很高,而且在不断的增加。 + +想要提高效率很简单,但是看到实际结果很难。为了在你的探索之旅上帮助到你,这篇文章会给你提供10条最高可以提升10倍网站性能的建议。这是系列介绍提高应用程序性能的第一篇文章,包括充分测试的优化技术和一点 NGINX 的帮助。这个系列也给出了潜在的提高安全性的帮助。 + +### Tip #1: 通过反向代理来提高性能和增加安全性 ### + +如果你的 web 应用运行在单个机器上,那么这个办法会明显的提升性能:只需要换一个更快的机器,更好的处理器,更多的内存,更快的磁盘阵列,等等。然后新机器就可以更快的运行你的 WordPress 服务器, Node.js 程序, Java 程序,以及其它程序。(如果你的程序要访问数据库服务器,那么解决方法依然很简单:添加两个更快的机器,以及在两台电脑之间使用一个更快的链路。) + +问题是,机器速度可能并不是问题。web 程序运行慢经常是因为计算机一直在不同的任务之间切换:通过成千上万的连接和用户交互,从磁盘访问文件,运行代码,等等。应用服务器可能会抖动(thrashing)-比如说内存不足、将内存数据交换到磁盘,以及有多个请求要等待某个任务完成,如磁盘I/O。 + +你可以采取一个完全不同的方案来替代升级硬件:添加一个反向代理服务器来分担部分任务。[反向代理服务器][1] 位于运行应用的机器的前端,是用来处理网络流量的。只有反向代理服务器是直接连接到互联网的;和应用服务器的通讯都是通过一个快速的内部网络完成的。 + +使用反向代理服务器可以将应用服务器从等待用户与 web 程序交互解放出来,这样应用服务器就可以专注于为反向代理服务器构建网页,让其能够传输到互联网上。而应用服务器就不需要等待客户端的响应,其运行速度可以接近于优化后的性能水平。 + +添加反向代理服务器还可以给你的 web 服务器安装带来灵活性。比如,一个某种类型的服务器已经超载了,那么就可以轻松的添加另一个相同的服务器;如果某个机器宕机了,也可以很容易替代一个新的。 + +因为反向代理带来的灵活性,所以反向代理也是一些性能加速功能的必要前提,比如: + +- **负载均衡** (参见 [Tip #2][2]) – 负载均衡运行在反向代理服务器上,用来将流量均衡分配给一批应用。有了合适的负载均衡,你就可以添加应用服务器而根本不用修改应用。 +- **缓存静态文件** (参见 [Tip #3][3]) – 直接读取的文件,比如图片或者客户端代码,可以保存在反向代理服务器,然后直接发给客户端,这样就可以提高速度、分担应用服务器的负载,可以让应用运行的更快。 +- **网站安全** – 反向代理服务器可以提高网站安全性,以及快速的发现和响应攻击,保证应用服务器处于被保护状态。 + +NGINX 软件为用作反向代理服务器而专门设计,也包含了上述的多种功能。NGINX 使用事件驱动的方式处理请求,这会比传统的服务器更加有效率。NGINX plus 添加了更多高级的反向代理特性,比如应用的[健康度检查][4],专门用来处理请求路由、高级缓冲和相关支持。 + +![NGINX Worker Process helps increase application performance](https://www.nginx.com/wp-content/uploads/2015/10/Graph-11.png) + +### Tip #2: 添加负载平衡 ### + +添加一个[负载均衡服务器][5] 是一个相当简单的用来提高性能和网站安全性的的方法。与其将核心 Web 服务器变得越来越大和越来越强,不如使用负载均衡将流量分配到多个服务器。即使程序写的不好,或者在扩容方面有困难,仅是使用负载均衡服务器就可以很好的提高用户体验。 + +负载均衡服务器首先是一个反向代理服务器(参见[Tip #1][6])——它接受来自互联网的流量,然后转发请求给另一个服务器。特别是负载均衡服务器支持两个或多个应用服务器,使用[分配算法][7]将请求转发给不同服务器。最简单的负载均衡方法是轮转法(round robin),每个新的请求都会发给列表里的下一个服务器。其它的复制均衡方法包括将请求发给活动连接最少的服务器。NGINX plus 拥有将特定用户的会话分配给同一个服务器的[能力][8]。 + +负载均衡可以很好的提高性能是因为它可以避免某个服务器过载而另一些服务器却没有需要处理的流量。它也可以简单的扩展服务器规模,因为你可以添加多个价格相对便宜的服务器并且保证它们被充分利用了。 + +可以进行负载均衡的协议包括 HTTP、HTTPS、SPDY、HTTP/2、WebSocket、[FastCGI][9]、SCGI、uwsgi、 memcached 等,以及几种其它的应用类型,包括基于 TCP 的应用和其它的第4层协议的程序。分析你的 web 应用来决定你要使用哪些以及哪些地方性能不足。 + +相同的服务器或服务器群可以被用来进行负载均衡,也可以用来处理其它的任务,如 SSL 末端服务器,支持客户端的 HTTP/1.x 和 HTTP/2 请求,以及缓存静态文件。 + +NGINX 经常被用于进行负载均衡;要想了解更多的情况,可以下载我们的电子书 [选择软件负载均衡器的五个理由][10]。你也可以从 [使用 NGINX 和 NGINX Plus 配置负载均衡,第一部分][11] 中了解基本的配置指导,在 NGINX Plus 管理员指南中有完整的 [NGINX 负载均衡][12]的文档。。我们的商业版本 [NGINX Plus][15] 支持更多优化了的负载均衡特性,如基于服务器响应时间的加载路由和Microsoft’s NTLM 协议上的负载均衡。 + +### Tip #3: 缓存静态和动态的内容 ### + +缓存可以通过加速内容的传输速度来提高 web 应用的性能。它可以采用以下几种策略:当需要的时候预处理要传输的内容,保存数据到速度更快的设备,把数据存储在距离客户端更近的位置,或者将这几种方法结合起来使用。 + +有两种不同类型数据的缓冲: + +- **静态内容缓存**。不经常变化的文件,比如图像(JPEG、PNG) 和代码(CSS,JavaScript),可以保存在外围服务器上,这样就可以快速的从内存和磁盘上提取。 +- **动态内容缓存**。很多 web 应用会针对每次网页请求生成一个新的 HTML 页面。在短时间内简单的缓存生成的 HTML 内容,就可以很好的减少要生成的内容的数量,而且这些页面足够新,可以满足你的需要。 + +举个例子,如果一个页面每秒会被浏览10次,你将它缓存 1 秒,90%请求的页面都会直接从缓存提取。如果你分开缓存静态内容,甚至新生成的页面可能都是由这些缓存构成的。 + +下面由是 web 应用发明的三种主要的缓存技术: + +- **缩短数据与用户的网络距离**。把一份内容的拷贝放的离用户更近的节点来减少传输时间。 +- **提高内容服务器的速度**。内容可以保存在一个更快的服务器上来减少提取文件的时间。 +- **从过载服务器上移走数据**。机器经常因为要完成某些其它的任务而造成某个任务的执行速度比测试结果要差。将数据缓存在不同的机器上可以提高缓存资源和非缓存资源的性能,而这是因为主机没有被过度使用。 + +对 web 应用的缓存机制可以在 web 应用服务器内部实现。首先,缓存动态内容是用来减少应用服务器加载动态内容的时间。其次,缓存静态内容(包括动态内容的临时拷贝)是为了更进一步的分担应用服务器的负载。而且缓存之后会从应用服务器转移到对用户而言更快、更近的机器,从而减少应用服务器的压力,减少提取数据和传输数据的时间。 + +改进过的缓存方案可以极大的提高应用的速度。对于大多数网页来说,静态数据,比如大图像文件,构成了超过一半的内容。如果没有缓存,那么这可能会花费几秒的时间来提取和传输这类数据,但是采用了缓存之后不到1秒就可以完成。 + +举一个在实际中缓存是如何使用的例子, NGINX 和 NGINX Plus 使用了两条指令来[设置缓存机制][16]:proxy_cache_path 和 proxy_cache。你可以指定缓存的位置和大小、文件在缓存中保存的最长时间和其它一些参数。使用第三条(而且是相当受欢迎的一条)指令 proxy_cache_use_stale,如果提供新鲜内容的服务器忙碌或者挂掉了,你甚至可以让缓存提供较旧的内容,这样客户端就不会一无所得。从用户的角度来看这可以很好的提高你的网站或者应用的可用时间。 + +NGINX plus 有个[高级缓存特性][17],包括对[缓存清除][18]的支持和在[仪表盘][19]上显示缓存状态信息。 + +要想获得更多关于 NGINX 的缓存机制的信息可以浏览 NGINX Plus 管理员指南中的 [参考文档][20] 和 [NGINX 内容缓存][21] 。 + +**注意**:缓存机制分布于应用开发者、投资决策者以及实际的系统运维人员之间。本文提到的一些复杂的缓存机制从[DevOps 的角度][23]来看很具有价值,即对集应用开发者、架构师以及运维操作人员的功能为一体的工程师来说可以满足它们对站点功能性、响应时间、安全性和商业结果(如完成的交易数)等需要。 + +### Tip #4: 压缩数据 ### + +压缩是一个具有很大潜力的提高性能的加速方法。现在已经有一些针对照片(JPEG 和PNG)、视频(MPEG-4)和音乐(MP3)等各类文件精心设计和高压缩率的标准。每一个标准都或多或少的减少了文件的大小。 + +文本数据 —— 包括HTML(包含了纯文本和 HTML 标签),CSS 和代码,比如 Javascript —— 经常是未经压缩就传输的。压缩这类数据会在对应用程序性能的感觉上,特别是处于慢速或受限的移动网络的客户端,产生更大的影响。 + +这是因为文本数据经常是用户与网页交互的有效数据,而多媒体数据可能更多的是起提供支持或者装饰的作用。智能的内容压缩可以减少 HTML,Javascript,CSS和其它文本内容对带宽的要求,通常可以减少 30% 甚至更多的带宽和相应的页面加载时间。 + +如果你使用 SSL,压缩可以减少需要进行 SSL 编码的的数据量,而这些编码操作会占用一些 CPU 时间而抵消了压缩数据减少的时间。 + +压缩文本数据的方法很多,举个例子,在定义小说文本压缩模式的 [HTTP/2 部分]就对于头数据来特别适合。另一个例子是可以在 NGINX 里打开使用 GZIP 压缩。你在你的服务里[预先压缩文本数据][25]之后,你就可以直接使用 gzip_static 指令来处理压缩过的 .gz 版本。 + +### Tip #5: 优化 SSL/TLS ### + +安全套接字([SSL][26]) 协议和它的下一代版本传输层安全(TLS)协议正在被越来越多的网站采用。SSL/TLS 对从原始服务器发往用户的数据进行加密提高了网站的安全性。影响这个趋势的部分原因是 Google 正在使用 SSL/TLS,这在搜索引擎排名上是一个正面的影响因素。 + +尽管 SSL/TLS 越来越流行,但是使用加密对速度的影响也让很多网站望而却步。SSL/TLS 之所以让网站变的更慢,原因有二: + +1. 任何一个连接第一次连接时的握手过程都需要传递密钥。而采用 HTTP/1.x 协议的浏览器在建立多个连接时会对每个连接重复上述操作。 +2. 数据在传输过程中需要不断的在服务器端加密、在客户端解密。 + +为了鼓励使用 SSL/TLS,HTTP/2 和 SPDY(在[下一章][27]会描述)的作者设计了新的协议来让浏览器只需要对一个浏览器会话使用一个连接。这会大大的减少上述第一个原因所浪费的时间。然而现在可以用来提高应用程序使用 SSL/TLS 传输数据的性能的方法不止这些。 + +web 服务器有对应的机制优化 SSL/TLS 传输。举个例子,NGINX 使用 [OpenSSL][28] 运行在普通的硬件上提供了接近专用硬件的传输性能。NGINX 的 [SSL 性能][29] 有详细的文档,而且把对 SSL/TLS 数据进行加解密的时间和 CPU 占用率降低了很多。 + +更进一步,参考这篇[文章][30]了解如何提高 SSL/TLS 性能的更多细节,可以总结为一下几点: + +- **会话缓冲**。使用指令 [ssl_session_cache][31] 可以缓存每个新的 SSL/TLS 连接使用的参数。 +- **会话票据或者 ID**。把 SSL/TLS 的信息保存在一个票据或者 ID 里可以流畅的复用而不需要重新握手。 +- **OCSP 分割**。通过缓存 SSL/TLS 证书信息来减少握手时间。 + +NGINX 和 NGINX Plus 可以被用作 SSL/TLS 服务端,用于处理客户端流量的加密和解密,而同时以明文方式和其它服务器进行通信。要设置 NGINX 和 NGINX Plus 作为 SSL/TLS 服务端,参看 [HTTPS 连接][32] 和[加密的 TCP 连接][33] + +### Tip #6: 使用 HTTP/2 或 SPDY ### + +对于已经使用了 SSL/TLS 的站点,HTTP/2 和 SPDY 可以很好的提高性能,因为每个连接只需要一次握手。而对于没有使用 SSL/TLS 的站点来说,从响应速度的角度来说 HTTP/2 和 SPDY 将让迁移到 SSL/TLS 没有什么压力(原本会降低效率)。 + +Google 在2012年开始把 SPDY 作为一个比 HTTP/1.x 更快速的协议来推荐。HTTP/2 是目前 IETF 通过的标准,是基于 SPDY 的。SPDY 已经被广泛的支持了,但是很快就会被 HTTP/2 替代。 + +SPDY 和 HTTP/2 的关键是用单一连接来替代多路连接。单个连接是被复用的,所以它可以同时携带多个请求和响应的分片。 + +通过使用单一连接,这些协议可以避免像在实现了 HTTP/1.x 的浏览器中一样建立和管理多个连接。单一连接在对 SSL 特别有效,这是因为它可以最小化 SSL/TLS 建立安全链接时的握手时间。 + +SPDY 协议需要使用 SSL/TLS,而 HTTP/2 官方标准并不需要,但是目前所有支持 HTTP/2 的浏览器只有在启用了 SSL/TLS 的情况下才能使用它。这就意味着支持 HTTP/2 的浏览器只有在网站使用了 SSL 并且服务器接收 HTTP/2 流量的情况下才会启用 HTTP/2。否则的话浏览器就会使用 HTTP/1.x 协议。 + +当你实现 SPDY 或者 HTTP/2 时,你不再需要那些常规的 HTTP 性能优化方案,比如按域分割、资源聚合,以及图像拼合。这些改变可以让你的代码和部署变得更简单和更易于管理。要了解 HTTP/2 带来的这些变化可以浏览我们的[白皮书][34]。 + +![NGINX Supports SPDY and HTTP/2 for increased web application performance](https://www.nginx.com/wp-content/uploads/2015/10/http2-27.png) + +作为支持这些协议的一个样例,NGINX 已经从一开始就支持了 SPDY,而且[大部分使用 SPDY 协议的网站][35]都运行的是 NGINX。NGINX 同时也[很早][36]对 HTTP/2 的提供了支持,从2015 年9月开始,开源版 NGINX 和 NGINX Plus 就[支持][37]它了。 + +经过一段时间,我们 NGINX 希望更多的站点完全启用 SSL 并且向 HTTP/2 迁移。这将会提高安全性,同时也会找到并实现新的优化手段,简化的代码表现的会更加优异。 + +### Tip #7: 升级软件版本 ### + +一个提高应用性能的简单办法是根据软件的稳定性和性能的评价来选在你的软件栈。进一步说,因为高性能组件的开发者更愿意追求更高的性能和解决 bug ,所以值得使用最新版本的软件。新版本往往更受开发者和用户社区的关注。更新的版本往往会利用到新的编译器优化,包括对新硬件的调优。 + +稳定的新版本通常比旧版本具有更好的兼容性和更高的性能。一直进行软件更新,可以非常简单的保持软件保持最佳的优化,解决掉 bug,以及提高安全性。 + +一直使用旧版软件也会阻止你利用新的特性。比如上面说到的 HTTP/2,目前要求 OpenSSL 1.0.1。在2016 年中期开始将会要求1.0.2 ,而它是在2015年1月才发布的。 + +NGINX 用户可以开始迁移到 [NGINX 最新的开源软件][38] 或者 [NGINX Plus][39];它们都包含了最新的能力,如 socket 分割和线程池(见下文),这些都已经为性能优化过了。然后好好看看的你软件栈,把它们升级到你能升级到的最新版本吧。 + +### Tip #8: Linux 系统性能调优 ### + +Linux 是大多数 web 服务器使用的操作系统,而且作为你的架构的基础,Linux 显然有不少提高性能的可能。默认情况下,很多 Linux 系统都被设置为使用很少的资源,以符合典型的桌面应用使用。这就意味着 web 应用需要一些微调才能达到最大效能。 + +这里的 Linux 优化是专门针对 web 服务器方面的。以 NGINX 为例,这里有一些在加速 Linux 时需要强调的变化: + +- **缓冲队列**。如果你有挂起的连接,那么你应该考虑增加 net.core.somaxconn 的值,它代表了可以缓存的连接的最大数量。如果连接限制太小,那么你将会看到错误信息,而你可以逐渐的增加这个参数直到错误信息停止出现。 +- **文件描述符**。NGINX 对一个连接使用最多2个文件描述符。如果你的系统有很多连接请求,你可能就需要提高sys.fs.file_max ,以增加系统对文件描述符数量整体的限制,这样才能支持不断增加的负载需求。 +- **临时端口**。当使用代理时,NGINX 会为每个上游服务器创建临时端口。你可以设置net.ipv4.ip_local_port_range 来提高这些端口的范围,增加可用的端口号。你也可以减少非活动的端口的超时判断来重复使用端口,这可以通过 net.ipv4.tcp_fin_timeout 来设置,这可以快速的提高流量。 + +对于 NGINX 来说,可以查阅 [NGINX 性能调优指南][40]来学习如果优化你的 Linux 系统,这样它就可以很好的适应大规模网络流量而不会超过工作极限。 + +### Tip #9: web 服务器性能调优 ### + +无论你是用哪种 web 服务器,你都需要对它进行优化来提高性能。下面的推荐手段可以用于任何 web 服务器,但是一些设置是针对 NGINX 的。关键的优化手段包括: + +- **访问日志**。不要把每个请求的日志都直接写回磁盘,你可以在内存将日志缓存起来然后批量写回磁盘。对于NGINX 来说,给指令 **access_log** 添加参数 **buffer=size** 可以让系统在缓存满了的情况下才把日志写到磁盘。如果你添加了参数 **flush=time** ,那么缓存内容会每隔一段时间再写回磁盘。 +- **缓存**。缓存会在内存中存放部分响应,直到满了为止,这可以让与客户端的通信更加高效。内存放不下的响应会写回磁盘,而这就会降低效能。当 NGINX [启用][42]了缓存机制后,你可以使用指令 **proxy_buffer_size** 和 **proxy_buffers** 来管理缓存。 +- **客户端保活**。保活连接可以减少开销,特别是使用 SSL/TLS 时。对于 NGINX 来说,你可以从 **keepalive_requests** 的默认值 100 开始增加最大连接数,这样一个客户端就可以在一个指定的连接上请求多次,而且你也可以通过增加 **keepalive_timeout** 的值来允许保活连接存活更长时间,这样就可以让后来的请求处理的更快速。 +- **上游保活**。上游的连接——即连接到应用服务器、数据库服务器等机器的连接——同样也会受益于连接保活。对于上游连接来说,你可以增加 **keepalive**,即每个工人进程的空闲保活连接个数。这就可以提高连接的复用次数,减少需要重新打开全新连接的次数。更多关于保活连接的信息可以参见[这篇“ HTTP 保活连接和性能”][41]。 +- **限制**。限制客户端使用的资源可以提高性能和安全性。对于 NGINX 来说,指令 **limit_conn** 和 **limit_conn_zone** 限制了给定来源的连接数量,而 **limit_rate** 限制了带宽。这些限制都可以阻止合法用户*扒取*资源,同时也避免了攻击。指令 **limit_req** 和 **limit_req_zone** 限制了客户端请求。对于上游服务器来说,可以在 upstream 的配置块里的 server 指令使用 max_conns 参数来限制连接到上游服务器的连接数。 这样可以避免服务器过载。关联的 queue 指令会创建一个队列来在连接数抵达 **max_conn** 限制时在指定长度的时间内保存特定数量的请求。 +- **工人进程**。工人进程负责处理请求。NGINX 采用事件驱动模型和操作系统特定的机制来有效的将请求分发给不同的工人进程。这条建议推荐设置 **worker_processes** 为每个 CPU 一个 。worker_connections 的最大数(默认512)可以在大部分系统上根据需要增加,实验性地找到最适合你的系统的值。 +- **套接字分割**。通常一个套接字监听器会把新连接分配给所有工人进程。套接字分割会为每个工人进程创建一个套接字监听器,这样一来以当套接字监听器可用时,内核就会将连接分配给它。这可以减少锁竞争,并且提高多核系统的性能,要启用[套接字分隔][43]需要在 **listen** 指令里面加上 **reuseport** 参数。 +- **线程池**。计算机进程可能被一个单一的缓慢的操作所占用。对于 web 服务器软件来说,磁盘访问会影响很多更快的操作,比如计算或者在内存中拷贝。使用了线程池之后慢操作可以分配到不同的任务集,而主进程可以一直运行快速操作。当磁盘操作完成后结果会返回给主进程的循环。在 NGINX 里有两个操作——read() 系统调用和 sendfile() ——被分配到了[线程池][44] + +![Thread pools help increase application performance by assigning a slow operation to a separate set of tasks](https://www.nginx.com/wp-content/uploads/2015/10/Graph-17.png) + +**技巧**。当改变任何操作系统或支持服务的设置时,一次只改变一个参数然后测试性能。如果修改引起问题了,或者不能让你的系统更快,那么就改回去。 + +在[文章“调优 NGINX 性能”][45]里可以看到更详细的 NGINX 调优方法。 + +### Tip #10: 监视系统活动来解决问题和瓶颈 ### + +在应用开发中要使得系统变得非常高效的关键是监视你的系统在现实世界运行的性能。你必须能通过特定的设备和你的 web 基础设施上监控程序活动。 + +监视活动是最积极的——它会告诉你发生了什么,把问题留给你发现和最终解决掉。 + +监视可以发现几种不同的问题。它们包括: + +- 服务器宕机。 +- 服务器出问题一直在丢失连接。 +- 服务器出现大量的缓存未命中。 +- 服务器没有发送正确的内容。 + +应用的总体性能监控工具,比如 New Relic 和 Dynatrace,可以帮助你监控到从远程加载网页的时间,而 NGINX 可以帮助你监控到应用交付端。当你需要考虑为基础设施添加容量以满足流量需求时,应用性能数据可以告诉你你的优化措施的确起作用了。 + +为了帮助开发者快速的发现、解决问题,NGINX Plus 增加了[应用感知健康度检查][46] ——对重复出现的常规事件进行综合分析并在问题出现时向你发出警告。NGINX Plus 同时提供[会话过滤][47] 功能,这可以阻止当前任务完成之前接受新的连接,另一个功能是慢启动,允许一个从错误恢复过来的服务器追赶上负载均衡服务器群的进度。当使用得当时,健康度检查可以让你在问题变得严重到影响用户体验前就发现它,而会话过滤和慢启动可以让你替换服务器,并且这个过程不会对性能和正常运行时间产生负面影响。下图就展示了内建的 NGINX Plus 模块[实时活动监视][48]的仪表盘,包括了服务器群,TCP 连接和缓存信息等 Web 架构信息。 + +![Use real-time application performance monitoring tools to identify and resolve issues quickly](https://www.nginx.com/wp-content/uploads/2015/10/Screen-Shot-2015-10-05-at-4.16.32-PM.png) + +### 总结: 看看10倍性能提升的效果 ### + +这些性能提升方案对任何一个 web 应用都可用并且效果都很好,而实际效果取决于你的预算、你能花费的时间、目前实现方案的差距。所以你该如何对你自己的应用实现10倍性能提升? + +为了指导你了解每种优化手段的潜在影响,这里是上面详述的每个优化方法的关键点,虽然你的情况肯定大不相同: + +- **反向代理服务器和负载均衡**。没有负载均衡或者负载均衡很差都会造成间歇的性能低谷。增加一个反向代理,比如 NGINX ,可以避免 web 应用程序在内存和磁盘之间波动。负载均衡可以将过载服务器的任务转移到空闲的服务器,还可以轻松的进行扩容。这些改变都可以产生巨大的性能提升,很容易就可以比你现在的实现方案的最差性能提高10倍,对于总体性能来说可能提高的不多,但是也是有实质性的提升。 +- **缓存动态和静态数据**。如果你有一个负担过重的 web 服务器,那么毫无疑问肯定是你的应用服务器,只通过缓存动态数据就可以在峰值时间提高10倍的性能。缓存静态文件可以提高几倍的性能。 +- **压缩数据**。使用媒体文件压缩格式,比如图像格式 JPEG,图形格式 PNG,视频格式 MPEG-4,音乐文件格式 MP3 可以极大的提高性能。一旦这些都用上了,然后压缩文件数据可以将初始页面加载速度提高两倍。 +- **优化 SSL/TLS**。安全握手会对性能产生巨大的影响,对它们的优化可能会对初始响应产生2倍的提升,特别是对于大量文本的站点。优化 SSL/TLS 下媒体文件只会产生很小的性能提升。 +- **使用 HTTP/2 和 SPDY*。当你使用了 SSL/TLS,这些协议就可以提高整个站点的性能。 +- **对 Linux 和 web 服务器软件进行调优**。比如优化缓存机制,使用保活连接,分配时间敏感型任务到不同的线程池可以明显的提高性能;举个例子,线程池可以加速对磁盘敏感的任务[近一个数量级][49]。 + +我们希望你亲自尝试这些技术。我们希望知道你说取得的各种性能提升案例。请在下面评论栏分享你的结果或者在标签 #NGINX 和 #webperf 下 tweet 你的故事。 + +### 网上资源 ### + +[Statista.com – Share of the internet economy in the gross domestic product in G-20 countries in 2016][50] + +[Load Impact – How Bad Performance Impacts Ecommerce Sales][51] + +[Kissmetrics – How Loading Time Affects Your Bottom Line (infographic)][52] + +[Econsultancy – Site speed: case studies, tips and tools for improving your conversion rate][53] + +-------------------------------------------------------------------------------- + +via: https://www.nginx.com/blog/10-tips-for-10x-application-performance/ + +作者:[Floyd Smith][a] +译者:[Ezio](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.nginx.com/blog/author/floyd/ +[1]:https://www.nginx.com/resources/glossary/reverse-proxy-server +[2]:https://www.nginx.com/blog/10-tips-for-10x-application-performance/?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io#tip2 +[3]:https://www.nginx.com/blog/10-tips-for-10x-application-performance/?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io#tip3 +[4]:https://www.nginx.com/products/application-health-checks/ +[5]:https://www.nginx.com/solutions/load-balancing/ +[6]:https://www.nginx.com/blog/10-tips-for-10x-application-performance/?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io#tip1 +[7]:https://www.nginx.com/resources/admin-guide/load-balancer/ +[8]:https://www.nginx.com/blog/load-balancing-with-nginx-plus/ +[9]:https://www.digitalocean.com/community/tutorials/understanding-and-implementing-fastcgi-proxying-in-nginx +[10]:https://www.nginx.com/resources/library/five-reasons-choose-software-load-balancer/ +[11]:https://www.nginx.com/blog/load-balancing-with-nginx-plus/ +[12]:https://www.nginx.com/resources/admin-guide/load-balancer// +[15]:https://www.nginx.com/products/ +[16]:https://www.nginx.com/blog/nginx-caching-guide/ +[17]:https://www.nginx.com/products/content-caching-nginx-plus/ +[18]:http://nginx.org/en/docs/http/ngx_http_proxy_module.html?&_ga=1.95342300.1348073562.1438712874#proxy_cache_purge +[19]:https://www.nginx.com/products/live-activity-monitoring/ +[20]:http://nginx.org/en/docs/http/ngx_http_proxy_module.html?&&&_ga=1.61156076.1348073562.1438712874#proxy_cache +[21]:https://www.nginx.com/resources/admin-guide/content-caching +[22]:https://www.nginx.com/blog/network-vs-devops-how-to-manage-your-control-issues/ +[23]:https://www.nginx.com/blog/10-tips-for-10x-application-performance/?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io#tip6 +[24]:https://www.nginx.com/resources/admin-guide/compression-and-decompression/ +[25]:http://nginx.org/en/docs/http/ngx_http_gzip_static_module.html +[26]:https://www.digicert.com/ssl.htm +[27]:https://www.nginx.com/blog/10-tips-for-10x-application-performance/?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io#tip6 +[28]:http://openssl.org/ +[29]:https://www.nginx.com/blog/nginx-ssl-performance/ +[30]:https://www.nginx.com/blog/improve-seo-https-nginx/ +[31]:http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_session_cache +[32]:https://www.nginx.com/resources/admin-guide/nginx-ssl-termination/ +[33]:https://www.nginx.com/resources/admin-guide/nginx-tcp-ssl-termination/ +[34]:https://www.nginx.com/resources/datasheet/datasheet-nginx-http2-whitepaper/ +[35]:http://w3techs.com/blog/entry/25_percent_of_the_web_runs_nginx_including_46_6_percent_of_the_top_10000_sites +[36]:https://www.nginx.com/blog/how-nginx-plans-to-support-http2/ +[37]:https://www.nginx.com/blog/nginx-plus-r7-released/ +[38]:http://nginx.org/en/download.html +[39]:https://www.nginx.com/products/ +[40]:https://www.nginx.com/blog/tuning-nginx/ +[41]:https://www.nginx.com/blog/http-keepalives-and-web-performance/ +[42]:http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering +[43]:https://www.nginx.com/blog/socket-sharding-nginx-release-1-9-1/ +[44]:https://www.nginx.com/blog/thread-pools-boost-performance-9x/ +[45]:https://www.nginx.com/blog/tuning-nginx/ +[46]:https://www.nginx.com/products/application-health-checks/ +[47]:https://www.nginx.com/products/session-persistence/#session-draining +[48]:https://www.nginx.com/products/live-activity-monitoring/ +[49]:https://www.nginx.com/blog/thread-pools-boost-performance-9x/ +[50]:http://www.statista.com/statistics/250703/forecast-of-internet-economy-as-percentage-of-gdp-in-g-20-countries/ +[51]:http://blog.loadimpact.com/blog/how-bad-performance-impacts-ecommerce-sales-part-i/ +[52]:https://blog.kissmetrics.com/loading-time/?wide=1 +[53]:https://econsultancy.com/blog/10936-site-speed-case-studies-tips-and-tools-for-improving-your-conversion-rate/ diff --git a/published/201604/20151109 How to Configure Tripwire IDS on Debian.md b/published/201604/20151109 How to Configure Tripwire IDS on Debian.md new file mode 100644 index 0000000000..b9f134c361 --- /dev/null +++ b/published/201604/20151109 How to Configure Tripwire IDS on Debian.md @@ -0,0 +1,381 @@ +如何在 Debian 中配置 Tripewire IDS +================================================================================ +本文是一篇关于 Debian 中安装和配置 Tripewire 的文章。它是 Linux 环境下基于主机的入侵检测系统(IDS)。tripwire 的高级功能有检测并报告任何 Linux 中未授权的(文件和目录)的更改。tripewire 安装之后,会先创建一个基本的数据库,tripewire 监控并检测新文件的创建修改和谁修改了它等等。如果修改是合法的,你可以接受修改并更新 tripwire 的数据库。 + +### 安装和配置 ### + +tripwire 在 Debian VM 中的安装如下。 + + # apt-get install tripwire + +![installation](http://blog.linoxide.com/wp-content/uploads/2015/11/installation.png) + +安装中,tripwire 会有下面的配置提示。 + +#### 站点密钥创建 #### + +tripwire 需要一个站点口令(site passphrase)来加密 tripwire 的配置文件 tw.cfg 和策略文件 tw.pol。tripewire 使用指定的密码加密两个文件。一个 tripewire 实例必须指定站点口令。 + +![site key1](http://blog.linoxide.com/wp-content/uploads/2015/11/site-key1.png) + +#### 本地密钥口令 #### + +本地口令用来保护 tripwire 数据库和报告文件。本地密钥用于阻止非授权的 tripewire 数据库修改。 + +![local key1](http://blog.linoxide.com/wp-content/uploads/2015/11/local-key1.png) + +#### tripwire 配置路径 #### + +tripewire 配置存储在 /etc/tripwire/twcfg.txt。它用于生成加密的配置文件 tw.cfg。 + +![configuration file](http://blog.linoxide.com/wp-content/uploads/2015/11/configuration-file.png) + +**tripwire 策略路径** + +tripwire 在 /etc/tripwire/twpol.txt 中保存策略文件。它用于生成加密的策略文件 tw.pol。 + +![tripwire policy](http://blog.linoxide.com/wp-content/uploads/2015/11/tripwire-policy.png) + +安装完成后如下图所示。 + +![installed tripewire1](http://blog.linoxide.com/wp-content/uploads/2015/11/installed-tripewire1.png) + +#### tripwire 配置文件 (twcfg.txt) #### + +tripewire 配置文件(twcfg.txt)细节如下图所示。加密策略文件(tw.pol)、站点密钥(site.key)和本地密钥(hostname-local.key)在后面展示。 + + ROOT =/usr/sbin + + POLFILE =/etc/tripwire/tw.pol + + DBFILE =/var/lib/tripwire/$(HOSTNAME).twd + + REPORTFILE =/var/lib/tripwire/report/$(HOSTNAME)-$(DATE).twr + + SITEKEYFILE =/etc/tripwire/site.key + + LOCALKEYFILE =/etc/tripwire/$(HOSTNAME)-local.key + + EDITOR =/usr/bin/editor + + LATEPROMPTING =false + + LOOSEDIRECTORYCHECKING =false + + MAILNOVIOLATIONS =true + + EMAILREPORTLEVEL =3 + + REPORTLEVEL =3 + + SYSLOGREPORTING =true + + MAILMETHOD =SMTP + + SMTPHOST =localhost + + SMTPPORT =25 + + TEMPDIRECTORY =/tmp + +#### tripwire 策略配置 #### + +在生成基础数据库之前先配置 tripwire 配置。有必要经用一些策略如 /dev、 /proc 、/root/mail 等。详细的 twpol.txt 策略文件如下所示。 + + @@section GLOBAL + TWBIN = /usr/sbin; + TWETC = /etc/tripwire; + TWVAR = /var/lib/tripwire; + + # + # File System Definitions + # + @@section FS + + # + # First, some variables to make configuration easier + # + SEC_CRIT = $(IgnoreNone)-SHa ; # Critical files that cannot change + + SEC_BIN = $(ReadOnly) ; # Binaries that should not change + + SEC_CONFIG = $(Dynamic) ; # Config files that are changed + # infrequently but accessed + # often + + SEC_LOG = $(Growing) ; # Files that grow, but that + # should never change ownership + + SEC_INVARIANT = +tpug ; # Directories that should never + # change permission or ownership + + SIG_LOW = 33 ; # Non-critical files that are of + # minimal security impact + + SIG_MED = 66 ; # Non-critical files that are of + # significant security impact + + SIG_HI = 100 ; # Critical files that are + # significant points of + # vulnerability + + # + # tripwire Binaries + # + ( + rulename = "tripwire Binaries", + severity = $(SIG_HI) + ) + { + $(TWBIN)/siggen -> $(SEC_BIN) ; + $(TWBIN)/tripwire -> $(SEC_BIN) ; + $(TWBIN)/twadmin -> $(SEC_BIN) ; + $(TWBIN)/twprint -> $(SEC_BIN) ; + } + { + /boot -> $(SEC_CRIT) ; + /lib/modules -> $(SEC_CRIT) ; + } + + ( + rulename = "Boot Scripts", + severity = $(SIG_HI) + ) + { + /etc/init.d -> $(SEC_BIN) ; + #/etc/rc.boot -> $(SEC_BIN) ; + /etc/rcS.d -> $(SEC_BIN) ; + /etc/rc0.d -> $(SEC_BIN) ; + /etc/rc1.d -> $(SEC_BIN) ; + /etc/rc2.d -> $(SEC_BIN) ; + /etc/rc3.d -> $(SEC_BIN) ; + /etc/rc4.d -> $(SEC_BIN) ; + /etc/rc5.d -> $(SEC_BIN) ; + /etc/rc6.d -> $(SEC_BIN) ; + } + + ( + rulename = "Root file-system executables", + severity = $(SIG_HI) + ) + { + /bin -> $(SEC_BIN) ; + /sbin -> $(SEC_BIN) ; + } + + # + # Critical Libraries + # + ( + rulename = "Root file-system libraries", + severity = $(SIG_HI) + ) + { + /lib -> $(SEC_BIN) ; + } + + # + # Login and Privilege Raising Programs + # + ( + rulename = "Security Control", + severity = $(SIG_MED) + ) + { + /etc/passwd -> $(SEC_CONFIG) ; + /etc/shadow -> $(SEC_CONFIG) ; + } + { + #/var/lock -> $(SEC_CONFIG) ; + #/var/run -> $(SEC_CONFIG) ; # daemon PIDs + /var/log -> $(SEC_CONFIG) ; + } + + # These files change the behavior of the root account + ( + rulename = "Root config files", + severity = 100 + ) + { + /root -> $(SEC_CRIT) ; # Catch all additions to /root + #/root/mail -> $(SEC_CONFIG) ; + #/root/Mail -> $(SEC_CONFIG) ; + /root/.xsession-errors -> $(SEC_CONFIG) ; + #/root/.xauth -> $(SEC_CONFIG) ; + #/root/.tcshrc -> $(SEC_CONFIG) ; + #/root/.sawfish -> $(SEC_CONFIG) ; + #/root/.pinerc -> $(SEC_CONFIG) ; + #/root/.mc -> $(SEC_CONFIG) ; + #/root/.gnome_private -> $(SEC_CONFIG) ; + #/root/.gnome-desktop -> $(SEC_CONFIG) ; + #/root/.gnome -> $(SEC_CONFIG) ; + #/root/.esd_auth -> $(SEC_CONFIG) ; + # /root/.elm -> $(SEC_CONFIG) ; + #/root/.cshrc -> $(SEC_CONFIG) ; + #/root/.bashrc -> $(SEC_CONFIG) ; + #/root/.bash_profile -> $(SEC_CONFIG) ; + # /root/.bash_logout -> $(SEC_CONFIG) ; + #/root/.bash_history -> $(SEC_CONFIG) ; + #/root/.amandahosts -> $(SEC_CONFIG) ; + #/root/.addressbook.lu -> $(SEC_CONFIG) ; + #/root/.addressbook -> $(SEC_CONFIG) ; + #/root/.Xresources -> $(SEC_CONFIG) ; + #/root/.Xauthority -> $(SEC_CONFIG) -i ; # Changes Inode number on login + /root/.ICEauthority -> $(SEC_CONFIG) ; + } + + # + # Critical devices + # + ( + rulename = "Devices & Kernel information", + severity = $(SIG_HI), + ) + { + #/dev -> $(Device) ; + #/proc -> $(Device) ; + } + +#### tripwire 报告 #### + +**tripwire-check** 命令检查 twpol.txt 文件并基于此文件生成 tripwire 报告如下。如果 twpol.txt 中有任何错误,tripwire 不会生成报告。 + +![tripwire report](http://blog.linoxide.com/wp-content/uploads/2015/11/tripwire-report.png) + +**文本形式报告** + + root@VMdebian:/home/labadmin# tripwire --check + + Parsing policy file: /etc/tripwire/tw.pol + + *** Processing Unix File System *** + + Performing integrity check... + + Wrote report file: /var/lib/tripwire/report/VMdebian-20151024-122322.twr + + Open Source tripwire(R) 2.4.2.2 Integrity Check Report + + Report generated by: root + + Report created on: Sat Oct 24 12:23:22 2015 + + Database last updated on: Never + + Report Summary: + + ========================================================= + + Host name: VMdebian + + Host IP address: 127.0.1.1 + + Host ID: None + + Policy file used: /etc/tripwire/tw.pol + + Configuration file used: /etc/tripwire/tw.cfg + + Database file used: /var/lib/tripwire/VMdebian.twd + + Command line used: tripwire --check + + ========================================================= + + Rule Summary: + + ========================================================= + + ------------------------------------------------------------------------------- + + Section: Unix File System + + ------------------------------------------------------------------------------- + + Rule Name Severity Level Added Removed Modified + + --------- -------------- ----- ------- -------- + + Other binaries 66 0 0 0 + + tripwire Binaries 100 0 0 0 + + Other libraries 66 0 0 0 + + Root file-system executables 100 0 0 0 + + tripwire Data Files 100 0 0 0 + + System boot changes 100 0 0 0 + + (/var/log) + + Root file-system libraries 100 0 0 0 + + (/lib) + + Critical system boot files 100 0 0 0 + + Other configuration files 66 0 0 0 + + (/etc) + + Boot Scripts 100 0 0 0 + + Security Control 66 0 0 0 + + Root config files 100 0 0 0 + + Invariant Directories 66 0 0 0 + + Total objects scanned: 25943 + + Total violations found: 0 + + =========================Object Summary:================================ + + ------------------------------------------------------------------------------- + + # Section: Unix File System + + ------------------------------------------------------------------------------- + + No violations. + + ===========================Error Report:===================================== + + No Errors + + ------------------------------------------------------------------------------- + + *** End of report *** + + Open Source tripwire 2.4 Portions copyright 2000 tripwire, Inc. tripwire is a registered + + trademark of tripwire, Inc. This software comes with ABSOLUTELY NO WARRANTY; + + for details use --version. This is free software which may be redistributed + + or modified only under certain conditions; see COPYING for details. + + All rights reserved. + + Integrity check complete. + +### 总结 ### + +本篇中,我们学习安装配置开源入侵检测软件 tripwire。首先生成基础数据库并通过比较检测出任何改动(文件/文件夹)。然而,tripwire 并不是实时监测的 IDS。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/security/configure-tripwire-ids-debian/ + +作者:[nido][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/naveeda/ + + diff --git a/published/201604/20151114 How to Setup Drone - a Continuous Integration Service in Linux.md b/published/201604/20151114 How to Setup Drone - a Continuous Integration Service in Linux.md new file mode 100644 index 0000000000..a22718badc --- /dev/null +++ b/published/201604/20151114 How to Setup Drone - a Continuous Integration Service in Linux.md @@ -0,0 +1,317 @@ +如何在 linux 上配置持续集成服务 - Drone +============================================================== + +如果你对一次又一次的克隆、构建、测试和部署代码感到厌倦了,可以考虑一下持续集成。持续集成简称 CI,是一种像我们一样的频繁提交的代码库,构建、测试和部署的软件工程实践。CI 可以帮助我们快速的集成新代码到已有的代码库。如果这个过程是自动化进行的,那么就会提高开发的速度,因为这可以减少开发人员手工构建和测试的时间。[Drone][1] 是一个自由开源项目,用来提供一个非常棒的持续集成服务的环境,采用 Apache 2.0 协议发布。它已经集成近很多代码库提供商,比如 Github、Bitbucket 以及 Google Code,它可以从代码库提取代码,使我们可以对包括 PHP, Node, Ruby, Go, Dart, Python, C/C++, JAVA 等等在内的各种语言编译构建。它是如此一个强大的平台,它使用了容器和 docker 技术,这让用户每次构建都可以在保证隔离的条件下完全控制他们自己的构建环境。 + +### 1. 安装 Docker ### + +首先,我们要安装 docker,因为这是 Drone 的工作流的最关键的元素。Drone 合理的利用了 docker 来构建和测试应用。容器技术提高了应用部署的效率。要安装 docker ,我们需要在不同的 linux 发行版本运行下面对应的命令,我们这里会说明 Ubuntu 14.04 和 CentOS 7 两个版本。 + +#### Ubuntu #### + +要在 Ubuntu 上安装 Docker ,我们只需要运行下面的命令。 + + # apt-get update + # apt-get install docker.io + +安装之后我们需要使用`service` 命令重启 docker 引擎。 + + # service docker restart + +然后我们让 docker 在系统启动时自动启动。 + + # update-rc.d docker defaults + + Adding system startup for /etc/init.d/docker ... + /etc/rc0.d/K20docker -> ../init.d/docker + /etc/rc1.d/K20docker -> ../init.d/docker + /etc/rc6.d/K20docker -> ../init.d/docker + /etc/rc2.d/S20docker -> ../init.d/docker + /etc/rc3.d/S20docker -> ../init.d/docker + /etc/rc4.d/S20docker -> ../init.d/docker + /etc/rc5.d/S20docker -> ../init.d/docker + +#### CentOS #### + +第一,我们要更新机器上已经安装的软件包。我们可以使用下面的命令。 + + # sudo yum update + +要在 centos 上安装 docker,我们可以简单的运行下面的命令。 + + # curl -sSL https://get.docker.com/ | sh + +安装好 docker 引擎之后我么只需要简单使用下面的`systemd` 命令启动 docker,因为 centos 7 的默认初始化系统是 systemd。 + + # systemctl start docker + +然后我们要让 docker 在系统启动时自动启动。 + + # systemctl enable docker + + ln -s '/usr/lib/systemd/system/docker.service' '/etc/systemd/system/multi-user.target.wants/docker.service' + +### 2. 安装 SQlite 驱动 ### + +Drone 默认使用 SQlite3 数据库服务器来保存数据和信息。它会在 /var/lib/drone/ 自动创建名为 drone.sqlite 的数据库来处理数据库模式的创建和迁移。要安装 SQlite3 我们要完成以下几步。 + +#### Ubuntu 14.04 #### + +因为 SQlite3 存在于 Ubuntu 14.04 的默认软件库,我们只需要简单的使用 apt 命令安装它。 + + # apt-get install libsqlite3-dev + +#### CentOS 7 #### + +要在 Centos 7 上安装需要使用下面的 yum 命令。 + + # yum install sqlite-devel + +### 3. 安装 Drone ### + +最后,我们安装好依赖的软件,我们现在更进一步的接近安装 Drone。在这一步里我们只简单的从官方链接下载对应的二进制软件包,然后使用默认软件包管理器安装 Drone。 + +#### Ubuntu #### + +我们将使用 wget 从官方的 [Debian 文件下载链接][2]下载 drone 的 debian 软件包。下面就是下载命令。 + + # wget downloads.drone.io/master/drone.deb + + Resolving downloads.drone.io (downloads.drone.io)... 54.231.48.98 + Connecting to downloads.drone.io (downloads.drone.io)|54.231.48.98|:80... connected. + HTTP request sent, awaiting response... 200 OK + Length: 7722384 (7.4M) [application/x-debian-package] + Saving to: 'drone.deb' + 100%[======================================>] 7,722,384 1.38MB/s in 17s + 2015-11-06 14:09:28 (456 KB/s) - 'drone.deb' saved [7722384/7722384] + +下载好之后,我们将使用 dpkg 软件包管理器安装它。 + + # dpkg -i drone.deb + + Selecting previously unselected package drone. + (Reading database ... 28077 files and directories currently installed.) + Preparing to unpack drone.deb ... + Unpacking drone (0.3.0-alpha-1442513246) ... + Setting up drone (0.3.0-alpha-1442513246) ... + Your system ubuntu 14: using upstart to control Drone + drone start/running, process 9512 + +#### CentOS #### + +在 CentOS 机器上我们要使用 wget 命令从[下载链接][3]下载 RPM 包。 + + # wget downloads.drone.io/master/drone.rpm + + --2015-11-06 11:06:45-- http://downloads.drone.io/master/drone.rpm + Resolving downloads.drone.io (downloads.drone.io)... 54.231.114.18 + Connecting to downloads.drone.io (downloads.drone.io)|54.231.114.18|:80... connected. + HTTP request sent, awaiting response... 200 OK + Length: 7763311 (7.4M) [application/x-redhat-package-manager] + Saving to: ‘drone.rpm’ + 100%[======================================>] 7,763,311 1.18MB/s in 20s + 2015-11-06 11:07:06 (374 KB/s) - ‘drone.rpm’ saved [7763311/7763311] + +然后我们使用 yum 安装 rpm 包。 + + # yum localinstall drone.rpm + +### 4. 配置端口 ### + +安装完成之后,我们要先进行配置才能工作起来。drone 的配置文件在**/etc/drone/drone.toml** 。默认情况下 drone 的 web 接口使用的是80,而这也是 http 默认的端口,如果我们修改它,请按下面所示的修改配置文件里 server 块对应的值。 + + [server] + port=":80" + +### 5. 集成 Github ### + +为了运行 Drone 我们必须设置最少一个和 GitHub、GitHub 企业版,Gitlab,Gogs,Bitbucket 关联的集成点。在本文里我们只集成了 github,但是如果我们要集成其他的服务,我们可以在配置文件做修改。为了集成 github 我们需要在github 的设置里创建一个新的应用:https://github.com/settings/developers 。 + +![Registering App Github](http://blog.linoxide.com/wp-content/uploads/2015/11/registering-app-github.png) + +要创建一个应用,我们需要在 `New Application` 页面点击 `Register`,然后如下所示填表。 + +![Registering OAuth app github](http://blog.linoxide.com/wp-content/uploads/2015/11/registering-OAuth-app-github.png) + +我们应该保证在应用的配置项里设置了**授权回调链接**,链接看起来类似 `http://drone.linoxide.com/api/auth/github.com`。然后我们点击注册应用。所有都做好之后我们会看到我们需要在我们的 Drone 配置文件里配置的客户端 ID 和客户端密钥。 + +![Client ID and Secret Token](http://blog.linoxide.com/wp-content/uploads/2015/11/client-id-secret-token.png) + +在这些都完成之后我们需要使用文本编辑器编辑 drone 配置文件,比如使用下面的命令。 + + # nano /etc/drone/drone.toml + +然后我们会在 drone 的配置文件里面找到`[github]` 部分,紧接着的是下面所示的配置内容 + + [github] + client="3dd44b969709c518603c" + secret="4ee261abdb431bdc5e96b19cc3c498403853632a" + # orgs=[] + # open=false + +![Configuring Github Drone](http://blog.linoxide.com/wp-content/uploads/2015/11/configuring-github-drone-e1446835124465.png) + +### 6. 配置 SMTP 服务器 ### + +如果我们想让 drone 使用 email 发送通知,那么我们需要在 SMTP 配置里面设置我们的 SMTP 服务器。如果我们已经有了一个 SMTP 服务,那就只需要简单的使用它的配置文件就行了,但是因为我们没有一个 SMTP 服务器,我们需要安装一个 MTA 比如 Postfix,然后在 drone 配置文件里配置好 SMTP。 + +#### Ubuntu #### + +在 ubuntu 里使用下面的 apt 命令安装 postfix。 + + # apt-get install postfix + +#### CentOS #### + +在 CentOS 里使用下面的 yum 命令安装 postfix。 + + # yum install postfix + +安装好之后,我们需要编辑我们的 postfix 配置文件。 + + # nano /etc/postfix/main.cf + +然后我们要把 myhostname 的值替换为我们自己的 FQDN,比如 drone.linoxide.com。 + + myhostname = drone.linoxide.com + +现在开始配置 drone 配置文件里的 SMTP 部分。 + + # nano /etc/drone/drone.toml + +找到`[smtp]` 部分补充上下面的内容。 + + [smtp] + host = "drone.linoxide.com" + port = "587" + from = "root@drone.linoxide.com" + user = "root" + pass = "password" + +![Configuring SMTP Drone](http://blog.linoxide.com/wp-content/uploads/2015/11/configuring-smtp-drone.png) + +注意:这里的 **user** 和 **pass** 参数强烈推荐一定要改成某个具体用户的配置。 + +### 7. 配置 Worker ### + +如我们所知的 drone 利用了 docker 完成构建、测试任务,我们需要把 docker 配置为 drone 的 worker。要完成这些需要修改 drone 配置文件里的`[worker]` 部分。 + + # nano /etc/drone/drone.toml + +然后取消底下几行的注释并且补充上下面的内容。 + + [worker] + nodes=[ + "unix:///var/run/docker.sock", + "unix:///var/run/docker.sock" + ] + +这里我们只设置了两个节点,这意味着上面的配置文件只能同时执行2 个构建操作。要提高并发性可以增大节点的值。 + + [worker] + nodes=[ + "unix:///var/run/docker.sock", + "unix:///var/run/docker.sock", + "unix:///var/run/docker.sock", + "unix:///var/run/docker.sock" + ] + +使用上面的配置文件 drone 被配置为使用本地的 docker 守护程序可以同时构建4个任务。 + +### 8. 重启 Drone ### + +最后,当所有的安装和配置都准备好之后,我们现在要在本地的 linux 机器上启动 drone 服务器。 + +#### Ubuntu #### + +因为 ubuntu 14.04 使用了 sysvinit 作为默认的初始化系统,所以只需要简单执行下面的 service 命令就可以启动 drone 了。 + + # service drone restart + +要让 drone 在系统启动时也自动运行,需要运行下面的命令。 + + # update-rc.d drone defaults + +#### CentOS #### + +因为 CentOS 7使用 systemd 作为初始化系统,所以只需要运行下面的 systemd 命令就可以重启 drone。 + + # systemctl restart drone + +要让 drone 自动运行只需要运行下面的命令。 + + # systemctl enable drone + +### 9. 添加防火墙例外规则 ### + +众所周知 drone 默认使用了80 端口而我们又没有修改它,所以我们需要配置防火墙程序允许80 端口(http)开放并允许其他机器可以通过网络连接。 + +#### Ubuntu 14.04 #### + +iptables 是最流行的防火墙程序,并且 ubuntu 默认安装了它。我们需要修改 iptable 以暴露端口80,这样我们才能让 drone 的 web 界面在网络上被大家访问。 + + # iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT + # /etc/init.d/iptables save + +#### CentOS 7 #### + +因为 CentOS 7 默认安装了 systemd,它使用 firewalld 作为防火墙程序。为了在 firewalld 上打开80端口(http 服务),我们需要执行下面的命令。 + + # firewall-cmd --permanent --add-service=http + + success + + # firewall-cmd --reload + + success + +### 10. 访问 web 界面 ### + +现在我们将在我们最喜欢的浏览器上通过 web 界面打开 drone。要完成这些我们要把浏览器指向运行 drone 的服务器。因为 drone 默认使用80 端口而我们有没有修改过,所以我们只需要在浏览器里根据我们的配置输入`http://ip-address/` 或 `http://drone.linoxide.com` 就行了。在我们正确的完成了上述操作后,我们就可以看到登录界面了。 + +![Login Github Drone](http://blog.linoxide.com/wp-content/uploads/2015/11/login-github-drone-e1446834688394.png) + +因为在上面的步骤里配置了 Github,我们现在只需要简单的选择 github 然后进入应用授权步骤,这些完成后我们就可以进入工作台了。 + +![Drone Dashboard](http://blog.linoxide.com/wp-content/uploads/2015/11/drone-dashboard.png) + +这里它会同步我们在 github 上的代码库,然后询问我们要在 drone 上构建那个代码库。 + +![Activate Repository](http://blog.linoxide.com/wp-content/uploads/2015/11/activate-repository-e1446835574595.png) + +这一步完成后,它会询问我们在代码库里添加`.drone.yml` 文件的新名称,并且在这个文件里定义构建的过程和配置项,比如使用那个 docker 镜像,执行那些命令和脚本来编译,等等。 + +我们按照下面的内容来配置我们的`.drone.yml`。 + + image: python + script: + - python helloworld.py + - echo "Build has been completed." + +这一步完成后我们就可以使用 drone 应用里的 YAML 格式的配置文件来构建我们的应用了。所有对代码库的提交和改变此时都会同步到这个仓库。一旦提交完成了,drone 就会自动开始构建。 + +![Building Application Drone](http://blog.linoxide.com/wp-content/uploads/2015/11/building-application-drone.png) + +所有操作都完成后,我们就能在终端看到构建的结果了。 + +![Build Success Drone](http://blog.linoxide.com/wp-content/uploads/2015/11/build-success-drone.png) + +### 总结 ### + +在本文中我们学习了如何安装一个可以工作的使用 drone 的持续集成平台。如果我们愿意我们甚至可以从 drone.io 官方提供的服务开始工作。我们可以根据自己的需求从免费的服务或者收费服务开始。它通过漂亮的 web 界面和强大的功能改变了持续集成的世界。它可以集成很多第三方应用和部署平台。如果你有任何问题、建议可以直接反馈给我们,谢谢。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/setup-drone-continuous-integration-linux/ + +作者:[Arun Pyasi][a] +译者:[ezio](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://drone.io/ +[2]:http://downloads.drone.io/master/drone.deb +[3]:http://downloads.drone.io/master/drone.rpm +[4]:https://github.com/settings/developers diff --git a/published/201604/20151119 Going Beyond Hello World Containers is Hard Stuff.md b/published/201604/20151119 Going Beyond Hello World Containers is Hard Stuff.md new file mode 100644 index 0000000000..f4e7b89720 --- /dev/null +++ b/published/201604/20151119 Going Beyond Hello World Containers is Hard Stuff.md @@ -0,0 +1,329 @@ +从 Hello World 容器进阶是件困难的事情 +================================================================================ + +在[我的上一篇文章里][1], 我介绍了 Linux 容器背后的技术的概念。我写了我知道的一切。容器对我来说也是比较新的概念。我写这篇文章的目的就是鼓励我真正的来学习这些东西。 + +我打算在使用中学习。首先实践,然后上手并记录下我是怎么走过来的。我假设这里肯定有很多像 "Hello World" 这种类型的知识帮助我快速的掌握基础。然后我能够更进一步,构建一个微服务容器或者其它东西。 + +我想,它应该不会有多难的。 + +但是我错了。 + +可能对某些人来说这很简单,因为他们在运维工作方面付出了大量的时间。但是对我来说实际上是很困难的,可以从我在Facebook 上的状态展示出来的挫折感就可以看出了。 + +但是还有一个好消息:我最终搞定了。而且它工作的还不错。所以我准备分享向你分享我如何制作我的第一个微服务容器。我的痛苦可能会节省你不少时间呢。 + +如果你曾经发现你也处于过这种境地,不要害怕:像我这样的人都能搞定,所以你也肯定行。 + +让我们开始吧。 + +### 一个缩略图微服务 ### + +我设计的微服务在理论上很简单。以 JPG 或者 PNG 格式在 HTTP 终端发布一张数字照片,然后获得一个100像素宽的缩略图。 + +下面是它的流程: + +![container-diagram-0](https://deis.com/images/blog-images/containers-hard-0.png) + +我决定使用 NodeJS 作为我的开发语言,使用 [ImageMagick][2] 来转换缩略图。 + +我的服务的第一版的逻辑如下所示: + +![container-diagram-1](https://deis.com/images/blog-images/containers-hard-1.png) + +我下载了 [Docker Toolbox][3],用它安装了 Docker 的快速启动终端(Docker Quickstart Terminal)。Docker 快速启动终端使得创建容器更简单了。终端会启动一个装好了 Docker 的 Linux 虚拟机,它允许你在一个终端里运行 Docker 命令。 + +虽然在我的例子里,我的操作系统是 Mac OS X。但是 Windows 下也有相同的工具。 + +我准备使用 Docker 快速启动终端里为我的微服务创建一个容器镜像,然后从这个镜像运行容器。 + +Docker 快速启动终端就运行在你使用的普通终端里,就像这样: + +![container-diagram-2](https://deis.com/images/blog-images/containers-hard-2.png) + +### 第一个小问题和第一个大问题### + +我用 NodeJS 和 ImageMagick 瞎搞了一通,然后让我的服务在本地运行起来了。 + +然后我创建了 Dockerfile,这是 Docker 用来构建容器的配置脚本。(我会在后面深入介绍构建过程和 Dockerfile) + +这是我运行 Docker 快速启动终端的命令: + + $ docker build -t thumbnailer:0.1 + +获得如下回应: + + docker: "build" requires 1 argument. + +呃。 + +我估摸着过了15分钟我才反应过来:我忘记了在末尾参数输入一个点`.`。 + +正确的指令应该是这样的: + + $ docker build -t thumbnailer:0.1 . + +但是这不是我遇到的最后一个问题。 + +我让这个镜像构建好了,然后我在 Docker 快速启动终端输入了 [`run` 命令][4]来启动容器,名字叫 `thumbnailer:0.1`: + + $ docker run -d -p 3001:3000 thumbnailer:0.1 + +参数 `-p 3001:3000` 让 NodeJS 微服务在 Docker 内运行在端口3000,而绑定在宿主主机上的3001。 + +到目前看起来都很好,对吧? + +错了。事情要马上变糟了。 + +我通过运行 `docker-machine` 命令为这个 Docker 快速启动终端里创建的虚拟机指定了 ip 地址: + + $ docker-machine ip default + +这句话返回了默认虚拟机的 IP 地址,它运行在 Docker 快速启动终端里。在我这里,这个 ip 地址是 192.168.99.100。 + +我浏览网页 http://192.168.99.100:3001/ ,然后找到了我创建的上传图片的网页: + +![container-diagram-3](https://deis.com/images/blog-images/containers-hard-3.png) + +我选择了一个文件,然后点击上传图片的按钮。 + +但是它并没有工作。 + +终端告诉我他无法找到我的微服务需要的 `/upload` 目录。 + +现在,你要知道,我已经在此耗费了将近一天的时间-从浪费时间到研究问题。我此时感到了一些挫折感。 + +然后灵光一闪。某人记起来微服务不应该自己做任何数据持久化的工作!保存数据应该是另一个服务的工作。 + +所以容器找不到目录 `/upload` 的原因到底是什么?这个问题的根本就是我的微服务在基础设计上就有问题。 + +让我们看看另一幅图: + +![container-diagram-4](https://deis.com/images/blog-images/containers-hard-4.png) + +我为什么要把文件保存到磁盘?微服务按理来说是很快的。为什么不能让我的全部工作都在内存里完成?使用内存缓冲可以解决“找不到目录”这个问题,而且可以提高我的应用的性能。 + +这就是我现在所做的。下面是我的计划: + +![container-diagram-5](https://deis.com/images/blog-images/containers-hard-5.png) + +这是我用 NodeJS 写的在内存运行、生成缩略图的代码: + + // Bind to the packages + var express = require('express'); + var router = express.Router(); + var path = require('path'); // used for file path + var im = require("imagemagick"); + + // Simple get that allows you test that you can access the thumbnail process + router.get('/', function (req, res, next) { + res.status(200).send('Thumbnailer processor is up and running'); + }); + + // This is the POST handler. It will take the uploaded file and make a thumbnail from the + // submitted byte array. I know, it's not rocket science, but it serves a purpose + router.post('/', function (req, res, next) { + req.pipe(req.busboy); + req.busboy.on('file', function (fieldname, file, filename) { + var ext = path.extname(filename) + + // Make sure that only png and jpg is allowed + if(ext.toLowerCase() != '.jpg' && ext.toLowerCase() != '.png'){ + res.status(406).send("Service accepts only jpg or png files"); + } + + var bytes = []; + + // put the bytes from the request into a byte array + file.on('data', function(data) { + for (var i = 0; i < data.length; ++i) { + bytes.push(data[i]); + } + console.log('File [' + fieldname + '] got bytes ' + bytes.length + ' bytes'); + }); + + // Once the request is finished pushing the file bytes into the array, put the bytes in + // a buffer and process that buffer with the imagemagick resize function + file.on('end', function() { + var buffer = new Buffer(bytes,'binary'); + console.log('Bytes got ' + bytes.length + ' bytes'); + + //resize + im.resize({ + srcData: buffer, + height: 100 + }, function(err, stdout, stderr){ + if (err){ + throw err; + } + // get the extension without the period + var typ = path.extname(filename).replace('.',''); + res.setHeader("content-type", "image/" + typ); + res.status(200); + // send the image back as a response + res.send(new Buffer(stdout,'binary')); + }); + }); + }); + }); + + module.exports = router; + +好了,一切回到了正轨,已经可以在我的本地机器正常工作了。我该去休息了。 + +但是,在我测试把这个微服务当作一个普通的 Node 应用运行在本地时... + +![Containers Hard](https://deis.com/images/blog-images/containers-hard-6.png) + +它工作的很好。现在我要做的就是让它在容器里面工作。 + +第二天我起床后喝点咖啡,然后创建一个镜像——这次没有忘记那个"."! + + $ docker build -t thumbnailer:01 . + +我从缩略图项目的根目录开始构建。构建命令使用了根目录下的 Dockerfile。它是这样工作的:把 Dockerfile 放到你想构建镜像的地方,然后系统就默认使用这个 Dockerfile。 + +下面是我使用的Dockerfile 的内容: + + FROM ubuntu:latest + MAINTAINER bob@CogArtTech.com + + RUN apt-get update + RUN apt-get install -y nodejs nodejs-legacy npm + RUN apt-get install imagemagick libmagickcore-dev libmagickwand-dev + RUN apt-get clean + + COPY ./package.json src/ + + RUN cd src && npm install + + COPY . /src + + WORKDIR src/ + + CMD npm start + +这怎么可能出错呢? + +### 第二个大问题 ### + +我运行了 `build` 命令,然后出了这个错: + + Do you want to continue? [Y/n] Abort. + + The command '/bin/sh -c apt-get install imagemagick libmagickcore-dev libmagickwand-dev' returned a non-zero code: 1 + +我猜测微服务出错了。我回到本地机器,从本机启动微服务,然后试着上传文件。 + +然后我从 NodeJS 获得了这个错误: + + Error: spawn convert ENOENT + +怎么回事?之前还是好好的啊! + +我搜索了我能想到的所有的错误原因。差不多4个小时后,我想:为什么不重启一下机器呢? + +重启了,你猜猜结果?错误消失了!(LCTT 译注:万能的“重启试试”) + +继续。 + +### 将精灵关进瓶子里 ### + +跳回正题:我需要完成构建工作。 + +我使用 [`rm` 命令][5]删除了虚拟机里所有的容器。 + + $ docker rm -f $(docker ps -a -q) + +`-f` 在这里的用处是强制删除运行中的镜像。 + +然后删除了全部 Docker 镜像,用的是[命令 `rmi`][6]: + + $ docker rmi if $(docker images | tail -n +2 | awk '{print $3}') + +我重新执行了重新构建镜像、安装容器、运行微服务的整个过程。然后过了一个充满自我怀疑和沮丧的一个小时,我告诉我自己:这个错误可能不是微服务的原因。 + +所以我重新看到了这个错误: + + Do you want to continue? [Y/n] Abort. + + The command '/bin/sh -c apt-get install imagemagick libmagickcore-dev libmagickwand-dev' returned a non-zero code: 1 + +这太打击我了:构建脚本好像需要有人从键盘输入 Y! 但是,这是一个非交互的 Dockerfile 脚本啊。这里并没有键盘。 + +回到 Dockerfile,脚本原来是这样的: + + RUN apt-get update + RUN apt-get install -y nodejs nodejs-legacy npm + RUN apt-get install imagemagick libmagickcore-dev libmagickwand-dev + RUN apt-get clean + +第二个`apt-get` 忘记了`-y` 标志,它用于自动应答提示所需要的“yes”。这才是错误的根本原因。 + +我在这条命令后面添加了`-y` : + + RUN apt-get update + RUN apt-get install -y nodejs nodejs-legacy npm + RUN apt-get install -y imagemagick libmagickcore-dev libmagickwand-dev + RUN apt-get clean + +猜一猜结果:经过将近两天的尝试和痛苦,容器终于正常工作了!整整两天啊! + +我完成了构建工作: + + $ docker build -t thumbnailer:0.1 . + +启动了容器: + + $ docker run -d -p 3001:3000 thumbnailer:0.1 + +获取了虚拟机的IP 地址: + + $ docker-machine ip default + +在我的浏览器里面输入 http://192.168.99.100:3001/ : + +上传页面打开了。 + +我选择了一个图片,然后得到了这个: + +![container-diagram-7](https://deis.com/images/blog-images/containers-hard-7.png) + +工作了! + +在容器里面工作了,我的第一次啊! + +### 这让我学到了什么? ### + +很久以前,我接受了这样一个道理:当你刚开始尝试某项技术时,即使是最简单的事情也会变得很困难。因此,我不会把自己当成最聪明的那个人,然而最近几天尝试容器的过程就是一个充满自我怀疑的旅程。 + +但是你想知道一些其它的事情吗?这篇文章是我在凌晨2点完成的,而每一个受折磨的时刻都值得了。为什么?因为这段时间你将自己全身心投入了喜欢的工作里。这件事很难,对于所有人来说都不是很容易就获得结果的。但是不要忘记:你在学习技术,运行世界的技术。 + +P.S. 了解一下Hello World 容器的两段视频,这里会有 [Raziel Tabib’s][7] 的精彩工作内容。 + +注:youtube视频 + + +千万被忘记第二部分... + +注:youtube视频 + + +-------------------------------------------------------------------------------- + +via: https://deis.com/blog/2015/beyond-hello-world-containers-hard-stuff + +作者:[Bob Reselman][a] +译者:[Ezio](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://deis.com/blog +[1]:https://linux.cn/article-6594-1.html +[2]:https://github.com/rsms/node-imagemagick +[3]:https://www.docker.com/toolbox +[4]:https://docs.docker.com/reference/commandline/run/ +[5]:https://docs.docker.com/reference/commandline/rm/ +[6]:https://docs.docker.com/reference/commandline/rmi/ +[7]:http://twitter.com/RazielTabib diff --git a/published/201604/20151126 Microsoft and Linux--True Romance or Toxic Love.md b/published/201604/20151126 Microsoft and Linux--True Romance or Toxic Love.md new file mode 100644 index 0000000000..4499e7273f --- /dev/null +++ b/published/201604/20151126 Microsoft and Linux--True Romance or Toxic Love.md @@ -0,0 +1,77 @@ +微软和 Linux :真正的浪漫还是有毒的爱情? +================================================================================ +时不时的我们会读到一个能让你喝咖啡呛到或者把热拿铁喷到你显示器上的新闻故事。微软最近宣布的对 Linux 的钟爱就是这样一个鲜明的例子。 + +从常识来讲,微软和自由开源软件(FOSS)运动就是恒久的敌人。在很多人眼里,微软体现了过分的贪婪,而这正为自由开源软件运动(FOSS)所拒绝。另外,之前微软就已经给自由开源软件社区贴上了"一伙强盗"的标签。 + +我们能够理解为什么微软一直以来都害怕免费的操作系统。免费操作系统结合挑战微软核心产品线的开源应用时,就威胁到了微软在台式机和笔记本电脑市场的控制地位。 + +尽管微软有对在台式机主导地位的担忧,在网络服务器市场 Linux 却有着最高的影响力。今天,大多数的服务器都是 Linux 系统。包括世界上最繁忙的站点服务器。对微软来说,看到这么多无法装到兜里的许可证的营收一定是非常痛苦的。 + +掌上设备是微软输给自由软件的另一个领域。曾几何时,微软的 Windows CE 和 Pocket PC 操作系统走在移动计算的前沿。Windows PDA 设备是最闪亮的和豪华的产品。但是这一切在苹果公司发布了iphone之后都结束了。从那时起,安卓就开始进入公众视野,Windows 的移动产品开始被忽略被遗忘。而安卓平台是建立在自由开源的组件的基础上的。 + +由于安卓平台的开放性,安卓的市场份额在迅速扩大。不像 IOS,任何一个手机制造商都可以发布安卓手机。也不像Windows 手机,安卓没有许可费用。这对消费者来说是件好事。这也导致了许多强大却又价格低廉的手机制造商在世界各地涌现。这非常明确的证明了自由开源软件(FOSS)的价值。 + +在服务器和移动计算的角逐中失利对微软来说是非常惨重的损失。考虑一下服务器和移动计算这两个加起来所占有的市场大小,台式机市场似乎是死水一潭。没有人喜欢失败,尤其是涉及到金钱。并且,微软确实有许多东西正在慢慢失去。你可能期望着微软自尝苦果。在过去,确实如此。 + +微软使用了各种可以支配的手段来对 Linux 和自由开源软件(FOSS)进行反击,从宣传到专利威胁。尽管这种攻击确实减慢了适配 Linux 的步伐,但却从来没有让 Linux 的脚步停下。 + +所以,当微软在开源大会和重大事件上拿出印有“Microsoft Loves Linux”的T恤和徽章时,请原谅我们表现出来的震惊。这是真的吗?微软真的爱 Linux ? + +当然,公关的口号和免费的T恤并不代表真理。行动胜于雄辩。当你思考一下微软的行动时,微软的立场就变得有点模棱两可了。 + +一方面,微软招募了几百名 Linux 开发者和系统管理员。将 .NET 核心框架作为一个开源的项目进行了发布,并提供了跨平台的支持(这样 .NET 就可以跑在 OS X 和 Linux 上了)。并且,微软与 Linux 公司合作把最流行的发行版本放到了 Azure 平台上。事实上,微软已经走的如此之远以至于要为 Azure 数据中心开发自己的 Linux 发行版了。 + +另一方面,微软继续直接通过法律或者傀儡公司来对开源项目进行攻击。很明显,微软在与自由软件的所有权较量上并没有发自内心的进行大的道德转变。那为什么要公开申明对 Linux 的钟爱之情呢? + +一个显而易见的事实:微软是一个经营性实体。对股东来说是一个投资工具,对雇员来说是收入来源。微软所做的只有一个终极目标:盈利。微软并没有表现出来爱或者恨(尽管这是一个最常见的指控)。 + +所以问题不应该是"微软真的爱 Linux 吗?"相反,我们应该问,微软是怎么从这一切中获利的。 + +让我们以 .NET 核心框架的开源发行为例。这一举动使得 .NET 的运行时环境移植到任何平台都很轻松。这使得微软的 .NET 框架所涉及到的范围远远大于 Windows 平台。 + +开放 .NET 的核心包,最终使得 .NET 开发者开发跨平台的 app 成为可能,比如 OS X、Linux 甚至安卓——都基于同一个核心代码库。 + +从开发者角度来讲,这使得 .NET 框架比之前更有吸引力了。能够从单一的代码库触及到多个平台,使得使用 .NET 框架开发的任何 app 戏剧性的扩大了潜在的目标市场。 + +另外,一个强大的开源社区能够提供给开发者一些代码来在他们自己的项目中进行复用。所以,开源项目的可利用性也将会成就 .NET 框架。 + +更进一步讲,开放 .NET 的核心代码能够减少跨越不同平台所产生的碎片,意味着对消费者来说有对 app 更广的选择。无论是开源软件还是专用的 app,都有更多的选择。 + +从微软的角度来讲,会得到一队开发者大军。微软可以通过销售培训、证书、技术支持、开发者工具(包括 Visual Studio)和应用扩展来获利。 + +我们应该自问的是,这对自由软件社区有利还是有弊? + +.NET 框架的大范围适用意味着许多参与竞争的开源项目的消亡,迫使我们会跟着微软的节奏走下去。 + +先抛开 .NET 不谈,微软正在花费大量的精力在 Azure 云计算平台对 Linux 的支持上。要记得,Azure 最初是 Windows 的 Azure。Windows 服务器是唯一能够支持 Azure 的操作系统。今天,Azure 也提供了对多个 Linux 发行版的支持。 + +关于此,有一个原因:付费给需要或者想要 Linux 服务的顾客。如果微软不提供 Linux 虚拟机,那些顾客就会跟别人合作了。 + +看上去好像是微软意识到“Linux 就在这里”的这样一个现实。微软不能真正的消灭它,所以必须接收它。 + +这又把我们带回到那个问题:关于微软和 Linux 为什么有这么多的流言?我们在谈论这个问题,因为微软希望我们思考这个问题。毕竟,所有这些谈资都会追溯到微软,不管是在新闻稿、博客还是会议上的公开声明。微软在努力吸引大家对其在 Linux 专业知识方面的注意力。 + +首席架构师 Kamala Subramaniam 的博文声明 Azure Cloud Switch 背后的其他企图会是什么?ACS 是一个定制的 Linux 发行版。微软用它来对 Azure 数据中心的交换机硬件进行自动配置。 + +ACS 不是公开的。它是用于 Azure 内部使用的。别人也不太可能找到这个发行版其他的用途。事实上,Subramaniam 在她的博文中也表述了同样的观点。 + +所以,微软不会通过卖 ACS 来获利,也不会通过赠送它而增加用户基数。相反,微软在 Linux 和 Azure 上花费精力,以加强其在 Linux 云计算平台方面的地位。 + +微软最近迷上 Linux 对社区来说是好消息吗? + +我们不应该慢慢忘记微软的“拥抱、扩展、消灭(Embrace, Extend and Exterminate)”的诅咒。现在,微软处在拥抱 Linux 的初期阶段。微软会通过定制扩展和专有“标准”来分裂社区吗? + +发表评论吧,让我们知道你是怎么想的。 + +-------------------------------------------------------------------------------- + +via: http://www.linuxjournal.com/content/microsoft-and-linux-true-romance-or-toxic-love-0 + +作者:[James Darvell][a] +译者:[sonofelice](https://github.com/sonofelice) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxjournal.com/users/james-darvell \ No newline at end of file diff --git a/published/201604/20160212 How to Add New Disk in Linux CentOS 7 Without Rebooting.md b/published/201604/20160212 How to Add New Disk in Linux CentOS 7 Without Rebooting.md new file mode 100644 index 0000000000..cc4d031bc1 --- /dev/null +++ b/published/201604/20160212 How to Add New Disk in Linux CentOS 7 Without Rebooting.md @@ -0,0 +1,172 @@ +如何在 CentOS 7 中添加新磁盘而不用重启系统 +================================================================================ + +对大多数系统管理员来说扩充 Linux 服务器的磁盘空间是日常的工作之一。因此这篇文章会通过使用 Linux 命令,在 CentOS 7 系统上演示一些简单的操作步骤来扩充您的磁盘空间而不需要重启您的生产服务器。关于扩充和增加新的磁盘到 Linux 系统,我们会提及多种方法和多种可行性,可按您所需选择最适用的一种。 + +### 1. 在虚拟机客户端扩充磁盘空间: ### + +在为 Linux 系统增加磁盘卷之前,您首先需要添加一块新的物理磁盘,或在 VMware vShere、VMware 工作站以及你使用的其它虚拟环境软件中进行设置来增加一块虚拟磁盘的容量。 + +![Increase disk](http://blog.linoxide.com/wp-content/uploads/2016/02/1.png) + +### 2. 检查磁盘空间: ### + +运行如下命令来检查当前磁盘空间大小。 + + # df -h + # fdisk -l + +![Fdisk check](http://blog.linoxide.com/wp-content/uploads/2016/02/2.png) + +可以看到,虽然我们已经在后端给其增加到 50 GB 的空间,但此时的总磁盘大小仍然为 10 GB。 + +### 3. 扩展空间而无需重启虚拟机 ### + +现在运行如下命令,通过重新扫描 SCSI (注:Small Computer System Interface 小型计算机系统接口)总线并添加 SCSI 设备,系统就可以扩展操作系统的物理卷磁盘空间,而且不需要重启虚拟机。 + + # ls /sys/class/scsi_host/ + # echo "- - -" > /sys/class/scsi_host/host0/scan + # echo "- - -" > /sys/class/scsi_host/host1/scan + # echo "- - -" > /sys/class/scsi_host/host2/scan + +使用下面的命令来检查 SCSI 设备的名称,然后重新扫描 SCSI 总线。 + + # ls /sys/class/scsi_device/ + # echo 1 > /sys/class/scsi_device/0\:0\:0\:0/device/rescan + # echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan + +如下图所示,会重新扫描 SCSI 总线,随后我们在虚拟机客户端设置的磁盘大小会正常显示。 + +![Rescan disk device](http://blog.linoxide.com/wp-content/uploads/2016/02/3.png) + +### 4. 创建新磁盘分区: ### + +一旦在系统中可以看到扩展的磁盘空间,就可以运行如下命令来格式化您的磁盘以创建一个新的分区。请按如下操作步骤来扩充您的物理磁盘卷。 + + # fdisk /dev/sda + Welcome to fdisk (util-linux 2.23.2) press the 'm' key for help + Command (m for help): m + Command action + a toggle a bootable flag + b edit bsd disklabel + c toggle the dos compatibility flag + d delete a partition + g create a new empty GPT partition table + G create an IRIX (SGI) partition table + l list known partition types + m print this menu + n add a new partition + o create a new empty DOS partition table + p print the partition table + q quit without saving changes + s create a new empty Sun disklabel + t change a partition's system id + u change display/entry units + v verify the partition table + w write table to disk and exit + x extra functionality (experts only) + + Command (m for help): + +键入 'p' 来查看当前的分区表信息,然后键入 'n' 键来创建一个新的主分区,选择所有可用的扇区。 使用 't' 命令改变磁盘类型为 'Linux LVM',然后选择编码 '8e' 或者默认不选,它默认的类型编码为 '83'。 + +现在输入 'w' 来保存分区表信息并且退出命令环境,如下示: + + Command (m for help): w + The partition table has been altered! + + Calling ioctl() to re-read partition table. + + WARNING: Re-reading the partition table failed with error 16: Device or resource busy. + The kernel still uses the old table. The new table will be used at + the next reboot or after you run partprobe(8) or kpartx(8) + +![New disk Volume](http://blog.linoxide.com/wp-content/uploads/2016/02/3A.png) + +### 5. 创建物理卷: ### + +根据上述提示,运行 'partprob' 或 'kpartx' 命令以使分区表生效,然后使用如下的命令来创建新的物理卷。 + + # partprobe + # pvresize /dev/sda3 + +要检查新创建的卷,运行如下的命令可以看出新的物理卷是否已经被创建,是否可用。接下来,我们就可以使用这个新的物理卷来扩展 'centos' 卷组了,如下示: + + # pvdisplay + # vgextend centos /dev/sda3 + +![Extend volume Group](http://blog.linoxide.com/wp-content/uploads/2016/02/3B.png) + +### 6. 扩展逻辑卷: ### + +现在我们使用如下的命令扩展逻辑卷,以增加我们系统正使用的磁盘空间。 + + # lvextend -L +40G /dev/mapper/centos-root + +一旦返回增加成功的消息,就可以运行如下命令来扩展您的逻辑卷大小。 + + # xfs_growfs /dev/mapper/centos-root + +'/' 分区的大小已经成功的增加了,可以使用 'df' 命令来检查您磁盘驱动器的大小。如图示。 + +![Increase disk space](http://blog.linoxide.com/wp-content/uploads/2016/02/3C.png) + +### 7. 通过增加新的磁盘来扩充根分区而不用重启系统: ### + +这是第二种方法,它使用的命令非常简单, 用来增加 CentOS 7 系统上逻辑卷空间大小。 + +所以第一步是打开您的虚拟机客户端的设置页面,点击 ‘增加’ 按纽,然后继续下一步操作。 + +![Add new disk](http://blog.linoxide.com/wp-content/uploads/2016/02/3D.png) + +选择新磁盘所需要的配置信息,如下图所示的,选择新磁盘的大小和它的类型。 + +![New disk setup](http://blog.linoxide.com/wp-content/uploads/2016/02/3E.png) + +然后进入服务端重复如下的命令来扫描您的磁盘设备,以使新磁盘在系统中可见。 + + # echo "- - -" > /sys/class/scsi_host/host0/scan + # echo "- - -" > /sys/class/scsi_host/host1/scan + # echo "- - -" > /sys/class/scsi_host/host2/scan + +列出您的 SCSI 设备的名称: + + # ls /sys/class/scsi_device/ + # echo 1 > /sys/class/scsi_device/1\:0\:0\:0/device/rescan + # echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan + # echo 1 > /sys/class/scsi_device/3\:0\:0\:0/device/rescan + # fdisk -l + +![Scanning new disk](http://blog.linoxide.com/wp-content/uploads/2016/02/3F.png) + +一旦新增的磁盘可见,就可以运行下面的命令来创建新的物理卷,然后增加到卷组,如下示。 + + # pvcreate /dev/sdb + # vgextend centos /dev/sdb + # vgdisplay + +![Extending Volume Group](http://blog.linoxide.com/wp-content/uploads/2016/02/3G.png) + +现在根据此磁盘的空间大小来扩展逻辑卷,然后添加到根分区。 + + # lvextend -L +20G /dev/mapper/centos-root + # xfs_growfs /dev/mapper/centos-root + # df -h + +![Increase / Partition](http://blog.linoxide.com/wp-content/uploads/2016/02/3H.png) + +### 结论: ### + +在 Linux CentOS 7 系统上管理磁盘分区的操作过程是非常简单的,可以使用这篇文章所述的操作步骤来扩充您的任意逻辑卷的磁盘空间。您不需要重启生产线上的服务器,只是简单的重扫描下 SCSI 设备,和扩展您想要的 LVM(逻辑卷管理)。我们希望这文章对您有用。请随意的发表有用的评论和建议。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/add-new-disk-centos-7-without-rebooting/ + +作者:[Kashif S][a] +译者:[runningwater](https://github.com/runningwater) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/kashifs/ \ No newline at end of file diff --git a/published/201604/20160220 Make Sudo Insult User For Each Incorrect Password Attempt.md b/published/201604/20160220 Make Sudo Insult User For Each Incorrect Password Attempt.md new file mode 100644 index 0000000000..973c95b666 --- /dev/null +++ b/published/201604/20160220 Make Sudo Insult User For Each Incorrect Password Attempt.md @@ -0,0 +1,58 @@ +输错密码?这个 sudo 会“嘲讽”你 +=========================================================== + +你在 Linux 终端中会有很多的乐趣。我今天要讲的不是在[终端中跑火车](http://itsfoss.com/ubuntu-terminal-train/)。 + +我今天要讲的技巧可以放松你的心情。前面一篇文章中,你学习了[如何在命令行中增加 sudo 命令的超时](http://itsfoss.com/change-sudo-password-timeout-ubuntu/)。今天的文章中,我会向你展示如何让 sudo 在输错密码的时候“嘲讽”你(或者其他人)。 + +对我讲的感到疑惑?这里,让我们看下这张 gif 来了解下 sudo 是如何在你输错密码之后“嘲讽”你的。 + +![](http://itsfoss.com/wp-content/uploads/2016/02/sudo-insults-Linux.gif) + +那么,为什么要这么做?毕竟,“嘲讽”不会让你的一天开心,不是么? + +对我来说,一点小技巧都是有趣的,并且要比以前的“密码错误”的错误提示更有趣。另外,我可以向我的朋友展示来逗弄他们(这个例子中是通过自由开源软件)。我很肯定你有你自己的理由来使用这个技巧的。 + +## 在 sudo 中启用“嘲讽” + +你可以在`sudo`配置中增加下面的行来启用“嘲讽”功能: + +``` +Defaults insults +``` + +让我们看看该如何做。打开终端并使用下面的命令: + +``` +sudo visudo +``` + +这会在 [nano](http://www.nano-editor.org/)中打开配置文件。 + +> 是的,我知道传统的 ‘visudo’ 应该在 vi 中打开 `/etc/sudoers` 文件,但是 Ubuntu 及基于它的发行版会使用 nano 打开。由于我们在讨论vi,这里有一份 [vi 速查表](http://itsfoss.com/download-vi-cheat-sheet)可以在你决定使用 vi 的时候使用。 + +回到编辑 sudeors 文件界面,你需要找出 Defaults 所在的行。简单的很,只需要在文件的开头加上`Defaults insults`,就像这样: + +![](http://itsfoss.com/wp-content/uploads/2016/02/sudo-insults-Linux-Mint.png) + +如果你正在使用 nano,使用`Ctrl+X`来退出编辑器。在退出的时候,它会询问你是否保存更改。要保存更改,按下“Y”。 + +一旦你保存了 sudoers 文件之后,打开终端并使用 sudo 运行各种命令。故意输错密码并享受嘲讽吧:) + +sudo 可能会生气的。看见没,他甚至在我再次输错之后威胁我。哈哈。 + +![](http://itsfoss.com/wp-content/uploads/2016/02/sudo-insults-Linux-Mint-1.jpeg) + +如果你喜欢这个终端技巧,你也可以查看[其他终端技巧的文章](http://itsfoss.com/category/terminal-tricks/)。如果你有其他有趣的技巧,在评论中分享。 + +------------------------------------------------------------------------------ + +via: http://itsfoss.com/sudo-insult-linux/ + +作者:[ABHISHEK][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ diff --git a/published/201604/20160223 BeeGFS Parallel File System Goes Open Source.md b/published/201604/20160223 BeeGFS Parallel File System Goes Open Source.md new file mode 100644 index 0000000000..6c9691b5c6 --- /dev/null +++ b/published/201604/20160223 BeeGFS Parallel File System Goes Open Source.md @@ -0,0 +1,32 @@ +并行文件系统 BeeGFS 现已开源 +================================================== + +![](http://insidehpc.com/wp-content/uploads/2015/08/beegfs.jpg) + +2月23日 ThinkParQ 宣布完整的 [BeeGFS 并行文件系统][1] 的源码现已开源。由于 BeeGFS 是专为要求性能的环境开发的,所以它在开发时十分注重安装的简易性以及高度灵活性,包括融合了在存储服务器同时做计算任务时需要的设置。随着系统中的服务器以及存储设备的增加,文件系统的容量以及性能将是需求的拓展点,无论是小型集群还是多达上千个节点的企业级系统。 + +官方第一次声明开放 BeeGFS 的源码是在 2013 年的国际超级计算大会上发布的。这个声明是在欧洲的百亿亿次级超算项目 [DEEP-ER][2] 的背景下做出的,在这个项目里为了得到更好的 I/O 要求,做出了一些新的改进。对于运算量高达百亿亿次的系统,不同的软硬件必须有效的协同工作才能得到最佳的拓展性。因此,开源 BeeGFS 是让一个百亿亿次的集群的所有组成部分高效的发挥作用的一步。 + +“当我们的一些用户对于 BeeGFS 十分容易安装并且不用费心管理而感到高兴时,另外一些用户则想要知道它是如何运行的以便于更好的优化他们的应用,使得他们可以监控它或者把它移植到其他的平台上,比如 BSD,” Sven Breuner 说道,他是 ThinkParQ (BeeGFS 背后的公司)的 CEO,“而且,把 BeeGFS 移植到其他的非 X86 架构,比如 ARM 或者 Power,也是社区即将要做的一件事。” + +对于未来的采购来说,ARM 技术的稳步发展确实使得它成为了一个越来越有趣的技术。因此, BeeGFS 的团队也参与了 [ExaNeSt][3],一个来自欧洲的新的百亿亿次级超算计划,这个计划致力于使 ARM 的生态能为高性能的工作负载做好准备。“尽管现在 BeeGFS 在 ARM 处理器上可以算是开箱即用,这个项目也将给我们机会来证明我们在这个架构上也能完全发挥其性能。”, Bernd Lietzow , BeeGFS 中 ExaNeSt 的领导者补充道。 + +作为一个有着 25 K 行 C++ 代码的元数据服务以及约 15 K 行存储服务的项目,BeeGFS 相对比较容易理解和拓展,不只是对于大神,对于对文件系统有兴趣的大学生也是这样。在 GitHub 上已经有很多的为 BeeGFS 写的项目,比如基于浏览器的监控或者 Docker 一体化。 + + 有关新闻显示, [BeeGFS 用户大会][4]将于 5 月 18-19 日在德国凯泽斯劳滕举行。 + + ----------------------------------------------------------------------------------------- + +via: http://insidehpc.com/2016/02/beegfs-parallel-file-system-now-open-source/ + +作者:[staff][a] +译者:[name1e5s](https://github.com/name1e5s) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://insidehpc.com/author/staff/ +[1]: http://www.beegfs.com/ +[2]: http://www.deep-project.eu/deep-project/EN/Home/home_node.html +[3]: http://www.exanest.eu/ +[4]: http://www.beegfs.com/content/user-meeting-2016/ diff --git a/published/201604/20160226 How to use Python to hack your Eclipse IDE.md b/published/201604/20160226 How to use Python to hack your Eclipse IDE.md new file mode 100644 index 0000000000..ab2e21d5fa --- /dev/null +++ b/published/201604/20160226 How to use Python to hack your Eclipse IDE.md @@ -0,0 +1,209 @@ +用 Python 打造你的 Eclipse +============================================== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/lightbulb_computer_person_general_.png?itok=ZY3UuQQa) + +Eclipse 高级脚本环境([EASE][1])项目虽然还在开发中,但是必须要承认它非常强大,它让我们可以快速打造自己的Eclipse 开发环境。 + +依据 Eclipse 强大的框架,可以通过其内建的插件系统全方面的扩展 Eclipse。然而,编写和部署一个新的插件还是十分麻烦,即使你只是需要一个额外的小功能。不过,现在依托于 EASE,你可以不用写任何一行 Java 代码就可以方便的做到这点。EASE 是一种使用 Python 或者 Javascript 这样的脚本语言自动实现这些功能的平台。 + +本文中,根据我在今年北美的 EclipseCon 大会上的[演讲][2],我将介绍如何用 Python 和 EASE 设置你的 Eclipse 环境,并告诉如何发挥 Python 的能量让你的 IDE 跑的飞起。 + +### 安装并运行 "Hello World" + +本文中的例子使用 Python 的 Java 实现 Jython。你可以将 EASE 直接安装到你已有的 Eclipse IDE 中。本例中使用[Eclipse Mars][3],并安装 EASE 环境本身以及它的模块和 Jython 引擎。 + +使用 Eclipse 安装对话框(`Help>Install New Software`...),安装 EASE[http://download.eclipse.org/ease/update/nightly][4], + +选择下列组件: + +- EASE Core feature +- EASE core UI feature +- EASE Python Developer Resources +- EASE modules (Incubation) + +这会安装 EASE 及其模块。这里我们要注意一下 Resource 模块,此模块可以访问 Eclipse 工作空间、项目和文件 API。 + +![](https://opensource.com/sites/default/files/1_installease_nightly.png) + +成功安装后,接下来安装 EASE Jython 引擎 [https://dl.bintray.com/pontesegger/ease-jython/][5] 。完成后,测试下。新建一个项目并新建一个 hello.py 文件,输入: + +``` +print "hello world" +``` + +选中这个文件,右击并选择“Run as -> EASE script”。这样就可以在控制台看到“Hello world”的输出。 + +现在就可以编写 Python 脚本来访问工作空间和项目了。这种方法可以用于各种定制,下面只是一些思路。 + +### 提升你的代码质量 + +管理良好的代码质量本身是一件非常烦恼的事情,尤其是当需要处理一个大型代码库或者要许多工程师参与的时候。而这些痛苦可以通过脚本来减轻,比如批量格式化一些文件,或者[去掉文件中的 unix 式的行结束符][6]来使得在 git 之类的源代码控制系统中比较差异更加容易。另外一个更好的用途是使用脚本来生成 Eclipse markers 以高亮你可以改善的代码。这里有一些示例脚本,你可以用来在 java 文件中所有找到的“printStackTrace”方法中加入task markers 。请看[源码][7]。 + +拷贝该文件到工作空间来运行,右击并选择“Run as -> EASE script”。 + +``` +loadModule('/System/Resources') + +from org.eclipse.core.resources import IMarker + +for ifile in findFiles("*.java"): + file_name = str(ifile.getLocation()) + print "Processing " + file_name + with open(file_name) as f: + for line_no, line in enumerate(f, start=1): + if "printStackTrace" in line: + marker = ifile.createMarker(IMarker.TASK) + marker.setAttribute(IMarker.TRANSIENT, True) + marker.setAttribute(IMarker.LINE_NUMBER, line_no) + marker.setAttribute(IMarker.MESSAGE, "Fix in Sprint 2: " + line.strip()) + +``` + +如果你的 java 文件中包含了 printStackTraces,你就可以看见任务视图和编辑器侧边栏上自动新加的标记。 + +![](https://opensource.com/sites/default/files/2_codequality.png) + +### 自动构建繁琐任务 + +当同时工作在多个项目的时候,肯定需要完成许多繁杂、重复的任务。可能你需要在所有源文件头上加入版权信息,或者采用新框架时候自动更新文件。例如,当首次切换到 Tycho 和 Maven 的时候,我们需要 giel每个项目添加 pom.xml 文件。使用几行 Python 代码可以很轻松的完成这个任务。然后当 Tycho 支持无 pom 构建后,我们需要移除不要的 pom 文件。同样,几行代码就可以搞定这个任务,例如,这里有个脚本可以在每一个打开的工作空间项目上加入 README.md。请看源代码 [add_readme.py][8]。 + +拷贝该文件到工作空间来运行,右击并选择“Run as -> EASE script”。 + +``` +loadModule('/System/Resources') + +for iproject in getWorkspace().getProjects(): + if not iproject.isOpen(): + continue + + ifile = iproject.getFile("README.md") + + if not ifile.exists(): + contents = "# " + iproject.getName() + "\n\n" + if iproject.hasNature("org.eclipse.jdt.core.javanature"): + contents += "A Java Project\n" + elif iproject.hasNature("org.python.pydev.pythonNature"): + contents += "A Python Project\n" + writeFile(ifile, contents) +``` + +脚本运行的结果会在每个打开的项目中加入 README.md,java 和 Python 的项目还会自动加上一行描述。 + +![](https://opensource.com/sites/default/files/3_tedioustask.png) + +### 构建新功能 + +你可以使用 Python 脚本来快速构建一些急需的功能,或者做个原型给团队和用户演示你想要的功能。例如,一个 Eclipse 目前不支持的功能是自动保存你正在工作的文件。即使这个功能将会很快提供,但是你现在就可以马上拥有一个能每隔 30 秒或处于后台时自动保存的编辑器。以下是主要方法的片段。请看下列代码:[autosave.py][9]。 + +``` +def save_dirty_editors(): + workbench = getService(org.eclipse.ui.IWorkbench) + for window in workbench.getWorkbenchWindows(): + for page in window.getPages(): + for editor_ref in page.getEditorReferences(): + part = editor_ref.getPart(False) + if part and part.isDirty(): + print "Auto-Saving", part.getTitle() + part.doSave(None) +``` + +在运行脚本之前,你需要勾选 'Allow Scripts to run code in UI thread' 设定,这个设定在 Window > Preferences > Scripting 中。然后添加该脚本到工作空间,右击并选择“Run as > EASE Script”。每次编辑器自动保存时,控制台就会输出一个保存的信息。要关掉自动保存脚本,只需要点击控制台的红色方块的停止按钮即可。 + +![](https://opensource.com/sites/default/files/4_prototype.png) + +### 快速扩展用户界面 + +EASE 最棒的事情是可以将你的脚本与 IDE 界面上元素(比如一个新的按钮或菜单)结合起来。不需要编写 java 代码或者安装新的插件,只需要在你的脚本前面增加几行代码。 + +下面是一个简单的脚本示例,用来创建三个新项目。 + +``` +# name : Create fruit projects +# toolbar : Project Explorer +# description : Create fruit projects + +loadModule("/System/Resources") + +for name in ["banana", "pineapple", "mango"]: + createProject(name) +``` + +上述注释会专门告诉 EASE 增加了一个按钮到 Project Explorer 工具条。下面这个脚本是用来增加一个删除这三个项目的按钮的。请看源码 [createProjects.py][10] 和 [deleteProjects.py][11]。 + +``` +# name :Delete fruit projects +# toolbar : Project Explorer +# description : Get rid of the fruit projects + +loadModule("/System/Resources") + +for name in ["banana", "pineapple", "mango"]: + project = getProject(name) + project.delete(0, None) +``` + +为了使按钮显示出来,增加这两个脚本到一个新的项目,假如叫做 'ScriptsProject'。然后到 Windows > Preference > Scripting > Script Location,点击 'Add Workspace' 按钮并选择 ScriptProject 项目。这个项目现在会成为放置脚本的默认位置。你可以发现 Project Explorer 上出现了这两个按钮,这样你就可以通过这两个新加的按钮快速增加和删除项目。 + +![](https://opensource.com/sites/default/files/5_buttons.png) + +### 整合第三方工具 + +不管怎么说,你可能需要除了 Eclipse 生态系统以外的工具(这是真的,虽然 Eclipse 已经很丰富了,但是不是什么都有)。这些时候你会发现将他们包装在一个脚本来调用会非常方便。这里有一个简单的例子让你整合资源管理器,并将它加入到右键菜单栏,这样点击图标就可以打开资源管理器浏览当前文件。请看源码 [explorer.py][12]。 + +``` +# name : Explore from here +# popup : enableFor(org.eclipse.core.resources.IResource) +# description : Start a file browser using current selection +loadModule("/System/Platform") +loadModule('/System/UI') + +selection = getSelection() +if isinstance(selection, org.eclipse.jface.viewers.IStructuredSelection): + selection = selection.getFirstElement() + +if not isinstance(selection, org.eclipse.core.resources.IResource): + selection = adapt(selection, org.eclipse.core.resources.IResource) + +if isinstance(selection, org.eclipse.core.resources.IFile): + selection = selection.getParent() + +if isinstance(selection, org.eclipse.core.resources.IContainer): + runProcess("explorer.exe", [selection.getLocation().toFile().toString()]) +``` + +为了让这个菜单显示出来,像之前一样将该文件加入一个新项目,比如说 'ScriptProject'。然后到 Windows > Preference > Scripting > Script Locations,点击“Add Workspace”并选择 'ScriptProject' 项目。当你在文件上右击鼠标键,你会看到弹出菜单出现了新的菜单项。点击它就会出现资源管理器。(注意,这个功能已经出现在 Eclipse 中了,但是你可以在这个例子中换成其它第三方工具。) + +![](https://opensource.com/sites/default/files/6_explorer.png) + +Eclipse 高级基本环境 (EASE)提供一套很棒的扩展功能,使得 Eclipse IDE 能使用 Python 来轻松扩展。虽然这个项目还在早期,但是[关于这个项目][13]更多更棒的功能也正在加紧开发中,如果你想为它做出贡献,请到[论坛][14]讨论。 + +我会在 2016 年的 [Eclipsecon North America][15] 会议上发布更多 EASE 细节。我的演讲 [Scripting Eclipse with Python][16] 也会不单会介绍 Jython,也包括 C-Python 和这个功能在科学领域是如何扩展的。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/16/2/how-use-python-hack-your-ide + +作者:[Tracy Miranda][a] +译者:[VicYu/Vic020](http://vicyu.net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/tracymiranda +[1]: https://eclipse.org/ease/ +[2]: https://www.eclipsecon.org/na2016/session/scripting-eclipse-python +[3]: https://www.eclipse.org/downloads/packages/eclipse-ide-eclipse-committers-451/mars1 +[4]: http://download.eclipse.org/ease/update/nightly +[5]: https://dl.bintray.com/pontesegger/ease-jython/ +[6]: http://code.activestate.com/recipes/66434-change-line-endings/ +[7]: https://gist.github.com/tracymiranda/6556482e278c9afc421d +[8]: https://gist.github.com/tracymiranda/f20f233b40f1f79b1df2 +[9]: https://gist.github.com/tracymiranda/e9588d0976c46a987463 +[10]: https://gist.github.com/tracymiranda/55995daaea9a4db584dc +[11]: https://gist.github.com/tracymiranda/baa218fc2c1a8e898194 +[12]: https://gist.github.com/tracymiranda/8aa3f0fc4bf44f4a5cd3 +[13]: https://eclipse.org/ease/ +[14]: https://dev.eclipse.org/mailman/listinfo/ease-dev +[15]: https://www.eclipsecon.org/na2016 +[16]: https://www.eclipsecon.org/na2016/session/scripting-eclipse-python diff --git a/published/201604/20160405 Ubuntu Budgie Could Be the New Flavor of Ubuntu Linux, as Part of Ubuntu 16.10.md b/published/201604/20160405 Ubuntu Budgie Could Be the New Flavor of Ubuntu Linux, as Part of Ubuntu 16.10.md new file mode 100644 index 0000000000..0470818ba6 --- /dev/null +++ b/published/201604/20160405 Ubuntu Budgie Could Be the New Flavor of Ubuntu Linux, as Part of Ubuntu 16.10.md @@ -0,0 +1,43 @@ +Ubuntu Budgie 将在 Ubuntu 16.10 中成为新官方分支发行版 +=== + +> Budgie-Remix Beta 2 已经就绪以供测试。 + +上个月我们介绍了一个新 GNU/Linux 发行版 [Budgie-Remix][1],它的终极目标是成为一个 Ubuntu 官方分支发行版,可能会使用 Ubuntu Budgie 这个名字。 + +![Budgie-Remix 16.04 Beta 2](http://i1-news.softpedia-static.com/images/news2/ubuntu-budgie-could-be-the-new-flavor-of-ubuntu-linux-as-part-of-ubuntu-16-10-502573-2.jpg) + +今天,Budgie-Remix 的开发者 David Mohammed 向 Softpedia 通报了项目进度,以及为即将到来的 16.04 发布了第二个 Beta 版本。Cononical 的创始人 [Mark Shuttleworth 说过][2]如果能够有围绕这个发行版的社区,它肯定会得到支持。 + +自我们[最初的报道][3]以来,David Mohammed 似乎与 Ubuntu MATE 项目的领导者 Martin Wimpress 取得了联系,后者敦促他以 Ubuntu 16.10 作为他还未正式命名的 Ubuntu 分支的官方版本目标。这个分支发行版构建于 Budgie 桌面环境之上,该桌面环境是由超赞的 [Solus][4] 开发者团队创建的。 + +“我们本周完成了 Beta 2 版本的开发以及很多其它东西,而且我们还有 Martin Wimpress (Ubuntu MATE 项目领导者)的支持,”David Mohammed 对 Softpedia 独家爆料。”他还敦促我们以 16.10 作为成为官方版本的目标——那当然是个主要的挑战——并且我们还需要社区的帮助/加入我们来让这一切成为现实!” + +### Ubuntu Budgie 16.10 可能在 2016 年 10 月到来 ### + +4 月 21 日,Canonical 将会发布 Ubuntu Linux 的下一个 LTS(Long Term Support,长期支持)版本:Xenial Xerus——好客的非洲地松鼠——也就是 Ubuntu 16.04。我们有可能能够提前体验到 Budgie-Remix 16.04,以后它也许成为了官方分支的 Ubuntu Budgie 。但在那之前,你可以帮助开发者[测试 Beta 2 版本][5]。 + +在 Ubuntu 16.04 LTS(Xenial Xerus)发布之后,Ubuntu 的开发者们就会立即将注意力转移到下一个版本的开发上。下一个版本 Ubuntu 16.10 应该会在 10 月底到来,并且 Ubuntu Budgie 也可能宣布成为 Ubuntu 官方分支发行版。 + + +![Budgie Applications Menu](http://i1-news.softpedia-static.com/images/news2/ubuntu-budgie-could-be-the-new-flavor-of-ubuntu-linux-as-part-of-ubuntu-16-10-502573-3.jpg) + +![Budgie Raven notification and customization center](http://i1-news.softpedia-static.com/images/news2/ubuntu-budgie-could-be-the-new-flavor-of-ubuntu-linux-as-part-of-ubuntu-16-10-502573-4.jpg) + +![Nautilus file manager](http://i1-news.softpedia-static.com/images/news2/ubuntu-budgie-could-be-the-new-flavor-of-ubuntu-linux-as-part-of-ubuntu-16-10-502573-5.jpg) + +---------------------------------- + +via: http://news.softpedia.com/news/ubuntu-budgie-could-be-the-new-flavor-of-ubuntu-linux-as-part-of-ubuntu-16-10-502573.shtml + +作者:Marius Nestor +译者:[alim0x](https://github.com/alim0x) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]: https://launchpad.net/budgie-remix +[2]: https://plus.google.com/+programmerslab/posts/CSvbSvgcdcv +[3]: http://news.softpedia.com/news/budgie-remix-could-become-ubuntu-budgie-download-and-test-it-501231.shtml +[4]: https://solus-project.com/ +[5]: https://sourceforge.net/projects/budgie-remix/files/beta2/ diff --git a/published/201604/20160414 Linux Kernel 3.12 to Be Supported Until 2017 Because of SUSE Linux Enterprise 12.md b/published/201604/20160414 Linux Kernel 3.12 to Be Supported Until 2017 Because of SUSE Linux Enterprise 12.md new file mode 100644 index 0000000000..ea71e0512b --- /dev/null +++ b/published/201604/20160414 Linux Kernel 3.12 to Be Supported Until 2017 Because of SUSE Linux Enterprise 12.md @@ -0,0 +1,31 @@ +因 SUSE Linux Enterprise 12,Linux Kernel 3.12 的支持延长至 2017 年 +================================================================================== + +>Linux 内核开发者 Jiri Slaby 已经宣布了 Linux 3.12 系列内核的第 58 个长期支持维护版本,以及关于生命周期状态的一些修改。 + +Linux Kernel 3.12.58 LTS(长期支持版)已经可用,那些运行该版本内核的 Linux 操作系统应尽快升级。有个好消息是 Linux 3.12 分支的支持将延长一年至 2017 年,因为 SUSE Linux Enterprise (SLE) 12 Service Pack 1 正是基于该分支。 + +“因为 SLE12-SP1 基于 3.12 之上,并且它的生命周期持续到 2017 年,所以将 3.12 的生命周期结束也修改到 2017 年,”Jiri Slaby 在发到 Linux 内核邮件列表的一个[补丁声明][1]中说道,同时他还公布了其它内核分支的生命周期结束时间(EOL,end of life),比如 Linux 3.14 为 2016 年 8 月,Linux 3.18 为 2017 年 1 月,Linux 4.1 是 2017 年 9 月。 + +### Linux kernel 3.12.58 LTS 改动 + +如果你想知道 Linux kernel 3.12.58 LTS 中有哪些改动,我们能告诉你的是,通过[附加的短日志][2]可知,这是一个健康的更新,改动涉及 114 个文件,有 835 行插入和 298 行删除。在这些改动之中,我们注意到多数是声音和网络栈的改进,以及许多驱动的更新。 + +更新中还有多个对 x86 硬件架构的改进,以及一些对 Xtensa 和 s390 的小修复。文件系统,如 NFS,OCFS2,Btrfs,JBD2 还有 XFS 也都收到了不同的修复,在驱动的更新中可以提到的还有 USB,Xen,MD,MTD,媒体,SCSI,TTY,网络,ATA,蓝牙,hwmon,EDAC 以及 CPUFreq。 + +和往常一样,你现在就可以从我们网站(linux.com)或直接从 kernel.org [下载 Linux kernel 3.12.58 LTS 的源码][3]。如果您的 GNU/Linux 操作系统运行的是 Linux 3.12 系列内核,请尽快升级您的内核。 + +------------------------------------------------------------------------------ + +via: http://www.linux.com/news/featured-blogs/191-linux-training/834644-7-steps-to-start-your-linux-sysadmin-career + +作者:[Marius Nestor][a] +译者:[alim0x](https://github.com/alim0x) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://news.softpedia.com/editors/browse/marius-nestor +[1]: http://lkml.iu.edu/hypermail/linux/kernel/1604.1/00792.html +[2]: http://www.spinics.net/lists/stable/msg128634.html +[3]: http://linux.softpedia.com/get/System/Operating-Systems/Kernels/Linux-Kernel-Stable-1960.shtml diff --git a/published/20160415 Docker 1.11 Adopts Open Container Project Components.md b/published/20160415 Docker 1.11 Adopts Open Container Project Components.md new file mode 100644 index 0000000000..9b73c52b8c --- /dev/null +++ b/published/20160415 Docker 1.11 Adopts Open Container Project Components.md @@ -0,0 +1,48 @@ +Docker 1.11 采纳了开源容器项目(OCP)组件 +======================================================= + +![](http://images.techhive.com/images/article/2015/01/docker-620x465-100559026-primary.idge.jpg) + +> Docker 在开放容器项目(Open Container Project,OCP)中的参与度达成圆满,最新构建的Docker采用了Docker 贡献给 OCP 的组件。 + +新发布的 [Docker 1.11][1] 的最大新闻并不是它的功能,而是它使用了在 OCP 支持下的标准化的组件版本。 + +去年,Docker 贡献了它的 [runC][2] 核心给 OCP 作为构建构建容器工具的基础。同样还有 [containerd][3],作为守护进程或者服务端用于控制 runC 的实例。Docker 1.11 现在使用的就是这个捐赠和公开的版本。 + + +Docker 此举挑战了它的容器生态仍[主要由 Docker 自身决定][6]这个说法。它并不是为了作秀才将容器规范和运行时细节贡献给 OCP。它希望项目将来的开发越开放和广泛越好。 + +![](http://images.techhive.com/images/article/2016/04/docker-runc-100656060-large.idge.png) + +> Docker 1.11 已经用贡献给 OCP 的 runC 和 containerd 进行了重构。runC 如果需要的话可以换成另外一个。 + +runC 的[两位主要提交者][7]来自 Docker,但是来自 Virtuozzo(Parallels fame)、OpenShift、Project Atomic、华为、GE Healthcare、Suse Linux 也都是提交人员里面的常客。 + +Docker 1.11 中一个更明显的变化是先前 Docker runtime 在 Docker 中是唯一可用的,并且评论家认为这个会限制用户的选择。runC runtime 现在是可替换的;虽然 Docker 在发布时将 runC 作为默认引擎,但是任何兼容的引擎都可以用来替换它。(Docker 同样希望它可以不用杀死并重启现在运行的容器,但是这个作为今后的改进规划。) + +Docker 正在将基于 OCP 的开发流程作为内部创建其产品的更好方式。在它发布 1.11 的[官方博客中称][8]:“将 Docker 切分成独立的工具意味着更专注的维护者,最终会有更好的软件质量。” + +除了修复长期以来存在的问题和确保 Docker 的 runC/containerd 跟上步伐,Docker 还在 Docker 1.11 中加入了一些改进。Docker Engine 现在支持 VLAN 和 IPv6 服务发现,并且会自动在多个相同别名容器间执行 DNS 轮询负载均衡。 + + +------------------------------------------------------------------------------ + +via: http://www.infoworld.com/article/3055966/open-source-tools/docker-111-adopts-open-container-project-components.html + +作者:[Serdar Yegulalp][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.infoworld.com/author/Serdar-Yegulalp/ +[1]: https://blog.docker.com/2016/04/docker-engine-1-11-runc/ +[2]: http://runc.io/ +[3]: https://containerd.tools/ +[4]: http://www.infoworld.com/resources/16373/application-virtualization/the-beginners-guide-to-docker#tk.ifw-infsb +[5]: http://www.infoworld.com/newsletters/signup.html#tk.ifw-infsb +[6]: http://www.infoworld.com/article/2876801/application-virtualization/docker-reorganization-grows-up.html +[7]: https://github.com/opencontainers/runc/graphs/contributors +[8]: https://blog.docker.com/2016/04/docker-engine-1-11-runc/ + + diff --git a/published/LFCS/Part 1 - LFCS--How to use GNU 'sed' Command to Create Edit and Manipulate files in Linux.md b/published/LFCS/Part 1 - LFCS--How to use GNU 'sed' Command to Create Edit and Manipulate files in Linux.md new file mode 100644 index 0000000000..dd19d6dc69 --- /dev/null +++ b/published/LFCS/Part 1 - LFCS--How to use GNU 'sed' Command to Create Edit and Manipulate files in Linux.md @@ -0,0 +1,226 @@ +LFCS 系列第一讲:如何在 Linux 上使用 GNU sed 等命令来创建、编辑和操作文件 +================================================================================ +Linux 基金会宣布了一个全新的 LFCS(Linux Foundation Certified Sysadmin,Linux 基金会认证系统管理员)认证计划。这一计划旨在帮助遍布全世界的人们获得其在处理 Linux 系统管理任务上能力的认证。这些能力包括支持运行的系统服务,以及第一手的故障诊断、分析,以及为工程师团队在升级时提供明智的决策。 + +![Linux Foundation Certified Sysadmin](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-1.png) + +*Linux 基金会认证系统管理员——第一讲* + +请观看下面关于 Linux 基金会认证计划的演示: + + + +该系列将命名为《LFCS 系列第一讲》至《LFCS 系列第十讲》并覆盖关于 Ubuntu、CentOS 以及 openSUSE 的下列话题。 + +- 第一讲:如何在 Linux 上使用 GNU sed 等命令来创建、编辑和操作文件 +- 第二讲:如何安装和使用 vi/m 全功能文字编辑器 +- 第三讲:归档文件/目录并在文件系统中寻找文件 +- 第四讲:为存储设备分区,格式化文件系统和配置交换分区 +- 第五讲:在 Linux 中挂载/卸载本地和网络(Samba & NFS)文件系统 +- 第六讲:组合分区作为 RAID 设备——创建&管理系统备份 +- 第七讲:管理系统启动进程和服务(使用 SysVinit, Systemd 和 Upstart) +- 第八讲:管理用户和组,文件权限和属性以及启用账户的 sudo 权限 +- 第九讲:用 Yum,RPM,Apt,Dpkg,Aptitude,Zypper 进行 Linux 软件包管理 +- 第十讲:学习简单的 Shell 脚本编程和文件系统故障排除 + + 重要提示:由于自 2016/2 开始 LFCS 认证要求有所变化,我们增加发布了下列必需的内容。要准备这个考试,推荐你也看看我们的 LFCE 系列。 + +- 第十一讲:怎样使用 vgcreate、lvcreate 和 lvextend 命令创建和管理 LVM +- 第十二讲:怎样安装帮助文档和工具来探索 Linux +- 第十三讲:怎样配置和排错 GRUB + +本文是覆盖这个参加 LFCS 认证考试的所必需的范围和技能的十三个教程的第一讲。话说了那么多,快打开你的终端,让我们开始吧! + +### 处理 Linux 中的文本流 ### + +Linux 将程序中的输入和输出当成字符流或者字符序列。在开始理解重定向和管道之前,我们必须先了解三种最重要的I/O(Input and Output,输入和输出)流,事实上,它们都是特殊的文件(根据 UNIX 和 Linux 中的约定,数据流和外围设备(设备文件)也被视为普通文件)。 + +在 \> (重定向操作符) 和 | (管道操作符)之间的区别是:前者将命令与文件相连接,而后者将命令的输出和另一个命令相连接。 + + # command > file + # command1 | command2 + +由于重定向操作符会静默地创建或覆盖文件,我们必须特别小心谨慎地使用它,并且永远不要把它和管道混淆起来。在 Linux 和 UNIX 系统上管道的优势是:第一个命令的输出不会写入一个文件而是直接被第二个命令读取。 + +在下面的操作练习中,我们将会使用这首诗——《A happy child》(作者未知) + +![cat command](http://www.tecmint.com/wp-content/uploads/2014/10/cat-command.png) + +*cat 命令样例* + +#### 使用 sed #### + +sed 是流编辑器(stream editor)的缩写。为那些不懂术语的人额外解释一下,流编辑器是用来在一个输入流(文件或者管道中的输入)执行基本的文本转换的工具。 + +sed 最基本的用法是字符替换。我们将通过把每个出现的小写 y 改写为大写 Y 并且将输出重定向到 ahappychild2.txt 开始。g 标志表示 sed 应该替换文件每一行中所有应当替换的实例。如果这个标志省略了,sed 将会只替换每一行中第一次出现的实例。 + +**基本语法:** + + # sed 's/term/replacement/flag' file + +**我们的样例:** + + # sed 's/y/Y/g' ahappychild.txt > ahappychild2.txt + +![sed command](http://www.tecmint.com/wp-content/uploads/2014/10/sed-command.png) + +*sed 命令样例* + +如果你要在替换文本中搜索或者替换特殊字符(如 /,\,&),你需要使用反斜杠对它进行转义。 + +例如,我们要用一个符号来替换一个文字,与此同时我们将把一行最开始出现的第一个 I 替换为 You。 + + # sed 's/and/\&/g;s/^I/You/g' ahappychild.txt + +![sed replace string](http://www.tecmint.com/wp-content/uploads/2014/10/sed-replace-string.png) + +*sed 替换字符串* + +在上面的命令中,众所周知 \^(插入符号)是正则表达式中用来表示一行开头的符号。 + +正如你所看到的,我们可以通过使用分号分隔以及用括号包裹来把两个或者更多的替换命令(并在它们中使用正则表达式)连接起来。 + +另一种 sed 的用法是显示或者删除文件中选中的一部分。在下面的样例中,将会显示 /var/log/messages 中从6月8日开始的头五行。 + + # sed -n '/^Jun 8/ p' /var/log/messages | sed -n 1,5p + +请注意,在默认的情况下,sed 会打印每一行。我们可以使用 -n 选项来覆盖这一行为并且告诉 sed 只需要打印(用 p来表示)文件(或管道)中匹配的部分(第一个命令中指定以“Jun 8” 开头的行,第二个命令中指定一到五行)。 + +最后,可能有用的技巧是当检查脚本或者配置文件的时候可以保留文件本身并且删除注释。下面的单行 sed 命令删除(d)空行或者是开头为`#`的行(| 字符对两个正则表达式进行布尔 OR 操作)。 + + # sed '/^#\|^$/d' apache2.conf + +![sed match string](http://www.tecmint.com/wp-content/uploads/2014/10/sed-match-string.png) + +*sed 匹配字符串* + +#### uniq 命令 #### + +uniq 命令允许我们返回或者删除文件中重复的行,默认写到标准输出。我们必须注意到,除非两个重复的行相邻,否则uniq 命令不会删除他们。因此,uniq 经常和一个前置的 sort 命令(一种用来对文本行进行排序的算法)搭配使用。默认情况下,sort 使用第一个字段(用空格分隔)作为关键字段。要指定一个不同的关键字段,我们需要使用 -k 选项。 + +**样例** + +du –sch /path/to/directory/* 命令将会以人类可读的格式返回在指定目录下每一个子文件夹和文件的磁盘空间使用情况(也会显示每个目录总体的情况),而且不是按照大小输出,而是按照子文件夹和文件的名称。我们可以使用下面的命令来让它通过大小排序。 + + # du -sch /var/* | sort -h + +![sort command](http://www.tecmint.com/wp-content/uploads/2014/10/sort-command.jpg) + +*sort 命令样例* + +你可以通过使用下面的命令告诉 uniq 比较每一行的前6个字符(-w 6)(这里是指定的日期)来统计日志事件的个数,而且在每一行的开头输出出现的次数(-c)。 + + + # cat /var/log/mail.log | uniq -c -w 6 + +![Count Numbers in File](http://www.tecmint.com/wp-content/uploads/2014/10/count-numbers-in-file.jpg) + +*文件中的统计数字* + +最后,你可以组合使用 sort 和 uniq 命令(通常如此)。看看下面文件中捐助者、捐助日期和金额的列表。假设我们想知道有多少个捐助者。我们可以使用下面的命令来分隔第一字段(字段由冒号分隔),按名称排序并且删除重复的行。 + + # cat sortuniq.txt | cut -d: -f1 | sort | uniq + +![Find Unique Records in File](http://www.tecmint.com/wp-content/uploads/2014/10/find-uniqu-records-in-file.jpg) + +*寻找文件中不重复的记录* + +- 也可阅读: [13个“cat”命令样例][1] + +#### grep 命令 #### + +grep 在文件(或命令输出)中搜索指定正则表达式,并且在标准输出中输出匹配的行。 + +**样例** + +显示文件 /etc/passwd 中用户 gacanepa 的信息,忽略大小写。 + + # grep -i gacanepa /etc/passwd + +![grep Command](http://www.tecmint.com/wp-content/uploads/2014/10/grep-command.jpg) + +*grep 命令样例* + +显示 /etc 文件夹下所有 rc 开头并跟随任意数字的内容。 + + # ls -l /etc | grep rc[0-9] + +![List Content Using grep](http://www.tecmint.com/wp-content/uploads/2014/10/list-content-using-grep.jpg) + +*使用 grep 列出内容* + +- 也可阅读: [12个“grep”命令样例][2] + +#### tr 命令使用技巧 #### + +tr 命令可以用来从标准输入中转换(改变)或者删除字符,并将结果写入到标准输出中。 + +**样例** + +把 sortuniq.txt 文件中所有的小写改为大写。 + + # cat sortuniq.txt | tr [:lower:] [:upper:] + +![Sort Strings in File](http://www.tecmint.com/wp-content/uploads/2014/10/sort-strings.jpg) + +*排序文件中的字符串* + +压缩`ls –l`输出中的分隔符为一个空格。 + + # ls -l | tr -s ' ' + +![Squeeze Delimiter](http://www.tecmint.com/wp-content/uploads/2014/10/squeeze-delimeter.jpg) + +*压缩分隔符* + +#### cut 命令使用方法 #### + +cut 命令可以基于字节(-b选项)、字符(-c)或者字段(-f)提取部分输入(从标准输入或者文件中)并且将结果输出到标准输出。在最后一种情况下(基于字段),默认的字段分隔符是一个制表符,但可以由 -d 选项来指定不同的分隔符。 + +**样例** + +从 /etc/passwd 中提取用户账户和他们被分配的默认 shell(-d 选项允许我们指定分界符,-f 选项指定那些字段将被提取)。 + + # cat /etc/passwd | cut -d: -f1,7 + +![Extract User Accounts](http://www.tecmint.com/wp-content/uploads/2014/10/extract-user-accounts.jpg) + +*提取用户账户* + +将以上命令结合起来,我们将使用 last 命令的输出中第一和第三个非空文件创建一个文本流。我们将使用 grep 作为第一过滤器来检查用户 gacanepa 的会话,然后将分隔符压缩至一个空格(tr -s ' ')。下一步,我们将使用 cut 来提取第一和第三个字段,最后使用第二个字段(本样例中,指的是IP地址)来排序之后,再用 uniq 去重。 + + # last | grep gacanepa | tr -s ‘ ‘ | cut -d’ ‘ -f1,3 | sort -k2 | uniq + +![last command](http://www.tecmint.com/wp-content/uploads/2014/10/last-command.png) + +*last 命令样例* + +上面的命令显示了如何将多个命令和管道结合起来,以便根据我们的要求得到过滤后的数据。你也可以逐步地使用它以帮助你理解输出是如何从一个命令传输到下一个命令的(顺便说一句,这是一个非常好的学习经验!) + +### 总结 ### + +尽管这个例子(以及在当前教程中的其他实例)第一眼看上去可能不是非常有用,但是他们是体验在 Linux 命令行中创建、编辑和操作文件的一个非常好的开始。请随时留下你的问题和意见——不胜感激! + +#### 参考链接 #### + +- [关于 LFCS][3] +- [为什么需要 Linux 基金会认证?][4] +- [注册 LFCS 考试][5] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/ + +作者:[Gabriel Cánepa][a] +译者:[Xuanwo](https://github.com/Xuanwo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://linux.cn/article-2336-1.html +[2]:https://linux.cn/article-2250-1.html +[3]:https://training.linuxfoundation.org/certification/LFCS +[4]:https://training.linuxfoundation.org/certification/why-certify-with-us +[5]:https://identity.linuxfoundation.org/user?destination=pid/1 +[6]:http://www.tecmint.com/installing-network-services-and-configuring-services-at-system-boot/ \ No newline at end of file diff --git a/published/LFCS/Part 2 - LFCS--How to Install and Use vi or vim as a Full Text Editor.md b/published/LFCS/Part 2 - LFCS--How to Install and Use vi or vim as a Full Text Editor.md new file mode 100644 index 0000000000..d7d962de0f --- /dev/null +++ b/published/LFCS/Part 2 - LFCS--How to Install and Use vi or vim as a Full Text Editor.md @@ -0,0 +1,251 @@ +LFCS 系列第二讲:如何安装和使用纯文本编辑器 vi/vim +================================================================================ + +几个月前, Linux 基金会发起了 LFCS (Linux Foundation Certified System administrator,Linux 基金会认证系统管理员)认证,以帮助世界各地的人来验证他们能够在 Linux 系统上做从基础的到中级的系统管理任务:如系统支持、第一手的故障诊断和处理、以及何时向上游支持团队提出问题的智能决策。 + +![Learning VI Editor in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/LFCS-Part-2.png) + +*在 Linux 中学习 vi 编辑器* + +请简要看看一下视频,里边介绍了 Linux 基金会认证的程序。 + +注:youtube 视频 + + + +这篇文章是系列教程的第二讲,在这个部分中,我们会介绍 vi/vim 基本的文件编辑操作,帮助读者理解编辑器中的三个模式,这是 LFCS 认证考试中必须掌握的。 + +### 使用 vi/vim 执行基本的文件编辑操作 ### + +vi 是为 Unix 而生的第一个全屏文本编辑器。它的设计小巧简单,对于仅仅使用过诸如 NotePad++ 或 gedit 等图形界面的文本编辑器的用户来说,使用起来可能存在一些困难。 + +为了使用 vi,我们必须首先理解这个强大的程序操作中的三种模式,方便我们后边学习这个强大的文本处理软件的相关操作。 + +请注意,大多数的现代 Linux 发行版都集成了 vi 的变种——— vim(Vi IMproved,改进版 VI),相比于 vi,它有更多新功能。所以,我们会在本教程中交替使用 vi 和 vim。 + +如果你的发行版还没有安装 vim,你可以通过以下方法来安装: + +- Ubuntu 及其衍生版:apt-get update && apt-get install vim +- 以 Red-Hat 为基础的发行版:yum update && yum install vim +- openSUSE :zypper update && zypper install vim + +### 我为什么要学习 vi ### + +至少有以下两个理由: + +1. 因为它是 POSIX 标准的一部分,所以不管你使用什么发行版 vi 总是可用的。 + +2. vi 基本不消耗多少系统资源,并且允许我们仅仅通过键盘来完成任何可能的任务。 + +此外,vi 有着非常丰富的内置帮助手册,程序打开后就可以通过 `:help` 命令来查看。这个内置帮助手册比 vi/vim 的 man 页面包含了更多信息。 + +![vi Man Pages](http://www.tecmint.com/wp-content/uploads/2014/10/vi-man-pages.png) + +*vi Man 页面* + +#### 启动 vi #### + +可以通过在命令提示符下输入 vi 来启动。 + +![Start vi Editor](http://www.tecmint.com/wp-content/uploads/2014/10/start-vi-editor.png) + +*使用 vi 编辑器* + +然后按下字母 i,你就可以开始输入了。或者通过下面的方法来启动 vi: + + # vi filename + +这样会打开一个名为 filename 的缓存区(buffer)(稍后会详细介绍缓存区),在你编辑完成之后就可以存储在磁盘中了。 + +#### 理解 vi 的三个模式 #### + +1. 在命令(command)模式中,vi 允许用户浏览该文件并输入由一个或多个字母组成的、简短的、大小写敏感的 vi 命令。这些命令的大部分都可以增加一个前缀数字表示执行次数。 + + 比如:`yy`(或`Y`) 复制当前的整行,`3yy`(或`3Y`) 复制当前整行和下边紧接着的两行(总共3行)。通过 `Esc` 键可以随时进入命令模式(而不管当前工作在什么模式下)。事实上,在命令模式下,键盘上所有的输入都被解释为命令而非文本,这往往使得初学者困惑不已。 + +2. 在末行(ex)模式中,我们可以处理文件(包括保存当前文件和运行外部程序)。我们必须在命令模式下输入一个冒号(`:`),才能进入这个模式,紧接着是要在末行模式下使用的命令。执行之后 vi 自动回到命令模式。 + +3. 在文本输入(insert)模式(通常在命令模式下使用字母 `i` 进入这个模式)中,我们可以随意输入文本。大多数的键入将以文本形式输出到屏幕(一个重要的例外是`Esc`键,它将退出文本编辑模式并回到命令模式)。 + +![vi Insert Mode](http://www.tecmint.com/wp-content/uploads/2014/10/vi-insert-mode.png) + +*vi 文本插入模式* + +#### vi 命令 #### + +下面的表格列出常用的 vi 命令。文件编辑的命令可以通过添加叹号的命令强制执行(如,`:q!` 命令强制退出编辑器而不保存文件)。 + +|关键命令|描述| +|------|:--:| +|`h` 或 ←|光标左移一个字符| +|`j` 或 ↓|光标下移一行| +|`k` 或 ↑|光标上移一行| +|`l` (小写字母 L) 或 →|光标右移一个字符| +|`H`|光标移至屏幕顶行| +|`L`|光标移至屏幕末行| +|`G`|光标移至文件末行| +|`w`|光标右移一个词| +|`b`|光标左移一个词| +|`0` (数字零)|光标移至行首| +|`^`|光标移至当前行第一个非空格字符| +|`$`|光标移至当前行行尾| +|`Ctrl-B`|向后翻页| +|`Ctrl-F`|向前翻页| +|`i`|在光标所在位置插入文本| +|`I` (大写字母 i)|在当前行首插入文本| +|`J` (大写字母 j)|将下一行与当前行合并(下一行上移到当前行)| +|`a`|在光标所在位置后追加文本| +|`o` (小写字母 O)|在当前行下边插入空白行| +|`O` (大写字母 O)|在当前行上边插入空白行| +|`r`|替换光标所在位置的一个字符| +|`R`|从光标所在位置开始覆盖插入文本| +|`x`|删除光标所在位置的字符| +|`X`|立即删除光标所在位置之前(左边)的一个字符| +|`dd`|剪切当前整行文本(为了之后进行粘贴)| +|`D`|剪切光标所在位置到行末的文本(该命令等效于 `d$`)| +|`yX`|给出一个移动命令 X (如 `h`、`j`、`H`、`L` 等),复制适当数量的字符、单词或者从光标开始到一定数量的行| +|`yy` 或 `Y`|复制当前整行| +|`p`|粘贴在光标所在位置之后(下一行)| +|`P`|粘贴在光标所在位置之前(上一行) +|`.` (句点)|重复最后一个命令| +|`u`|撤销最后一个命令| +|`U`|撤销最后一行的最后一个命令,只有光标仍在最后一行才能执行。| +|`n`|在查找中跳到下一个匹配项| +|`N`|在查找中跳到前一个匹配项| +|`:n`|下一个文件,编辑多个指定文件时,该命令加载下一个文件。| +|`:e file`|加载新文件来替代当前文件| +|`:r file`|将新文件的内容插入到光标所在位置的下一行| +|`:q`|退出并放弃更改| +|`:w file`|将当期打开的缓存区保存为file。如果是追加到已存在的文件中,则使用 :`w >> file` 命令| +|`:wq`|保存当前文件的内容并退出。等效于 `x!` 和 `ZZ`| +|`:r! command`|执行 command 命令,并将命令的输出插入到光标所在位置的下一行| + +#### vi 选项 #### + +下列选项可以让你在运行 Vim 的时候很方便(需要写入到 `~/.vimrc` 文件): + + # echo set number >> ~/.vimrc + # echo syntax on >> ~/.vimrc + # echo set tabstop=4 >> ~/.vimrc + # echo set autoindent >> ~/.vimrc + +![vi Editor Options](http://www.tecmint.com/wp-content/uploads/2014/10/vi-options.png) + +*vi编辑器选项* + +- set number 当 vi 打开或新建文件时,显示行号。 +- syntax on 打开语法高亮(对应多个文件扩展名),以便源码文件和配置文件更具可读性。 +- set tabstop=4 设置制表符间距为 4 个空格(默认为 8)。 +- set autoindent 将前一行的缩进应用于下一行。 + +#### 查找和替换 #### + +vi 具有通过查找将光标移动到(在单独一行或者整个文件中的)指定位置。它还可自动或者通过用户确认来执行文本替换。 + +a) 在行内查找。`f` 命令在当前行查找指定字符,并将光标移动到指定字符出现的位置。 + +例如,命令 `fh` 会在本行中将光标移动到字母`h`下一次出现的位置。注意,字母 `f` 和你要查找的字符都不会出现在屏幕上,但是当你按下回车的时候,要查找的字符会被高亮显示。 + +比如,以下是在命令模式按下 `f4` 之后的结果。 + +![Search String in Vi](http://www.tecmint.com/wp-content/uploads/2014/10/vi-search-string.png) + +*在 vi 中查找字符* + +b) 在整个文件内查找。使用 `/` 命令,紧接着需要查找的单词或短语。这个查找可以通过使用 `n` 命令或者 `N` 重复查找上一个查找的字符串。以下是在命令模式键入 `/Jane` 的查找结果。 + +![Vi Search String in File](http://www.tecmint.com/wp-content/uploads/2014/10/vi-search-line.png) + +*在 vi 中查找字符* + +c) vi 通过使用命令来完成多行或者整个文件的替换操作(类似于 sed)。我们可以使用以下命令,使得整个文件中的单词 “old” 替换为 “young”。 + + :%s/old/young/g + +**注意**:冒号位于命令的最前面。 + +![Vi Search and Replace](http://www.tecmint.com/wp-content/uploads/2014/10/vi-search-and-replace.png) + +*vi 的查找和替换* + +冒号 (`:`) 进入末行模式,在本例中 `s` 表示替换,`%` 是从第一行到最后一行的表示方式(也可以使用 nm 表示范围,即第 n 行到第 m 行),old 是查找模式,young 是用来替换的文本,`g` 表示在每个查找出来的字符串都进行替换。 + +另外,在命令最后增加一个 `c`,可以在每一个匹配项替换前进行确认。 + + :%s/old/young/gc + +将旧文本替换为新文本前,vi/vim 会向我们显示以下信息: + +![Replace String in Vi](http://www.tecmint.com/wp-content/uploads/2014/10/vi-replace-old-with-young.png) + +*vi 中替换字符串* + +- `y`: 执行替换(yes) +- `n`: 跳过这个匹配字符的替换并转到下一个(no) +- `a`: 在当前匹配字符及后边的相同项全部执行替换 +- `q` 或 `Esc`: 取消替换 +- `l` (小写 L): 执行本次替换并退出 +- `Ctrl-e`, `Ctrl-y`: 下翻页,上翻页,查看相应的文本来进行替换 + +#### 同时编辑多个文件 #### + +我们在命令提示符输入 vim file1 file2 file3 如下: + + # vim file1 file2 file3 + +vim 会首先打开 file1,要跳到 file2 需用 :n 命令。当需要打开前一个文件时,:N 就可以了。 + +为了从 file1 跳到 file3 + +a) `:buffers` 命令会显示当前正在编辑的文件列表 + + :buffers + +![Edit Multiple Files](http://www.tecmint.com/wp-content/uploads/2014/10/vi-edit-multiple-files.png) + +*编辑多个文件* + +b) `:buffer 3` 命令(后边没有 s)会打开第三个文件 file3 进行编辑。 + +在上边的图片中,标记符号 `#` 表示该文件当前已被打开,但是是在后台,而 `%a` 标记的文件是正在被编辑的。另外,文件号(如上边例子的 3)后边的空格表示该文件还没有被打开。 + +#### vi 的临时缓存区 #### + +为了复制连续的多行(比如,假设为 4 行)到一个名为 a 的临时缓存区(与文件无关),并且还要将这些行粘贴到在当前 vi 会话文件中的其它位置,我们需要: + +1. 按下 `Esc` 键以确认 vi 处在命令模式 + +2. 将光标放在我们希望复制的第一行文本 + +3. 输入 `a4yy` 复制当前行和接下来的 3 行,进入一个名为 a 的缓存区。我们可以继续编辑我们的文件————我们不需要立即插入刚刚复制的行。 + +4. 当到了需要使用刚刚复制的那些行的位置,在 `p`(小写)或 `P`(大写)命令前使用`a`来将复制行插入到名为 a 的 缓存区: + - 输入 `ap`,复制行将插入到光标位置所在行的下一行。 + - 输入 `aP`,复制行将插入到光标位置所在行的上一行。 + +如果愿意,我们可以重复上述步骤,将缓存区 a 中的内容插入到我们文件的多个位置。像本节中这样的一个临时缓存区,会在当前窗口关闭时释放掉。 + +### 总结 ### + +像我们看到的一样,vi/vim 在命令接口下是一个强大而灵活的文本编辑器。通过以下链接,随时分享你自己的技巧和评论。 + +#### 参考链接 #### + +- [关于 LFCS][1] +- [为什么需要 Linux 基金会认证?][2] +- [注册 LFCS 考试][3] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/vi-editor-usage/ + +作者:[Gabriel Cánepa][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[东风唯笑](https://github.com/dongfengweixiao), [wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://training.linuxfoundation.org/certification/LFCS +[2]:https://training.linuxfoundation.org/certification/why-certify-with-us +[3]:https://identity.linuxfoundation.org/user?destination=pid/1 diff --git a/published/LFCS/Part 3 - LFCS--How to Archive or Compress Files and Directories Setting File Attributes and Finding Files in Linux.md b/published/LFCS/Part 3 - LFCS--How to Archive or Compress Files and Directories Setting File Attributes and Finding Files in Linux.md new file mode 100644 index 0000000000..d99008cc29 --- /dev/null +++ b/published/LFCS/Part 3 - LFCS--How to Archive or Compress Files and Directories Setting File Attributes and Finding Files in Linux.md @@ -0,0 +1,298 @@ +LFCS 系列第三讲:归档/压缩文件及目录、设置文件属性和搜索文件 +================================================================================ + +最近,Linux 基金会发起了一个全新的 LFCS(Linux Foundation Certified Sysadmin,Linux 基金会认证系统管理员)认证,旨在让遍布全世界的人都有机会参加该认证的考试,通过考试的人将表明他们有能力在 Linux 上执行基本的中级系统管理任务。这项认证包括了对已运行的系统和服务的支持、一流水平的问题解决和分析以及决定何时将问题反映给工程师团队的能力。 + +![Linux Foundation Certified Sysadmin – Part 3](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-3.png) + +*LFCS 系列第三讲* + +请看以下视频,这里边讲给出 Linux 基金会认证程序的一些想法。 + +注:youtube 视频 + + +本讲是系列教程中的第三讲,在这一讲中,我们会涵盖如何在文件系统中归档/压缩文件及目录、设置文件属性和搜索文件等内容,这些都是 LFCS 认证中必须掌握的知识。 + +### 归档和压缩的相关工具 ### + +文件归档工具将一堆文件整合到一个单独的归档文件之后,我们可以将归档文件备份到不同类型的介质或者通过网络传输和发送 Email 来备份。在 Linux 中使用频率最高的归档实用工具是 tar。当归档工具和压缩工具一起使用的时候,可以减少同一文件和信息在硬盘中的存储空间。 + +#### tar 使用工具 #### + +tar 将一组文件打包到一个单独的归档文件(通常叫做 tar 文件或者 tarball)。tar 这个名称最初代表磁带存档程序(tape archiver),但现在我们可以用它来归档任意类型的可读写介质上边的数据,而不是只能归档磁带数据。tar 通常与 gzip、bzip2 或者 xz 等压缩工具一起使用,生成一个压缩的 tarball。 + +**基本语法:** + + # tar [选项] [路径名 ...] + +其中 ... 代表指定哪些文件进行归档操作的表达式 + +#### tar 的常用命令 #### + + +|长选项|简写|描述| +|-----|:---:|:---| +| -create| c| 创建 tar 归档文件| +| -concatenate| A| 将一存档与已有的存档合并| +| -append| r| 把要存档的文件追加到归档文件的末尾| +| -update| u| 更新新文件到归档文件中去| +| -diff 或 -compare| d| 比较存档与当前文件的不同之处| +| -file archive| f| 使用档案文件或归档设备| +| -list| t| 列出 tarball 中的内容| +| -extract 或 -get| x| 从归档文件中释放文件| + + +#### 常用的操作修饰符 #### + +注:表格 + +|长选项|缩写|描述| +|-----|:--:|:--| +| -directory dir| C| 执行归档操作前,先转到指定目录| +| -same-permissions| p| 保持原始的文件权限| +| -verbose| v| 列出所有的读取或提取的文件。但这个标识符与 -list 一起使用的时候,还会显示出文件大小、属主和时间戳的信息| +| -verify| W| 写入存档后进行校验| +| -exclude file| | 不把指定文件包含在内| +| -exclude=pattern| X| 以PATTERN模式排除文件| +| -gzip 或 -gunzip| z| 通过gzip压缩归档| +| -bzip2| j| 通过bzip2压缩归档| +| -xz| J| 通过xz压缩归档| + + +Gzip 是最古老的压缩工具,压缩率最小,bzip2 的压缩率稍微高一点。另外,xz 是最新的压缩工具,压缩率最好。xz 具有最佳压缩率的代价是:完成压缩操作花费最多时间,压缩过程中占有较多系统资源。 + +通常,通过这些工具压缩的 tar 文件相应的具有 .gz、.bz2 或 .xz的扩展名。在下列的例子中,我们使用 file1、file2、file3、file4 和 file5 进行演示。 + +**通过 gzip、bzip2 和 xz 压缩归档** + +归档当前工作目录的所有文件,并以 gzip、bzip2 和 xz 压缩刚刚的归档文件(请注意,用正则表达式来指定哪些文件应该归档——这是为了防止将归档工具包前一步生成的文件打包进来)。 + + # tar czf myfiles.tar.gz file[0-9] + # tar cjf myfiles.tar.bz2 file[0-9] + # tar cJf myfile.tar.xz file[0-9] + +![Compress Multiple Files Using tar](http://www.tecmint.com/wp-content/uploads/2014/10/Compress-Multiple-Files.png) + +*压缩多个文件* + +**列举 tarball 中的内容和更新/追加文件到归档文件中** + +列举 tarball 中的内容,并显示相同信息为一个详细目录清单。注意,不能直接向压缩的归档文件更新/追加文件(若你需要向压缩的 tarball 中更新/追加文件,需要先解压 tar 文件后再进行操作,然后重新压缩)。 + + # tar tvf [tarball] + +![Check Files in tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/List-Archive-Content.png) + +*列举归档文件中的内容* + +运行一下任意一条命令: + + # gzip -d myfiles.tar.gz [#1] + # bzip2 -d myfiles.tar.bz2 [#2] + # xz -d myfiles.tar.xz [#3] + +然后: + + # tar --delete --file myfiles.tar file4 (删除tarball中的file4) + # tar --update --file myfiles.tar file4 (更新tarball中的file4) + +和 + + # gzip myfiles.tar [ 如果你运行 #1 命令 ] + # bzip2 myfiles.tar [ 如果你运行 #2 命令 ] + # xz myfiles.tar [ 如果你运行 #3 命令 ] + +最后 + + # tar tvf [tarball] #again + +将 file4 修改后的日期和时间与之前显示的对应信息进行比较 + +**排除文件类型** + +假设你现在需要备份用户的家目录。一个有经验的系统管理员会选择忽略所有视频和音频文件再备份(也可能是公司规定)。 + +可能你最先想到的方法是在备份的时候,忽略扩展名为 .mp3 和 .mp4(或者其他格式)的文件。但如果你有些自作聪明的用户将扩展名改为 .txt 或者 .bkp,那你的方法就不灵了。为了发现并排除音频或者视频文件,你需要先检查文件类型。以下 shell 脚本可以代你完成类型检查: + + #!/bin/bash + # 把需要进行备份的目录传递给 $1 参数. + DIR=$1 + # 排除文件类型中包含了 mpeg 字符串的文件,然后创建 tarball 并进行压缩。 + # -若文件类型中包含 mpeg 字符串, $?(最后执行的命令的退出状态)返回 0,然后文件名被定向到排除选项。否则返回 1。 + # -若 $? 等于 0,该文件从需要备份文件的列表排除。 + tar X <(for i in $DIR/*; do file $i | grep -i mpeg; if [ $? -eq 0 ]; then echo $i; fi;done) -cjf backupfile.tar.bz2 $DIR/* + +![Exclude Files in tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/Exclude-Files-in-Tar.png) + +*排除文件进行备份* + +**使用 tar 保持文件的原有权限进行恢复** + +通过以下命令,你可以保留文件的权限将备份文件恢复到原始用户的家目录(本例是 user_restore)。 + + # tar xjf backupfile.tar.bz2 --directory user_restore --same-permissions + +![Restore Files from tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/Restore-tar-Backup-Files.png) + +*从归档文件中恢复* + +**扩展阅读:** + +- [18 tar Command Examples in Linux][1] +- [Dtrx – An Intelligent Archive Tool for Linux][2] + +### 通过 find 命令搜索文件 ### + +find 命令用于递归搜索目录树中包含指定字符的文件和目录,然后在屏幕显示出于指定字符相匹配的文件和目录,或者在匹配项进行其他操作。 + +通常,我们通过文件名、文件的属主、属组、类型权限、日期及大小来搜索。 + +#### 基本语法:#### + + # find [需搜索的目录] [表达式] + +**通过文件大小递归搜索文件** + +以下命令会搜索当前目录(.)及其下两层子目录(-maxdepth 3,包含当前目录及往下两层的子目录)中大于 2 MB(-size +2M)的所有文件(-f)。 + + # find . -maxdepth 3 -type f -size +2M + +![Find Files by Size in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Files-Based-on-Size.png) +* +通过文件大小搜索文件* + +**搜索符合一定规则的文件并将其删除** + +有时候,777 权限的文件通常为外部攻击者打开便利之门。不管是以何种方式,让所有人都可以对文件进行任意操作都是不安全的。对此,我们采取一个相对激进的方法——删除这些文件('{}' + 用来“聚集”搜索的结果)。 + + # find /home/user -perm 777 -exec rm '{}' + + +![Find all 777 Permission Files](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Files-with-777-Permission.png) + +*搜索 777 权限的文件* + +**按访问时间和修改时间搜索文件** + +搜索 /etc 目录下访问时间(-atime)或修改时间(-mtime)大于(+180)或小于(-180) 6 个月或者刚好(180) 6 个月的配置文件。 + +按照下面例子对命令进行修改: + + # find /etc -iname "*.conf" -mtime -180 -print + +![Find Files by Modification Time](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Modified-Files.png) + +*按修改时间搜索文件* + +- 扩展阅读: [35 Practical Examples of Linux ‘find’ Command][3] + +### 文件权限及基本属性 ### + +ls -l 命令输出的前 10 位字符是文件的属性,其中第一个字符用来表明文件的类型。 + +- – : 普通文件 +- -d : 目录 +- -l : 符号链接 +- -c : 字符设备 (它将数据作为字节流处理,如terminal) +- -b : 块设备 (在块设备中处理数据,如存储设备) + +接下来表示文件属性的 9 位字符叫做文件的读写模式,代表文件属主、同组用户和其他用户(通常指的是“外部世界”)对应的读(r)、写(w)和执行(x)权限。 + +文件的写权限允许对应的用户对文件进行打开和读写,对于同时设置了执行权限的目录,对应用户可以列举出该目录的内容。另外,文件的执行权限允许将文件当做是一个可执行程序来运行,而目录的执行权限则是允许用户进入和退出该目录。 + +文件的权限通过 chown 命令来更改,其基本语法如下: + + # chmod [new_mode] file + +new_mode 可以是 3 位八进制数值或者对应权限的表达式。 + +八进制数值可以从二进制数值进行等值转换,通过下列方法来计算文件属主、同组用户和其他用户权限对应的二进制数值: + +一个确定权限的二进制数值表现为 2 的幂(r=2\^2,w=2\^1,x=2\^0),当权限省缺时,二进制数值为 0。如下: + +![Linux File Permissions](http://www.tecmint.com/wp-content/uploads/2014/10/File-Permissions.png) + +*文件权限* + +使用八进制数值设置上图的文件权限,请输入: + + # chmod 744 myfile + +通过 u、g 和 o 分别代表用户、同组用户和其他用户,然后你也可以使用权限表达式来单独对用户设置文件的权限模式。也可以通过 a 代表所有用户,然后设置文件权限。通过 + 号或者 - 号相应的赋予或移除文件权限。 + +**为所有用户撤销一个 shell 脚本的执行权限** + +正如之前解释的那样,我们可以通过 - 号为需要移除权限的属主、同组用户、其他用户或者所有用户去掉指定的文件权限。下面命令中的短横线(-)可以理解为:移除(-)所有用户(a)的 backup.sh 文件执行权限(x)。 + + # chmod a-x backup.sh + +下面演示为文件属主、同组用户赋予读、写和执行权限,并赋予其他用户读权限。 + +当我们使用 3 位八进制数值为文件设置权限的时候,第一位数字代表属主权限,第二位数字代表同组用户权限,第三位数字代表其他用户的权限: + +- 属主:(r=2\^2 + w=2\^1 + x=2\^0 = 7) +- 同组用户:(r=2\^2 + w=2\^1 + x=2\^0 = 7) +- 其他用户:(r=2\^2 + w=0 + x=0 = 4) + +命令如下: + + # chmod 774 myfile + +随着练习时间的推移,你会知道何种情况下使用哪种方式来更改文件的权限模式的效果最好。 + +使用 ls -l 详细列举目录详细同样会显示出文件的属主和属组(这个很基本,而且影响到系统文件的访问控制)。 + +![Linux File Listing](http://www.tecmint.com/wp-content/uploads/2014/10/Linux-File-Listing.png) + +*列举 Linux 文件* + +通过 chown 命令可以对文件的归属权进行更改,可以同时或者分开更改属主和属组。其基本语法为: + + # chown user:group file + +至少要指定用户或者用户组 + +**举几个例子:** + +将文件的属主更改为指定用户: + + # chown gacanepa sent + +同时将文件的属主和属组更改为指定的用户和组: + + # chown gacanepa:gacanepa TestFile + +只将文件的属组更改为指定组。注意组名前的冒号(:)。 + + # chown :gacanepa email_body.txt + +### 结论 ### + +作为一个系统管理员,你需要懂得如何创建和恢复备份、如何在系统中搜索文件并更改它们的属性。通过一些技巧,你可以更好地管理系统并避免以后出问题。 + +我希望,本文给出的技巧可以帮助你达成管理系统的目标。你可以随时在评论中发表自己的技巧及社区给你带来的益处。 + +先行感谢! + +参考链接 +- [关于 LFCS][4] +- [为什么需要 Linux 基金会认证?][5] +- [注册 LFCS 考试][6] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/compress-files-and-finding-files-in-linux/ + +作者:[Gabriel Cánepa][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/18-tar-command-examples-in-linux/ +[2]:http://www.tecmint.com/dtrx-an-intelligent-archive-extraction-tar-zip-cpio-rpm-deb-rar-tool-for-linux/ +[3]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/ +[4]:https://training.linuxfoundation.org/certification/LFCS +[5]:https://training.linuxfoundation.org/certification/why-certify-with-us +[6]:https://identity.linuxfoundation.org/user?destination=pid/1 diff --git a/published/LFCS/Part 4 - LFCS--Partitioning Storage Devices, Formatting Filesystems and Configuring Swap Partition.md b/published/LFCS/Part 4 - LFCS--Partitioning Storage Devices, Formatting Filesystems and Configuring Swap Partition.md new file mode 100644 index 0000000000..77bd84087c --- /dev/null +++ b/published/LFCS/Part 4 - LFCS--Partitioning Storage Devices, Formatting Filesystems and Configuring Swap Partition.md @@ -0,0 +1,193 @@ +LFCS 系列第四讲:对存储设备分区、格式化文件系统和配置交换分区 +================================================================================ + +去年八月份,Linux 基金会发起了 LFCS(Linux Foundation Certified Sysadmin,Linux 基金会认证系统管理员)认证,给所有系统管理员一个展现自己的机会。通过基础考试后,他们可以胜任在 Linux 上的整体运维工作:包括系统支持、一流水平的诊断和监控以及在必要之时向其他支持团队提交帮助请求等。 + +![Linux Foundation Certified Sysadmin – Part 4](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-4.png) + +*LFCS 系列第四讲* + +需要注意的是,Linux 基金会认证是非常严格的,通过与否完全要看个人能力。通过在线链接,你可以随时随地参加 Linux 基金会认证考试。所以,你再也不用到考试中心了,只需要不断提高自己的专业技能和经验就可去参加考试了。 + +请看一下视频,这里将讲解 Linux 基金会认证程序。 + +注:youtube 视频 + + +本讲是系列教程中的第四讲。在本讲中,我们将涵盖对存储设备进行分区、格式化文件系统和配置交换分区等内容,这些都是 LFCS 认证中的必备知识。 + +### 对存储设备分区 ### + +分区是一种将单独的硬盘分成一个或多个区的手段。一个分区只是硬盘的一部分,我们可以认为这部分是独立的磁盘,里边包含一个单一类型的文件系统。分区表则是将硬盘上这些分区与分区标识符联系起来的索引。 + +在 Linux 上,IBM PC 兼容系统里边用于管理传统 MBR(用到2009年)分区的工具是 fdisk。对于 GPT(2010年至今)分区,我们使用 gdisk。这两个工具都可以通过程序名后面加上设备名称(如 /dev/sdb)进行调用。 + +#### 使用 fdisk 管理 MBR 分区 #### + +我们先来介绍 fdisk: + + # fdisk /dev/sdb + +然后出现提示说进行下一步操作。若不确定如何操作,按下 “m” 键显示帮助。 + +![fdisk Help Menu](http://www.tecmint.com/wp-content/uploads/2014/10/fdisk-help.png) + +*fdisk 帮助菜单* + +上图中,使用频率最高的选项已高亮显示。你可以随时按下 “p” 显示分区表。 + +![Check Partition Table in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Show-Partition-Table.png) + +*显示分区表* + +Id 列显示由 fdisk 分配给每个分区的分区类型(分区 id)。一个分区类型代表一种文件系统的标识符,简单来说,包括该分区上数据的访问方法。 + +请注意,每个分区类型的全面讲解将超出了本教程的范围——本系列教材主要专注于 LFCS 测试,以考试为主。 + +**下面列出一些 fdisk 常用选项:** + +按下 “l”(小写 L)选项来显示所有可以由 fdisk 管理的分区类型。 + +按下 “d” 可以删除现有的分区。若硬盘上有多个分区,fdisk 将询问你要删除那个分区。 + +键入对应的数字,并按下 “w” 保存更改(将更改写入分区表)。 + +在下图的命令中,我们将删除 /dev/sdb2,然后显示(p)分区表来验证更改。 + +![fdisk Command Options](http://www.tecmint.com/wp-content/uploads/2014/10/fdisk-options.png) + +*fdisk 命令选项* + +按下 “n” 后接着按下 “p” 会创建新一个主分区。最后,你可以使用所有的默认值(这将占用所有的可用空间),或者像下面一样自定义分区大小。 + +![Create New Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-New-Partition.png) + +*创建新分区* + +若 fdisk 分配的分区 Id 并不是我们想用的,可以按下 “t” 来更改。 + +![Change Partition Name in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Change-Partition-Name.png) + +*更改分区类型* + +全部设置好分区后,按下 “w” 将更改保存到硬盘分区表上。 + +![Save Partition Changes](http://www.tecmint.com/wp-content/uploads/2014/10/Save-Partition-Changes.png) + +*保存分区更改* + +#### 使用 gdisk 管理 GPT 分区 #### + +下面的例子中,我们使用 /dev/sdb。 + + # gdisk /dev/sdb + +必须注意的是,gdisk 可以用于创建 MBR 和 GPT 两种分区表。 + +![Create GPT Partitions in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-GPT-Partitions.png) + +*创建 GPT 分区* + +使用 GPT 分区方案,我们可以在同一个硬盘上创建最多 128 个分区,单个分区最大以 PB 为单位,而 MBR 分区方案最大的只能 2TB。 + +注意,fdisk 与 gdisk 中大多数命令都是一样的。因此,我们不会详细介绍这些命令选项,而是给出一张使用过程中的截图。 + +![gdisk Command Options](http://www.tecmint.com/wp-content/uploads/2014/10/gdisk-options.png) + +*gdisk 命令选项* + +### 格式化文件系统 ### + +一旦创建完需要的分区,我们就必须为分区创建文件系统。查询你所用系统支持的文件系统,请运行: + + # ls /sbin/mk* + +![Check Filesystems Type in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Check-Filesystems.png) + +*检查文件系统类型* + +选择文件系统取决于你的需求。你应该考虑到每个文件系统的优缺点以及其特点。选择文件系统需要看的两个重要属性: + +- 日志支持,允许从系统崩溃事件中快速恢复数据。 +- 安全增强式 Linux(SELinux)支持,按照项目 wiki 所说,“安全增强式 Linux 允许用户和管理员更好的控制访问控制权限”。 + +在接下来的例子中,我们通过 mkfs 在 /dev/sdb1 上创建 ext4 文件系统(支持日志和 SELinux),标卷为 Tecmint。mkfs 基本语法如下: + + # mkfs -t [filesystem] -L [label] device + 或者 + # mkfs.[filesystem] -L [label] device + +![Create ext4 Filesystems in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-ext4-Filesystems.png) + +*创建 ext4 文件系统* + +### 创建并启用交换分区 ### + +要让 Linux 系统访问虚拟内存,则必须有一个交换分区,当内存(RAM)用完的时候,将硬盘中指定分区(即 Swap 分区)当做内存来使用。因此,当有足够的系统内存(RAM)来满足系统的所有的需求时,我们并不需要划分交换分区。尽管如此,是否使用交换分区取决于管理员。 + +下面列出选择交换分区大小的经验法则: + +> 物理内存不高于 2GB 时,取两倍物理内存大小即可;物理内存在 2GB 以上时,取一倍物理内存大小即可;并且所取大小应该大于 32MB。 + +所以,如果: + +M为物理内存大小,S 为交换分区大小,单位 GB,那么: + + 若 M < 2 + S = M *2 + 否则 + S = M + 2 + +记住,这只是基本的经验。对于作为系统管理员的你,才是决定是否使用交换分区及其大小的关键。 + +要配置交换分区,首先要划分一个常规分区,大小像我们之前演示的那样来选取。然后添加以下条目到 /etc/fstab 文件中(其中的 X 要更改为对应的 b 或 c)。 + + /dev/sdX1 swap swap sw 0 0 + +最后,格式化并启用交换分区: + + # mkswap /dev/sdX1 + # swapon -v /dev/sdX1 + +显示交换分区的快照: + + # cat /proc/swaps + +关闭交换分区: + + # swapoff /dev/sdX1 + +下面的例子,我们会使用 fdisk 将 /dev/sdc1(512MB,系统和内存为 256MB)来设置交换分区,下面是我们之前详细提过的步骤。注意,这种情况下我们使用的是指定大小分区。 + +![Create-Swap-Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-Swap-Partition.png) + +*创建交换分区* + +![Add Swap Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Enable-Swap-Partition.png) + +*启用交换分区* + +### 结论 ### + +在你的系统管理员之路上,创建分区(包括交换分区)和格式化文件系统是非常重要的一步。我希望本文中所给出的技巧指导你到达你的管理员目标。随时在本讲评论区中发表你的技巧和想法,一起为社区做贡献。 + +参考链接 + +- [About the LFCS][1] +- [Why get a Linux Foundation Certification?][2] +- [Register for the LFCS exam][3] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/create-partitions-and-filesystems-in-linux/ + +作者:[Gabriel Cánepa][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://training.linuxfoundation.org/certification/LFCS +[2]:https://training.linuxfoundation.org/certification/why-certify-with-us +[3]:https://identity.linuxfoundation.org/user?destination=pid/1 diff --git a/published/LFCS/Part 5 - LFCS--How to Mount or Unmount Local and Network Samba and NFS Filesystems in Linux.md b/published/LFCS/Part 5 - LFCS--How to Mount or Unmount Local and Network Samba and NFS Filesystems in Linux.md new file mode 100644 index 0000000000..50344e5da0 --- /dev/null +++ b/published/LFCS/Part 5 - LFCS--How to Mount or Unmount Local and Network Samba and NFS Filesystems in Linux.md @@ -0,0 +1,236 @@ +LFCS 系列第五讲:如何在 Linux 中挂载/卸载本地文件系统和网络文件系统(Samba 和 NFS) +================================================================================ + +Linux 基金会已经发起了一个全新的 LFCS(Linux Foundation Certified Sysadmin,Linux 基金会认证系统管理员)认证,旨在让来自世界各地的人有机会参加到 LFCS 测试,获得关于有能力在 Linux 系统中执行中间系统管理任务的认证。该认证包括:维护正在运行的系统和服务的能力、全面监控和分析的能力以及何时向上游团队请求支持的决策能力。 + +![Linux Foundation Certified Sysadmin – Part 5](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-5.png) + +*LFCS 系列第五讲* + +请看以下视频,这里边介绍了 Linux 基金会认证程序。 + +注:youtube 视频 + + +本讲是系列教程中的第五讲,在这一讲里边,我们会解释如何在 Linux 中挂载/卸载本地和网络文件系统。这些都是 LFCS 认证中的必备知识。 + +### 挂载文件系统 ### + +在个硬盘分好区之后,Linux 需要通过某些方式对硬盘分区上的数据进行访问。Linux 并不会像 DOS 或者 Windows 那样给每个硬盘分区分配一个字母来作为盘符,而是将硬盘分区挂载到统一的目录树上的挂载点。 + +挂载点是一个目录,挂载是一种访问分区上文件系统的方法,挂载文件系统实际上是将一个确切的文件系统(比如一个分区)和目录树中指定的目录联系起来的过程。 + +换句话说,管理存储设备的第一步就是把设备关联到文件系统树。要完成这一步,通常可以这样:用 mount 命令来进行临时挂载(用完的时候,使用 umount 命令来卸载),或者通过编辑 /etc/fstab 文件之后重启系统来永久性挂载,这样每次开机都会进行挂载。 + +不带任何选项的 mount 命令,可以显示当前已挂载的文件系统。 + + # mount + +![Check Mounted Filesystem in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/check-mounted-filesystems.png) + +*检查已挂载的文件系统* + +另外,mount 命令通常用来挂载文件系统。其基本语法如下: + + # mount -t type device dir -o options + +该命令会指引内核将在设备上找到的文件系统(如已格式化为指定类型的文件系统)挂载到指定目录。像这样的形式,mount 命令不会再到 /etc/fstab 文件中进行确认。 + +除非像下面,挂载指定的目录或者设备: + + # mount /dir -o options + 或 + # mount device -o options + +mount 命令会尝试寻找挂载点,如果找不到就会查找设备(上述两种情况下,mount 命令会在 /etc/fstab 查找相应的设备或挂载点),最后尝试完成挂载操作(这个通常可以成功执行,除非你的挂载点或者设备正在使用中,或者你调用 mount 命令的时候没有 root 权限)。 + +你可以看到,mount 命令的每行输出都是如下格式: + + device on directory type (options) + +例如: + + /dev/mapper/debian-home on /home type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered) + +读作: + +设备 dev/mapper/debian-home 挂载在 /home 下,它被格式化为 ext4,并且有以下挂载选项: rw,relatime,user_xattr,barrier=1,data=ordered。 + +**mount 命令选项** + +下面列出 mount 命令的常用选项 + +- async:允许在将要挂载的文件系统上进行异步 I/O 操作 +- auto:标示该文件系统通过 mount -a 命令挂载,与 noauto 相反。 +- defaults:该选项相当于 `async,auto,dev,exec,nouser,rw,suid` 的组合。注意,多个选项必须由逗号隔开并且中间没有空格。倘若你不小心在两个选项中间输入了一个空格,mount 命令会把后边的字符解释为另一个参数。 +- loop:将镜像文件(如 .iso 文件)挂载为 loop 设备。该选项可以用来模拟显示光盘中的文件内容。 +- noexec:阻止该文件系统中可执行文件的执行。与 exec 选项相反。 +- nouser:阻止任何用户(除 root 用户外) 挂载或卸载文件系统。与 user 选项相反。 +- remount:重新挂载文件系统。 +- ro:只读模式挂载。 +- rw:读写模式挂载。 +- relatime:只要访问时间早于修改时间,就更新文件的的访问时间。 +- user_xattr:允许用户设置和移除可扩展文件系统属性。 + +**以 ro 和 noexec 模式挂载设备** + + # mount -t ext4 /dev/sdg1 /mnt -o ro,noexec + +在本例中,我们可以看到,在挂载点 /mnt 中尝试写入文件或者运行可执行文件都会显示相应的错误信息。 + + # touch /mnt/myfile + # /mnt/bin/echo “Hi there” + +![Mount Device in Read Write Mode](http://www.tecmint.com/wp-content/uploads/2014/10/Mount-Device-Read-Write.png) + +*可读写模式挂载设备* + +**以默认模式挂载设备** + +以下场景,我们在重新挂载设备的挂载点中,像上例一样尝试你写入文件和运行可执行文件。 + + + # mount -t ext4 /dev/sdg1 /mnt -o defaults + +![Mount Device in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Mount-Device.png) + +*挂载设备* + +在这个例子中,我们发现写入文件和命令都完美执行了。 + +### 卸载设备 ### + +使用 umount 命令卸载设备,意味着将所有的“在使用”数据全部写入到文件系统,然后可以安全移除文件系统。请注意,倘若你移除一个没有事先正确卸载的设备,就会有造成设备损坏和数据丢失的风险。 + +也就是说,你必须“离开”设备的块设备描述符或者挂载点,才能卸载设备。换言之,你的当前工作目录不能是需要卸载设备的挂载点。否则,系统将返回设备繁忙的提示信息。 + +![Unmount Device in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Unmount-Device.png) + +*卸载设备* + +离开需卸载设备的挂载点最简单的方法就是,运行不带任何选项的 cd 命令,这样会回到当前用户的家目录。 + +### 挂载常见的网络文件系统 ### + +最常用的两种网络文件系统是 SMB(Server Message Block,服务器消息块)和 NFS(Network File System,网络文件系统)。如果你只向类 Unix 客户端提供共享,用 NFS 就可以了,如果是向 Windows 和其他类 Unix 客户端提供共享服务,就需要用到 Samba 了。 + +扩展阅读 + +- [Setup Samba Server in RHEL/CentOS and Fedora][1] +- [Setting up NFS (Network File System) on RHEL/CentOS/Fedora and Debian/Ubuntu][2] + +下面的例子中,假设 Samba 和 NFS 已经在地址为 192.168.0.10 的服务器上架设好了(请注意,架设 NFS 服务器也是 LFCS 考试中需要考核的能力,我们会在后边中提到)。 + +#### 在 Linux 中挂载 Samba 共享 #### + +第一步:在 Red Hat 以 Debian 系发行版中安装 samba-client、samba-common 和 cifs-utils 软件包,如下: + + # yum update && yum install samba-client samba-common cifs-utils + # aptitude update && aptitude install samba-client samba-common cifs-utils + +然后运行下列命令,查看服务器上可用的 Samba 共享。 + + # smbclient -L 192.168.0.10 + +并输入远程机器上 root 账户的密码。 + +![Mount Samba Share in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Mount-Samba-Share.png) + +*挂载 Samba 共享* + +上图中,已经对可以挂载到我们本地系统上的共享进行高亮显示。你只需要与一个远程服务器上的合法用户名及密码就可以访问共享了。 + +第二步:当挂载有密码保护的网络文件系统时候,将你的访问凭证写入到 /etc/fstab 文件中并非明智的选择。你需要将这些信息写入到具有 600 权限的隐藏文件中,像这样: + + # mkdir /media/samba + # echo “username=samba_username” > /media/samba/.smbcredentials + # echo “password=samba_password” >> /media/samba/.smbcredentials + # chmod 600 /media/samba/.smbcredentials + +第三步:然后将下面的内容添加到 /etc/fstab 文件中。 + + # //192.168.0.10/gacanepa /media/samba cifs credentials=/media/samba/.smbcredentials,defaults 0 0 + +第四步:现在可以挂载你的 Samba 共享了。手动挂载(mount //192.168.0.10/gacanepa)或者重启系统并应用 /etc/fstab 中相应行来用就挂载都可以。 + +![Mount Password Protect Samba Share](http://www.tecmint.com/wp-content/uploads/2014/10/Mount-Password-Protect-Samba-Share.png) + +*挂载有密码保护的 Samba 共享* + +#### 在 Linux 系统中挂载 NFS 共享 #### + +第一步:在 Red Hat 以 Debian 系发行版中安装 nfs-common 和 portmap 软件包。如下: + + # yum update && yum install nfs-utils nfs-utils-lib + # aptitude update && aptitude install nfs-common + +第二步:为 NFS 共享创建挂载点。 + + # mkdir /media/nfs + +第三步:将下面的内容添加到 /etc/fstab 文件中。 + +192.168.0.10:/NFS-SHARE /media/nfs nfs defaults 0 0 + +第四步:现在可以挂载你的 Samba 共享了。手动挂载(mount 192.168.0.10:/NFS-SHARE)或者重启系统并应用 /etc/fstab 中相应行来用就挂载都可以。 + +![Mount NFS Share in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Mount-NFS-Share.png) + +*挂载 NFS 共享* + +### 永久性挂载文件系统 ### + +像前面两个例子那样,/etc/fstab 控制着Linux如何访问硬盘分区及可移动设备。/etc/fstab 由六个字段的内容组成,各个字段之间通过一个空格符或者制表符来分开。井号(#)开始的行只是会被忽略的注释。 + +每一行都按照这个格式来写入: + + + +其中: + +- \: 第一个字段指定挂载的设备。大多数发行版本都通过分区的标卷(label)或者 UUID 来指定。这样做可以避免分区号改变时带来的错误。 +- \: 第二个字段指定挂载点。 +- \ :文件系统的类型代码与 mount 命令挂载文件系统时使用的类型代码是一样的。通过 auto 类型代码可以让内核自动检测文件系统,这对于可移动设备来说非常方便。注意,该选项可能不是对所有文件系统可用。 +- \: 一个(或多个)挂载选项。 +- \: 你可能把这个字段设置为 0(否则设置为 1),使得系统启动时禁用 dump 工具(dump 程序曾经是一个常用的备份工具,但现在越来越少用了)对文件系统进行备份。 +- \: 这个字段指定启动系统是是否通过 fsck 来检查文件系统的完整性。0 表示 fsck 不对文件系统进行检查。数字越大,优先级越低。因此,根分区(/)最可能使用数字 1,其他所有需要检查的分区则是以数字 2. + +**Mount 命令例示** + +1. 在系统启动时,通过 TECMINT 标卷来挂载文件系统,并具备 rw 和 noexec 属性,你应该将以下语句添加到 /etc/fstab 文件中。 + + LABEL=TECMINT /mnt ext4 rw,noexec 0 0 + +2. 若你想在系统启动时挂载 DVD 光驱中的内容,添加以下语句。 + + /dev/sr0 /media/cdrom0 iso9660 ro,user,noauto 0 0 + +其中 /dev/sr0 为你的 DVD 光驱。 + +### 总结 ### + +不用怀疑,在命令行中挂载/卸载本地和网络文件系统将是你作为系统管理员的日常责任的一部分。同时,你需要掌握 /etc/fstab 文件的编写。希望本文对你有帮助。随时在下边发表评论(或者提问),并分享本文到你的朋友圈。 + + +参考链接 + +- [About the LFCS][3] +- [Why get a Linux Foundation Certification?][4] +- [Register for the LFCS exam][5] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/mount-filesystem-in-linux/ + +作者:[Gabriel Cánepa][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/setup-samba-server-using-tdbsam-backend-on-rhel-centos-6-3-5-8-and-fedora-17-12/ +[2]:http://www.tecmint.com/how-to-setup-nfs-server-in-linux/ +[3]:https://training.linuxfoundation.org/certification/LFCS +[4]:https://training.linuxfoundation.org/certification/why-certify-with-us +[5]:https://identity.linuxfoundation.org/user?destination=pid/1 diff --git a/published/LFCS/Part 6 - LFCS--Assembling Partitions as RAID Devices – Creating & Managing System Backups.md b/published/LFCS/Part 6 - LFCS--Assembling Partitions as RAID Devices – Creating & Managing System Backups.md new file mode 100644 index 0000000000..ff480868ac --- /dev/null +++ b/published/LFCS/Part 6 - LFCS--Assembling Partitions as RAID Devices – Creating & Managing System Backups.md @@ -0,0 +1,283 @@ +LFCS 系列第六讲:组装分区为RAID设备——创建和管理系统备份 +========================================================= +Linux 基金会已经发起了一个全新的 LFCS(Linux Foundation Certified Sysadmin,Linux 基金会认证系统管理员)认证,旨在让来自世界各地的人有机会参加到 LFCS 测试,获得关于有能力在 Linux 系统中执行中级系统管理任务的认证。该认证包括:维护正在运行的系统和服务的能力、全面监控和分析的能力以及何时向上游团队请求支持的决策能力。 + +![Linux Foundation Certified Sysadmin – Part 6](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-6.png) + +*LFCS 系列第六讲* + +以下视频介绍了 Linux 基金会认证程序。 + +注:youtube 视频 + + +本讲是系列教程中的第六讲,在这一讲里,我们将会解释如何将分区组装为 RAID 设备——创建和管理系统备份。这些都是 LFCS 认证中的必备知识。 + +### 了解RAID ### + +这种被称为独立磁盘冗余阵列(Redundant Array of Independent Disks)(RAID)的技术是将多个硬盘组合成一个单独逻辑单元的存储解决方案,它提供了数据冗余功能并且改善硬盘的读写操作性能。 + +然而,实际的容错和磁盘 I/O 性能硬盘取决于如何将多个硬盘组装成磁盘阵列。根据可用的设备和容错/性能的需求,RAID 被分为不同的级别,你可以参考 RAID 系列文章以获得每个 RAID 级别更详细的解释。 + +- [在 Linux 下使用 RAID(一):介绍 RAID 的级别和概念][1] + +我们选择用于创建、组装、管理、监视软件 RAID 的工具,叫做 mdadm (multiple disk admin 的简写)。 + +``` +---------------- Debian 及衍生版 ---------------- +# aptitude update && aptitude install mdadm +``` + +``` +---------------- Red Hat 和基于 CentOS 的系统 ---------------- +# yum update && yum install mdadm +``` + +``` +---------------- openSUSE 上 ---------------- +# zypper refresh && zypper install mdadm # +``` + +#### 将分区组装成 RAID 设备 #### + +组装已有分区作为 RAID 设备的过程由以下步骤组成。 + +**1. 使用 mdadm 创建阵列** + +如果先前其中一个分区已经格式化,或者作为了另一个 RAID 阵列的一部分,你会被提示以确认创建一个新的阵列。假设你已经采取了必要的预防措施以避免丢失重要数据,那么可以安全地输入 Y 并且按下回车。 + +``` +# mdadm --create --verbose /dev/md0 --level=stripe --raid-devices=2 /dev/sdb1 /dev/sdc1 +``` + +![Creating RAID Array](http://www.tecmint.com/wp-content/uploads/2014/10/Creating-RAID-Array.png) + +*创建 RAID 阵列* + +**2. 检查阵列的创建状态** + +在创建了 RAID 阵列之后,你可以检查使用以下命令检查阵列的状态。 + + + # cat /proc/mdstat + or + # mdadm --detail /dev/md0 [More detailed summary] + +![Check RAID Array Status](http://www.tecmint.com/wp-content/uploads/2014/10/Check-RAID-Array-Status.png) + +*检查 RAID 阵列的状态* + +**3. 格式化 RAID 设备** + +如本系列[第四讲][2]所介绍的,按照你的需求/要求采用某种文件系统格式化你的设备。 + +**4. 监控 RAID 阵列服务** + +让监控服务时刻监视你的 RAID 阵列。把`# mdadm --detail --scan`命令输出结果添加到 `/etc/mdadm/mdadm.conf`(Debian及其衍生版)或者`/etc/mdadm.conf`(Cent0S/openSUSE),如下。 + + # mdadm --detail --scan + + +![Monitor RAID Array](http://www.tecmint.com/wp-content/uploads/2014/10/Monitor-RAID-Array.png) + +*监控 RAID 阵列* + + # mdadm --assemble --scan [Assemble the array] + +为了确保服务能够开机启动,需要以 root 权限运行以下命令。 + +**Debian 及其衍生版** + +Debian 及其衍生版能够通过下面步骤使服务默认开机启动: + + # update-rc.d mdadm defaults + +在 `/etc/default/mdadm` 文件中添加下面这一行 + + AUTOSTART=true + + +**CentOS 和 openSUSE(systemd-based)** + + # systemctl start mdmonitor + # systemctl enable mdmonitor + +**CentOS 和 openSUSE(SysVinit-based)** + + # service mdmonitor start + # chkconfig mdmonitor on + +**5. 检查RAID磁盘故障** + +在支持冗余的的 RAID 级别中,在需要时会替换故障的驱动器。当磁盘阵列中的设备出现故障时,仅当存在我们第一次创建阵列时预留的备用设备时,磁盘阵列会将自动启动重建。 + +![Check RAID Faulty Disk](http://www.tecmint.com/wp-content/uploads/2014/10/Check-RAID-Faulty-Disk.png) + +*检查 RAID 故障磁盘* + +否则,我们需要手动将一个额外的物理驱动器插入到我们的系统,并且运行。 + + # mdadm /dev/md0 --add /dev/sdX1 + +/dev/md0 是出现了问题的阵列,而 /dev/sdx1 是新添加的设备。 + +**6. 拆解一个工作阵列** + +如果你需要使用工作阵列的设备创建一个新的阵列,你可能不得不去拆解已有工作阵列——(可选步骤) + + # mdadm --stop /dev/md0 # Stop the array + # mdadm --remove /dev/md0 # Remove the RAID device + # mdadm --zero-superblock /dev/sdX1 # Overwrite the existing md superblock with zeroes + +**7. 设置邮件通知** + +你可以配置一个用于发送通知的有效邮件地址或者系统账号(确保在 mdadm.conf 文件中有下面这一行)。——(可选步骤) + + MAILADDR root + +在这种情况下,来自 RAID 后台监控程序所有的通知将会发送到你的本地 root 账号的邮件箱中。其中一个类似的通知如下。 + +说明:此次通知事件和第5步中的例子相关。此处一个设备被标志为错误,并且一个空闲的设备自动地被 mdadm 加入到阵列。我们用完了所有“健康的”空闲设备,因此我们得到了通知。 + +![RAID Monitoring Alerts](http://www.tecmint.com/wp-content/uploads/2014/10/RAID-Monitoring-Alerts.png) + +*RAID 监控通知* + +#### 了解 RAID 级别 #### + +**RAID 0** + +阵列总大小是最小分区大小的 n 倍,n 是阵列中独立磁盘的个数(你至少需要两个驱动器/磁盘)。运行下面命令,使用 /dev/sdb1 和 /dev/sdc1 分区组装一个 RAID 0 阵列。 + + # mdadm --create --verbose /dev/md0 --level=stripe --raid-devices=2 /dev/sdb1 /dev/sdc1 + +常见用途:用于支持性能比容错更重要的实时应用程序的设置 + +**RAID 1 (又名镜像)** + +阵列总大小等于最小分区大小(你至少需要两个驱动器/磁盘)。运行下面命令,使用 /dev/sdb1 和 /dev/sdc1 分区组装一个 RAID 1 阵列。 + + # mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1 + +常见用途:操作系统的安装或者重要的子文件夹,例如 /home + +**RAID 5 (又名奇偶校验码盘)** + +阵列总大小将是最小分区大小的 (n-1) 倍。所减少的大小用于奇偶校验(冗余)计算(你至少需要3个驱动器/磁盘)。 + +说明:你可以指定一个空闲设备 (/dev/sde1) 替换问题出现时的故障部分(分区)。运行下面命令,使用 /dev/sdb1, /dev/sdc1, /dev/sdd1,/dev/sde1 组装一个 RAID 5 阵列,其中 /dev/sde1 作为空闲分区。 + + # mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 --spare-devices=1 /dev/sde1 + +常见用途:Web 和文件服务 + +**RAID 6 (又名双重奇偶校验码盘)** + +阵列总大小为(n*s)-2*s,其中n为阵列中独立磁盘的个数,s为最小磁盘大小。 + +说明:你可以指定一个空闲分区(在这个例子为 /dev/sdf1)替换问题出现时的故障部分(分区)。 + +运行下面命令,使用 /dev/sdb1, /dev/sdc1, /dev/sdd1, /dev/sde1 和 /dev/sdf1 组装 RAID 6 阵列,其中 /dev/sdf1 作为空闲分区。 + + # mdadm --create --verbose /dev/md0 --level=6 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde --spare-devices=1 /dev/sdf1 + +常见用途:大容量、高可用性要求的文件服务器和备份服务器。 + +**RAID 1+0 (又名镜像条带)** + +因为 RAID 1+0 是 RAID 0 和 RAID 1 的组合,所以阵列总大小是基于两者的公式计算的。首先,计算每一个镜像的大小,然后再计算条带的大小。 + + # mdadm --create --verbose /dev/md0 --level=10 --raid-devices=4 /dev/sd[b-e]1 --spare-devices=1 /dev/sdf1 + +常见用途:需要快速 IO 操作的数据库和应用服务器 + +#### 创建和管理系统备份 #### + +记住, RAID 其所有的价值不是在于备份的替换者!在黑板上写上1000次,如果你需要的话,但无论何时一定要记住它。在我们开始前,我们必须注意的是,没有一个放之四海皆准的针对所有系统备份的解决方案,但这里有一些东西,是你在规划一个备份策略时需要考虑的。 + +- 你的系统将用于什么?(桌面或者服务器?如果系统是应用于后者,那么最重要的服务是什么?哪个配置是痛点?) +- 你每隔多久备份你的系统? +- 你需要备份的数据是什么(比如文件/文件夹/数据库转储)?你还可以考虑是否需要备份大型文件(比如音频和视频文件)。 +- 这些备份将会存储在哪里(物理位置和媒体)? + +**备份你的数据** + +方法1:使用 dd 命令备份整个磁盘。你可以在任意时间点通过创建一个准确的镜像来备份一整个硬盘或者是分区。注意当设备是离线时,这种方法效果最好,也就是说它没有被挂载并且没有任何进程的 I/O 操作访问它。 + +这种备份方法的缺点是镜像将具有和磁盘或分区一样的大小,即使实际数据占用的是一个很小的比例。比如,如果你想要为只使用了10%的20GB的分区创建镜像,那么镜像文件将仍旧是20GB。换句话来讲,它不仅包含了备份的实际数据,而且也包含了整个分区。如果你想完整备份你的设备,那么你可以考虑使用这个方法。 + +**从现有的设备创建一个镜像文件** + + # dd if=/dev/sda of=/system_images/sda.img + 或者 + --------------------- 可选地,你可以压缩镜像文件 ------------------- + # dd if=/dev/sda | gzip -c > /system_images/sda.img.gz + +**从镜像文件恢复备份** + + # dd if=/system_images/sda.img of=/dev/sda + 或者 + --------------------- 根据你创建镜像文件时的选择(译者注:比如压缩) ---------------- + # gzip -dc /system_images/sda.img.gz | dd of=/dev/sda + +方法2:使用 tar 命令备份确定的文件/文件夹——已经在本系列[第三讲][3]中讲了。如果你想要备份指定的文件/文件夹(配置文件,用户主目录等等),你可以使用这种方法。 + +方法3:使用 rsync 命令同步文件。rsync 是一种多功能远程(和本地)文件复制工具。如果你想要从网络设备备份或同步文件,rsync 是一种选择。 + + +无论是你是正在同步两个本地文件夹还是本地 < — > 挂载在本地文件系统的远程文件夹,其基本语法是一样的。 + + # rsync -av source_directory destination_directory + +在这里,-a 递归遍历子目录(如果它们存在的话),维持符号链接、时间戳、权限以及原本的属主/属组,-v 显示详细过程。 + +![rsync Synchronizing Files](http://www.tecmint.com/wp-content/uploads/2014/10/rsync-synchronizing-Files.png) + +*rsync 同步文件* + +除此之外,如果你想增加在网络上传输数据的安全性,你可以通过 ssh 协议使用 rsync。 + +**通过 ssh 同步本地到远程文件夹** + + # rsync -avzhe ssh backups root@remote_host:/remote_directory/ + +这个示例,本地主机上的 backups 文件夹将与远程主机上的 /root/remote_directory 的内容同步。 + +在这里,-h 选项以易读的格式显示文件的大小,-e 标志用于表示一个 ssh 连接。 + +![rsync Synchronize Remote Files](http://www.tecmint.com/wp-content/uploads/2014/10/rsync-synchronize-Remote-Files.png) + +*rsync 同步远程文件* + +**通过ssh同步远程到本地文件夹** + +在这种情况下,交换前面示例中的 source 和 destination 文件夹。 + + # rsync -avzhe ssh root@remote_host:/remote_directory/ backups + +请注意这些只是 rsync 用法的三个示例而已(你可能遇到的最常见的情形)。对于更多有关 rsync 命令的示例和用法 ,你可以查看下面的文章。 + +- [在 Linux 下同步文件的10个 rsync命令][4] + +### 总结 ### + +作为一个系统管理员,你需要确保你的系统表现得尽可能好。如果你做好了充分准备,并且如果你的数据完整性能被诸如 RAID 和系统日常备份的存储技术支持,那你将是安全的。 + +如果你有有关完善这篇文章的问题、评论或者进一步的想法,可以在下面畅所欲言。除此之外,请考虑通过你的社交网络简介分享这系列文章。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/creating-and-managing-raid-backups-in-linux/ + +作者:[Gabriel Cánepa][a] +译者:[cpsoture](https://github.com/cposture) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://linux.cn/article-6085-1.html +[2]:https://linux.cn/article-7187-1.html +[3]:https://linux.cn/article-7171-1.html +[4]:http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/ + diff --git a/published/LFCS/Part 7 - LFCS--Managing System Startup Process and Services SysVinit Systemd and Upstart.md b/published/LFCS/Part 7 - LFCS--Managing System Startup Process and Services SysVinit Systemd and Upstart.md new file mode 100644 index 0000000000..ff987c3e9b --- /dev/null +++ b/published/LFCS/Part 7 - LFCS--Managing System Startup Process and Services SysVinit Systemd and Upstart.md @@ -0,0 +1,341 @@ +LFCS 系列第七讲:通过 SysVinit、Systemd 和 Upstart 管理系统自启动进程和服务 +================================================================================ +几个月前, Linux 基金会宣布 LFCS (Linux 基金会认证系统管理员) 认证诞生了,这个令人兴奋的新计划定位于让来自全球各地的初级到中级的 Linux 系统管理员得到认证。这其中包括维护已经在运行的系统和服务的能力、第一手的问题查找和分析能力、以及决定何时向开发团队提交问题的能力。 + +![Linux Foundation Certified Sysadmin – Part 7](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-7.png) + +*第七讲: Linux 基金会认证系统管理员* + +下面的视频简要介绍了 Linux 基金会认证计划。 + +注:youtube 视频 + + +本讲是系列教程中的第七讲,在这篇文章中,我们会介绍如何管理 Linux 系统自启动进程和服务,这是 LFCS 认证考试要求的一部分。 + +### 管理 Linux 自启动进程 ### + +Linux 系统的启动程序包括多个阶段,每个阶段由一个不同的图示块表示。下面的图示简要总结了启动过程以及所有包括的主要组件。 + +![Linux Boot Process](http://www.tecmint.com/wp-content/uploads/2014/10/Linux-Boot-Process.png) + +*Linux 启动过程* + +当你按下你机器上的电源键时,存储在主板 EEPROM 芯片中的固件初始化 POST(通电自检) 检查系统硬件资源的状态。POST 结束后,固件会搜索并加载位于第一块可用磁盘上的 MBR 或 EFI 分区的第一阶段引导程序,并把控制权交给引导程序。 + +#### MBR 方式 #### + +MBR 是位于 BIOS 设置中标记为可启动磁盘上的第一个扇区,大小是 512 个字节。 + +- 前面 446 个字节:包括可执行代码和错误信息文本的引导程序 +- 接下来的 64 个字节:四个分区(主分区或扩展分区)中每个分区一条记录的分区表。其中,每条记录标示了每个一个分区的状态(是否活跃)、大小以及开始和结束扇区。 +- 最后 2 个字节: MBR 有效性检查的魔法数。 + +下面的命令对 MBR 进行备份(在本例中,/dev/sda 是第一块硬盘)。结果文件 mbr.bkp 在分区表被破坏、例如系统不可引导时能排上用场。 + +当然,为了后面需要的时候能使用它,我们需要把它保存到别的地方(例如一个 USB 设备)。该文件能帮助我们重新恢复 MBR,这只在我们操作过程中没有改变硬盘驱动布局时才有效。 + +**备份 MBR** + + # dd if=/dev/sda of=mbr.bkp bs=512 count=1 + +![Backup MBR in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Backup-MBR-in-Linux.png) + +*在 Linux 中备份 MBR* + +**恢复 MBR** + + # dd if=mbr.bkp of=/dev/sda bs=512 count=1 + +![Restore MBR in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Restore-MBR-in-Linux.png) + +*在 Linux 中恢复 MBR* + +#### EFI/UEFI 方式 #### + +对于使用 EFI/UEFI 方式的系统, UEFI 固件读取它的设置来决定从哪里启动哪个 UEFI 应用。(例如, EFI 分区位于哪块磁盘或分区。 + +接下来,加载并运行第二阶段引导程序(又名引导管理器)。GRUB[GRand Unified Boot] 是 Linux 中最常使用的引导管理器。今天大部分使用的系统中都能找到它两个中的其中一个版本。 + +- GRUB 有效配置文件: /boot/grub/menu.lst(旧发行版, EFI/UEFI 固件不支持)。 +- GRUB2 配置文件: 通常是 /etc/default/grub。 + +尽管 LFCS 考试目标没有明确要求了解 GRUB 内部知识,但如果你足够大胆并且不怕把你的系统搞乱(为了以防万一,你可以先在虚拟机上进行尝试)你可以运行: + + # update-grub + +为了使更改生效,你需要以 root 用户修改 GRUB 的配置。 + +首先, GRUB 加载默认的内核以及 initrd 或 initramfs 镜像。补充一句,initrd 或者 initramfs 帮助完成硬件检测、内核模块加载、以及发现挂载根目录文件系统需要的设备。 + +一旦真正的根目录文件系统启动,为了显示用户界面,内核就会执行系统和服务管理器(init 或 systemd,进程号 PID 一般为 1)开始普通用户态的引导程序。 + +init 和 systemd 都是管理其它守护进程的守护进程(后台进程),它们总是最先启动(系统引导时),最后结束(系统关闭时)。 + +![Systemd and Init](http://www.tecmint.com/wp-content/uploads/2014/10/systemd-and-init.png) + +*Systemd 和 Init* + +### 自启动服务(SysVinit) ### + +Linux 中运行等级通过控制运行哪些服务来以不同方式使用系统。换句话说,运行等级控制着当前执行状态下可以完成什么任务(以及什么不能完成)。 + +传统上,这个启动过程是基于起源于 System V Unix 的形式,通过执行脚本启动或者停止服务从而使机器进入指定的运行等级(换句话说,是一个不同的系统运行模式)。 + +在每个运行等级中,独立服务可以设置为运行、或者在运行时关闭。一些主流发行版的最新版本中,已经移除了标准的 System V,而用一个称为 systemd(表示系统守护进程)的新服务和系统管理器代替,但为了兼容性,通常也支持 sysv 命令。这意味着你可以在基于 systemd 的发行版中运行大部分有名的 sysv 初始化工具。 + +- 推荐阅读: [Linux 为什么用 ‘systemd’ 代替 ‘init’][1] + +除了启动系统进程,init 还会查看 /etc/inittab 来决定进入哪个运行等级。 + + +|Runlevel| Description| +|--------|------------| +|0|停止系统。运行等级 0 是一个用于快速关闭系统的特殊过渡状态。| +|1|别名为 s 或 S,这个运行等级有时候也称为维护模式。在这个运行等级启动的服务由于发行版不同而不同。通常用于正常系统操作损坏时低级别的系统维护。| +|2|多用户。在 Debian 系统及其衍生版中,这是默认的运行等级,还包括了一个图形化登录(如果有的话)。在基于红帽的系统中,这是没有网络的多用户模式。| +|3|在基于红帽的系统中,这是默认的多用户模式,运行除了图形化环境以外的所有东西。基于 Debian 的系统中通常不会使用这个运行等级以及等级 4 和 5。| +|4|通常默认情况下不使用,可用于自定制。| +|5|基于红帽的系统中,支持 GUI 登录的完全多用户模式。这个运行等级和等级 3 类似,但是有可用的 GUI 登录。| +|6|重启系统。| + + +要在运行等级之间切换,我们只需要使用 init 命令更改运行等级:init N(其中 N 是上面列出的一个运行等级)。 +请注意这并不是运行中的系统切换运行等级的推荐方式,因为它不会给已经登录的用户发送警告(因而导致他们丢失工作以及进程异常终结)。 + +相反,应该用 shutdown 命令重启系统(它首先发送警告信息给所有已经登录的用户,并锁住任何新的登录;然后再给 init 发送信号切换运行等级)但是,首先要在 /etc/inittab 文件中设置好默认的运行等级(系统引导到的等级)。 + +因为这个原因,按照下面的步骤切当地切换运行等级。以 root 用户在 /etc/inittab 中查找下面的行。 + + id:2:initdefault: + +并用你喜欢的文本编辑器,例如 vim(本系列的 [LFCS 系列第二讲:如何安装和使用纯文本编辑器 vi/vim][2]),更改数字 2 为想要的运行等级。 + +然后,以 root 用户执行 + + # shutdown -r now + +最后一个命令会重启系统,并使它在下一次引导时进入指定的运行等级,并会执行保存在 /etc/rc[runlevel].d 目录中的脚本以决定应该启动什么服务、不应该启动什么服务。例如,在下面的系统中运行等级 2。 + +![Change Runlevels in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Change-Runlevels-in-Linux.jpeg) + +*在 Linux 中更改运行等级* + +#### 使用 chkconfig 管理服务 #### + +为了在启动时启动或者停用系统服务,我们可以在 CentOS / openSUSE 中使用 [chkconfig 命令][3],在 Debian 及其衍生版中使用 sysv-rc-conf 命令。这个工具还能告诉我们对于一个指定的运行等级预先配置的状态是什么。 + +- 推荐阅读: [如何在 Linux 中停止和停用不想要的服务][4] + +列出某个服务的运行等级配置。 + + # chkconfig --list [service name] + # chkconfig --list postfix + # chkconfig --list mysqld + +![Listing Runlevel Configuration](http://www.tecmint.com/wp-content/uploads/2014/10/Listing-Runlevel-Configuration.png) + +*列出运行等级配置* + +从上图中我们可以看出,当系统进入运行等级 2 到 5 的时候就会启动 postfix,而默认情况下运行等级 2 到 4 时会运行 mysqld。现在假设我们并不希望如此。 + +例如,我们希望运行等级为 5 时也启动 mysqld,运行等级为 4 或 5 时关闭 postfix。下面分别针对两种情况进行设置(以 root 用户执行以下命令)。 + +**为特定运行等级启用服务** + + # chkconfig --level [level(s)] service on + # chkconfig --level 5 mysqld on + +**为特定运行等级停用服务** + + # chkconfig --level [level(s)] service off + # chkconfig --level 45 postfix off + +![在 Linux 中启用/停用服务Enable Disable Services in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Enable-Disable-Services.png) + +*启用/停用服务* + +我们在基于 Debian 的系统中使用 sysv-rc-conf 完成类似任务。 + +#### 使用 sysv-rc-conf 管理服务 #### + +配置服务自动启动时进入指定运行等级,同时禁止启动时进入其它运行等级。 + +1. 我们可以用下面的命令查看启动 mdadm 时的运行等级。 + + # ls -l /etc/rc[0-6].d | grep -E 'rc[0-6]|mdadm' + + + ![查看运行中服务的运行等级Check Runlevel of Service Running](http://www.tecmint.com/wp-content/uploads/2014/10/Check-Service-Runlevel.png) + + *查看运行中服务的运行等级* + +2. 我们使用 sysv-rc-conf 设置防止 mdadm 在运行等级2 之外的其它等级启动。只需根据需要(你可以使用上下左右按键)选中或取消选中(通过空格键)。 + + # sysv-rc-conf + + ![Sysv 运行等级配置SysV Runlevel Config](http://www.tecmint.com/wp-content/uploads/2014/10/SysV-Runlevel-Config.png) + + *Sysv 运行等级配置* + + 然后输入 q 退出。 + +3. 重启系统并从步骤 1 开始再操作一遍。 + + # ls -l /etc/rc[0-6].d | grep -E 'rc[0-6]|mdadm' + + ![验证服务运行等级Verify Service Runlevel](http://www.tecmint.com/wp-content/uploads/2014/10/Verify-Service-Runlevel.png) + + *验证服务运行等级* + + 从上图中我们可以看出 mdadm 配置为只在运行等级 2 上启动。 + +### 那关于 systemd 呢? ### + +systemd 是另外一个被多种主流 Linux 发行版采用的服务和系统管理器。它的目标是允许系统启动时多个任务尽可能并行(而 sysvinit 并非如此,sysvinit 一般比较慢,因为它每次只启动一个进程,而且会检查彼此之间是否有依赖,在启动其它服务之前还要等待守护进程启动),充当运行中系统动态资源管理的角色。 + +因此,服务只在需要的时候启动,而不是系统启动时毫无缘由地启动(为了防止消耗系统资源)。 + +要查看你系统中运行的原生 systemd 服务和 Sysv 服务,可以用以下的命令。 + + # systemctl + +![在 Linux 中查看运行中的进程Check All Running Processes in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Check-All-Running-Processes.png) + +*查看运行中的进程* + +LOAD 一列显示了单元(UNIT 列,显示服务或者由 systemd 维护的其它进程)是否正确加载,ACTIVE 和 SUB 列则显示了该单元当前的状态。 + +**显示服务当前状态的信息** + +当 ACTIVE 列显示某个单元状态并非活跃时,我们可以使用以下命令查看具体原因。 + + # systemctl status [unit] + +例如,上图中 media-samba.mount 处于失败状态。我们可以运行: + + # systemctl status media-samba.mount + +![查看 Linux 服务状态Check Linux Service Status](http://www.tecmint.com/wp-content/uploads/2014/10/Check-Service-Status.png) + +*查看服务状态* + +我们可以看到 media-samba.mount 失败的原因是 host dev1 上的挂载进程无法找到 //192.168.0.10/gacanepa 上的共享网络。 + +### 启动或停止服务 ### + +一旦 //192.168.0.10/gacanepa 上的共享网络可用,我们可以再来尝试启动、停止以及重启 media-samba.mount 单元。执行每次操作之后,我们都执行 systemctl stats media-samba.mout 来查看它的状态。 + + # systemctl start media-samba.mount + # systemctl status media-samba.mount + # systemctl stop media-samba.mount + # systemctl restart media-samba.mount + # systemctl status media-samba.mount + +![启动停止服务](http://www.tecmint.com/wp-content/uploads/2014/10/Starting-Stoping-Service.jpeg) + +*启动停止服务* + +**启用或停用某服务随系统启动** + +使用 systemd 你可以在系统启动时启用或停用某服务 + + # systemctl enable [service] # 启用服务 + # systemctl disable [service] # 阻止服务随系统启动 + + +启用或停用某服务随系统启动包括在 /etc/systemd/system/multi-user.target.wants 目录添加或者删除符号链接。 + +![启用或停用服务](http://www.tecmint.com/wp-content/uploads/2014/10/Enabling-Disabling-Services.jpeg) + +*启用或停用服务* + +你也可以用下面的命令查看某个服务的当前状态(启用或者停用)。 + + # systemctl is-enabled [service] + +例如, + + # systemctl is-enabled postfix.service + +另外,你可以用下面的命令重启或者关闭系统。 + + # systemctl reboot + # systemctl shutdown + +### Upstart ### + +基于事件的 Upstart 是 /sbin/init 守护进程的替代品,它仅为在需要那些服务的时候启动服务而生,(或者当它们在运行时管理它们),以及处理发生的实践,因此 Upstart 优于基于依赖的 sysvinit 系统。 + +一开始它是为 Ubuntu 发行版开发的,但在红帽企业版 Linux 6.0 中得到使用。尽管希望它能在所有 Linux 发行版中替代 sysvinit,但它已经被 systemd 超越。2014 年 2 月 14 日,Mark Shuttleworth(Canonical Ltd. 创建者)发布声明之后的 Ubuntu 发行版采用 systemd 作为默认初始化守护进程。 + +由于 Sysv 启动脚本已经流行很长时间了,很多软件包中都包括了 Sysv 启动脚本。为了兼容这些软件, Upstart 提供了兼容模式:它可以运行保存在常用位置(/etc/rc.d/rc?.d, /etc/init.d/rc?.d, /etc/rc?.d或其它类似的位置)的Sysv 启动脚本。因此,如果我们安装了一个还没有 Upstart 配置脚本的软件,仍然可以用原来的方式启动它。 + +另外,如果我们还安装了类似 [chkconfig][5] 的工具,你还可以和在基于 sysvinit 的系统中一样用它们管理基于 Sysv 的服务。 + +Upstart 脚本除了支持 Sysv 启动脚本,还支持基于多种方式启动或者停用服务;例如, Upstart 可以在一个特定硬件设备连接上的时候启动一个服务。 + +使用 Upstart以及它原生脚本的系统替换了 /etc/inittab 文件和 /etc/init 目录下和运行等级相关的以 .conf 作为后缀的 Sysv 启动脚本目录。 + +这些 *.conf 脚本(也称为任务定义)通常包括以下几部分: + +- 进程描述 +- 进程的运行等级或者应该触发它们的事件 +- 应该停止进程的运行等级或者触发停止进程的事件 +- 选项 +- 启动进程的命令 + +例如, + + # My test service - Upstart script demo description "Here goes the description of 'My test service'" author "Dave Null " + # Stanzas + + # + # Stanzas define when and how a process is started and stopped + # See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas#respawn + # When to start the service + start on runlevel [2345] + # When to stop the service + stop on runlevel [016] + # Automatically restart process in case of crash + respawn + # Specify working directory + chdir /home/dave/myfiles + # Specify the process/command (add arguments if needed) to run + exec bash backup.sh arg1 arg2 + +要使更改生效,你要让 upstart 重新加载它的配置文件。 + + # initctl reload-configuration + +然后用下面的命令启动你的任务。 + + $ sudo start yourjobname + +其中 yourjobname 是之前 yourjobname.conf 脚本中添加的任务名称。 + +关于 Upstart 更完整和详细的介绍可以参考该项目网站的 “[Cookbook][6]” 栏目。 + +### 总结 ### + +了解 Linux 启动进程对于你进行错误处理、调整计算机系统以及根据需要运行服务非常有用。 + +在这篇文章中,我们分析了你按下电源键启动机器的一刻到你看到完整的可操作用户界面这段时间发生了什么。我希望你能像我一样把它们放在一起阅读。欢迎在下面留下你的评论或者疑问。我们总是期待听到读者的回复。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-boot-process-and-manage-services/ + +作者:[Gabriel Cánepa][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/systemd-replaces-init-in-linux/ +[2]:https://linux.cn/article-7165-1.html +[3]:http://www.tecmint.com/chkconfig-command-examples/ +[4]:http://www.tecmint.com/remove-unwanted-services-from-linux/ +[5]:http://www.tecmint.com/chkconfig-command-examples/ +[6]:http://upstart.ubuntu.com/cookbook/ diff --git a/published/201508/Part 1 - Introduction to RAID, Concepts of RAID and RAID Levels.md b/published/RAID/Part 1 - Introduction to RAID, Concepts of RAID and RAID Levels.md similarity index 100% rename from published/201508/Part 1 - Introduction to RAID, Concepts of RAID and RAID Levels.md rename to published/RAID/Part 1 - Introduction to RAID, Concepts of RAID and RAID Levels.md diff --git a/published/201508/Part 2 - Creating Software RAID0 (Stripe) on ‘Two Devices’ Using ‘mdadm’ Tool in Linux.md b/published/RAID/Part 2 - Creating Software RAID0 (Stripe) on ‘Two Devices’ Using ‘mdadm’ Tool in Linux.md similarity index 100% rename from published/201508/Part 2 - Creating Software RAID0 (Stripe) on ‘Two Devices’ Using ‘mdadm’ Tool in Linux.md rename to published/RAID/Part 2 - Creating Software RAID0 (Stripe) on ‘Two Devices’ Using ‘mdadm’ Tool in Linux.md diff --git a/published/201508/Part 3 - Setting up RAID 1 (Mirroring) using 'Two Disks' in Linux.md b/published/RAID/Part 3 - Setting up RAID 1 (Mirroring) using 'Two Disks' in Linux.md similarity index 100% rename from published/201508/Part 3 - Setting up RAID 1 (Mirroring) using 'Two Disks' in Linux.md rename to published/RAID/Part 3 - Setting up RAID 1 (Mirroring) using 'Two Disks' in Linux.md diff --git a/published/201508/Part 4 - Creating RAID 5 (Striping with Distributed Parity) in Linux.md b/published/RAID/Part 4 - Creating RAID 5 (Striping with Distributed Parity) in Linux.md similarity index 100% rename from published/201508/Part 4 - Creating RAID 5 (Striping with Distributed Parity) in Linux.md rename to published/RAID/Part 4 - Creating RAID 5 (Striping with Distributed Parity) in Linux.md diff --git a/published/201508/Part 5 - Setup RAID Level 6 (Striping with Double Distributed Parity) in Linux.md b/published/RAID/Part 5 - Setup RAID Level 6 (Striping with Double Distributed Parity) in Linux.md similarity index 100% rename from published/201508/Part 5 - Setup RAID Level 6 (Striping with Double Distributed Parity) in Linux.md rename to published/RAID/Part 5 - Setup RAID Level 6 (Striping with Double Distributed Parity) in Linux.md diff --git a/published/201508/Part 6 - Setting Up RAID 10 or 1+0 (Nested) in Linux.md b/published/RAID/Part 6 - Setting Up RAID 10 or 1+0 (Nested) in Linux.md similarity index 100% rename from published/201508/Part 6 - Setting Up RAID 10 or 1+0 (Nested) in Linux.md rename to published/RAID/Part 6 - Setting Up RAID 10 or 1+0 (Nested) in Linux.md diff --git a/published/201508/Part 7 - Growing an Existing RAID Array and Removing Failed Disks in Raid.md b/published/RAID/Part 7 - Growing an Existing RAID Array and Removing Failed Disks in Raid.md similarity index 100% rename from published/201508/Part 7 - Growing an Existing RAID Array and Removing Failed Disks in Raid.md rename to published/RAID/Part 7 - Growing an Existing RAID Array and Removing Failed Disks in Raid.md diff --git a/published/RAID/Part 8 - How to Recover Data and Rebuild Failed Software RAID's.md b/published/RAID/Part 8 - How to Recover Data and Rebuild Failed Software RAID's.md new file mode 100644 index 0000000000..82233aacda --- /dev/null +++ b/published/RAID/Part 8 - How to Recover Data and Rebuild Failed Software RAID's.md @@ -0,0 +1,167 @@ +在 Linux 下使用 RAID(八):当软件 RAID 故障时如何恢复和重建数据 +================================================================================ + +在阅读过 [RAID 系列][1] 前面的文章后你已经对 RAID 比较熟悉了。回顾前面几个软件 RAID 的配置,我们对每一个都做了详细的解释,使用哪一个取决与你的具体情况。 + +![Recover Rebuild Failed Software RAID's](http://www.tecmint.com/wp-content/uploads/2015/10/Recover-Rebuild-Failed-Software-RAID.png) + +*恢复并重建故障的软件 RAID - 第8部分* + +在本文中,我们将讨论当一个磁盘发生故障时如何重建软件 RAID 阵列并且不会丢失数据。为方便起见,我们仅考虑RAID 1 的配置 - 但其方法和概念适用于所有情况。 + +#### RAID 测试方案 #### + +在进一步讨论之前,请确保你已经配置好了 RAID 1 阵列,可以按照本系列第3部分提供的方法:[在 Linux 中如何创建 RAID 1(镜像)][2]。 + +在目前的情况下,仅有的变化是: + +1. 使用不同版本 CentOS(v7),而不是前面文章中的(v6.5)。 +2. 磁盘容量发生改变, /dev/sdb 和 /dev/sdc(各8GB)。 + +此外,如果 SELinux 设置为 enforcing 模式,你需要将相应的标签添加到挂载 RAID 设备的目录中。否则,当你试图挂载时,你会碰到这样的警告信息: + +![SELinux RAID Mount Error](http://www.tecmint.com/wp-content/uploads/2015/10/SELinux-RAID-Mount-Error.png) + +*启用 SELinux 时 RAID 挂载错误* + +通过以下命令来解决: + + # restorecon -R /mnt/raid1 + +### 配置 RAID 监控 ### + +存储设备损坏的原因很多(尽管固态硬盘大大减少了这种情况发生的可能性),但不管是什么原因,可以肯定问题随时可能发生,你需要准备好替换发生故障的部分,并确保数据的可用性和完整性。 + +首先建议是。虽然你可以查看 `/proc/mdstat` 来检查 RAID 的状态,但有一个更好的和节省时间的方法,使用监控 + 扫描模式运行 mdadm,它将警报通过电子邮件发送到一个预定义的收件人。 + +要这样设置,在 `/etc/mdadm.conf` 添加以下行: + + MAILADDR user@ + +我自己的设置如下: + + MAILADDR gacanepa@localhost + +![RAID Monitoring Email Alerts](http://www.tecmint.com/wp-content/uploads/2015/10/RAID-Monitoring-Email-Alerts.png) + +*监控 RAID 并使用电子邮件进行报警* + +要让 mdadm 运行在监控 + 扫描模式中,以 root 用户添加以下 crontab 条目: + + @reboot /sbin/mdadm --monitor --scan --oneshot + +默认情况下,mdadm 每隔60秒会检查 RAID 阵列,如果发现问题将发出警报。你可以通过添加 `--delay` 选项到crontab 条目上面,后面跟上秒数,来修改默认行为(例如,`--delay` 1800意味着30分钟)。 + +最后,确保你已经安装了一个邮件用户代理(MUA),如[mutt 或 mailx][3]。否则,你将不会收到任何警报。 + +在一分钟内,我们就会看到 mdadm 发送的警报。 + +### 模拟和更换发生故障的 RAID 存储设备 ### + +为了给 RAID 阵列中的存储设备模拟一个故障,我们将使用 `--manage` 和 `--set-faulty` 选项,如下所示: + + # mdadm --manage --set-faulty /dev/md0 /dev/sdc1 + +这将导致 /dev/sdc1 被标记为 faulty,我们可以在 /proc/mdstat 看到: + +![Stimulate Issue with RAID Storage](http://www.tecmint.com/wp-content/uploads/2015/10/Stimulate-Issue-with-RAID-Storage.png) + +*在 RAID 存储设备上模拟问题* + +更重要的是,让我们看看是不是收到了同样的警报邮件: + +![Email Alert on Failed RAID Device](http://www.tecmint.com/wp-content/uploads/2015/10/Email-Alert-on-Failed-RAID-Device.png) + +*RAID 设备故障时发送邮件警报* + +在这种情况下,你需要从软件 RAID 阵列中删除该设备: + + # mdadm /dev/md0 --remove /dev/sdc1 + +然后,你可以直接从机器中取出,并将其使用备用设备来取代(/dev/sdd 中类型为 fd 的分区是以前创建的): + + # mdadm --manage /dev/md0 --add /dev/sdd1 + +幸运的是,该系统会使用我们刚才添加的磁盘自动重建阵列。我们可以通过标记 /dev/sdb1 为 faulty 来进行测试,从阵列中取出后,并确认 tecmint.txt 文件仍然在 /mnt/raid1 是可访问的: + + # mdadm --detail /dev/md0 + # mount | grep raid1 + # ls -l /mnt/raid1 | grep tecmint + # cat /mnt/raid1/tecmint.txt + +![Confirm Rebuilding RAID Array](http://www.tecmint.com/wp-content/uploads/2015/10/Rebuilding-RAID-Array.png) + +*确认 RAID 重建* + +上面图片清楚的显示,添加 /dev/sdd1 到阵列中来替代 /dev/sdc1,数据的重建是系统自动完成的,不需要干预。 + +虽然要求不是很严格,有一个备用设备是个好主意,这样更换故障的设备就可以在瞬间完成了。要做到这一点,先让我们重新添加 /dev/sdb1 和 /dev/sdc1: + + # mdadm --manage /dev/md0 --add /dev/sdb1 + # mdadm --manage /dev/md0 --add /dev/sdc1 + +![Replace Failed Raid Device](http://www.tecmint.com/wp-content/uploads/2015/10/Replace-Failed-Raid-Device.png) + +*取代故障的 Raid 设备* + +### 从冗余丢失中恢复数据 ### + +如前所述,当一个磁盘发生故障时, mdadm 将自动重建数据。但是,如果阵列中的2个磁盘都故障时会发生什么?让我们来模拟这种情况,通过标记 /dev/sdb1 和 /dev/sdd1 为 faulty: + + # umount /mnt/raid1 + # mdadm --manage --set-faulty /dev/md0 /dev/sdb1 + # mdadm --stop /dev/md0 + # mdadm --manage --set-faulty /dev/md0 /dev/sdd1 + +此时尝试以同样的方式重新创建阵列就(或使用 `--assume-clean` 选项)可能会导致数据丢失,因此不到万不得已不要使用。 + +让我们试着从 /dev/sdb1 恢复数据,例如,在一个类似的磁盘分区(/dev/sde1 - 注意,这需要你执行前在/dev/sde 上创建一个 fd 类型的分区)上使用 `ddrescue`: + + # ddrescue -r 2 /dev/sdb1 /dev/sde1 + +![Recovering Raid Array](http://www.tecmint.com/wp-content/uploads/2015/10/Recovering-Raid-Array.png) + +*恢复 Raid 阵列* + +请注意,到现在为止,我们还没有触及 /dev/sdb 和 /dev/sdd,这是 RAID 阵列的一部分分区。 + +现在,让我们使用 /dev/sde1 和 /dev/sdf1 来重建阵列: + + # mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/sd[e-f]1 + +请注意,在真实的情况下,你需要使用与原来的阵列中相同的设备名称,即设备失效后替换的磁盘的名称应该是 /dev/sdb1 和 /dev/sdc1。 + +在本文中,我选择了使用额外的设备来重新创建全新的磁盘阵列,是为了避免与原来的故障磁盘混淆。 + +当被问及是否继续写入阵列时,键入 Y,然后按 Enter。阵列被启动,你也可以查看它的进展: + + # watch -n 1 cat /proc/mdstat + +当这个过程完成后,你就应该能够访问 RAID 的数据: + +![Confirm Raid Content](http://www.tecmint.com/wp-content/uploads/2015/10/Raid-Content.png) + +*确认 Raid 数据* + +### 总结 ### + +在本文中,我们回顾了从 RAID 故障和冗余丢失中恢复数据。但是,你要记住,这种技术是一种存储解决方案,不能取代备份。 + +本文中介绍的方法适用于所有 RAID 中,其中的概念我将在本系列的最后一篇(RAID 管理)中涵盖它。 + +如果你对本文有任何疑问,随时给我们以评论的形式说明。我们期待倾听阁下的心声! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/recover-data-and-rebuild-failed-software-raid/ + +作者:[Gabriel Cánepa][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://linux.cn/article-6085-1.html +[2]:https://linux.cn/article-6093-1.html +[3]:http://www.tecmint.com/send-mail-from-command-line-using-mutt-command/ diff --git a/published/RAID/Part 9 - How to Manage Software RAID's in Linux with 'Mdadm' Tool.md b/published/RAID/Part 9 - How to Manage Software RAID's in Linux with 'Mdadm' Tool.md new file mode 100644 index 0000000000..775e82aba5 --- /dev/null +++ b/published/RAID/Part 9 - How to Manage Software RAID's in Linux with 'Mdadm' Tool.md @@ -0,0 +1,162 @@ +在 Linux 下使用 RAID(九):如何使用 ‘Mdadm’ 工具管理软件 RAID +================================================================================ + +无论你以前有没有使用 RAID 阵列的经验,以及是否完成了 [此 RAID 系列][1] 的所有教程,一旦你在 Linux 中熟悉了 `mdadm --manage` 命令的使用,管理软件 RAID 将不是很复杂的任务。 + +![在 Linux 中使用 mdadm 管理 RAID 设备 - 第9部分](http://www.tecmint.com/wp-content/uploads/2015/10/Manage-Raid-with-Mdadm-Tool-in-Linux.jpg) + +*在 Linux 中使用 mdadm 管理 RAID 设备 - 第9部分* + +在本教程中,我们会再介绍此工具提供的功能,这样当你需要它,就可以派上用场。 + +#### RAID 测试方案 #### + +在本系列的最后一篇文章中,我们将使用一个简单的 RAID 1(镜像)阵列,它由两个 8GB 的磁盘(/dev/sdb 和 /dev/sdc)和一个备用设备(/dev/sdd)来演示,但在此使用的方法也适用于其他类型的配置。也就是说,放心去用吧,把这个页面添加到浏览器的书签,然后让我们开始吧。 + +### 了解 mdadm 的选项和使用方法 ### + +幸运的是,mdadm 有一个内建的 `--help` 参数来对每个主要的选项提供说明文档。 + +因此,让我们开始输入: + + # mdadm --manage --help + +就会使我们看到 `mdadm --manage` 能够执行哪些任务: + +![Manage RAID with mdadm Tool](http://www.tecmint.com/wp-content/uploads/2015/10/mdadm-Usage-in-Linux.png) + +*使用 mdadm 工具来管理 RAID* + +正如我们在上面的图片看到,管理一个 RAID 阵列可以在任意时间执行以下任务: + +- (重新)将设备添加到阵列中 +- 把设备标记为故障 +- 从阵列中删除故障设备 +- 使用备用设备更换故障设备 +- 先创建部分阵列 +- 停止阵列 +- 标记阵列为 ro(只读)或 rw(读写) + +### 使用 mdadm 工具管理 RAID 设备 ### + +需要注意的是,如果用户忽略 `--manage` 选项,mdadm 默认使用管理模式。请记住这一点,以避免出现最坏的情况。 + +上图中的高亮文本显示了管理 RAID 的基本语法: + + # mdadm --manage RAID options devices + +让我们来演示几个例子。 + +#### ​例1:为 RAID 阵列添加设备 #### + +你通常会添加新设备来更换故障的设备,或者使用空闲的分区以便在出现故障时能及时替换: + + # mdadm --manage /dev/md0 --add /dev/sdd1 + +![Add Device to Raid Array](http://www.tecmint.com/wp-content/uploads/2015/10/Add-Device-to-Raid-Array.png) + +*添加设备到 Raid 阵列* + +#### ​例2:把一个 RAID 设备标记为故障并从阵列中移除 #### + +在从逻辑阵列中删除该设备前,这是强制性的步骤,然后才能从机器中取出它 - 注意顺序(如果弄错了这些步骤,最终可能会造成实际设备的损害): + + # mdadm --manage /dev/md0 --fail /dev/sdb1 + +请注意在前面的例子中,知道如何添加备用设备来自动更换出现故障的磁盘。在此之后,[恢复和重建 raid 数据][2] 就开始了: + +![Recover and Rebuild Raid Data](http://www.tecmint.com/wp-content/uploads/2015/10/Recover-and-Rebuild-Raid-Data.png) + +*恢复和重建 raid 数据* + +一旦设备已被手动标记为故障,你就可以安全地从阵列中删除它: + + # mdadm --manage /dev/md0 --remove /dev/sdb1 + +#### 例3:重新添加设备,来替代阵列中已经移除的设备 #### + +到现在为止,我们有一个工作的 RAID 1 阵列,它包含了2个活动的设备:/dev/sdc1 和 /dev/sdd1。现在让我们试试重新添加 /dev/sdb1 到/dev/md0: + + # mdadm --manage /dev/md0 --re-add /dev/sdb1 + +我们会碰到一个错误: + + # mdadm: --re-add for /dev/sdb1 to /dev/md0 is not possible + +因为阵列中的磁盘已经达到了最大的数量。因此,我们有两个选择:a)将 /dev/sdb1 添加为备用的,如例1;或 b)从阵列中删除 /dev/sdd1 然后重新添加 /dev/sdb1。 + +我们选择选项 b),先停止阵列然后重新启动: + + # mdadm --stop /dev/md0 + # mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1 + +如果上面的命令不能成功添加 /dev/sdb1 到阵列中,使用例1中的命令来完成。 + +mdadm 能检测到新添加的设备并将其作为备用设备,当添加完成后它会开始重建数据,它也被认为是 RAID 中的活动设备: + +![Raid Rebuild Status](http://www.tecmint.com/wp-content/uploads/2015/10/Raid-Rebuild-Status.png) + +*重建 Raid 的状态* + +#### 例4:使用特定磁盘更换 RAID 设备 #### + +在阵列中使用备用磁盘更换磁盘很简单: + + # mdadm --manage /dev/md0 --replace /dev/sdb1 --with /dev/sdd1 + +![Replace Raid Device](http://www.tecmint.com/wp-content/uploads/2015/10/Replace-Raid-device.png) + +*更换 Raid 设备* + +这会导致 `--replace` 指定的设备被标记为故障,而 `--with`指定的设备添加到 RAID 中来替代它: + +![Check Raid Rebuild Status](http://www.tecmint.com/wp-content/uploads/2015/10/Check-Raid-Rebuild-Status.png) + +*检查 Raid 重建状态* + +#### ​例5:标记 RAID 阵列为 ro 或 rw #### + +创建阵列后,你必须在它上面创建一个文件系统并将其挂载到一个目录下才能使用它。你可能不知道,RAID 也可以被设置为 ro,使其只读;或者设置为 rw,就可以同时写入了。 + +要标记该设备为 ro,首先需要将其卸载: + + # umount /mnt/raid1 + # mdadm --manage /dev/md0 --readonly + # mount /mnt/raid1 + # touch /mnt/raid1/test1 + +![Set Permissions on Raid Array](http://www.tecmint.com/wp-content/uploads/2015/10/Set-Permissions-on-Raid-Array.png) + +*在 RAID 阵列上设置权限* + +要配置阵列允许写入操作需要使用 `--readwrite` 选项。请注意,在设置 rw 标志前,你需要先卸载设备并停止它: + + # umount /mnt/raid1 + # mdadm --manage /dev/md0 --stop + # mdadm --assemble /dev/md0 /dev/sdc1 /dev/sdd1 + # mdadm --manage /dev/md0 --readwrite + # touch /mnt/raid1/test2 + +![Allow Read Write Permission on Raid](http://www.tecmint.com/wp-content/uploads/2015/10/Allow-Write-Permission-on-Raid.png) + +*配置 Raid 允许读写操作* + +### 总结 ### + +在本系列中,我们已经解释了如何建立一个在企业环境中使用的软件 RAID 阵列。如果你按照这些文章所提供的例子进行配置,在 Linux 中你会充分领会到软件 RAID 的价值。 + +如果你碰巧任何问题或有建议,请随时使用下面的方式与我们联系。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/manage-software-raid-devices-in-linux-with-mdadm/ + +作者:[GABRIEL CÁNEPA][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://linux.cn/article-6085-1.html +[2]:https://linux.cn/article-6448-1.html diff --git a/translated/tech/RHCE/Part 1 - RHCE Series--How to Setup and Test Static Network Routing.md b/published/RHCE/Part 1 - RHCE Series--How to Setup and Test Static Network Routing.md similarity index 61% rename from translated/tech/RHCE/Part 1 - RHCE Series--How to Setup and Test Static Network Routing.md rename to published/RHCE/Part 1 - RHCE Series--How to Setup and Test Static Network Routing.md index 03038b92d5..2e20280ecd 100644 --- a/translated/tech/RHCE/Part 1 - RHCE Series--How to Setup and Test Static Network Routing.md +++ b/published/RHCE/Part 1 - RHCE Series--How to Setup and Test Static Network Routing.md @@ -1,27 +1,28 @@ -RHCE 系列第一部分:如何设置和测试静态网络路由 +RHCE 系列(一):如何设置和测试静态网络路由 ================================================================================ RHCE(Red Hat Certified Engineer,红帽认证工程师)是红帽公司的一个认证,红帽向企业社区贡献开源操作系统和软件,同时它还给公司提供训练、支持和咨询服务。 ![RHCE 考试准备指南](http://www.tecmint.com/wp-content/uploads/2015/07/RHCE-Exam-Series-by-TecMint.jpg) -RHCE 考试准备指南 +*RHCE 考试准备指南* -这个 RHCE 是基于性能的考试(代号 EX300),面向那些拥有更多的技能、知识和能力的红帽企业版 Linux(RHEL)系统高级系统管理员。 +这个 RHCE 是一个绩效考试(代号 EX300),面向那些拥有更多的技能、知识和能力的红帽企业版 Linux(RHEL)系统高级系统管理员。 **重要**: [红帽认证系统管理员][1] (Red Hat Certified System Administrator,RHCSA)认证要求先有 RHCE 认证。 以下是基于红帽企业版 Linux 7 考试的考试目标,我们会在该 RHCE 系列中分别介绍: - 第一部分:如何在 RHEL 7 中设置和测试静态路由 -- 第二部分:如果进行包过滤、网络地址转换和设置内核运行时参数 -- 第三部分:如果使用 Linux 工具集产生和发送系统活动报告 +- 第二部分:如何进行包过滤、网络地址转换和设置内核运行时参数 +- 第三部分:如何使用 Linux 工具集产生和发送系统活动报告 - 第四部分:使用 Shell 脚本进行自动化系统维护 -- 第五部分:如果配置本地和远程系统日志 -- 第六部分:如果配置一个 Samba 服务器或 NFS 服务器(译者注:Samba 是在 Linux 和 UNI X系统上实现 SMB 协议的一个免费软件,由服务器及客户端程序构成。SMB,Server Messages Block,信息服务块,是一种在局域网上共享文件和打印机的一种通信协议,它为局域网内的不同计算机之间提供文件及打印机等资源的共享服务。) -- 第七部分:为收发邮件配置完整的 SMTP 服务器 -- 第八部分:在 RHEL 7 上设置 HTTPS 和 TLS -- 第九部分:设置网络时间协议 -- 第十部分:如何配置一个 Cache-Only DNS 服务器 +- 第五部分:如何在 RHEL 7 中管理系统日志(配置、轮换和导入到数据库) +- 第六部分:设置 Samba 服务器并配置 FirewallD 和 SELinux 支持客户端文件共享 +- 第七部分:设置 NFS 服务器及基于 Kerberos 认证的客户端 +- 第八部分:在 Apache 上使用网络安全服务(NSS)通过 TLS 提供 HTTPS 服务 +- 第九部分:如何使用无客户端配置来设置 Postfix 邮件服务器(SMTP) +- 第十部分:在 RHEL/CentOS 7 中设置网络时间协议(NTP)服务器 +- 第十一部分:如何配置一个只缓存的 DNS 服务器 在你的国家查看考试费用和注册考试,可以到 [RHCE 认证][2] 网页。 @@ -29,31 +30,31 @@ RHCE 考试准备指南 ![在 RHEL 中设置静态网络路由](http://www.tecmint.com/wp-content/uploads/2015/07/Setup-Static-Network-Routing-in-RHEL-7.jpg) -RHCE 系列第一部分:设置和测试网络静态路由 +*RHCE 系列第一部分:设置和测试网络静态路由* 请注意我们不会作深入的介绍,但以这种方式组织内容能帮助你开始第一步并继续后面的内容。 ### 红帽企业版 Linux 7 中的静态路由 ### -现代网络的一个奇迹就是有很多可用的设备能将一组计算机连接起来,不管是在一个房间里少量的机器还是在一栋建筑物、城市、国家或者大洲之间的多台机器。 +现代网络的一个奇迹就是有很多可用设备能将一组计算机连接起来,不管是在一个房间里少量的机器还是在一栋建筑物、城市、国家或者大洲之间的多台机器。 然而,为了能在任意情形下有效的实现这些,需要对网络包进行路由,或者换句话说,它们从源到目的地的路径需要按照某种规则。 -静态路由是为网络包指定一个路由的过程,而不是使用网络设备提供的默认网关。除非另有指定,否则通过路由,网络包会被导向默认网关;基于预定义的标准,例如数据包目的地,使用静态路由可以定义其它路径。 +静态路由是为网络包指定一个路由的过程,而不是使用网络设备提供的默认网关。除非另有指定静态路由,网络包会被导向默认网关;而静态路由则基于预定义标准所定义的其它路径,例如数据包目的地。 -我们在该篇指南中会考虑以下场景。我们有一台红帽企业版 Linux 7,连接到路由器 1号 [192.168.0.1] 以访问因特网以及 192.168.0.0/24 中的其它机器。 +我们在该篇指南中会考虑以下场景。我们有一台 RHEL 7,连接到 1号路由器 [192.168.0.1] 以访问因特网以及 192.168.0.0/24 中的其它机器。 -第二个路由器(路由器 2号)有两个网卡:enp0s3 同样通过网络连接到路由器 1号,以便连接RHEL 7 以及相同网络中的其它机器,另外一个网卡(enp0s8)用于授权访问内部服务所在的 10.0.0.0/24 网络,例如 web 或数据库服务器。 +第二个路由器(2号路由器)有两个网卡:enp0s3 同样连接到路由器1号以访问互联网,及与 RHEL 7 和同一网络中的其它机器通讯,另外一个网卡(enp0s8)用于授权访问内部服务所在的 10.0.0.0/24 网络,例如 web 或数据库服务器。 该场景可以用下面的示意图表示: ![静态路由网络示意图](http://www.tecmint.com/wp-content/uploads/2015/07/Static-Routing-Network-Diagram.png) -静态路由网络示意图 +*静态路由网络示意图* -在这篇文章中我们会集中介绍在 RHEL 7 中设置路由表,确保它能通过路由器 1号访问因特网以及通过路由器 2号访问内部网络。 +在这篇文章中我们会集中介绍在 RHEL 7 中设置路由表,确保它能通过1号路由器访问因特网以及通过2号路由器访问内部网络。 -在 RHEL 7 中,你会通过命令行用 [命令 ip][3] 配置和显示设备和路由。这些更改能在运行的系统中及时生效,但由于重启后不会保存,我们会使用 /etc/sysconfig/network-scripts 目录下的 ifcfg-enp0sX 和 route-enp0sX 文件永久保存我们的配置。 +在 RHEL 7 中,你可以通过命令行用 [ip 命令][3] 配置和显示设备和路由。这些更改能在运行的系统中及时生效,但由于重启后不会保存,我们会使用 `/etc/sysconfig/network-scripts` 目录下的 `ifcfg-enp0sX` 和 `route-enp0sX` 文件永久保存我们的配置。 首先,让我们打印出当前的路由表: @@ -61,15 +62,15 @@ RHCE 系列第一部分:设置和测试网络静态路由 ![在 Linux 中检查路由表](http://www.tecmint.com/wp-content/uploads/2015/07/Check-Current-Routing-Table.png) -检查当前路由表 +*检查当前路由表* 从上面的输出中,我们可以得出以下结论: - 默认网关的 IP 是 192.168.0.1,可以通过网卡 enp0s3 访问。 -- 系统启动的时候,它启用了到 169.254.0.0/16 的 zeroconf 路由(只是在本例中)。也就是说,如果机器设置为通过 DHCP 获取一个 IP 地址,但是由于某些原因失败了,它就会在该网络中自动分配到一个地址。这一行的意思是,该路由会允许我们通过 enp0s3 和其它没有从 DHCP 服务器中成功获得 IP 地址的机器机器连接。 -- 最后,但同样重要的是,我们也可以通过 IP 地址是 192.168.0.18 的 enp0s3 和 192.168.0.0/24 网络中的其它机器连接。 +- 系统启动的时候,它启用了到 169.254.0.0/16 的 zeroconf 路由(只是在本例中)。也就是说,如果机器设置通过 DHCP 获取 IP 地址,但是由于某些原因失败了,它就会在上述网段中自动分配到一个地址。这一行的意思是,该路由会允许我们通过 enp0s3 和其它没有从 DHCP 服务器中成功获得 IP 地址的机器机器相连接。 +- 最后,但同样重要的是,我们也可以通过 IP 地址是 192.168.0.18 的 enp0s3 与 192.168.0.0/24 网络中的其它机器连接。 -下面是这样的配置中你需要做的一些典型任务。除非另有说明,下面的任务都在路由器 2号上进行。 +下面是这样的配置中你需要做的一些典型任务。除非另有说明,下面的任务都在2号路由器上进行。 确保正确安装了所有网卡: @@ -88,7 +89,7 @@ RHCE 系列第一部分:设置和测试网络静态路由 # ip addr del 10.0.0.17 dev enp0s8 # ip addr add 10.0.0.18 dev enp0s8 -现在,请注意你只能添加一个通过已经能访问的网关到目标网络的路由。因为这个原因,我们需要在 192.168.0.0/24 范围中给 enp0s3 分配一个 IP 地址,这样我们的 RHEL 7 才能连接到它: +现在,请注意你只能添加一个通过网关到目标网络的路由,网关需要可以访问到。因为这个原因,我们需要在 192.168.0.0/24 范围中给 enp0s3 分配一个 IP 地址,这样我们的 RHEL 7 才能连接到它: # ip addr add 192.168.0.19 dev enp0s3 @@ -101,7 +102,7 @@ RHCE 系列第一部分:设置和测试网络静态路由 # systemctl stop firewalld # systemctl disable firewalld -回到我们的 RHEL 7(192.168.0.18),让我们配置一个通过 192.168.0.19(路由器 2号的 enp0s3)到 10.0.0.0/24 的路由: +回到我们的 RHEL 7(192.168.0.18),让我们配置一个通过 192.168.0.19(2号路由器的 enp0s3)到 10.0.0.0/24 的路由: # ip route add 10.0.0.0/24 via 192.168.0.19 @@ -111,7 +112,7 @@ RHCE 系列第一部分:设置和测试网络静态路由 ![显示网络路由表](http://www.tecmint.com/wp-content/uploads/2015/07/Show-Network-Routing.png) -确认网络路由表 +*确认网络路由表* 同样,在你尝试连接的 10.0.0.0/24 网络的机器中添加对应的路由: @@ -131,13 +132,13 @@ RHCE 系列第一部分:设置和测试网络静态路由 192.168.0.18 也就是我们的 RHEL 7 机器的 IP 地址。 -另外,我们还可以使用 [tcpdump][4](需要通过 yum install tcpdump 安装)来检查我们 RHEL 7 和 10.0.0.20 中 web 服务器之间的 TCP 双向通信。 +另外,我们还可以使用 [tcpdump][4](需要通过 `yum install tcpdump` 安装)来检查我们 RHEL 7 和 10.0.0.20 中 web 服务器之间的 TCP 双向通信。 首先在第一台机器中启用日志: # tcpdump -qnnvvv -i enp0s3 host 10.0.0.20 -在同一个系统上的另一个终端,让我们通过 telnet 连接到 web 服务器的 80 号端口(假设 Apache 正在监听该端口;否则在下面命令中使用正确的端口): +在同一个系统上的另一个终端,让我们通过 telnet 连接到 web 服务器的 80 号端口(假设 Apache 正在监听该端口;否则应在下面命令中使用正确的监听端口): # telnet 10.0.0.20 80 @@ -145,7 +146,7 @@ tcpdump 日志看起来像下面这样: ![检查服务器之间的网络连接](http://www.tecmint.com/wp-content/uploads/2015/07/Tcpdump-logs.png) -检查服务器之间的网络连接 +*检查服务器之间的网络连接* 通过查看我们 RHEL 7(192.168.0.18)和 web 服务器(10.0.0.20)之间的双向通信,可以看出已经正确地初始化了连接。 @@ -162,7 +163,7 @@ tcpdump 日志看起来像下面这样: # Device used to connect to default gateway. Replace X with the appropriate number. GATEWAYDEV=enp0sX -当需要为每个网卡设置特定的变量和值时(正如我们在路由器 2号上面做的),你需要编辑 /etc/sysconfig/network-scripts/ifcfg-enp0s3 和 /etc/sysconfig/network-scripts/ifcfg-enp0s8 文件。 +当需要为每个网卡设置特定的变量和值时(正如我们在2号路由器上面做的),你需要编辑 `/etc/sysconfig/network-scripts/ifcfg-enp0s3` 和 `/etc/sysconfig/network-scripts/ifcfg-enp0s8` 文件。 下面是我们的例子, @@ -184,23 +185,23 @@ tcpdump 日志看起来像下面这样: NAME=enp0s8 ONBOOT=yes -分别对应 enp0s3 和 enp0s8。 +其分别对应 enp0s3 和 enp0s8。 -由于要为我们的客户端机器(192.168.0.18)进行路由,我们需要编辑 /etc/sysconfig/network-scripts/route-enp0s3: +由于要为我们的客户端机器(192.168.0.18)进行路由,我们需要编辑 `/etc/sysconfig/network-scripts/route-enp0s3`: 10.0.0.0/24 via 192.168.0.19 dev enp0s3 -现在重启系统你可以在路由表中看到该路由规则。 +现在`reboot`你的系统,就可以在路由表中看到该路由规则。 ### 总结 ### -在这篇文章中我们介绍了红帽企业版 Linux 7 的静态路由。尽管场景可能不同,这里介绍的例子说明了所需的原理以及进行该任务的步骤。结束之前,我还建议你看一下 Linux 文档项目中 [第四章 4][5] 保护和优化 Linux 部分,以了解这里介绍主题的更详细内容。 +在这篇文章中我们介绍了红帽企业版 Linux 7 的静态路由。尽管场景可能不同,这里介绍的例子说明了所需的原理以及进行该任务的步骤。结束之前,我还建议你看一下 Linux 文档项目(The Linux Documentation Project)网站上的《安全加固和优化 Linux(Securing and Optimizing Linux)》的[第四章][5],以了解这里介绍主题的更详细内容。 -免费电子书 Securing & Optimizing Linux: The Hacking Solution (v.3.0) - 这本 800 多页的电子书全面收集了 Linux 安全的小技巧以及如果安全和简便的使用它们去配置基于 Linux 的应用和服务。 +免费电子书《Securing and Optimizing Linux: The Hacking Solution (v.3.0)》 - 这本 800 多页的电子书全面收集了 Linux 安全的小技巧以及如果安全和简便的使用它们去配置基于 Linux 的应用和服务。 ![Linux 安全和优化](http://www.tecmint.com/wp-content/uploads/2015/07/Linux-Security-Optimization-Book.gif) -Linux 安全和优化 +*Linux 安全和优化* [马上下载][6] @@ -214,12 +215,12 @@ via: http://www.tecmint.com/how-to-setup-and-configure-static-network-routing-in 作者:[Gabriel Cánepa][a] 译者:[ictlyh](https://github.com/ictlyh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ +[1]:https://linux.cn/article-6133-1.html [2]:https://www.redhat.com/en/services/certification/rhce [3]:http://www.tecmint.com/ip-command-examples/ [4]:http://www.tecmint.com/12-tcpdump-commands-a-network-sniffer-tool/ diff --git a/published/RHCE/Part 10 - Setting Up 'NTP (Network Time Protocol) Server' in RHEL or CentOS 7.md b/published/RHCE/Part 10 - Setting Up 'NTP (Network Time Protocol) Server' in RHEL or CentOS 7.md new file mode 100644 index 0000000000..404ad003fd --- /dev/null +++ b/published/RHCE/Part 10 - Setting Up 'NTP (Network Time Protocol) Server' in RHEL or CentOS 7.md @@ -0,0 +1,131 @@ +RHCE 系列(十):在 RHEL/CentOS 7 中设置 NTP(网络时间协议)服务器 +================================================================================ + +网络时间协议 - NTP - 是运行在传输层 123 号端口的 UDP 协议,它允许计算机通过网络同步准确时间。随着时间的流逝,计算机内部时间会出现漂移,这会导致时间不一致问题,尤其是对于服务器和客户端日志文件,或者你想要复制服务器的资源或数据库。 + +![在 CentOS 上安装 NTP 服务器](http://www.tecmint.com/wp-content/uploads/2014/09/NTP-Server-Install-in-CentOS.png) + +*在 CentOS 和 RHEL 7 上安装 NTP 服务器* + +#### 前置要求: #### + +- [CentOS 7 安装过程][1] +- [RHEL 安装过程][2] + +#### 额外要求: #### + +- [注册并启用 RHEL 7 更新订阅][3] +- [在 CentOS/RHCE 7 上配置静态 IP][4] +- [在 CentOS/RHEL 7 上停用并移除不需要的服务][5] + +这篇指南会告诉你如何在 CentOS/RHCE 7 上安装和配置 NTP 服务器,并使用 NTP 公共时间服务器池(NTP Public Pool Time Servers)列表中和你服务器地理位置最近的可用节点中同步时间。 + +#### 步骤一:安装和配置 NTP 守护进程 #### + +1、 官方 CentOS /RHEL 7 库默认提供 NTP 服务器安装包,可以通过使用下面的命令安装。 + + # yum install ntp + +![在 CentOS 上安装 NTP 服务器](http://www.tecmint.com/wp-content/uploads/2014/09/Install-NTP-in-CentOS.png) + +*安装 NTP 服务器* + +2、 安装完服务器之后,首先到官方 [NTP 公共时间服务器池(NTP Public Pool Time Servers)][6],选择你服务器物理位置所在的洲,然后搜索你的国家位置,然后会出现 NTP 服务器列表。 + +![NTP 服务器池](http://www.tecmint.com/wp-content/uploads/2014/09/NTP-Pool-Server.png) + +*NTP 服务器池* + +3、 然后打开编辑 NTP 守护进程的主配置文件,注释掉来自 pool.ntp.org 项目的公共服务器默认列表,并用类似下面截图中提供给你所在国家的列表替换。(LCTT 译注:中国使用 0.cn.pool.ntp.org 等) + +![在 CentOS 中配置 NTP 服务器](http://www.tecmint.com/wp-content/uploads/2014/09/Configure-NTP-Server.png) + +*配置 NTP 服务器* + +4、 下一步,你需要允许来自你的网络的客户端和这台服务器同步时间。为了做到这点,添加下面一行到 NTP 配置文件,其中 **restrict** 语句控制允许哪些网络查询和同步时间 - 请根据需要替换网络 IP。 + + restrict 192.168.1.0 netmask 255.255.255.0 nomodify notrap + +nomodify notrap 语句意味着不允许你的客户端配置服务器或者作为同步时间的节点。 + +5、 如果你需要用于错误处理的额外信息,以防你的 NTP 守护进程出现问题,添加一个 logfile 语句,用于记录所有 NTP 服务器问题到一个指定的日志文件。 + + logfile /var/log/ntp.log + +![在 CentOS 中启用 NTP 日志](http://www.tecmint.com/wp-content/uploads/2014/09/Enable-NTP-Log.png) + +*启用 NTP 日志* + +6、 在你编辑完所有上面解释的配置并保存关闭 ntp.conf 文件后,你最终的配置看起来像下面的截图。 + +![CentOS 中 NTP 服务器的配置](http://www.tecmint.com/wp-content/uploads/2014/09/NTP-Server-Configuration.png) + +*NTP 服务器配置* + +### 步骤二:添加防火墙规则并启动 NTP 守护进程 ### + +7、 NTP 服务使用 OSI 传输层(第四层)的 123 号 UDP 端口。它是为了避免可变延迟的影响所特别设计的。要在 RHEL/CentOS 7 中开放这个端口,可以对 Firewalld 服务使用下面的命令。 + + # firewall-cmd --add-service=ntp --permanent + # firewall-cmd --reload + +![在 Firewall 中开放 NTP 端口](http://www.tecmint.com/wp-content/uploads/2014/09/Open-NTP-Port.png) + +*在 Firewall 中开放 NTP 端口* + +8、 你在防火墙中开放了 123 号端口之后,启动 NTP 服务器并确保系统范围内可用。用下面的命令管理服务。 + + # systemctl start ntpd + # systemctl enable ntpd + # systemctl status ntpd + +![启动 NTP 服务](http://www.tecmint.com/wp-content/uploads/2014/09/Start-NTP-Service.png) + +*启动 NTP 服务* + +### 步骤三:验证服务器时间同步 ### + +9、 启动了 NTP 守护进程后,用几分钟等服务器和它的服务器池列表同步时间,然后运行下面的命令验证 NTP 节点同步状态和你的系统时间。 + + # ntpq -p + # date -R + +![验证 NTP 服务器时间](http://www.tecmint.com/wp-content/uploads/2014/09/Verify-NTP-Time-Sync.png) + +*验证 NTP 时间同步* + +10、 如果你想查询或者和你选择的服务器池同步,你可以使用 ntpdate 命令,后面跟服务器名或服务器地址,类似下面建议的命令行示例。 + + # ntpdate -q 0.ro.pool.ntp.org 1.ro.pool.ntp.org + +![同步 NTP 同步](http://www.tecmint.com/wp-content/uploads/2014/09/Synchronize-NTP-Time.png) + +*同步 NTP 时间* + +### 步骤四:设置 Windows NTP 客户端 ### + +11、 如果你的 windows 机器不是域名控制器的一部分,你可以配置 Windows 和你的 NTP服务器同步时间。在任务栏右边 -> 时间 -> 更改日期和时间设置 -> 网络时间标签 -> 更改设置 -> 和一个网络时间服务器检查同步 -> 在 Server 空格输入服务器 IP 或 FQDN -> 马上更新 -> OK。 + +![和 NTP 同步 Windows 时间](http://www.tecmint.com/wp-content/uploads/2014/09/Synchronize-Windows-Time-with-NTP.png) + +*和 NTP 同步 Windows 时间* + +就是这些。在你的网络中配置一个本地 NTP 服务器能确保你所有的服务器和客户端有相同的时间设置,以防出现网络连接失败,并且它们彼此都相互同步。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-ntp-server-in-centos/ + +作者:[Matei Cezar][a] +译者:[ictlyh](http://motouxiaogui.cn/blog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/cezarmatei/ +[1]:http://www.tecmint.com/centos-7-installation/ +[2]:http://www.tecmint.com/redhat-enterprise-linux-7-installation/ +[3]:http://www.tecmint.com/enable-redhat-subscription-reposiories-and-updates-for-rhel-7/ +[4]:http://www.tecmint.com/configure-network-interface-in-rhel-centos-7-0/ +[5]:http://www.tecmint.com/remove-unwanted-services-in-centos-7/ +[6]:http://www.pool.ntp.org/en/ \ No newline at end of file diff --git a/translated/tech/RHCE/Part 2 - How to Perform Packet Filtering Network Address Translation and Set Kernel Runtime Parameters.md b/published/RHCE/Part 2 - How to Perform Packet Filtering Network Address Translation and Set Kernel Runtime Parameters.md similarity index 63% rename from translated/tech/RHCE/Part 2 - How to Perform Packet Filtering Network Address Translation and Set Kernel Runtime Parameters.md rename to published/RHCE/Part 2 - How to Perform Packet Filtering Network Address Translation and Set Kernel Runtime Parameters.md index 74b162be1c..38baedd754 100644 --- a/translated/tech/RHCE/Part 2 - How to Perform Packet Filtering Network Address Translation and Set Kernel Runtime Parameters.md +++ b/published/RHCE/Part 2 - How to Perform Packet Filtering Network Address Translation and Set Kernel Runtime Parameters.md @@ -1,16 +1,17 @@ -RHCE 第二部分 - 如何进行包过滤、网络地址转换和设置内核运行时参数 +RHCE 系列(二):如何进行包过滤、网络地址转换和设置内核运行时参数 ================================================================================ -正如第一部分(“[设置静态网络路由][1]”)承诺的,在这篇文章(RHCE 系列第二部分),我们首先介绍红帽企业版 Linux 7中包过滤和网络地址转换原理,然后再介绍某些条件发送变化或者需要激活时设置运行时内核参数以改变运行时内核行为。 + +正如第一部分(“[设置静态网络路由][1]”)提到的,在这篇文章(RHCE 系列第二部分),我们首先介绍红帽企业版 Linux 7(RHEL)中包过滤和网络地址转换(NAT)的原理,然后再介绍在某些条件发生变化或者需要变动时设置运行时内核参数以改变运行时内核行为。 ![RHEL 中的网络包过滤](http://www.tecmint.com/wp-content/uploads/2015/07/Network-Packet-Filtering-in-RHEL.jpg) -RHCE 第二部分:网络包过滤 +*RHCE 第二部分:网络包过滤* ### RHEL 7 中的网络包过滤 ### -当我们讨论数据包过滤的时候,我们指防火墙读取每个尝试通过它的数据包的包头所进行的处理。然后,根据系统管理员之前定义的规则,通过采取所要求的动作过滤数据包。 +当我们讨论数据包过滤的时候,我们指防火墙读取每个试图通过它的数据包的包头所进行的处理。然后,根据系统管理员之前定义的规则,通过采取所要求的动作过滤数据包。 -正如你可能知道的,从 RHEL 7 开始,管理防火墙的默认服务是 [firewalld][2]。类似 iptables,它和 Linux 内核的 netfilter 模块交互以便检查和操作网络数据包。不像 iptables,Firewalld 的更新可以立即生效,而不用中断活跃的连接 - 你甚至不需要重启服务。 +正如你可能知道的,从 RHEL 7 开始,管理防火墙的默认服务是 [firewalld][2]。类似 iptables,它和 Linux 内核的 netfilter 模块交互以便检查和操作网络数据包。但不像 iptables,Firewalld 的更新可以立即生效,而不用中断活跃的连接 - 你甚至不需要重启服务。 Firewalld 的另一个优势是它允许我们定义基于预配置服务名称的规则(之后会详细介绍)。 @@ -18,27 +19,27 @@ Firewalld 的另一个优势是它允许我们定义基于预配置服务名称 ![静态路由网络示意图](http://www.tecmint.com/wp-content/uploads/2015/07/Static-Routing-Network-Diagram.png) -静态路由网络示意图 +*静态路由网络示意图* -然而,你应该记得,由于还没有介绍包过滤,为了简化例子,我们停用了路由器 2号 的防火墙。现在让我们来看看如何可以使接收的数据包发送到目的地的特定服务或端口。 +然而,你应该记得,由于还没有介绍包过滤,为了简化例子,我们停用了2号路由器的防火墙。现在让我们来看看如何使接收的数据包发送到目的地的特定服务或端口。 -首先,让我们添加一条永久规则允许从 enp0s3 (192.168.0.19) 到 enp0s8 (10.0.0.18) 的绑定流量: +首先,让我们添加一条永久规则允许从 enp0s3 (192.168.0.19) 到 enp0s8 (10.0.0.18) 的入站流量: # firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i enp0s3 -o enp0s8 -j ACCEPT -上面的命令会把规则保存到 /etc/firewalld/direct.xml: +上面的命令会把规则保存到 `/etc/firewalld/direct.xml` 中: # cat /etc/firewalld/direct.xml ![在 CentOS 7 中检查 Firewalld 保存的规则](http://www.tecmint.com/wp-content/uploads/2015/07/Check-Firewalld-Save-Rules.png) -检查 Firewalld 保存的规则 +*检查 Firewalld 保存的规则* 然后启用规则使其立即生效: # firewall-cmd --direct --add-rule ipv4 filter FORWARD 0 -i enp0s3 -o enp0s8 -j ACCEPT -现在你可以从 RHEL 7 中通过 telnet 登录到 web 服务器并再次运行 [tcpdump][3] 监视两台机器之间的 TCP 流量,这次路由器 2号已经启用了防火墙。 +现在你可以从 RHEL 7 中通过 telnet 到 web 服务器并再次运行 [tcpdump][3] 监视两台机器之间的 TCP 流量,这次2号路由器已经启用了防火墙。 # telnet 10.0.0.20 80 # tcpdump -qnnvvv -i enp0s3 host 10.0.0.20 @@ -61,19 +62,19 @@ Firewalld 的另一个优势是它允许我们定义基于预配置服务名称 我强烈建议你看看 Fedora Project Wiki 中的 [Firewalld Rich Language][4] 文档更详细地了解关于富规则的内容。 -### RHEL 7 中的网络地址转换 ### +### RHEL 7 中的网络地址转换(NAT) ### -网络地址转换(NAT)是为专用网络中的一组计算机(也可能是其中的一台)分配一个独立的公共 IP 地址的过程。结果,在内部网络中仍然可以用它们自己的私有 IP 地址区别,但外部“看来”它们是一样的。 +网络地址转换(NAT)是为专用网络中的一组计算机(也可能是其中的一台)分配一个独立的公共 IP 地址的过程。这样,在内部网络中仍然可以用它们自己的私有 IP 地址来区别,但外部“看来”它们是一样的。 -另外,网络地址转换使得内部网络中的计算机发送请求到外部资源(例如因特网)然后只有源系统能接收到对应的响应成为可能。 +另外,网络地址转换使得内部网络中的计算机发送请求到外部资源(例如因特网),然后只有源系统能接收到对应的响应成为可能。 现在让我们考虑下面的场景: ![RHEL 中的网络地址转换](http://www.tecmint.com/wp-content/uploads/2015/07/Network-Address-Translation-Diagram.png) -网络地址转换 +*网络地址转换* -在路由器 2 中,我们会把 enp0s3 接口移动到外部区域,enp0s8 到内部区域,伪装或者说 NAT 默认是启用的: +在2号路由器中,我们会把 enp0s3 接口移动到外部区域(external),enp0s8 到内部区域(external),伪装(masquerading)或者说 NAT 默认是启用的: # firewall-cmd --list-all --zone=external # firewall-cmd --change-interface=enp0s3 --zone=external @@ -81,7 +82,7 @@ Firewalld 的另一个优势是它允许我们定义基于预配置服务名称 # firewall-cmd --change-interface=enp0s8 --zone=internal # firewall-cmd --change-interface=enp0s8 --zone=internal --permanent -对于我们当前的设置,内部区域 - 以及和它一起启用的任何东西都是默认区域: +对于我们当前的设置,内部区域(internal) - 以及和它一起启用的任何东西都是默认区域: # firewall-cmd --set-default-zone=internal @@ -89,44 +90,44 @@ Firewalld 的另一个优势是它允许我们定义基于预配置服务名称 # firewall-cmd --reload -最后,在 web 服务器中添加路由器 2 为默认网关: +最后,在 web 服务器中添加2号路由器为默认网关: # ip route add default via 10.0.0.18 -现在你会发现在 web 服务器中你可以 ping 路由器 1 和外部网站(例如 tecmint.com): +现在你会发现在 web 服务器中你可以 ping 1号路由器和外部网站(例如 tecmint.com): # ping -c 2 192.168.0.1 # ping -c 2 tecmint.com ![验证网络路由](http://www.tecmint.com/wp-content/uploads/2015/07/Verify-Network-Routing.png) -验证网络路由 +*验证网络路由* ### 在 RHEL 7 中设置内核运行时参数 ### -在 Linux 中,允许你更改、启用以及停用内核运行时参数,RHEL 也不例外。/proc/sys 接口允许你当操作条件发生变化时实时设置运行时参数以改变系统行为而不需太多麻烦。 +在 Linux 中,允许你更改、启用以及停用内核运行时参数,RHEL 也不例外。当操作条件发生变化时,`/proc/sys` 接口(sysctl)允许你实时设置运行时参数改变系统行为,而不需太多麻烦。 -为了实现这个目的,会用内建的 echo shell 写 /proc/sys/ 中的文件,其中 很可能是以下目录中的一个: +为了实现这个目的,会用 shell 内建的 echo 写 `/proc/sys/` 中的文件,其中 `` 一般是以下目录中的一个: - dev: 连接到机器中的特定设备的参数。 - fs: 文件系统配置(例如 quotas 和 inodes)。 - kernel: 内核配置。 - net: 网络配置。 -- vm: 内核虚拟内存的使用。 +- vm: 内核的虚拟内存的使用。 要显示所有当前可用值的列表,运行 # sysctl -a | less -在第一部分中,我们通过以下命令改变了 net.ipv4.ip_forward 参数的值以允许 Linux 机器作为一个路由器。 +在第一部分中,我们通过以下命令改变了 `net.ipv4.ip_forward` 参数的值以允许 Linux 机器作为一个路由器。 # echo 1 > /proc/sys/net/ipv4/ip_forward -另一个你可能想要设置的运行时参数是 kernel.sysrq,它会启用你键盘上的 Sysrq 键,以使系统更好的运行一些底层函数,例如如果由于某些原因冻结了后重启系统: +另一个你可能想要设置的运行时参数是 `kernel.sysrq`,它会启用你键盘上的 `Sysrq` 键,以使系统更好的运行一些底层功能,例如如果由于某些原因冻结了后重启系统: # echo 1 > /proc/sys/kernel/sysrq -要显示特定参数的值,可以按照下面方式使用 sysctl: +要显示特定参数的值,可以按照下面方式使用 `sysctl`: # sysctl @@ -135,28 +136,29 @@ Firewalld 的另一个优势是它允许我们定义基于预配置服务名称 # sysctl net.ipv4.ip_forward # sysctl kernel.sysrq -一些参数,例如上面提到的一个,只需要一个值,而其它一些(例如 fs.inode-state)要求多个值: +有些参数,例如上面提到的某个,只需要一个值,而其它一些(例如 `fs.inode-state`)要求多个值: ![在 Linux 中查看内核参数](http://www.tecmint.com/wp-content/uploads/2015/07/Check-Kernel-Parameters.png) -查看内核参数 +*查看内核参数* 不管什么情况下,做任何更改之前你都需要阅读内核文档。 -请注意系统重启后这些设置会丢失。要使这些更改永久生效,我们需要添加内容到 /etc/sysctl.d 目录的 .conf 文件,像下面这样: +请注意系统重启后这些设置会丢失。要使这些更改永久生效,我们需要添加内容到 `/etc/sysctl.d` 目录的 .conf 文件,像下面这样: # echo "net.ipv4.ip_forward = 1" > /etc/sysctl.d/10-forward.conf (其中数字 10 表示相对同一个目录中其它文件的处理顺序)。 -并用下面命令启用更改 +并用下面命令启用更改: # sysctl -p /etc/sysctl.d/10-forward.conf ### 总结 ### 在这篇指南中我们解释了基本的包过滤、网络地址变换和在运行的系统中设置内核运行时参数并使重启后能持久化。我希望这些信息能对你有用,如往常一样,我们期望收到你的回复! -别犹豫,在下面的表格中和我们分享你的疑问、评论和建议吧。 + +别犹豫,在下面的表单中和我们分享你的疑问、评论和建议吧。 -------------------------------------------------------------------------------- @@ -164,12 +166,12 @@ via: http://www.tecmint.com/perform-packet-filtering-network-address-translation 作者:[Gabriel Cánepa][a] 译者:[ictlyh](https://github.com/ictlyh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/how-to-setup-and-configure-static-network-routing-in-rhel/ +[1]:https://linux.cn/article-6451-1.html [2]:http://www.tecmint.com/firewalld-rules-for-centos-7/ [3]:http://www.tecmint.com/12-tcpdump-commands-a-network-sniffer-tool/ [4]:https://fedoraproject.org/wiki/Features/FirewalldRichLanguage \ No newline at end of file diff --git a/translated/tech/RHCE/Part 3 - How to Produce and Deliver System Activity Reports Using Linux Toolsets.md b/published/RHCE/Part 3 - How to Produce and Deliver System Activity Reports Using Linux Toolsets.md similarity index 69% rename from translated/tech/RHCE/Part 3 - How to Produce and Deliver System Activity Reports Using Linux Toolsets.md rename to published/RHCE/Part 3 - How to Produce and Deliver System Activity Reports Using Linux Toolsets.md index 7a373cd76b..b60fdfe39d 100644 --- a/translated/tech/RHCE/Part 3 - How to Produce and Deliver System Activity Reports Using Linux Toolsets.md +++ b/published/RHCE/Part 3 - How to Produce and Deliver System Activity Reports Using Linux Toolsets.md @@ -1,32 +1,32 @@ -RHCE 第三部分 - 如何使用 Linux 工具集产生和发送系统活动报告 +RHCE 系列(三):如何使用 Linux 工具集生成和发送系统活动报告 ================================================================================ -作为一个系统工程师,你经常需要生成一些显示系统资源利用率的报告,以便确保:1)正最佳利用它们,2)防止出现瓶颈,3)确保可扩展性,以及其它原因。 +作为一个系统工程师,你经常需要生成一些显示系统资源利用率的报告,以便确保:1)正在合理利用系统,2)防止出现瓶颈,3)确保可扩展性,以及其它原因。 ![监视 Linux 性能活动报告](http://www.tecmint.com/wp-content/uploads/2015/08/Monitor-Linux-Performance-Activity-Reports.jpg) -RHCE 第三部分:监视 Linux 性能活动报告 +*RHCE 第三部分:监视 Linux 性能活动报告* -除了著名的用于检测磁盘、内存和 CPU 使用率的原生 Linux 工具 - 可以给出很多例子,红帽企业版 Linux 7 还提供了两个额外的工具集用于为你的报告增加可以收集的数据:sysstat 和 dstat。 +除了著名的用于检测磁盘、内存和 CPU 使用率的原生 Linux 工具 - 可以给出很多例子,红帽企业版 Linux 7 还提供了另外两个可以为你的报告更多数据的工具套装:sysstat 和 dstat。 在这篇文章中,我们会介绍两者,但首先让我们来回顾一下传统工具的使用。 ### 原生 Linux 工具 ### -使用 df,你可以报告磁盘空间以及文件系统的 inode 使用情况。你需要监视两者,因为缺少磁盘空间会阻止你保存更多文件(甚至会导致系统崩溃),就像耗尽 inode 意味着你不能将文件链接到对应的数据结构,从而导致同样的结果:你不能将那些文件保存到磁盘中。 +使用 df,你可以报告磁盘空间以及文件系统的 inode 使用情况。你需要监视这两者,因为缺少磁盘空间会阻止你保存更多文件(甚至会导致系统崩溃),就像耗尽 inode 意味着你不能将文件链接到对应的数据结构,从而导致同样的结果:你不能将那些文件保存到磁盘中。 # df -h [以人类可读形式显示输出] # df -h --total [生成总计] ![检查 Linux 总的磁盘使用](http://www.tecmint.com/wp-content/uploads/2015/08/Check-Linux-Total-Disk-Usage.png) -检查 Linux 总的磁盘使用 +*检查 Linux 总的磁盘使用* # df -i [显示文件系统的 inode 数目] # df -i --total [生成总计] ![检查 Linux 总的 inode 数目](http://www.tecmint.com/wp-content/uploads/2015/08/Check-Linux-Total-inode-Numbers.png) -检查 Linux 总的 inode 数目 +*检查 Linux 总的 inode 数目* 用 du,你可以估计文件、目录或文件系统的文件空间使用。 @@ -37,7 +37,7 @@ RHCE 第三部分:监视 Linux 性能活动报告 ![检查 Linux 目录磁盘大小](http://www.tecmint.com/wp-content/uploads/2015/08/Check-Linux-Directory-Disk-Size.png) -检查 Linux 目录磁盘大小 +*检查 Linux 目录磁盘大小* 别错过了: @@ -56,7 +56,7 @@ RHCE 第三部分:监视 Linux 性能活动报告 ![检查 Linux 系统性能](http://www.tecmint.com/wp-content/uploads/2015/08/Check-Linux-Systerm-Performance.png) -检查 Linux 系统性能 +*检查 Linux 系统性能* 正如你从上面图片看到的,vmstat 的输出分为很多列:proc(process)、memory、swap、io、system、和 CPU。每个字段的意义可以在 vmstat man 手册的 FIELD DESCRIPTION 部分找到。 @@ -66,20 +66,20 @@ RHCE 第三部分:监视 Linux 性能活动报告 ![Vmstat Linux 性能监视](http://www.tecmint.com/wp-content/uploads/2015/08/Vmstat-Linux-Peformance-Monitoring.png) -Vmstat Linux 性能监视 +*Vmstat Linux 性能监视* 请注意当磁盘上的文件被更改时,活跃内存的数量增加,写到磁盘的块数目(bo)和属于用户进程的 CPU 时间(us)也是这样。 -或者一个保存大文件到磁盘时(dsync 引发): +或者直接保存一个大文件到磁盘时(由 dsync 标志引发): # vmstat -a 1 5 # dd if=/dev/zero of=dummy.out bs=1M count=1000 oflag=dsync ![Vmstat Linux 磁盘性能监视](http://www.tecmint.com/wp-content/uploads/2015/08/VmStat-Linux-Disk-Performance-Monitoring.png) -Vmstat Linux 磁盘性能监视 +*Vmstat Linux 磁盘性能监视* -在这个例子中,我们可以看到很大数目的块被写入到磁盘(bo),这正如预期的那样,同时 CPU 处理任务之前等待 IO 操作完成的时间(wa)也增加了。 +在这个例子中,我们可以看到大量的块被写入到磁盘(bo),这正如预期的那样,同时 CPU 处理任务之前等待 IO 操作完成的时间(wa)也增加了。 **别错过**: [Vmstat – Linux 性能监视][3] @@ -90,22 +90,22 @@ Vmstat Linux 磁盘性能监视 sysstat 软件包包含以下工具: - sar (收集、报告、或者保存系统活动信息)。 -- sadf (以多种方式显式 sar 收集的数据)。 +- sadf (以多种方式显示 sar 收集的数据)。 - mpstat (报告处理器相关的统计信息)。 - iostat (报告 CPU 统计信息和设备以及分区的 IO统计信息)。 - pidstat (报告 Linux 任务统计信息)。 - nfsiostat (报告 NFS 的输出/输出统计信息)。 - cifsiostat (报告 CIFS 统计信息) -- sa1 (收集并保存系统活动日常文件的二进制数据)。 -- sa2 (在 /var/log/sa 目录写每日报告)。 +- sa1 (收集并保存二进制数据到系统活动每日数据文件中)。 +- sa2 (在 /var/log/sa 目录写入每日报告)。 -dstat 为这些工具提供的功能添加了一些额外的特性,以及更多的计数器和更大的灵活性。你可以通过运行 yum info sysstat 或者 yum info dstat 找到每个工具完整的介绍,或者安装完成后分别查看每个工具的 man 手册。 +dstat 比这些工具所提供的功能更多一些,并且提供了更多的计数器和更大的灵活性。你可以通过运行 yum info sysstat 或者 yum info dstat 找到每个工具完整的介绍,或者安装完成后分别查看每个工具的 man 手册。 安装两个软件包: # yum update && yum install sysstat dstat -sysstat 主要的配置文件是 /etc/sysconfig/sysstat。你可以在该文件中找到下面的参数: +sysstat 主要的配置文件是 `/etc/sysconfig/sysstat`。你可以在该文件中找到下面的参数: # How long to keep log files (in days). # If value is greater than 28, then log files are kept in @@ -119,17 +119,17 @@ sysstat 主要的配置文件是 /etc/sysconfig/sysstat。你可以在该文件 # Compression program to use. ZIP="bzip2" -sysstat 安装完成后,/etc/cron.d/sysstat 中会添加和启用两个 cron 作业。第一个作业每 10 分钟运行系统活动计数工具并在 /var/log/sa/saXX 中保存报告,其中 XX 是该月的一天。 +sysstat 安装完成后,`/etc/cron.d/sysstat` 中会添加和启用两个 cron 任务。第一个任务每 10 分钟运行系统活动计数工具,并在 `/var/log/sa/saXX` 中保存报告,其中 XX 是该月的一天。 -因此,/var/log/sa/sa05 会包括该月份第 5 天所有的系统活动报告。这里假设我们在上面的配置文件中对 HISTORY 变量使用默认的值: +因此,`/var/log/sa/sa05` 会包括该月份第 5 天所有的系统活动报告。这里假设我们在上面的配置文件中对 HISTORY 变量使用默认的值: */10 * * * * root /usr/lib64/sa/sa1 1 1 -第二个作业在每天夜间 11:53 生成每日进程计数总结并把它保存到 /var/log/sa/sarXX 文件,其中 XX 和之前例子中的含义相同: +第二个任务在每天夜间 11:53 生成每日进程计数总结并把它保存到 `/var/log/sa/sarXX` 文件,其中 XX 和之前例子中的含义相同: 53 23 * * * root /usr/lib64/sa/sa2 -A -例如,你可能想要输出该月份第 6 天从上午 9:30 到晚上 5:30 的系统统计信息到一个 LibreOffice Calc 或 Microsoft Excel 可以查看的 .csv 文件(它也允许你创建表格和图片): +例如,你可能想要输出该月份第 6 天从上午 9:30 到晚上 5:30 的系统统计信息到一个 LibreOffice Calc 或 Microsoft Excel 可以查看的 .csv 文件(这样就可以让你创建表格和图片了): # sadf -s 09:30:00 -e 17:30:00 -dh /var/log/sa/sa06 -- | sed 's/;/,/g' > system_stats20150806.csv @@ -137,7 +137,7 @@ sysstat 安装完成后,/etc/cron.d/sysstat 中会添加和启用两个 cron ![Linux 系统统计信息](http://www.tecmint.com/wp-content/uploads/2015/08/Linux-System-Statistics.png) -Linux 系统统计信息 +*Linux 系统统计信息* 最后,让我们看看 dstat 提供什么功能。请注意如果不带参数运行,dstat 默认使用 -cdngy(表示 CPU、磁盘、网络、内存页、和系统统计信息),并每秒添加一行(可以在任何时候用 Ctrl + C 中断执行): @@ -145,15 +145,15 @@ Linux 系统统计信息 ![Linux 磁盘统计检测](http://www.tecmint.com/wp-content/uploads/2015/08/dstat-command.png) -Linux 磁盘统计检测 +*Linux 磁盘统计检测* 要输出统计信息到 .csv 文件,可以用 -output 标记后面跟一个文件名称。让我们来看看在 LibreOffice Calc 中该文件看起来是怎样的: ![检测 Linux 统计信息输出](http://www.tecmint.com/wp-content/uploads/2015/08/Monitor-Linux-Statistics-Output.png) -检测 Linux 统计信息输出 +*检测 Linux 统计信息输出* -我强烈建议你查看 dstat 的 man 手册,为了方便你的阅读用 PDF 格式包括本文以及 sysstat 的 man 手册。你会找到其它能帮助你创建自定义的详细系统活动报告的选项。 +为了更多的阅读体验,我强烈建议你查看 [dstat][5] 和 [sysstat][6] 的 pdf 格式 man 手册。你会找到其它能帮助你创建自定义的详细系统活动报告的选项。 **别错过**: [Sysstat – Linux 的使用活动检测工具][4] @@ -161,7 +161,7 @@ Linux 磁盘统计检测 在该指南中我们解释了如何使用 Linux 原生工具以及 RHEL 7 提供的特定工具来生成系统使用报告。在某种情况下,你可能像依赖最好的朋友那样依赖这些报告。 -你很可能使用过这篇指南中我们没有介绍到的其它工具。如果真是这样的话,用下面的表格和社区中的其他成员一起分享吧,也可以是任何其它的建议/疑问/或者评论。 +你很可能使用过这篇指南中我们没有介绍到的其它工具。如果真是这样的话,用下面的表单和社区中的其他成员一起分享吧,也可以是任何其它的建议/疑问/或者评论。 我们期待你的回复。 @@ -171,12 +171,14 @@ via: http://www.tecmint.com/linux-performance-monitoring-and-file-system-statist 作者:[Gabriel Cánepa][a] 译者:[ictlyh](https://github.com/ictlyh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/how-to-check-disk-space-in-linux/ +[1]:https://linux.cn/article-6466-1.html [2]:http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/ -[3]:http://www.tecmint.com/linux-performance-monitoring-with-vmstat-and-iostat-commands/ -[4]:http://www.tecmint.com/install-sysstat-in-linux/ \ No newline at end of file +[3]:https://linux.cn/article-4024-1.html +[4]:https://linux.cn/article-4028-1.html +[5]:http://www.tecmint.com/wp-content/pdf/dstat.pdf +[6]:http://www.tecmint.com/wp-content/pdf/sysstat.pdf \ No newline at end of file diff --git a/translated/tech/RHCE/Part 4 - Using Shell Scripting to Automate Linux System Maintenance Tasks.md b/published/RHCE/Part 4 - Using Shell Scripting to Automate Linux System Maintenance Tasks.md similarity index 81% rename from translated/tech/RHCE/Part 4 - Using Shell Scripting to Automate Linux System Maintenance Tasks.md rename to published/RHCE/Part 4 - Using Shell Scripting to Automate Linux System Maintenance Tasks.md index 37a3dbe11c..fdf0d29c96 100644 --- a/translated/tech/RHCE/Part 4 - Using Shell Scripting to Automate Linux System Maintenance Tasks.md +++ b/published/RHCE/Part 4 - Using Shell Scripting to Automate Linux System Maintenance Tasks.md @@ -1,20 +1,20 @@ -第四部分 - 使用 Shell 脚本自动化 Linux 系统维护任务 +RHCE 系列(四): 使用 Shell 脚本自动化 Linux 系统维护任务 ================================================================================ -之前我听说高效系统管理员/工程师的其中一个特点是懒惰。一开始看起来很矛盾,但作者接下来解释了其中的原因: +之前我听说高效的系统管理员的一个特点是懒惰。一开始看起来很矛盾,但作者接下来解释了其中的原因: ![自动化 Linux 系统维护任务](http://www.tecmint.com/wp-content/uploads/2015/08/Automate-Linux-System-Maintenance-Tasks.png) -RHCE 系列:第四部分 - 自动化 Linux 系统维护任务 +*RHCE 系列:第四部分 - 自动化 Linux 系统维护任务* -如果一个系统管理员花费大量的时间解决问题以及做重复的工作,你就应该怀疑他这么做是否正确。换句话说,一个高效的系统管理员/工程师应该制定一个计划使得尽量花费少的时间去做重复的工作,以及通过使用该系列中第三部分 [使用 Linux 工具集监视系统活动报告][1] 介绍的工具预见问题。因此,尽管看起来他/她没有做很多的工作,但那是因为 shell 脚本帮助完成了他的/她的大部分任务,这也就是本章我们将要探讨的东西。 +如果一个系统管理员花费大量的时间解决问题以及做重复的工作,你就应该怀疑他这么做是否正确。换句话说,一个高效的系统管理员/工程师应该制定一个计划使得其尽量花费少的时间去做重复的工作,以及通过使用本系列中第三部分 [使用 Linux 工具集监视系统活动报告][1] 介绍的工具来预见问题。因此,尽管看起来他/她没有做很多的工作,但那是因为 shell 脚本帮助完成了他的/她的大部分任务,这也就是本章我们将要探讨的东西。 ### 什么是 shell 脚本? ### -简单的说,shell 脚本就是一个由 shell 一步一步执行的程序,而 shell 是在 Linux 内核和端用户之间提供接口的另一个程序。 +简单的说,shell 脚本就是一个由 shell 一步一步执行的程序,而 shell 是在 Linux 内核和最终用户之间提供接口的另一个程序。 -默认情况下,RHEL 7 中用户使用的 shell 是 bash(/bin/bash)。如果你想知道详细的信息和历史背景,你可以查看 [维基页面][2]。 +默认情况下,RHEL 7 中用户使用的 shell 是 bash(/bin/bash)。如果你想知道详细的信息和历史背景,你可以查看这个[维基页面][2]。 -关于这个 shell 提供的众多功能的介绍,可以查看 **man 手册**,也可以从 ([Bash 命令][3])下载 PDF 格式。除此之外,假设你已经熟悉 Linux 命令(否则我强烈建议你首先看一下 **Tecmint.com** 中的文章 [从新手到系统管理员指南][4] )。现在让我们开始吧。 +关于这个 shell 提供的众多功能的介绍,可以查看 **man 手册**,也可以从 ([Bash 命令][3])处下载 PDF 格式。除此之外,假设你已经熟悉 Linux 命令(否则我强烈建议你首先看一下 **Tecmint.com** 中的文章 [从新手到系统管理员指南][4] )。现在让我们开始吧。 ### 写一个脚本显示系统信息 ### @@ -27,7 +27,7 @@ RHCE 系列:第四部分 - 自动化 Linux 系统维护任务 #!/bin/bash - # RHCE 系列第四部分事例脚本 + # RHCE 系列第四部分示例脚本 # 该脚本会返回以下这些系统信息: # -主机名称: echo -e "\e[31;43m***** HOSTNAME INFORMATION *****\e[0m" @@ -67,9 +67,9 @@ RHCE 系列:第四部分 - 自动化 Linux 系统维护任务 ![服务器监视 Shell 脚本](http://www.tecmint.com/wp-content/uploads/2015/08/Server-Monitoring-Shell-Script.png) -服务器监视 Shell 脚本 +*服务器监视 Shell 脚本* -该功能用以下命令提供: +颜色功能是由以下命令提供的: echo -e "\e[COLOR1;COLOR2m\e[0m" @@ -79,13 +79,13 @@ RHCE 系列:第四部分 - 自动化 Linux 系统维护任务 你想使其自动化的任务可能因情况而不同。因此,我们不可能在一篇文章中覆盖所有可能的场景,但是我们会介绍使用 shell 脚本可以使其自动化的三种典型任务: -**1)** 更新本地文件数据库, 2) 查找(或者删除)有 777 权限的文件, 以及 3) 文件系统使用超过定义的阀值时发出警告。 +1) 更新本地文件数据库, 2) 查找(或者删除)有 777 权限的文件, 以及 3) 文件系统使用超过定义的阀值时发出警告。 让我们在脚本目录中新建一个名为 `auto_tasks.sh` 的文件并添加以下内容: #!/bin/bash - # 自动化任务事例脚本: + # 自动化任务示例脚本: # -更新本地文件数据库: echo -e "\e[4;32mUPDATING LOCAL FILE DATABASE\e[0m" updatedb @@ -123,16 +123,16 @@ RHCE 系列:第四部分 - 自动化 Linux 系统维护任务 ![查找 777 权限文件的 Shell 脚本](http://www.tecmint.com/wp-content/uploads/2015/08/Shell-Script-to-Find-777-Permissions.png) -查找 777 权限文件的 Shell 脚本 +*查找 777 权限文件的 Shell 脚本* ### 使用 Cron ### -想更进一步提高效率,你不会想只是坐在你的电脑前手动执行这些脚本。相反,你会使用 cron 来调度这些任务周期性地执行,并把结果通过邮件发动给预定义的接收者或者将它们保存到使用 web 浏览器可以查看的文件中。 +想更进一步提高效率,你不会想只是坐在你的电脑前手动执行这些脚本。相反,你会使用 cron 来调度这些任务周期性地执行,并把结果通过邮件发动给预先指定的接收者,或者将它们保存到使用 web 浏览器可以查看的文件中。 下面的脚本(filesystem_usage.sh)会运行有名的 **df -h** 命令,格式化输出到 HTML 表格并保存到 **report.html** 文件中: #!/bin/bash - # Sample script to demonstrate the creation of an HTML report using shell scripting + # 演示使用 shell 脚本创建 HTML 报告的示例脚本 # Web directory WEB_DIR=/var/www/html # A little CSS and table layout to make the report look a little nicer @@ -177,7 +177,7 @@ RHCE 系列:第四部分 - 自动化 Linux 系统维护任务 ![服务器监视报告](http://www.tecmint.com/wp-content/uploads/2015/08/Server-Monitoring-Report.png) -服务器监视报告 +*服务器监视报告* 你可以添加任何你想要的信息到那个报告中。添加下面的 crontab 条目在每天下午的 1:30 运行该脚本: @@ -193,12 +193,12 @@ via: http://www.tecmint.com/using-shell-script-to-automate-linux-system-maintena 作者:[Gabriel Cánepa][a] 译者:[ictlyh](https://github.com/ictlyh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/linux-performance-monitoring-and-file-system-statistics-reports/ +[1]:https://linux.cn/article-6512-1.html [2]:https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29 [3]:http://www.tecmint.com/wp-content/pdf/bash.pdf [4]:http://www.tecmint.com/60-commands-of-linux-a-guide-from-newbies-to-system-administrator/ diff --git a/translated/tech/RHCE/Part 5 - How to Manage System Logs (Configure, Rotate and Import Into Database) in RHEL 7.md b/published/RHCE/Part 5 - How to Manage System Logs (Configure, Rotate and Import Into Database) in RHEL 7.md similarity index 73% rename from translated/tech/RHCE/Part 5 - How to Manage System Logs (Configure, Rotate and Import Into Database) in RHEL 7.md rename to published/RHCE/Part 5 - How to Manage System Logs (Configure, Rotate and Import Into Database) in RHEL 7.md index a37c9610fd..ab4ddd5a32 100644 --- a/translated/tech/RHCE/Part 5 - How to Manage System Logs (Configure, Rotate and Import Into Database) in RHEL 7.md +++ b/published/RHCE/Part 5 - How to Manage System Logs (Configure, Rotate and Import Into Database) in RHEL 7.md @@ -1,26 +1,24 @@ -第五部分 - 如何在 RHEL 7 中管理系统日志(配置、旋转以及导入到数据库) +RHCE 系列(五):如何在 RHEL 7 中管理系统日志(配置、轮换以及导入到数据库) ================================================================================ -为了确保你的 RHEL 7 系统安全,你需要通过查看日志文件监控系统中发生的所有活动。这样,你就可以检测任何不正常或有潜在破坏的活动并进行系统故障排除或者其它恰当的操作。 +为了确保你的 RHEL 7 系统安全,你需要通过查看日志文件来监控系统中发生的所有活动。这样,你就可以检测到任何不正常或有潜在破坏的活动并进行系统故障排除或者其它恰当的操作。 -![Linux 中使用 Rsyslog 和 Logrotate 旋转日志文件](http://www.tecmint.com/wp-content/uploads/2015/08/Manage-and-Rotate-Linux-Logs-Using-Rsyslog-Logrotate.jpg) +![Linux 中使用 Rsyslog 和 Logrotate 轮换日志文件](http://www.tecmint.com/wp-content/uploads/2015/08/Manage-and-Rotate-Linux-Logs-Using-Rsyslog-Logrotate.jpg) -(译者注:[日志旋转][9]是系统管理中归档每天产生的日志文件的自动化过程) - -RHCE 考试 - 第五部分:使用 Rsyslog 和 Logrotate 管理系统日志 +*RHCE 考试 - 第五部分:使用 Rsyslog 和 Logrotate 管理系统日志* 在 RHEL 7 中,[rsyslogd][1] 守护进程负责系统日志,它从 /etc/rsyslog.conf(该文件指定所有系统日志的默认路径)和 /etc/rsyslog.d 中的所有文件(如果有的话)读取配置信息。 ### Rsyslogd 配置 ### -快速浏览一下 [rsyslog.conf][2] 会是一个好的开端。该文件分为 3 个主要部分:模块(rsyslong 按照模块化设计),全局指令(用于设置 rsyslogd 守护进程的全局属性),以及规则。正如你可能猜想的,最后一个部分指示获取,显示以及在哪里保存什么的日志(也称为选择子),这也是这篇博文关注的重点。 +快速浏览一下 [rsyslog.conf][2] 会是一个好的开端。该文件分为 3 个主要部分:模块(rsyslong 按照模块化设计),全局指令(用于设置 rsyslogd 守护进程的全局属性),以及规则。正如你可能猜想的,最后一个部分指示记录或显示什么以及在哪里保存(也称为选择子(selector)),这也是这篇文章关注的重点。 rsyslog.conf 中典型的一行如下所示: ![Rsyslogd 配置](http://www.tecmint.com/wp-content/uploads/2015/08/Rsyslogd-Configuration.png) -Rsyslogd 配置 +*Rsyslogd 配置* -在上面的图片中,我们可以看到一个选择子包括了一个或多个用分号分隔的设备:优先级(Facility:Priority)对,其中设备描述了消息类型(参考 [RFC 3164 4.1.1 章节][3] 查看 rsyslog 可用的完整设备列表),优先级指示它的严重性,这可能是以下几种之一: +在上面的图片中,我们可以看到一个选择子包括了一个或多个用分号分隔的“设备:优先级”(Facility:Priority)对,其中设备描述了消息类型(参考 [RFC 3164 4.1.1 章节][3],查看 rsyslog 可用的完整设备列表),优先级指示它的严重性,这可能是以下几种之一: - debug - info @@ -31,7 +29,7 @@ Rsyslogd 配置 - alert - emerg -尽管自身并不是一个优先级,关键字 none 意味着指定设备没有任何优先级。 +尽管 none 并不是一个优先级,不过它意味着指定设备没有任何优先级。 **注意**:给定一个优先级表示该优先级以及之上的消息都应该记录到日志中。因此,上面例子中的行指示 rsyslogd 守护进程记录所有优先级为 info 以及以上(不管是什么设备)的除了属于 mail、authpriv、以及 cron 服务(不考虑来自这些设备的消息)的消息到 /var/log/messages。 @@ -47,7 +45,7 @@ Rsyslogd 配置 #### 创建自定义日志文件 #### -要把所有的守护进程消息记录到 /var/log/tecmint.log,我们需要在 rsyslog.conf 或者 /etc/rsyslog.d 目录中的单独文件(易于管理)添加下面一行: +要把所有的守护进程消息记录到 /var/log/tecmint.log,我们需要在 rsyslog.conf 或者 /etc/rsyslog.d 目录中的单独文件(这样易于管理)添加下面一行: daemon.* /var/log/tecmint.log @@ -55,19 +53,19 @@ Rsyslogd 配置 # systemctl restart rsyslog -在随机重启两个守护进程之前和之后查看自定义日志的内容: +在随便重启两个守护进程之前和之后查看下自定义日志的内容: ![Linux 创建自定义日志文件](http://www.tecmint.com/wp-content/uploads/2015/08/Create-Custom-Log-File.png) -创建自定义日志文件 +*创建自定义日志文件* 作为一个自学练习,我建议你重点关注设备和优先级,添加额外的消息到已有的日志文件或者像上面那样创建一个新的日志文件。 -### 使用 Logrotate 旋转日志 ### +### 使用 Logrotate 轮换日志 ### -为了防止日志文件无限制增长,logrotate 工具用于旋转、压缩、移除或者通过电子邮件发送日志,从而减轻管理会产生大量日志文件系统的困难。 +为了防止日志文件无限制增长,logrotate 工具用于轮换、压缩、移除或者通过电子邮件发送日志,从而减轻管理会产生大量日志文件系统的困难。(译者注:[日志轮换][9](rotate)是系统管理中归档每天产生的日志文件的自动化过程) -Logrotate 作为一个 cron 作业(/etc/cron.daily/logrotate)每天运行,并从 /etc/logrotate.conf 和 /etc/logrotate.d 中的文件(如果有的话)读取配置信息。 +Logrotate 作为一个 cron 任务(/etc/cron.daily/logrotate)每天运行,并从 /etc/logrotate.conf 和 /etc/logrotate.d 中的文件(如果有的话)读取配置信息。 对于 rsyslog,即使你可以在主文件中为指定服务包含设置,为每个服务创建单独的配置文件能帮助你更好地组织设置。 @@ -75,27 +73,27 @@ Logrotate 作为一个 cron 作业(/etc/cron.daily/logrotate)每天运行, ![Logrotate 配置](http://www.tecmint.com/wp-content/uploads/2015/08/Logrotate-Configuration.png) -Logrotate 配置 +*Logrotate 配置* -在上面的例子中,logrotate 会为 /var/log/wtmp 进行以下操作:尝试每个月旋转一次,但至少文件要大于 1MB,然后用 0664 权限、用户 root、组 utmp 创建一个新的日志文件。下一步只保存一个归档日志,正如旋转指令指定的: +在上面的例子中,logrotate 会为 /var/log/wtmp 进行以下操作:尝试每个月轮换一次,但至少文件要大于 1MB,然后用 0664 权限、用户 root、组 utmp 创建一个新的日志文件。下一步只保存一个归档日志,正如轮换指令指定的: ![每月 Logrotate 日志](http://www.tecmint.com/wp-content/uploads/2015/08/Logrotate-Logs-Monthly.png) -每月 Logrotate 日志 +*每月 Logrotate 日志* 让我们再来看看 /etc/logrotate.d/httpd 中的另一个例子: -![旋转 Apache 日志文件](http://www.tecmint.com/wp-content/uploads/2015/08/Rotate-Apache-Log-Files.png) +![轮换 Apache 日志文件](http://www.tecmint.com/wp-content/uploads/2015/08/Rotate-Apache-Log-Files.png) -旋转 Apache 日志文件 +*轮换 Apache 日志文件* 你可以在 logrotate 的 man 手册([man logrotate][4] 和 [man logrotate.conf][5])中阅读更多有关它的设置。为了方便你的阅读,本文还提供了两篇文章的 PDF 格式。 -作为一个系统工程师,很可能由你决定多久按照什么格式保存一次日志,取决于你是否有一个单独的分区/逻辑卷给 /var。否则,你真的要考虑删除旧日志以节省存储空间。另一方面,根据你公司和客户内部的政策,为了以后的安全审核,你可能被迫要保留多个日志。 +作为一个系统工程师,很可能由你决定多久按照什么格式保存一次日志,这取决于你是否有一个单独的分区/逻辑卷给 `/var`。否则,你真的要考虑删除旧日志以节省存储空间。另一方面,根据你公司和客户内部的政策,为了以后的安全审核,你可能必须要保留多个日志。 #### 保存日志到数据库 #### -当然检查日志可能是一个很繁琐的工作(即使有类似 grep 工具和正则表达式的帮助)。因为这个原因,rsyslog 允许我们把它们导出到数据库(OTB 支持的关系数据库管理系统包括 MySQL、MariaDB、PostgreSQL 和 Oracle)。 +当然检查日志可能是一个很繁琐的工作(即使有类似 grep 工具和正则表达式的帮助)。因为这个原因,rsyslog 允许我们把它们导出到数据库(OTB 支持的关系数据库管理系统包括 MySQL、MariaDB、PostgreSQL 和 Oracle 等)。 指南的这部分假设你已经在要管理日志的 RHEL 7 上安装了 MariaDB 服务器和客户端: @@ -104,10 +102,9 @@ Logrotate 配置 然后使用 `mysql_secure_installation` 工具为 root 用户设置密码以及其它安全考量: - ![保证 MySQL 数据库安全](http://www.tecmint.com/wp-content/uploads/2015/08/Secure-MySQL-Database.png) -保证 MySQL 数据库安全 +*保证 MySQL 数据库安全* 注意:如果你不想用 MariaDB root 用户插入日志消息到数据库,你也可以配置用另一个用户账户。如何实现的介绍已经超出了本文的范围,但在 [MariaDB 知识][6] 中有详细解析。为了简单在这篇指南中我们会使用 root 账户。 @@ -117,7 +114,7 @@ Logrotate 配置 ![保存服务器日志到数据库](http://www.tecmint.com/wp-content/uploads/2015/08/Save-Server-Logs-to-Database.png) -保存服务器日志到数据库 +*保存服务器日志到数据库* 最后,添加下面的行到 /etc/rsyslog.conf: @@ -132,18 +129,18 @@ Logrotate 配置 #### 使用 SQL 语法查询日志 #### -现在执行一些会改变日志的操作(例如停止和启动服务),然后登陆到你的 DB 服务器并使用标准的 SQL 命令显示和查询日志: +现在执行一些会改变日志的操作(例如停止和启动服务),然后登录到你的数据库服务器并使用标准的 SQL 命令显示和查询日志: USE Syslog; SELECT ReceivedAt, Message FROM SystemEvents; ![在数据库中查询日志](http://www.tecmint.com/wp-content/uploads/2015/08/Query-Logs-in-Database.png) -在数据库中查询日志 +*在数据库中查询日志* ### 总结 ### -在这篇文章中我们介绍了如何设置系统日志,如果旋转日志以及为了简化查询如何重定向消息到数据库。我们希望这些技巧能对你准备 [RHCE 考试][8] 和日常工作有所帮助。 +在这篇文章中我们介绍了如何设置系统日志,如果轮换日志以及为了简化查询如何重定向消息到数据库。我们希望这些技巧能对你准备 [RHCE 考试][8] 和日常工作有所帮助。 正如往常,非常欢迎你的反馈。用下面的表单和我们联系吧。 @@ -153,7 +150,7 @@ via: http://www.tecmint.com/manage-linux-system-logs-using-rsyslogd-and-logrotat 作者:[Gabriel Cánepa][a] 译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -165,5 +162,5 @@ via: http://www.tecmint.com/manage-linux-system-logs-using-rsyslogd-and-logrotat [5]:http://www.tecmint.com/wp-content/pdf/logrotate.conf.pdf [6]:https://mariadb.com/kb/en/mariadb/create-user/ [7]:https://github.com/sematext/rsyslog/blob/master/plugins/ommysql/createDB.sql -[8]:http://www.tecmint.com/how-to-setup-and-configure-static-network-routing-in-rhel/ +[8]:https://linux.cn/article-6451-1.html [9]:https://en.wikipedia.org/wiki/Log_rotation \ No newline at end of file diff --git a/published/RHCE/Part 6 - Setting Up Samba and Configure FirewallD and SELinux to Allow File Sharing on Linux or Windows Clients.md b/published/RHCE/Part 6 - Setting Up Samba and Configure FirewallD and SELinux to Allow File Sharing on Linux or Windows Clients.md new file mode 100644 index 0000000000..a439469b81 --- /dev/null +++ b/published/RHCE/Part 6 - Setting Up Samba and Configure FirewallD and SELinux to Allow File Sharing on Linux or Windows Clients.md @@ -0,0 +1,210 @@ +RHCE 系列(六):安装 Samba 并配置 Firewalld 和 SELinux 让 Linux 和 Windows 共享文件 +================================================================================ +由于计算机很少作为一个独立的系统工作,作为一个系统管理员或工程师,就应该知道如何在有多种类型的服务器之间搭设和维护网络。 + +在本篇以及该系列后面的文章中,我们会介绍用 Windows/Linux 配置 Samba 和 NFS 服务器以及 Linux 客户端。 + +![在 Linux 中配置 Samba 进行文件共享](http://www.tecmint.com/wp-content/uploads/2015/09/setup-samba-file-sharing-on-linux-windows-clients.png) + +*RHCE 系列第六部分 - 设置 Samba 文件共享* + +如果有人让你设置文件服务器用于协作或者配置很可能有多种不同类型操作系统和设备的企业环境,这篇文章就能派上用场。 + +由于你可以在网上找到很多关于 Samba 和 NFS 背景和技术方面的介绍,在这篇文章以及后续文章中我们就省略了这些部分直接进入到我们的主题。 + +### 步骤一: 安装 Samba 服务器 ### + +我们当前的测试环境包括两台 RHEL 7 和一台 Windows 8: + + 1. Samba / NFS 服务器 [box1 (RHEL 7): 192.168.0.18], + 2. Samba 客户端 #1 [box2 (RHEL 7): 192.168.0.20] + 3. Samba 客户端 #2 [Windows 8 machine: 192.168.0.106] + +![测试安装 Samba](http://www.tecmint.com/wp-content/uploads/2015/09/Testing-Setup-for-Samba.png) + +*测试安装 Samba* + +在 box1 中安装以下软件包: + + # yum update && yum install samba samba-client samba-common + +在 box2: + + # yum update && yum install samba samba-client samba-common cifs-utils + +安装完成后,就可以配置我们的共享了。 + +### 步骤二: 设置通过 Samba 进行文件共享 ### + +Samba 这么重要的原因之一是它为 SMB/CIFS 客户端(LCTT 译注:SMB 是微软和英特尔制定的一种通信协议,CIFS 是其中一个版本,更详细的介绍可以参考 [Wiki][6])提供了文件和打印设备,这使得服务器在客户端看起来就是一个 Windows 系统(我必须承认写这篇文章的时候我有一点激动,因为这是我多年前作为一个新手 Linux 系统管理员的第一次设置)。 + +**添加系统用户并设置权限和属性** + +为了允许组协作,我们会在 box1 中用 [useradd 命令][1]创建一个有两个用户(user1 和 user2)的组 finance 和目录 /finance。 + +我们同时会把这个目录的组所有者更改为 finance 并把权限设置为 0777(所有者和组属主可读可写可执行): + + # groupadd finance + # useradd user1 + # useradd user2 + # usermod -a -G finance user1 + # usermod -a -G finance user2 + # mkdir /finance + # chmod 0770 /finance + # chgrp finance /finance + +### 步骤三: 配置 SELinux 和 Firewalld ### + +在配置 /finance 作为 Samba 共享目录之前,我们需要像下面那样停用 SELinux 或设置恰当的布尔值和安全选项(否则,SELinux 会阻止客户端访问共享目录): + + # setsebool -P samba_export_all_ro=1 samba_export_all_rw=1 + # getsebool –a | grep samba_export + # semanage fcontext –at samba_share_t "/finance(/.*)?" + # restorecon /finance + +另外我们必须确保 [firewalld][2] 允许 Samba 流量通过。 + + # firewall-cmd --permanent --add-service=samba + # firewall-cmd --reload + +### 步骤四: 配置 Samba 共享目录 ### + +现在我们来看看配置文件 /etc/samba/smb.conf 并添加用于共享的章节(section):我们希望组 finance 的成员可以浏览 /finance 的内容,在里面保存/创建文件或者子目录(默认权限为 0777,组所有者为 finance): + +**smb.conf** + +---------- + + [finance] + comment=Directory for collaboration of the company's finance team + browsable=yes + path=/finance + public=no + valid users=@finance + write list=@finance + writeable=yes + create mask=0770 + Force create mode=0770 + force group=finance + +保存文件然后用 testparm 工具进行测试。如果这里有任何错误,命令的输出或提示你需要如何修复。否则,会显示你 Samba 服务器配置的回顾: + +![测试 Samba 配置](http://www.tecmint.com/wp-content/uploads/2015/09/Test-Samba-Configuration.png) + +*测试 Samba 配置* + +如果你要添加另一个公开的共享目录(意味着不需要任何验证),在 /etc/samba/smb.conf 中创建另一章节,在共享目录名称下面复制上面的章节,只需要把 public=no 更改为 public=yes 并去掉有效用户(valid users)和写列表(write list)命令。 + +### 步骤五: 添加 Samba 用户 ### + +下一步,你需要添加 user1 和 user2 作为 Samba 的用户。要做到这点,你需要用 smbpasswd 命令,它会和 Samba 的数据库进行交互。会提示你输入一个命令用于你之后和共享目录连接: + + # smbpasswd -a user1 + # smbpasswd -a user2 + +最后,重启 Samda,并让系统启动时自动启动该服务,确保共享目录对网络客户端可用: + + # systemctl start smb + # systemctl enable smb + # smbclient -L localhost –U user1 + # smbclient -L localhost –U user2 + + +![验证 Samba 共享](http://www.tecmint.com/wp-content/uploads/2015/09/Verify-Samba-Share.png) + +*验证 Samba 共享* + +到这里,已经正确安装和配置了 Samba 文件服务器。现在让我们在 RHEL 7 和 Windows 8 客户端中测试该配置。 + +### 步骤六: 在 Linux 中挂载 Samba 共享 ### + +首先,确保客户端可以访问 Samba 共享: + + # smbclient –L 192.168.0.18 -U user2 + +![在 Linux 上挂载 Samba 共享](http://www.tecmint.com/wp-content/uploads/2015/09/Mount-Samba-Share-on-Linux.png) + +*在 Linux 上挂载 Samba 共享* + +(为 user1 重复上面的命令) + +正如任何其它存储介质,当你需要的时候你可以挂载(之后卸载)该网络共享: + + # mount //192.168.0.18/finance /media/samba -o username=user1 + +![挂载 Samba 网络共享](http://www.tecmint.com/wp-content/uploads/2015/09/Mount-Samba-Network-Share.png) + +*挂载 Samba 网络共享* + +(其中 /media/samba 是一个已有的目录) + +或者在 /etc/fstab 文件中添加下面的条目以自动挂载: + +**fstab** + +---------- + + //192.168.0.18/finance /media/samba cifs credentials=/media/samba/.smbcredentials,defaults 0 0 + +其中隐藏文件 /media/samba/.smbcredentials(它的权限被设置为 600 和 root:root)有两行内容,指示允许使用共享的账户的用户名和密码: + +**.smbcredentials** + +---------- + + username=user1 + password=PasswordForUser1 + +最后,让我们在 /finance 中创建一个文件并检查权限和属性: + + # touch /media/samba/FileCreatedInRHELClient.txt + +![在 Samba 共享中创建文件](http://www.tecmint.com/wp-content/uploads/2015/09/Create-File-in-Samba-Share.png) + +*在 Samba 共享中创建文件* + +正如你看到的,用权限 0770 和属主 user1:finance 创建了文件。 + +### 步骤七: 在 Windows 上挂载 Samba 共享 ### + +要在 Windows 上挂载 Samba 共享,进入 ‘我的计算机’ 并选择 ‘计算机’,‘网络驱动映射’。下一步,为要映射的驱动分配一个驱动器盘符并用不同的认证身份检查是否可以连接(下面的截图使用我的母语西班牙语): + +![在 Windows 中挂载 Samba 共享](http://www.tecmint.com/wp-content/uploads/2015/09/Mount-Samba-Share-in-Windows.png) + +*在 Windows 中挂载 Samba 共享* + +最后,让我们新建一个文件并检查权限和属性: + +![在 Windows Samba 共享中新建文件](http://www.tecmint.com/wp-content/uploads/2015/09/Create-Files-on-Windows-Samba-Share.png) + +在 Windows Samba 共享中新建文件 + + # ls -l /finance + +这次文件属于 user2,因为这是我们用于从 Windows 客户端中连接的账户。 + +### 总结 ### + +在这篇文章中我们不仅介绍了如何使用不同操作系统设置 Samba 服务器和两个客户端,也介绍了[如何配置 Firewalld][3] 和 [服务器中的 SELinux][4] 以获取所需的组协作功能。 + +最后,同样重要的是,我推荐阅读网上的 [smb.conf man 手册][5] ,查看其它比本文中介绍的场景更加合适你的场景的配置命令。 + +正如往常,欢迎在下面的评论框中留下你的评论或建议。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/setup-samba-file-sharing-for-linux-windows-clients/ + +作者:[Gabriel Cánepa][a] +译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/add-users-in-linux/ +[2]:http://www.tecmint.com/firewalld-vs-iptables-and-control-network-traffic-in-firewall/ +[3]:http://www.tecmint.com/configure-firewalld-in-centos-7/ +[4]:http://www.tecmint.com/selinux-essentials-and-control-filesystem-access/ +[5]:https://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html +[6]:https://en.wikipedia.org/wiki/Server_Message_Block \ No newline at end of file diff --git a/published/RHCE/Part 7 - Setting Up NFS Server with Kerberos-based Authentication for Linux Clients.md b/published/RHCE/Part 7 - Setting Up NFS Server with Kerberos-based Authentication for Linux Clients.md new file mode 100644 index 0000000000..a05935f7c1 --- /dev/null +++ b/published/RHCE/Part 7 - Setting Up NFS Server with Kerberos-based Authentication for Linux Clients.md @@ -0,0 +1,184 @@ +RHCE 系列(七):在 Linux 客户端配置基于 Kerberos 身份验证的 NFS 服务器 +================================================================================ +在本系列的前一篇文章,我们回顾了[如何在可能包括多种类型操作系统的网络上配置 Samba 共享][1]。现在,如果你需要为一组类 Unix 客户端配置文件共享,很自然的你会想到网络文件系统,或简称 NFS。 + +![设置使用 Kerberos 进行身份验证的 NFS 服务器](http://www.tecmint.com/wp-content/uploads/2015/09/Setting-Kerberos-Authentication-with-NFS.jpg) + +*RHCE 系列:第七部分 - 设置使用 Kerberos 进行身份验证的 NFS 服务器* + +在这篇文章中我们会介绍配置基于 Kerberos 身份验证的 NFS 共享的整个流程。假设你已经配置好了一个 NFS 服务器和一个客户端。如果还没有,可以参考 [安装和配置 NFS 服务器][2] - 它列出了需要安装的依赖软件包并解释了在进行下一步之前如何在服务器上进行初始化配置。 + +另外,你可能还需要配置 [SELinux][3] 和 [firewalld][4] 以允许通过 NFS 进行文件共享。 + +下面的例子假设你的 NFS 共享目录在 box2 的 /nfs: + + # semanage fcontext -a -t public_content_rw_t "/nfs(/.*)?" + # restorecon -R /nfs + # setsebool -P nfs_export_all_rw on + # setsebool -P nfs_export_all_ro on + +(其中 -P 标记指示重启持久有效)。 + +最后,别忘了: + +#### 创建 NFS 组并配置 NFS 共享目录 #### + +1、 新建一个名为 nfs 的组并给它添加用户 nfsnobody,然后更改 /nfs 目录的权限为 0770,组属主为 nfs。于是,nfsnobody(对应请求用户)在共享目录有写的权限,你就不需要在 /etc/exports 文件中使用 no_root_squash(LCTT 译注:设为 root_squash 意味着在访问 NFS 服务器上的文件时,客户机上的 root 用户不会被当作 root 用户来对待)。 + + # groupadd nfs + # usermod -a -G nfs nfsnobody + # chmod 0770 /nfs + # chgrp nfs /nfs + +2、 像下面那样更改 export 文件(/etc/exports)只允许从 box1 使用 Kerberos 安全验证的访问(sec=krb5)。 + +**注意**:anongid 的值设置为之前新建的组 nfs 的 GID: + +**exports – 添加 NFS 共享** + + /nfs box1(rw,sec=krb5,anongid=1004) + +3、 再次 exprot(-r)所有(-a)NFS 共享。为输出添加详情(-v)是个好主意,因为它提供了发生错误时解决问题的有用信息: + + # exportfs -arv + +4、 重启并启用 NFS 服务器以及相关服务。注意你不需要启动 nfs-lock 和 nfs-idmapd,因为系统启动时其它服务会自动启动它们: + + # systemctl restart rpcbind nfs-server nfs-lock nfs-idmap + # systemctl enable rpcbind nfs-server + +#### 测试环境和其它前提要求 #### + +在这篇指南中我们使用下面的测试环境: + +- 客户端机器 [box1: 192.168.0.18] +- NFS / Kerberos 服务器 [box2: 192.168.0.20] (也称为密钥分发中心,简称 KDC)。 + +**注意**:Kerberos 服务是至关重要的认证方案。 + +正如你看到的,为了简便,NFS 服务器和 KDC 在同一台机器上,当然如果你有更多可用机器你也可以把它们安装在不同的机器上。两台机器都在 `mydomain.com` 域。 + +最后同样重要的是,Kerberos 要求客户端和服务器中至少有一个域名解析的基本方式和[网络时间协议][5]服务,因为 Kerberos 身份验证的安全一部分基于时间戳。 + +为了配置域名解析,我们在客户端和服务器中编辑 /etc/hosts 文件: + +**host 文件 – 为域添加 DNS** + + 192.168.0.18 box1.mydomain.com box1 + 192.168.0.20 box2.mydomain.com box2 + +在 RHEL 7 中,chrony 是用于 NTP 同步的默认软件: + + # yum install chrony + # systemctl start chronyd + # systemctl enable chronyd + +为了确保 chrony 确实在和时间服务器同步你系统的时间,你可能要输入下面的命令两到三次,确保时间偏差尽可能接近 0: + + # chronyc tracking + +![用 Chrony 同步服务器时间](http://www.tecmint.com/wp-content/uploads/2015/09/Synchronize-Time-with-Chrony.png) + +*用 Chrony 同步服务器时间* + +### 安装和配置 Kerberos ### + +要设置 KDC,首先在客户端和服务器安装下面的软件包(客户端不需要 server 软件包): + + # yum update && yum install krb5-server krb5-workstation pam_krb5 + +安装完成后,编辑配置文件(/etc/krb5.conf 和 /var/kerberos/krb5kdc/kadm5.acl),像下面那样用 `mydomain.com` 替换所有 example.com。 + +下一步,确保 Kerberos 能功过防火墙并启动/启用相关服务。 + +**重要**:客户端也必须启动和启用 nfs-secure: + + # firewall-cmd --permanent --add-service=kerberos + # systemctl start krb5kdc kadmin nfs-secure + # systemctl enable krb5kdc kadmin nfs-secure + +现在创建 Kerberos 数据库(请注意这可能会需要一点时间,因为它会和你的系统进行多次交互)。为了加速这个过程,我打开了另一个终端并运行了 ping -f localhost 30 到 45 秒): + + # kdb5_util create -s + +![创建 Kerberos 数据库](http://www.tecmint.com/wp-content/uploads/2015/09/Create-Kerberos-Database.png) + +*创建 Kerberos 数据库* + +下一步,使用 kadmin.local 工具为 root 创建管理权限: + + # kadmin.local + # addprinc root/admin + +添加 Kerberos 服务器到数据库: + + # addprinc -randkey host/box2.mydomain.com + +在客户端(box1)和服务器(box2)上对 NFS 服务同样操作。请注意下面的截图中在退出前我忘了在 box1 上进行操作: + + # addprinc -randkey nfs/box2.mydomain.com + # addprinc -randkey nfs/box1.mydomain.com + +输入 quit 和回车键退出: + +![添加 Kerberos 到 NFS 服务器](http://www.tecmint.com/wp-content/uploads/2015/09/Create-Kerboros-for-NFS.png) + +*添加 Kerberos 到 NFS 服务器* + +为 root/admin 获取和缓存票据授权票据(ticket-granting ticket): + + # kinit root/admin + # klist + +![缓存 Kerberos](http://www.tecmint.com/wp-content/uploads/2015/09/Cache-kerberos-Ticket.png) + +*缓存 Kerberos* + +真正使用 Kerberos 之前的最后一步是保存被授权使用 Kerberos 身份验证的规则到一个密钥表文件(在服务器中): + + # kdadmin.local + # ktadd host/box2.mydomain.com + # ktadd nfs/box2.mydomain.com + # ktadd nfs/box1.mydomain.com + +最后,挂载共享目录并进行一个写测试: + + # mount -t nfs4 -o sec=krb5 box2:/nfs /mnt + # echo "Hello from Tecmint.com" > /mnt/greeting.txt + +![挂载 NFS 共享](http://www.tecmint.com/wp-content/uploads/2015/09/Mount-NFS-Share.png) + +*挂载 NFS 共享* + +现在让我们卸载共享,在客户端中重命名密钥表文件(模拟它不存在)然后试着再次挂载共享目录: + + # umount /mnt + # mv /etc/krb5.keytab /etc/krb5.keytab.orig + +![挂载/卸载 Kerberos NFS 共享](http://www.tecmint.com/wp-content/uploads/2015/09/Mount-Unmount-Kerberos-NFS-Share.png) + +*挂载/卸载 Kerberos NFS 共享* + +现在你可以使用基于 Kerberos 身份验证的 NFS 共享了。 + +### 总结 ### + +在这篇文章中我们介绍了如何设置带 Kerberos 身份验证的 NFS。和我们在这篇指南中介绍的相比,该主题还有很多相关内容,可以在 [Kerberos 手册][6] 查看,另外至少可以说 Kerberos 有一点棘手,如果你在测试或实现中遇到了任何问题或需要帮助,别犹豫在下面的评论框中告诉我们吧。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/setting-up-nfs-server-with-kerberos-based-authentication/ + +作者:[Gabriel Cánepa][a] +译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://linux.cn/article-6550-1.html +[2]:http://www.tecmint.com/configure-nfs-server/ +[3]:http://www.tecmint.com/selinux-essentials-and-control-filesystem-access/ +[4]:http://www.tecmint.com/firewalld-rules-for-centos-7/ +[5]:http://www.tecmint.com/install-ntp-server-in-centos/ +[6]:http://web.mit.edu/kerberos/krb5-1.12/doc/admin/admin_commands/ \ No newline at end of file diff --git a/published/RHCE/Part 8 - RHCE Series--Implementing HTTPS through TLS using Network Security Service NSS for Apache.md b/published/RHCE/Part 8 - RHCE Series--Implementing HTTPS through TLS using Network Security Service NSS for Apache.md new file mode 100644 index 0000000000..574e9dc594 --- /dev/null +++ b/published/RHCE/Part 8 - RHCE Series--Implementing HTTPS through TLS using Network Security Service NSS for Apache.md @@ -0,0 +1,212 @@ +RHCE 系列(八):在 Apache 上使用网络安全服务(NSS)实现 HTTPS +================================================================================ + +如果你是一个负责维护和确保 web 服务器安全的系统管理员,你需要花费最大的精力确保服务器中处理和通过的数据任何时候都受到保护。 + +![使用 SSL/TLS 设置 Apache HTTPS](http://www.tecmint.com/wp-content/uploads/2015/09/Setup-Apache-SSL-TLS-Server.png) + +*RHCE 系列:第八部分 - 使用网络安全服务(NSS)为 Apache 通过 TLS 实现 HTTPS* + +为了在客户端和服务器之间提供更安全的连接,作为 HTTP 和 SSL(Secure Sockets Layer,安全套接层)或者最近称为 TLS(Transport Layer Security,传输层安全)的组合,产生了 HTTPS 协议。 + +由于一些严重的安全漏洞,SSL 已经被更健壮的 TLS 替代。由于这个原因,在这篇文章中我们会解析如何通过 TLS 实现你 web 服务器和客户端之间的安全连接。 + +这里假设你已经安装并配置好了 Apache web 服务器。如果还没有,在进入下一步之前请阅读下面站点中的文章。 + +- [在 RHEL/CentOS 7 上安装 LAMP(Linux,MySQL/MariaDB,Apache 和 PHP)][1] + +### 安装 OpenSSL 和一些工具包 ### + +首先,确保正在运行 Apache 并且允许 http 和 https 通过防火墙: + + # systemctl start http + # systemctl enable http + # firewall-cmd --permanent –-add-service=http + # firewall-cmd --permanent –-add-service=https + +然后安装一些必需的软件包: + + # yum update && yum install openssl mod_nss crypto-utils + +**重要**:请注意如果你想使用 OpenSSL 库而不是 NSS(Network Security Service,网络安全服务)实现 TLS,你可以在上面的命令中用 mod\_ssl 替换 mod\_nss(使用哪一个取决于你,但在这篇文章中我们会使用 NSS,因为它更加安全,比如说,它支持最新的加密标准,比如 PKCS #11)。 + +如果你使用 mod\_nss,首先要卸载 mod\_ssl,反之如此。 + + # yum remove mod_ssl + +### 配置 NSS(网络安全服务)### + +安装完 mod\_nss 之后,会创建默认的配置文件 /etc/httpd/conf.d/nss.conf。你应该确保所有 Listen 和 VirualHost 指令都指向 443 号端口(HTTPS 默认端口): + +nss.conf – 配置文件 + +---------- + + Listen 443 + VirtualHost _default_:443 + +然后重启 Apache 并检查是否加载了 mod\_nss 模块: + + # apachectl restart + # httpd -M | grep nss + +![在 Apache 中检查 mod_nss 模块](http://www.tecmint.com/wp-content/uploads/2015/09/Check-Mod_NSS-Module-in-Apache.png) + +检查 Apache 是否加载 mod\_nss 模块 + +下一步,在 `/etc/httpd/conf.d/nss.conf` 配置文件中做以下更改: + +1、 指定 NSS 数据库目录。你可以使用默认的目录或者新建一个。本文中我们使用默认的: + + NSSCertificateDatabase /etc/httpd/alias + +2、 通过保存密码到数据库目录中的 `/etc/httpd/nss-db-password.conf` 文件来避免每次系统启动时要手动输入密码: + + NSSPassPhraseDialog file:/etc/httpd/nss-db-password.conf + +其中 `/etc/httpd/nss-db-password.conf` 只包含以下一行,其中 mypassword 是后面你为 NSS 数据库设置的密码: + + internal:mypassword + +另外,要设置该文件的权限和属主为 0640 和 root:apache: + + # chmod 640 /etc/httpd/nss-db-password.conf + # chgrp apache /etc/httpd/nss-db-password.conf + +3、 由于 POODLE SSLv3 漏洞,红帽建议停用 SSL 和 TLSv1.0 之前所有版本的 TLS(更多信息可以查看[这里][2])。 + +确保 NSSProtocol 指令的每个实例都类似下面一样(如果你没有托管其它虚拟主机,很可能只有一条): + + NSSProtocol TLSv1.0,TLSv1.1 + +4、 由于这是一个自签名证书,Apache 会拒绝重启,并不会识别为有效发行人。由于这个原因,对于这种特殊情况我们还需要添加: + + NSSEnforceValidCerts off + +5、 虽然并不是严格要求,为 NSS 数据库设置一个密码同样很重要: + + # certutil -W -d /etc/httpd/alias + +![为 NSS 数据库设置密码](http://www.tecmint.com/wp-content/uploads/2015/09/Set-Password-for-NSS-Database.png) + +*为 NSS 数据库设置密码* + +### 创建一个 Apache SSL 自签名证书 ### + +下一步,我们会创建一个自签名证书来让我们的客户机可以识别服务器(请注意这个方法对于生产环境并不是最好的选择;对于生产环境你应该考虑购买第三方可信证书机构验证的证书,例如 DigiCert)。 + +我们用 genkey 命令为 box1 创建有效期为 365 天的 NSS 兼容证书。完成这一步后: + + # genkey --nss --days 365 box1 + +选择 Next: + +![创建 Apache SSL 密钥](http://www.tecmint.com/wp-content/uploads/2015/09/Create-Apache-SSL-Key.png) + +*创建 Apache SSL 密钥* + +你可以使用默认的密钥大小(2048),然后再次选择 Next: + +![选择 Apache SSL 密钥大小](http://www.tecmint.com/wp-content/uploads/2015/09/Select-Apache-SSL-Key-Size.png) + +*选择 Apache SSL 密钥大小* + +等待系统生成随机比特: + +![生成随机密钥比特](http://www.tecmint.com/wp-content/uploads/2015/09/Generating-Random-Bits.png) + +*生成随机密钥比特* + +为了加快速度,会提示你在控制台输入随机字符,正如下面的截图所示。请注意当没有从键盘接收到输入时进度条是如何停止的。然后,会让你选择: + +1. 是否发送验证签名请求(CSR)到一个验证机构(CA):选择 No,因为这是一个自签名证书。 + +2. 为证书输入信息。 + +注:youtube 视频 + + +最后,会提示你输入之前给 NSS 证书设置的密码: + + # genkey --nss --days 365 box1 + +![Apache NSS 证书密码](http://www.tecmint.com/wp-content/uploads/2015/09/Apache-NSS-Password.png) + +*Apache NSS 证书密码* + +需要的话,你可以用以下命令列出现有的证书: + + # certutil –L –d /etc/httpd/alias + +![列出 Apache NSS 证书](http://www.tecmint.com/wp-content/uploads/2015/09/List-Apache-Certificates.png) + +*列出 Apache NSS 证书* + +然后通过名字删除(如果你真的需要删除的,用你自己的证书名称替换 box1): + + # certutil -d /etc/httpd/alias -D -n "box1" + +如果你需要继续进行的话,请继续阅读。 + +### 测试 Apache SSL HTTPS 连接 ### + +最后,是时候测试到我们服务器的安全连接了。当你用浏览器打开 https://\,你会看到著名的信息 “This connection is untrusted”: + +![检查 Apache SSL 连接](http://www.tecmint.com/wp-content/uploads/2015/09/Check-Apache-SSL-Connection.png) + +*检查 Apache SSL 连接* + +在上面的情况中,你可以点击添加例外(Add Exception) 然后确认安全例外(Confirm Security Exception) - 但先不要这么做。让我们首先来看看证书看它的信息是否和我们之前输入的相符(如截图所示)。 + +要做到这点,点击上面的视图(View...)-> 详情(Details)选项卡,当你从列表中选择发行人你应该看到这个: + +![确认 Apache SSL 证书详情](http://www.tecmint.com/wp-content/uploads/2015/09/Check-Apache-SSL-Certificate-Details.png) + +*确认 Apache SSL 证书详情* + +现在你可以继续,确认例外(限于此次或永久),然后会通过 https 把你带到你 web 服务器的 DocumentRoot 目录,在这里你可以使用你浏览器自带的开发者工具检查连接详情: + +在火狐浏览器中,你可以通过在屏幕中右击,然后从上下文菜单中选择检查元素(Inspect Element)启动开发者工具,尤其要看“网络”选项卡: + +![检查 Apache HTTPS 连接](http://www.tecmint.com/wp-content/uploads/2015/09/Inspect-Apache-HTTPS-Connection.png) + +*检查 Apache HTTPS 连接* + +请注意这和之前显示的在验证过程中输入的信息一致。还有一种方式通过使用命令行工具测试连接: + +左图(测试 SSLv3): + + # openssl s_client -connect localhost:443 -ssl3 + +右图(测试 TLS): + + # openssl s_client -connect localhost:443 -tls1 + +![测试 Apache SSL 和 TLS 连接](http://www.tecmint.com/wp-content/uploads/2015/09/Testing-Apache-SSL-and-TLS.png) + +*测试 Apache SSL 和 TLS 连接* + +参考上面的截图了解更详细信息。 + +### 总结 ### + +我想你已经知道,使用 HTTPS 会增加会在你站点中输入个人信息的访客的信任(从用户名和密码到任何商业/银行账户信息)。 + +在那种情况下,你会希望获得由可信验证机构签名的证书,正如我们之前解释的(步骤和设置需要启用例外的证书的步骤相同,发送 CSR 到 CA 然后获得返回的签名证书);否则,就像我们的例子中一样使用自签名证书即可。 + +要获取更多关于使用 NSS 的详情,可以参考关于 [mod-nss][3] 的在线帮助。如果你有任何疑问或评论,请告诉我们。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/create-apache-https-self-signed-certificate-using-nss/ + +作者:[Gabriel Cánepa][a] +译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://linux.cn/article-5789-1.html +[2]:https://access.redhat.com/articles/1232123 +[3]:https://git.fedorahosted.org/cgit/mod_nss.git/plain/docs/mod_nss.html \ No newline at end of file diff --git a/published/RHCE/Part 9 - How to Setup Postfix Mail Server (SMTP) using null-client Configuration.md b/published/RHCE/Part 9 - How to Setup Postfix Mail Server (SMTP) using null-client Configuration.md new file mode 100644 index 0000000000..59d6d9de0c --- /dev/null +++ b/published/RHCE/Part 9 - How to Setup Postfix Mail Server (SMTP) using null-client Configuration.md @@ -0,0 +1,144 @@ +RHCE 系列(九):如何使用无客户端配置 Postfix 邮件服务器(SMTP) +================================================================================ +尽管现在有很多在线联系方式,电子邮件仍然是一个人传递信息给远在世界尽头或办公室里坐在我们旁边的另一个人的有效方式。 + +下面的图描述了电子邮件从发送者发出直到信息到达接收者收件箱的传递过程。 + +![电子邮件如何工作](http://www.tecmint.com/wp-content/uploads/2015/09/How-Mail-Setup-Works.png) + +*电子邮件如何工作* + +要实现这一切,背后发生了好多事情。为了使电子邮件信息从一个客户端应用程序(例如 [Thunderbird][1]、Outlook,或者 web 邮件服务,例如 Gmail 或 Yahoo 邮件)投递到一个邮件服务器,并从其投递到目标服务器并最终到目标接收人,每个服务器上都必须有 SMTP(简单邮件传输协议)服务。 + +这就是为什么我们要在这篇博文中介绍如何在 RHEL 7 中设置 SMTP 服务器,从本地用户发送的邮件(甚至发送到另外一个本地用户)被转发(forward)到一个中央邮件服务器以便于访问。 + +在这个考试的要求中这称为无客户端(null-client)安装。 + +在我们的测试环境中将包括一个起源(originating)邮件服务器和一个中央服务器或中继主机(relayhost)。 + +- 起源邮件服务器: (主机名: box1.mydomain.com / IP: 192.168.0.18) +- 中央邮件服务器: (主机名: mail.mydomain.com / IP: 192.168.0.20) + +我们在两台机器中都会使用你熟知的 `/etc/hosts` 文件做名字解析: + + 192.168.0.18 box1.mydomain.com box1 + 192.168.0.20 mail.mydomain.com mail + +### 安装 Postfix 和防火墙/SELinux 注意事项 ### + +首先,我们需要(在两台机器上): + +**1、 安装 Postfix:** + + # yum update && yum install postfix + +**2、 启动服务并启用开机自动启动:** + + # systemctl start postfix + # systemctl enable postfix + +**3、 允许邮件流量通过防火墙:** + + # firewall-cmd --permanent --add-service=smtp + # firewall-cmd --add-service=smtp + +![在防火墙中开通邮件服务器端口](http://www.tecmint.com/wp-content/uploads/2015/09/Allow-Traffic-through-Firewall.png) + +*在防火墙中开通邮件服务器端口* + +**4、 在 box1.mydomain.com 配置 Postfix** + +Postfix 的主要配置文件是 `/etc/postfix/main.cf`。这个文件本身是一个很大的文本文件,因为其中包含了解释程序设置的用途的注释。 + +为了简洁,我们只显示了需要编辑的行(没错,在起源服务器中你需要保留 `mydestination` 为空;否则邮件会被存储到本地,而不是我们实际想要发往的中央邮件服务器): + + myhostname = box1.mydomain.com + mydomain = mydomain.com + myorigin = $mydomain + inet_interfaces = loopback-only + mydestination = + relayhost = 192.168.0.20 + +**5、 在 mail.mydomain.com 配置 Postfix** + + myhostname = mail.mydomain.com + mydomain = mydomain.com + myorigin = $mydomain + inet_interfaces = all + mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain + mynetworks = 192.168.0.0/24, 127.0.0.0/8 + +如果还没有设置,还要设置相关的 SELinux 布尔值永久为真: + + # setsebool -P allow_postfix_local_write_mail_spool on + +![设置 Postfix SELinux 权限](http://www.tecmint.com/wp-content/uploads/2015/09/Set-Postfix-SELinux-Permission.png) + +*设置 Postfix SELinux 权限* + +上面的 SELinux 布尔值会允许中央服务器上的 Postfix 可以写入邮件池(mail spool)。 + +**6、 在两台机子上重启服务以使更改生效:** + + # systemctl restart postfix + +如果 Postfix 没有正确启动,你可以使用下面的命令进行错误处理。 + + # systemctl -l status postfix + # journalctl -xn + # postconf -n + +### 测试 Postfix 邮件服务 ### + +要测试邮件服务器,你可以使用任何邮件用户代理(Mail User Agent,常简称为 MUA),例如 [mail 或 mutt][2]。 + +由于我个人喜欢 mutt,我会在 box1 中使用它发送邮件给用户 tecmint,并把现有文件(mailbody.txt)作为信息内容: + + # mutt -s "Part 9-RHCE series" tecmint@mydomain.com < mailbody.txt + +![测试 Postfix 邮件服务器](http://www.tecmint.com/wp-content/uploads/2015/09/Test-Postfix-Mail-Server.png) + +*测试 Postfix 邮件服务器* + +现在到中央邮件服务器(mail.mydomain.com)以 tecmint 用户登录,并检查是否收到了邮件: + + # su – tecmint + # mail + +![检查 Postfix 邮件服务器发送](http://www.tecmint.com/wp-content/uploads/2015/09/Check-Postfix-Mail-Server-Delivery.png) + +*检查 Postfix 邮件服务器发送* + +如果没有收到邮件,检查 root 用户的邮件池看看是否有警告或者错误提示。你也许需要使用 [nmap 命令][3]确保两台服务器运行了 SMTP 服务,并在中央邮件服务器中打开了 25 号端口: + + # nmap -PN 192.168.0.20 + +![Postfix 邮件服务器错误处理](http://www.tecmint.com/wp-content/uploads/2015/09/Troubleshoot-Postfix-Mail-Server.png) + +*Postfix 邮件服务器错误处理* + +### 总结 ### + +像本文中展示的设置邮件服务器和中继主机是每个系统管理员必须拥有的重要技能,也代表了理解和安装更复杂情景的基础,例如一个邮件服务器托管有多个邮件账户(甚至成百上千)的域名。 + +(请注意这种类型的设置需要有 DNS 服务器,这不在本文的介绍范围),但你可以参照下面的文章设置 DNS 服务器: + +- [在 CentOS/RHEL 07 上配置仅缓存的 DNS 服务器][4] + +最后,我强烈建议你熟悉 Postfix 的配置文件(main.cf)和这个程序的帮助手册。如果有任何疑问,别犹豫,使用下面的评论框或者我们的论坛 Linuxsay.com 告诉我们吧,你会从世界各地的 Linux 高手中获得几乎是及时的帮助。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/setup-postfix-mail-server-smtp-using-null-client-on-centos/ + +作者:[Gabriel Cánepa][a] +译者:[ictlyh](https//www.mutouxiaogui.cn/blog/) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/install-thunderbird-17-in-ubuntu-xubuntu-linux-mint/ +[2]:http://www.tecmint.com/send-mail-from-command-line-using-mutt-command/ +[3]:http://www.tecmint.com/nmap-command-examples/ +[4]:http://www.tecmint.com/setup-dns-cache-server-in-centos-7/ \ No newline at end of file diff --git a/published/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md b/published/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md similarity index 100% rename from published/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md rename to published/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md diff --git a/published/RHCSA Series--Part 02--How to Perform File and Directory Management.md b/published/RHCSA Series/RHCSA Series--Part 02--How to Perform File and Directory Management.md similarity index 100% rename from published/RHCSA Series--Part 02--How to Perform File and Directory Management.md rename to published/RHCSA Series/RHCSA Series--Part 02--How to Perform File and Directory Management.md diff --git a/published/RHCSA Series/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md b/published/RHCSA Series/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md new file mode 100644 index 0000000000..cbe4f0bdc6 --- /dev/null +++ b/published/RHCSA Series/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md @@ -0,0 +1,248 @@ +RHCSA 系列(三): 如何管理 RHEL7 的用户和组 +================================================================================ + +和管理其它Linux服务器一样,管理一个 RHEL 7 服务器要求你能够添加、修改、暂停或删除用户帐户,并且授予他们执行其分配的任务所需的文件、目录、其它系统资源所必要的权限。 + +![User and Group Management in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/User-and-Group-Management-in-Linux.png) + +*RHCSA: 用户和组管理 – Part 3* + +###管理用户帐户## + +如果想要给RHEL 7 服务器添加账户,你需要以root用户执行如下两条命令之一: + + # adduser [new_account] + # useradd [new_account] + +当添加新的用户帐户时,默认会执行下列操作。 + +- 它/她的主目录就会被创建(一般是"/home/用户名",除非你特别设置) +- 一些隐藏文件 如`.bash_logout`, `.bash_profile` 以及 `.bashrc` 会被复制到用户的主目录,它们会为用户的回话提供环境变量。你可以进一步查看它们的相关细节。 +- 会为您的账号添加一个邮件池目录。 +- 会创建一个和用户名同样的组(LCTT 译注:除非你给新创建的用户指定了组)。 + +用户帐户的全部信息被保存在`/etc/passwd`文件。这个文件以如下格式保存了每一个系统帐户的所有信息(字段以“:”分割) + + [username]:[x]:[UID]:[GID]:[Comment]:[Home directory]:[Default shell] + +- `[username]` 和`[Comment]` 其意自明,就是用户名和备注 +- 第二个‘x’表示帐户的启用了密码保护(记录在`/etc/shadow`文件),密码用于登录`[username]` +- `[UID]` 和`[GID]`是整数,它们表明了`[username]`的用户ID 和所属的主组ID + +最后。 + +- `[Home directory]`显示`[username]`的主目录的绝对路径 +- `[Default shell]` 是当用户登录系统后使用的默认shell + +另外一个你必须要熟悉的重要的文件是存储组信息的`/etc/group`。和`/etc/passwd`类似,也是每行一个记录,字段由“:”分割 + + [Group name]:[Group password]:[GID]:[Group members] + +- `[Group name]` 是组名 +- 这个组是否使用了密码 (如果是"x"意味着没有) +- `[GID]`: 和`/etc/passwd`中一样 +- `[Group members]`:用户列表,使用“,”隔开。里面包含组内的所有用户 + +添加过帐户后,任何时候你都可以通过 usermod 命令来修改用户账户信息,基本的语法如下: + + # usermod [options] [username] + +相关阅读 + +- [15 ‘useradd’ 命令示例][1] +- [15 ‘usermod’ 命令示例][2] + +#### 示例1 : 设置帐户的过期时间 #### + +如果你的公司有一些短期使用的帐户或者你要在有限时间内授予访问,你可以使用 `--expiredate` 参数 ,后加YYYY-MM-DD 格式的日期。为了查看是否生效,你可以使用如下命令查看 + + # chage -l [username] + +帐户更新前后的变动如下图所示 + +![Change User Account Information](http://www.tecmint.com/wp-content/uploads/2015/03/Change-User-Account-Information.png) + +*修改用户信息* + +#### 示例 2: 向组内追加用户 #### + +除了创建用户时的主用户组,一个用户还能被添加到别的组。你需要使用 -aG或 -append -group 选项,后跟逗号分隔的组名。 + +#### 示例 3: 修改用户主目录或默认Shell #### + +如果因为一些原因,你需要修改默认的用户主目录(一般为 /home/用户名),你需要使用 -d 或 -home 参数,后跟绝对路径来修改主目录。 + +如果有用户想要使用其它的shell来取代默认的bash(比如zsh)。使用 usermod ,并使用 -shell 的参数,后加新的shell的路径。 + +#### 示例 4: 展示组内的用户 #### + +当把用户添加到组中后,你可以使用如下命令验证属于哪一个组 + + # groups [username] + # id [username] + +下面图片的演示了示例2到示例4 + +![Adding User to Supplementary Group](http://www.tecmint.com/wp-content/uploads/2015/03/Adding-User-to-Supplementary-Group.png) + +*添加用户到额外的组* + +在上面的示例中: + + # usermod --append --groups gacanepa,users --home /tmp --shell /bin/sh tecmint + +如果想要从组内删除用户,取消 `--append` 选项,并使用 `--groups` 和你要用户属于的组的列表。 + +#### 示例 5: 通过锁定密码来停用帐户 #### + +如果想要关闭帐户,你可以使用 -l(小写的L)或 -lock 选项来锁定用户的密码。这将会阻止用户登录。 + +#### 示例 6: 解锁密码 #### + +当你想要重新启用帐户让它可以继续登录时,使用 -u 或 –unlock 选项来解锁用户的密码,就像示例5 介绍的那样 + + # usermod --unlock tecmint + +下面的图片展示了示例5和示例6: + +![Lock Unlock User Account](http://www.tecmint.com/wp-content/uploads/2015/03/Lock-Unlock-User-Account.png) + +*锁定上锁用户* + +#### 示例 7:删除组和用户 #### + +如果要删除一个组,你需要使用 groupdel ,如果需要删除用户 你需要使用 userdel (添加 -r 可以删除主目录和邮件池的内容)。 + + # groupdel [group_name] # 删除组 + # userdel -r [user_name] # 删除用户,并删除主目录和邮件池 + +如果一些文件属于该组,删除组时它们不会也被删除。但是组拥有者的名字将会被设置为删除掉的组的GID。 + +### 列举,设置,并且修改标准 ugo/rwx 权限 ### + +著名的 [ls 命令][3] 是管理员最好的助手. 当我们使用 -l 参数, 这个工具允许您以长格式(或详细格式)查看一个目录中的内容。 + +而且,该命令还可以用于单个文件中。无论哪种方式,在“ls”输出中的前10个字符表示每个文件的属性。 + +这10个字符序列的第一个字符用于表示文件类型: + +- – (连字符): 一个标准文件 +- d: 一个目录 +- l: 一个符号链接 +- c: 字符设备(将数据作为字节流,例如终端) +- b: 块设备(以块的方式处理数据,例如存储设备) + +文件属性的接下来的九个字符,分为三个组,被称为文件模式,并注明读(r)、写(w)、和执行(x)权限授予文件的所有者、文件的所有组、和其它的用户(通常被称为“世界”)。 + +同文件上的读取权限允许文件被打开和读取一样,如果目录同时有执行权限时,就允许其目录内容被列出。此外,如果一个文件有执行权限,就允许它作为一个程序运行。 + +文件权限是通过chmod命令改变的,它的基本语法如下: + + # chmod [new_mode] file + +new_mode 是一个八进制数或表达式,用于指定新的权限。随意试试各种权限看看是什么效果。或者您已经有了一个更好的方式来设置文件的权限,你也可以用你自己的方式自由地试试。 + +八进制数可以基于二进制等价计算,可以从所需的文件权限的文件的所有者、所有组、和世界组合成。每种权限都等于2的幂(R = 2\^2,W = 2\^1,x = 2\^0),没有时即为0。例如: + +![File Permissions](http://www.tecmint.com/wp-content/uploads/2015/03/File-Permissions.png) + +*文件权限* + +在八进制形式下设置文件的权限,如上图所示 + + # chmod 744 myfile + +请用马上来对比一下我们以前的计算,在更改文件的权限后,我们的实际输出为: + +![Long List Format](http://www.tecmint.com/wp-content/uploads/2015/03/Long-List-Format.png) + +*长列表格式* + +#### 示例 8: 寻找777权限的文件 #### + +出于安全考虑,你应该确保在正常情况下,尽可能避免777权限(任何人可读、可写、可执行的文件)。虽然我们会在以后的教程中教你如何更有效地找到您的系统的具有特定权限的全部文件,你现在仍可以组合使用ls 和 grep来获取这种信息。 + +在下面的例子,我们会寻找 /etc 目录下的777权限文件。注意,我们要使用[第二章:文件和目录管理][4]中讲到的管道的知识: + + # ls -l /etc | grep rwxrwxrwx + +![Find All Files with 777 Permission](http://www.tecmint.com/wp-content/uploads/2015/03/Find-All-777-Files.png) + +*查找所有777权限的文件* + +#### 示例 9: 为所有用户指定特定权限 #### + +shell脚本,以及一些二进制文件,所有用户都应该有权访问(不只是其相应的所有者和组),应该有相应的执行权限(我们会讨论特殊情况下的问题): + + # chmod a+x script.sh + +**注意**: 我们可以使用表达式设置文件模式,表示用户权限的字母如“u”,组所有者权限的字母“g”,其余的为“o” ,同时具有所有权限为“a”。权限可以通过`+` 或 `-` 来授予和收回。 + +![Set Execute Permission on File](http://www.tecmint.com/wp-content/uploads/2015/03/Set-Execute-Permission-on-File.png) + +*为文件设置执行权限* + +长目录列表还用两列显示了该文件的所有者和所有组。此功能可作为系统中文件的第一级访问控制方法: + +![Check File Owner and Group](http://www.tecmint.com/wp-content/uploads/2015/03/Check-File-Owner-and-Group.png) + +*检查文件的所有者和所有组* + +改变文件的所有者,您应该使用chown命令。请注意,您可以在同时或分别更改文件的所有组: + + # chown user:group file + +你可以更改用户或组,或在同时更改两个属性,但是不要忘记冒号区分,如果你想要更新其它属性,让另外的部分为空: + + # chown :group file # 仅改变所有组 + # chown user: file # 仅改变所有者 + +#### 示例 10:从一个文件复制权限到另一个文件#### + + +如果你想“克隆”一个文件的所有权到另一个,你可以这样做,使用–reference参数,如下: + + # chown --reference=ref_file file + +ref_file的所有信息会复制给 file + +![Clone File Ownership](http://www.tecmint.com/wp-content/uploads/2015/03/Clone-File-Ownership.png) + +*复制文件属主信息* + +### 设置 SETGID 协作目录 ### + +假如你需要授予在一个特定的目录中拥有访问所有的文件的权限给一个特定的用户组,你有可能需要使用给目录设置setgid的方法。当setgid设置后,该真实用户的有效GID会变成属主的GID。 + +因此,任何访问该文件的用户会被授予该文件的属组的权限。此外,当setgid设置在一个目录中,新创建的文件继承组该目录的组,而且新创建的子目录也将继承父目录的setgid权限。 + + # chmod g+s [filename] + +要以八进制形式设置 setgid,需要在基本权限前缀以2。 + + # chmod 2755 [directory] + +### 总结 ### + +扎实的用户和组管理知识,以及标准和特殊的 Linux权限管理,通过实践,可以帮你快速解决 RHEL 7 服务器的文件权限问题。 + +我向你保证,当你按照本文所概述的步骤和使用系统文档(在本系列的[第一章 回顾基础命令及系统文档][5]中讲到), 你将掌握基本的系统管理的能力。 + +请随时使用下面的评论框让我们知道你是否有任何问题或意见。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-manage-users-and-groups/ + +作者:[Gabriel Cánepa][a] +译者:[xiqingongzi](https://github.com/xiqingongzi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/add-users-in-linux/ +[2]:http://www.tecmint.com/usermod-command-examples/ +[3]:http://linux.cn/article-5349-1.html +[4]:https://www.linux.cn/article-6155-1.html +[5]:http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ diff --git a/published/RHCSA Series/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md b/published/RHCSA Series/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md new file mode 100644 index 0000000000..995aab93e1 --- /dev/null +++ b/published/RHCSA Series/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md @@ -0,0 +1,209 @@ +RHCSA 系列(四): 编辑文本文件及分析文本 +================================================================================ + +作为系统管理员的日常职责的一部分,每个系统管理员都必须处理文本文件,这包括编辑已有文件(大多可能是配置文件),或创建新的文件。有这样一个说法,假如你想在 Linux 世界中挑起一场圣战,你可以询问系统管理员们,什么是他们最喜爱的编辑器以及为什么。在这篇文章中,我们并不打算那样做,但我们将向你呈现一些技巧,这些技巧对使用两款在 RHEL 7 中最为常用的文本编辑器: nano(由于其简单和易用,特别是对于新手来说)和 vi/m(由于其自身的几个特色使得它不仅仅是一个简单的编辑器)来说都大有裨益。我确信你可以找到更多的理由来使用其中的一个或另一个,或许其他的一些编辑器如 emacs 或 pico。这完全取决于你自己。 + +![学习 Nano 和 vi 编辑器](http://www.tecmint.com/wp-content/uploads/2015/03/Learn-Nano-and-vi-Editors.png) + +*RHCSA: 使用 Nano 和 Vim 编辑文本文件 – Part 4* + +### 使用 Nano 编辑器来编辑文件 ### + +要启动 nano,你可以在命令提示符下输入 `nano`,或可选地跟上一个文件名(在这种情况下,若文件存在,它将在编辑模式中被打开)。若文件不存在,或我们省略了文件名, nano 也将在编辑模式下开启,但将为我们开启一个空白屏以便开始输入: + +![Nano 编辑器](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Editor.png) + +*Nano 编辑器* + +正如你在上一张图片中所见的那样, nano 在屏幕的底部呈现出一些可以通过指定的快捷键来触发的功能(\^,即插入记号,代指 Ctrl 键)。它们中的一些是: + +- Ctrl + G: 触发一个帮助菜单,带有一个关于功能和相应的描述的完整列表; + +![Nano 编辑器帮助菜单](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Help.png) + +*Nano 编辑器帮助菜单* + +- Ctrl + O: 保存更改到一个文件。它可以让你用一个与源文件相同或不同的名称来保存该文件,然后按 Enter 键来确认。 + +![Nano 编辑器保存更改模式](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Save-Changes.png) + +*Nano 编辑器的保存更改模式* + +- Ctrl + X: 离开当前文件,假如更改没有被保存,则它们将被丢弃; +- Ctrl + R: 通过指定一个完整的文件路径,让你选择一个文件来将该文件的内容插入到当前文件中; + +![Nano: 插入文件内容到主文件中](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-File-Content.png) + +*Nano: 插入文件内容到主文件中* + +上图的操作将把 `/etc/passwd` 的内容插入到当前文件中。 + +- Ctrl + K: 剪切当前行; +- Ctrl + U: 粘贴; +- Ctrl + C: 取消当前的操作并返回先前的屏幕; + +为了轻松地在打开的文件中浏览, nano 提供了下面的功能: + +- Ctrl + F 和 Ctrl + B 分别先前或向后移动光标;而 Ctrl + P 和 Ctrl + N 则分别向上或向下移动一行,功能与箭头键相同; +- Ctrl + space 和 Alt + space 分别向前或向后移动一个单词; + +最后, + +- 假如你想将光标移动到文档中的特定位置,使用 Ctrl + _ (下划线) 并接着输入 X,Y 将准确地带你到 第 X 行,第 Y 列。 + +![在 nano 中定位到具体的行,列](http://www.tecmint.com/wp-content/uploads/2015/03/Column-Numbers.png) + +*在 nano 中定位到具体的行和列* + +上面的例子将带你到当前文档的第 15 行,第 14 列。 + +假如你可以回忆起你早期的 Linux 岁月,特别是当你刚从 Windows 迁移到 Linux 中,你就可能会同意:对于一个新手来说,使用 nano 来开始学习是最好的方式。 + +### 使用 Vim 编辑器来编辑文件 ### + +Vim 是 vi 的加强版本,它是 Linux 中一个著名的文本编辑器,可在所有兼容 POSIX 的 *nix 系统中获取到,例如在 RHEL 7 中。假如你有机会并可以安装 Vim,请继续;假如不能,这篇文章中的大多数(若不是全部)的提示也应该可以正常工作。 + +Vim 的一个出众的特点是可以在多个不同的模式中进行操作: + +- 命令模式(Command Mode)将允许你在文件中跳转和输入命令,这些命令是由一个或多个字母组成的简洁且大小写敏感的组合。假如你想重复执行某个命令特定次数,你可以在这个命令前加上需要重复的次数(这个规则只有极少数例外)。例如, `yy`(或 `Y`,yank 的缩写)可以复制整个当前行,而 `4yy`(或 `4Y`)则复制整个从当前行到接下来的 3 行(总共 4 行)。 +- 我们总是可以通过敲击 `Esc` 键来进入命令模式(无论我们正工作在哪个模式下)。 +- 在末行模式(Ex Mode)中,你可以操作文件(包括保存当前文件和运行外部的程序或命令)。要进入末行模式,你必须从命令模式中(换言之,输入 `Esc` + `:`)输入一个冒号(`:`),再直接跟上你想使用的末行模式命令的名称。 +- 对于插入模式(Insert Mode),可以输入字母 `i` 进入,然后只需要输入文字即可。大多数的击键结果都将出现在屏幕中的文本中。 + +现在,让我们看看如何在 vim 中执行在上一节列举的针对 nano 的相同的操作。不要忘记敲击 Enter 键来确认 vim 命令。 + +为了从命令行中获取 vim 的完整手册,在命令模式下键入 `:help` 并敲击 Enter 键: + +![vim 编辑器帮助菜单](http://www.tecmint.com/wp-content/uploads/2015/03/vim-Help-Menu.png) + +*vim 编辑器帮助菜单* + +上面的部分呈现出一个内容列表,这些定义的小节则描述了 Vim 的特定话题。要浏览某一个小节,可以将光标放到它的上面,然后按 `Ctrl + ]` (闭方括号)。注意,底部的小节展示的是当前文件的内容。 + +1、 要保存更改到文件,在命令模式中运行下面命令中的任意一个,就可以达到这个目的: + +``` +:wq! +:x! +ZZ (是的,两个 ZZ,前面无需添加冒号) +``` + +2、 要离开并丢弃更改,使用 `:q!`。这个命令也将允许你离开上面描述过的帮助菜单,并返回到命令模式中的当前文件。 + +3、 剪切 N 行:在命令模式中键入 `Ndd`。 + +4、 复制 M 行:在命令模式中键入 `Myy`。 + +5、 粘贴先前剪贴或复制过的行:在命令模式中按 `P`键。 + +6、 要插入另一个文件的内容到当前文件: + + :r filename + +例如,插入 `/etc/fstab` 的内容,可以这样做: + +[在 vi 编辑器中插入文件的内容](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-Content-vi-Editor.png) + +*在 vi 编辑器中插入文件的内容* + +7、 插入一个命令的输出到当前文档: + + :r! command + +例如,要在光标所在的当前位置后面插入日期和时间: + +![在 vi 编辑器中插入时间和日期](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-Time-and-Date-in-vi-Editor.png) + +*在 vi 编辑器中插入时间和日期* + +在另一篇我写的文章中,([LFCS 系列(二)][1]),我更加详细地解释了在 vim 中可用的键盘快捷键和功能。或许你可以参考那个教程来查看如何使用这个强大的文本编辑器的更深入的例子。 + +### 使用 grep 和正则表达式来分析文本 ### + +到现在为止,你已经学习了如何使用 nano 或 vim 创建和编辑文件。打个比方说,假如你成为了一个文本编辑器忍者 – 那又怎样呢? 在其他事情上,你也需要知道如何在文本中搜索正则表达式。 + +正则表达式(也称为 "regex" 或 "regexp") 是一种识别一个特定文本字符串或模式的方式,使得一个程序可以将这个模式和任意的文本字符串相比较。尽管利用 grep 来使用正则表达式值得用一整篇文章来描述,这里就让我们复习一些基本的知识: + +**1、 最简单的正则表达式是一个由数字和字母构成的字符串(例如,单词 "svm") ,或者两个(在使用两个字符串时,你可以使用 `|`(或) 操作符):** + + # grep -Ei 'svm|vmx' /proc/cpuinfo + +上面命令的输出结果中若有这两个字符串之一的出现,则标志着你的处理器支持虚拟化: + +![正则表达式示例](http://www.tecmint.com/wp-content/uploads/2015/03/Regular-Expression-Example.png) + +*正则表达式示例* + +**2、 第二种正则表达式是一个范围列表,由方括号包裹。** + +例如, `c[aeiou]t` 匹配字符串 cat、cet、cit、cot 和 cut,而 `[a-z]` 和 `[0-9]` 则相应地匹配小写字母或十进制数字。假如你想重复正则表达式 X 次,在正则表达式的后面立即输入 `{X}`即可。 + +例如,让我们从 `/etc/fstab` 中析出存储设备的 UUID: + + # grep -Ei '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' -o /etc/fstab + +![在 Linux 中从一个文件中析出字符串](http://www.tecmint.com/wp-content/uploads/2015/03/Extract-String-from-a-File.png) + +*从一个文件中析出字符串* + +方括号中的第一个表达式 `[0-9a-f]` 被用来表示小写的十六进制字符,`{8}`是一个量词,暗示前面匹配的字符串应该重复的次数(在一个 UUID 中的开头序列是一个 8 个字符长的十六进制字符串)。 + +在圆括号中,量词 `{4}`和连字符暗示下一个序列是一个 4 个字符长的十六进制字符串,接着的量词 `({3})`表示前面的表达式要重复 3 次。 + +最后,在 UUID 中的最后一个 12 个字符长的十六进制字符串可以由 `[0-9a-f]{12}` 取得, `-o` 选项表示只打印出在 `/etc/fstab`中匹配行中的匹配的(非空)部分。 + +**3、 POSIX 字符类** + +|字符类|匹配 …| +|-----|-----| +| `[:alnum:]` | 任意字母或数字 [a-zA-Z0-9] | +| `[:alpha:]` |任意字母 [a-zA-Z] | +| `[:blank:]` |空格或制表符 | +| `[:cntrl:]` |任意控制字符 (ASCII 码的 0 至 32) | +| `[:digit:]` |任意数字 [0-9] | +| `[:graph:]` |任意可见字符 | +| `[:lower:]` |任意小写字母 [a-z] | +| `[:print:]` |任意非控制字符 | +| `[:space:]` |任意空格 | +| `[:punct:]` |任意标点字符 | +| `[:upper:]` |任意大写字母 [A-Z] | +| `[:xdigit:]` |任意十六进制数字 [0-9a-fA-F] | +| `[:word:]` |任意字母,数字和下划线 [a-zA-Z0-9_] | + +例如,我们可能会对查找已添加到我们系统中给真实用户的 UID 和 GID(参考“[RHCSA 系列(二): 如何进行文件和目录管理][2]”来回忆起这些知识)感兴趣。那么,我们将在 `/etc/passwd` 文件中查找 4 个字符长的序列: + + # grep -Ei [[:digit:]]{4} /etc/passwd + +![在文件中查找一个字符串](http://www.tecmint.com/wp-content/uploads/2015/03/Search-For-String-in-File.png) + +*在文件中查找一个字符串* + +上面的示例可能不是真实世界中使用正则表达式的最好案例,但它清晰地启发了我们如何使用 POSIX 字符类来使用 grep 分析文本。 + +### 总结 ### + + +在这篇文章中,我们已经提供了一些技巧来最大地利用针对命令行用户的两个文本编辑器 nano 和 vim,这两个工具都有相关的扩展文档可供阅读,你可以分别查询它们的官方网站(链接在下面给出)以及使用“[RHCSA 系列(一): 回顾基础命令及系统文档][3]”中给出的建议。 + +#### 参考文件链接 #### + +- [http://www.nano-editor.org/][4] +- [http://www.vim.org/][5] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-how-to-use-nano-vi-editors/ + +作者:[Gabriel Cánepa][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/vi-editor-usage/ +[2]:https://linux.cn/article-6155-1.html +[3]:https://linux.cn/article-6133-1-rel.html +[4]:http://www.nano-editor.org/ +[5]:http://www.vim.org/ +[6]:http://www.tecmint.com/vi-editor-usage/ \ No newline at end of file diff --git a/published/RHCSA Series/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md b/published/RHCSA Series/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md new file mode 100644 index 0000000000..36caaf5294 --- /dev/null +++ b/published/RHCSA Series/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md @@ -0,0 +1,152 @@ +RHCSA 系列(五): RHEL7 中的进程管理:开机,关机 +================================================================================ +我们将概括和简要地复习从你按开机按钮来打开你的 RHEL 7 服务器到呈现出命令行界面的登录屏幕之间所发生的所有事情,以此来作为这篇文章的开始。 + +![RHEL 7 开机过程](http://www.tecmint.com/wp-content/uploads/2015/03/RHEL-7-Boot-Process.png) + +*Linux 开机过程* + +**请注意:** + +1. 相同的基本原则也可以应用到其他的 Linux 发行版本中,但可能需要较小的更改,并且 +2. 下面的描述并不是旨在给出开机过程的一个详尽的解释,而只是介绍一些基础的东西 + +### Linux 开机过程 ### + +1. 初始化 POST(加电自检)并执行硬件检查; + +2. 当 POST 完成后,系统的控制权将移交给启动管理器的第一阶段(first stage),它存储在一个硬盘的引导扇区(对于使用 BIOS 和 MBR 的旧式的系统而言)或存储在一个专门的 (U)EFI 分区上。 + +3. 启动管理器的第一阶段完成后,接着进入启动管理器的第二阶段(second stage),通常大多数使用的是 GRUB(GRand Unified Boot Loader 的简称),它驻留在 `/boot` 中,然后开始加载内核和驻留在 RAM 中的初始化文件系统(被称为 initramfs,它包含执行必要操作所需要的程序和二进制文件,以此来最终挂载真实的根文件系统)。 + +4. 接着展示了闪屏(splash)过后,呈现在我们眼前的是类似下图的画面,它允许我们选择一个操作系统和内核来启动: + + ![RHEL 7 开机屏幕](http://www.tecmint.com/wp-content/uploads/2015/03/RHEL-7-Boot-Screen.png) + + *启动菜单屏幕* + +5. 内核会对接入到系统的硬件进行设置,当根文件系统被挂载后,接着便启动 PID 为 1 的进程,这个进程将开始初始化其他的进程并最终呈现给我们一个登录提示符界面。 + + 注意:假如我们想在启动后查看这些信息,我们可以使用 [dmesg 命令][1],并使用这个系列里的上一篇文章中介绍过的工具(注:即 grep)来过滤它的输出。 + + ![登录屏幕和进程的 PID](http://www.tecmint.com/wp-content/uploads/2015/03/Login-Screen-Process-PID.png) + + *登录屏幕和进程的 PID* + +在上面的例子中,我们使用了大家熟知的 `ps` 命令来显示在系统启动过程中的一系列当前进程的信息,它们的父进程(或者换句话说,就是那个开启这些进程的进程)为 systemd(大多数现代的 Linux 发行版本已经切换到的系统和服务管理器): + + # ps -o ppid,pid,uname,comm --ppid=1 + +记住 `-o`(为 -format 的简写)选项允许你以一个自定义的格式来显示 ps 的输出,以此来满足你的需求;这个自定义格式使用 `man ps` 里 STANDARD FORMAT SPECIFIERS 一节中的特定关键词。 + +另一个你想自定义 ps 的输出而不是使用其默认输出的情形是:当你需要找到引起 CPU 或内存消耗过多的那些进程,并按照下列方式来对它们进行排序时: + + # ps aux --sort=+pcpu # 以 %CPU 来排序(增序) + # ps aux --sort=-pcpu # 以 %CPU 来排序(降序) + # ps aux --sort=+pmem # 以 %MEM 来排序(增序) + # ps aux --sort=-pmem # 以 %MEM 来排序(降序) + # ps aux --sort=+pcpu,-pmem # 结合 %CPU (增序) 和 %MEM (降序)来排列 + +![http://www.tecmint.com/wp-content/uploads/2015/03/ps-command-output.png](http://www.tecmint.com/wp-content/uploads/2015/03/ps-command-output.png) + +*自定义 ps 命令的输出* + +### systemd 的一个介绍 ### + +在 Linux 世界中,很少有能比在主流的 Linux 发行版本中采用 systemd 引起更多的争论的决定。systemd 的倡导者根据以下事实来表明其主要的优势: + +1. 在系统启动期间,systemd 允许并发地启动更多的进程(相比于先前的 SysVinit,SysVinit 似乎总是表现得更慢,因为它一个接一个地启动进程,检查一个进程是否依赖于另一个进程,然后等待守护进程启动才可以启动的更多的服务),并且 +2. 在一个运行着的系统中,它用作一个动态的资源管理器。这样在启动期间,当一个服务被需要时,才启动它(以此来避免消耗系统资源)而不是在没有一个合理的原因的情况下启动额外的服务。 +3. 向后兼容 sysvinit 的脚本。 + + 另外请阅读: ['init' 和 'systemd' 背后的故事][2] + +systemd 由 systemctl 工具控制,假如你了解 SysVinit,你将会对以下的内容感到熟悉: + +- service 工具,在旧一点的系统中,它被用来管理 SysVinit 脚本,以及 +- chkconfig 工具,为系统服务升级和查询运行级别信息 +- shutdown 你一定使用过几次来重启或关闭一个运行的系统。 + +下面的表格展示了使用传统的工具和 systemctl 之间的相似之处: + + +| 旧式工具 | Systemctl 等价命令 | 描述 | +|-------------|----------------------|-------------| +| service name start | systemctl start name | 启动 name (这里 name 是一个服务) | +| service name stop | systemctl stop name | 停止 name | +| service name condrestart | systemctl try-restart name | 重启 name (如果它已经运行了) | +| service name restart | systemctl restart name | 重启 name | +| service name reload | systemctl reload name | 重载 name 的配置 | +| service name status | systemctl status name | 显示 name 的当前状态 | +| service - status-all | systemctl | 显示当前所有服务的状态 | +| chkconfig name on | systemctl enable name | 通过一个特定的单元文件,让 name 可以在系统启动时运行(这个文件是一个符号链接)。启用或禁用一个启动时的进程,实际上是增加或移除一个到 /etc/systemd/system 目录中的符号链接。 | +| chkconfig name off | systemctl disable name | 通过一个特定的单元文件,让 name 可以在系统启动时禁止运行(这个文件是一个符号链接)。 | +| chkconfig -list name | systemctl is-enabled name | 确定 name (一个特定的服务)当前是否启用。| +| chkconfig - list | systemctl - type=service | 显示所有的服务及其是否启用或禁用。 | +| shutdown -h now | systemctl poweroff | 关机 | +| shutdown -r now | systemctl reboot | 重启系统 | + +systemd 也引进了单元(unit)(它可能是一个服务,一个挂载点,一个设备或者一个网络套接字)和目标(target)(它们定义了 systemd 如何去管理和同时开启几个相关的进程,可以认为它们与在基于 SysVinit 的系统中的运行级别等价,尽管事实上它们并不等价)的概念。 + +### 总结归纳 ### + +其他与进程管理相关,但并不仅限于下面所列的功能的任务有: + +**1. 在考虑到系统资源的使用上,调整一个进程的执行优先级:** + +这是通过 `renice` 工具来完成的,它可以改变一个或多个正在运行着的进程的调度优先级。简单来说,调度优先级是一个允许内核(当前只支持 >= 2.6 的版本)根据某个给定进程被分配的执行优先级(即友善度(niceness),从 -20 到 19)来为其分配系统资源的功能。 + +`renice` 的基本语法如下: + + # renice [-n] priority [-gpu] identifier + +在上面的通用命令中,第一个参数是将要使用的优先级数值,而另一个参数可以是进程 ID(这是默认的设定),进程组 ID,用户 ID 或者用户名。一个常规的用户(即除 root 以外的用户)只可以更改他或她所拥有的进程的调度优先级,并且只能增加友善度的层次(这意味着占用更少的系统资源)。 + +![在 Linux 中调整进程的优先级](http://www.tecmint.com/wp-content/uploads/2015/03/Process-Scheduling-Priority.png) + +*进程调度优先级* + +**2. 按照需要杀死一个进程(或终止其正常执行):** + +更精确地说,杀死一个进程指的是通过 [kill 或 pkill][3] 命令给该进程发送一个信号,让它优雅地(SIGTERM=15)或立即(SIGKILL=9)结束它的执行。 + +这两个工具的不同之处在于前一个被用来终止一个特定的进程或一个进程组,而后一个则允许你通过进程的名称和其他属性,执行相同的动作。 + +另外, pkill 与 pgrep 相捆绑,pgrep 提供将受符合的进程的 PID 给 pkill 来使用。例如,在运行下面的命令之前: + + # pkill -u gacanepa + +查看一眼由 gacanepa 所拥有的 PID 或许会带来点帮助: + + # pgrep -l -u gacanepa + +![找到用户拥有的 PID](http://www.tecmint.com/wp-content/uploads/2015/03/Find-PIDs-of-User.png) + +*找到用户拥有的 PID* + +默认情况下,kill 和 pkiill 都发送 SIGTERM 信号给进程,如我们上面提到的那样,这个信号可以被忽略(即该进程可能会终止其自身的执行,也可能不终止),所以当你因一个合理的理由要真正地停止一个运行着的进程,则你将需要在命令行中带上特定的 SIGKILL 信号: + + # kill -9 identifier # 杀死一个进程或一个进程组 + # kill -s SIGNAL identifier # 同上 + # pkill -s SIGNAL identifier # 通过名称或其他属性来杀死一个进程 + +### 结论 ### + +在这篇文章中,我们解释了在 RHEL 7 系统中,有关开机启动过程的基本知识,并分析了一些可用的工具来帮助你通过使用一般的程序和 systemd 特有的命令来管理进程。 + +请注意,这个列表并不旨在涵盖有关这个话题的所有花哨的工具,请随意使用下面的评论栏来添加你自已钟爱的工具和命令。同时欢迎你的提问和其他的评论。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-boot-process-and-process-management/ + +作者:[Gabriel Cánepa][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://linux.cn/article-3587-1.html +[2]:http://www.tecmint.com/systemd-replaces-init-in-linux/ +[3]:https://linux.cn/article-2116-1.html diff --git a/translated/tech/RHCSA/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md b/published/RHCSA Series/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md similarity index 71% rename from translated/tech/RHCSA/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md rename to published/RHCSA Series/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md index 41890b2280..d33d4eb3d0 100644 --- a/translated/tech/RHCSA/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md +++ b/published/RHCSA Series/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md @@ -1,28 +1,28 @@ -RHCSA 系列:使用 'Parted' 和 'SSM' 来配置和加密系统存储 – Part 6 +RHCSA 系列(六): 使用 Parted 和 SSM 来配置和加密系统存储 ================================================================================ -在本篇文章中,我们将讨论在 RHEL 7 中如何使用传统的工具来设置和配置本地系统存储,并介绍系统存储管理器(也称为 SSM),它将极大地简化上面的任务。 +在本篇文章中,我们将讨论在 RHEL 7 中如何使用传统的工具来设置和配置本地系统存储,并介绍系统存储管理器(也称为 SSM),它将极大地简化上面的任务。 ![配置和加密系统存储](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-and-Encrypt-System-Storage.png) -RHCSA: 配置和加密系统存储 – Part 6 +*RHCSA: 配置和加密系统存储 – Part 6* -请注意,我们将在这篇文章中展开这个话题,但由于该话题的宽泛性,我们将在下一期(Part 7)中继续介绍有关它的描述和使用。 +请注意,我们将在这篇文章中展开这个话题,但由于该话题的宽泛性,我们将在下一期中继续介绍有关它的描述和使用。 ### 在 RHEL 7 中创建和修改分区 ### 在 RHEL 7 中, parted 是默认的用来处理分区的程序,且它允许你: - 展示当前的分区表 -- 操纵(增加或减少分区的大小)现有的分区 +- 操纵(扩大或缩小分区的大小)现有的分区 - 利用空余的磁盘空间或额外的物理存储设备来创建分区 -强烈建议你在试图增加一个新的分区或对一个现有分区进行更改前,你应当确保设备上没有任何一个分区正在使用(`umount /dev/partition`),且假如你正使用设备的一部分来作为 swap 分区,在进行上面的操作期间,你需要将它禁用(`swapoff -v /dev/partition`) 。 +强烈建议你在试图增加一个新的分区或对一个现有分区进行更改前,你应当确保该设备上没有任何一个分区正在使用(`umount /dev/分区`),且假如你正使用设备的一部分来作为 swap 分区,在进行上面的操作期间,你需要将它禁用(`swapoff -v /dev/分区`) 。 -实施上面的操作的最简单的方法是使用一个安装介质例如一个 RHEL 7 安装 DVD 或 USB 以急救模式启动 RHEL(Troubleshooting → Rescue a Red Hat Enterprise Linux system),然后当让你选择一个选项来挂载现有的 Linux 安装时,选择'跳过'这个选项,接着你将看到一个命令行提示符,在其中你可以像下图显示的那样开始键入与在一个未被使用的物理设备上创建一个正常的分区时所用的相同的命令。 +实施上面的操作的最简单的方法是使用一个安装介质例如一个 RHEL 7 的 DVD 或 USB 安装盘以急救模式启动 RHEL(`Troubleshooting` → `Rescue a Red Hat Enterprise Linux system`),然后当让你选择一个选项来挂载现有的 Linux 安装时,选择“跳过”这个选项,接着你将看到一个命令行提示符,在其中你可以像下图显示的那样开始键入与在一个未被使用的物理设备上创建一个正常的分区时所用的相同的命令。 ![RHEL 7 急救模式](http://www.tecmint.com/wp-content/uploads/2015/04/RHEL-7-Rescue-Mode.png) -RHEL 7 急救模式 +*RHEL 7 急救模式* 要启动 parted,只需键入: @@ -32,17 +32,17 @@ RHEL 7 急救模式 ![创建新的分区](http://www.tecmint.com/wp-content/uploads/2015/04/Create-New-Partition.png) -创建新的分区 +*创建新的分区* -正如你所看到的那样,在这个例子中,我们正在使用一个 5 GB 的虚拟光驱。现在我们将要创建一个 4 GB 的主分区,然后将它格式化为 xfs 文件系统,它是 RHEL 7 中默认的文件系统。 +正如你所看到的那样,在这个例子中,我们正在使用一个 5 GB 的虚拟驱动器。现在我们将要创建一个 4 GB 的主分区,然后将它格式化为 xfs 文件系统,它是 RHEL 7 中默认的文件系统。 -你可以从一系列的文件系统中进行选择。你将需要使用 mkpart 来手动地创建分区,接着和平常一样,用 mkfs.fstype 来对分区进行格式化,因为 mkpart 并不支持许多现代的文件系统以达到即开即用。 +你可以从一系列的文件系统中进行选择。你将需要使用 `mkpart` 来手动地创建分区,接着和平常一样,用 `mkfs.类型` 来对分区进行格式化,因为 `mkpart` 并不支持许多现代的文件系统的到即开即用。 在下面的例子中,我们将为设备设定一个标记,然后在 `/dev/sdb` 上创建一个主分区 `(p)`,它从设备的 0% 开始,并在 4000MB(4 GB) 处结束。 ![在 Linux 中设定分区名称](http://www.tecmint.com/wp-content/uploads/2015/04/Label-Partition.png) -标记分区的名称 +*标记分区的名称* 接下来,我们将把分区格式化为 xfs 文件系统,然后再次打印出分区表,以此来确保更改已被应用。 @@ -51,11 +51,11 @@ RHEL 7 急救模式 ![在 Linux 中格式化分区](http://www.tecmint.com/wp-content/uploads/2015/04/Format-Partition-in-Linux.png) -格式化分区为 XFS 文件系统 +*格式化分区为 XFS 文件系统* -对于旧一点的文件系统,在 parted 中你应该使用 `resize` 命令来改变分区的大小。不幸的是,这只适用于 ext2, fat16, fat32, hfs, linux-swap, 和 reiserfs (若 libreiserfs 已被安装)。 +对于旧一点的文件系统,在 parted 中你可以使用 `resize` 命令来改变分区的大小。不幸的是,这只适用于 ext2, fat16, fat32, hfs, linux-swap, 和 reiserfs (若 libreiserfs 已被安装)。 -因此,改变分区大小的唯一方式是删除它然后再创建它(所以确保你对你的数据做了完整的备份!)。毫无疑问,在 RHEL 7 中默认的分区方案是基于 LVM 的。 +因此,改变分区大小的唯一方式是删除它然后再创建它(所以,确保你对你的数据做了完整的备份!)。毫无疑问,在 RHEL 7 中默认的分区方案是基于 LVM 的。 使用 parted 来移除一个分区,可以用: @@ -64,23 +64,23 @@ RHEL 7 急救模式 ![在 Linux 中移除分区](http://www.tecmint.com/wp-content/uploads/2015/04/Remove-Partition-in-Linux.png) -移除或删除分区 +*移除或删除分区* ### 逻辑卷管理(LVM) ### -一旦一个磁盘被分好了分区,再去更改分区的大小就是一件困难或冒险的事了。基于这个原因,假如我们计划在我们的系统上对分区的大小进行更改,我们应当考虑使用 LVM 的可能性,而不是使用传统的分区系统。这样多个物理设备可以组成一个逻辑组,以此来寄宿可自定义数目的逻辑卷,而逻辑卷的增大或减少不会带来任何麻烦。 +一旦一个磁盘被分好了分区,再去更改分区的大小就是一件困难或冒险的事了。基于这个原因,假如我们计划在我们的系统上对分区的大小进行更改,我们应当考虑使用 LVM 的可能性,而不是使用传统的分区系统。这样多个物理设备可以组成一个逻辑组,以此来存放任意数目的逻辑卷,而逻辑卷的增大或减少不会带来任何麻烦。 简单来说,你会发现下面的示意图对记住 LVM 的基础架构或许有用。 ![LVM 的基本架构](http://www.tecmint.com/wp-content/uploads/2015/04/LVM-Diagram.png) -LVM 的基本架构 +*LVM 的基本架构* #### 创建物理卷,卷组和逻辑卷 #### 遵循下面的步骤是为了使用传统的卷管理工具来设置 LVM。由于你可以通过阅读这个网站上的 LVM 系列来扩展这个话题,我将只是概要的介绍设置 LVM 的基本步骤,然后与使用 SSM 来实现相同功能做个比较。 -**注**: 我们将使用整个磁盘 `/dev/sdb` 和 `/dev/sdc` 来作为 PVs (物理卷),但是否执行相同的操作完全取决于你。 +**注**: 我们将使用整个磁盘 `/dev/sdb` 和 `/dev/sdc` 来作为物理卷(PV),但是否执行相同的操作完全取决于你。 **1. 使用 /dev/sdb 和 /dev/sdc 中 100% 的可用磁盘空间来创建分区 `/dev/sdb1` 和 `/dev/sdc1`:** @@ -89,7 +89,7 @@ LVM 的基本架构 ![创建新分区](http://www.tecmint.com/wp-content/uploads/2015/04/Create-New-Partitions.png) -创建新分区 +*创建新分区* **2. 分别在 /dev/sdb1 和 /dev/sdc1 上共创建 2 个物理卷。** @@ -98,21 +98,21 @@ LVM 的基本架构 ![创建两个物理卷](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Physical-Volumes.png) -创建两个物理卷 +*创建两个物理卷* -记住,你可以使用 pvdisplay /dev/sd{b,c}1 来显示有关新建的 PV 的信息。 +记住,你可以使用 pvdisplay /dev/sd{b,c}1 来显示有关新建的物理卷的信息。 -**3. 在上一步中创建的 PV 之上创建一个 VG:** +**3. 在上一步中创建的物理卷之上创建一个卷组(VG):** # vgcreate tecmint_vg /dev/sd{b,c}1 ![在 Linux 中创建卷组](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Volume-Group.png) -创建卷组 +*创建卷组* -记住,你可使用 vgdisplay tecmint_vg 来显示有关新建的 VG 的信息。 +记住,你可使用 vgdisplay tecmint_vg 来显示有关新建的卷组的信息。 -**4. 像下面那样,在 VG tecmint_vg 之上创建 3 个逻辑卷:** +**4. 像下面那样,在卷组 tecmint_vg 之上创建 3 个逻辑卷(LV):** # lvcreate -L 3G -n vol01_docs tecmint_vg [vol01_docs → 3 GB] # lvcreate -L 1G -n vol02_logs tecmint_vg [vol02_logs → 1 GB] @@ -120,11 +120,11 @@ LVM 的基本架构 ![在 LVM 中创建逻辑卷](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Logical-Volumes.png) -创建逻辑卷 +*创建逻辑卷* -记住,你可以使用 lvdisplay tecmint_vg 来显示有关在 VG tecmint_vg 之上新建的 LV 的信息。 +记住,你可以使用 lvdisplay tecmint_vg 来显示有关在 tecmint_vg 之上新建的逻辑卷的信息。 -**5. 格式化每个逻辑卷为 xfs 文件系统格式(假如你计划在以后将要缩小卷的大小,请别使用 xfs 文件系统格式!):** +**5. 格式化每个逻辑卷为 xfs 文件系统格式(假如你计划在以后将要缩小卷的大小,请别使用 xfs 文件系统格式!):** # mkfs.xfs /dev/tecmint_vg/vol01_docs # mkfs.xfs /dev/tecmint_vg/vol02_logs @@ -138,7 +138,7 @@ LVM 的基本架构 #### 移除逻辑卷,卷组和物理卷 #### -**7.现在我们将进行与刚才相反的操作并移除 LV,VG 和 PV:** +**7.现在我们将进行与刚才相反的操作并移除逻辑卷、卷组和物理卷:** # lvremove /dev/tecmint_vg/vol01_docs # lvremove /dev/tecmint_vg/vol02_logs @@ -161,20 +161,20 @@ LVM 的基本架构 - 初始化块设备来作为物理卷 - 创建一个卷组 - 创建逻辑卷 -- 格式化 LV 和 +- 格式化逻辑卷,以及 - 只使用一个命令来挂载它们 -**9. 现在,我们可以使用下面的命令来展示有关 PV,VG 或 LV 的信息:** +**9. 现在,我们可以使用下面的命令来展示有关物理卷、卷组或逻辑卷的信息:** # ssm list dev # ssm list pool # ssm list vol -![检查有关 PV, VG,或 LV 的信息](http://www.tecmint.com/wp-content/uploads/2015/04/Display-LVM-Information.png) +![检查有关物理卷、卷组或逻辑卷的信息](http://www.tecmint.com/wp-content/uploads/2015/04/Display-LVM-Information.png) -检查有关 PV, VG,或 LV 的信息 +*检查有关物理卷、卷组或逻辑卷的信息* -**10. 正如我们知道的那样, LVM 的一个显著的特点是可以在不停机的情况下更改(增大或缩小) 逻辑卷的大小:** +**10. 正如我们知道的那样, LVM 的一个显著的特点是可以在不停机的情况下更改(增大或缩小)逻辑卷的大小:** 假定在 vol02_logs 上我们用尽了空间,而 vol03_homes 还留有足够的空间。我们将把 vol03_homes 的大小调整为 4 GB,并使用剩余的空间来扩展 vol02_logs: @@ -184,7 +184,7 @@ LVM 的基本架构 ![查看卷的大小](http://www.tecmint.com/wp-content/uploads/2015/04/Check-LVM-Free-Space.png) -查看卷的大小 +*查看卷的大小* 然后执行: @@ -196,11 +196,11 @@ LVM 的基本架构 # ssm remove tecmint_vg -这个命令将返回一个提示,询问你是否确认删除 VG 和它所包含的 LV: +这个命令将返回一个提示,询问你是否确认删除卷组和它所包含的逻辑卷: ![移除逻辑卷和卷组](http://www.tecmint.com/wp-content/uploads/2015/04/Remove-LV-VG.png) -移除逻辑卷和卷组 +*移除逻辑卷和卷组* ### 管理加密的卷 ### @@ -216,7 +216,7 @@ SSM 也给系统管理员提供了为新的或现存的卷加密的能力。首 我们的下一个任务是往 /etc/fstab 中添加条目来让这些逻辑卷在启动时可用,而不是使用设备识别编号(/dev/something)。 -我们将使用每个 LV 的 UUID (使得当我们添加其他的逻辑卷或设备后,我们的设备仍然可以被唯一的标记),而我们可以使用 blkid 应用来找到它们的 UUID: +我们将使用每个逻辑卷的 UUID (使得当我们添加其他的逻辑卷或设备后,我们的设备仍然可以被唯一的标记),而我们可以使用 blkid 应用来找到它们的 UUID: # blkid -o value UUID /dev/tecmint_vg/vol01_docs # blkid -o value UUID /dev/tecmint_vg/vol02_logs @@ -226,7 +226,7 @@ SSM 也给系统管理员提供了为新的或现存的卷加密的能力。首 ![找到逻辑卷的 UUID](http://www.tecmint.com/wp-content/uploads/2015/04/Logical-Volume-UUID.png) -找到逻辑卷的 UUID +*找到逻辑卷的 UUID* 接着,使用下面的内容来创建 /etc/crypttab 文件(请更改 UUID 来适用于你的设置): @@ -243,11 +243,11 @@ SSM 也给系统管理员提供了为新的或现存的卷加密的能力。首 # Logical volume vol03_homes /dev/mapper/homes /mnt/homes ext4 defaults 0 2 -现在重启(systemctl reboot),则你将被要求为每个 LV 输入密码。随后,你可以通过检查相应的挂载点来确保挂载操作是否成功: +现在重启(`systemctl reboot`),则你将被要求为每个逻辑卷输入密码。随后,你可以通过检查相应的挂载点来确保挂载操作是否成功: ![确保逻辑卷挂载点](http://www.tecmint.com/wp-content/uploads/2015/04/Verify-LV-Mount-Points.png) -确保逻辑卷挂载点 +*确保逻辑卷挂载点* ### 总结 ### @@ -261,7 +261,7 @@ via: http://www.tecmint.com/rhcsa-exam-create-format-resize-delete-and-encrypt-p 作者:[Gabriel Cánepa][a] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者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/RHCSA/RHCSA Series--Part 07--Using ACLs (Access Control Lists) and Mounting Samba or NFS Shares.md b/published/RHCSA Series/RHCSA Series--Part 07--Using ACLs (Access Control Lists) and Mounting Samba or NFS Shares.md similarity index 67% rename from translated/tech/RHCSA/RHCSA Series--Part 07--Using ACLs (Access Control Lists) and Mounting Samba or NFS Shares.md rename to published/RHCSA Series/RHCSA Series--Part 07--Using ACLs (Access Control Lists) and Mounting Samba or NFS Shares.md index a68d36de2b..94f42a47ba 100644 --- a/translated/tech/RHCSA/RHCSA Series--Part 07--Using ACLs (Access Control Lists) and Mounting Samba or NFS Shares.md +++ b/published/RHCSA Series/RHCSA Series--Part 07--Using ACLs (Access Control Lists) and Mounting Samba or NFS Shares.md @@ -1,42 +1,40 @@ -RHCSA 系列:使用 ACL(访问控制列表) 和挂载 Samba/NFS 共享 – Part 7 +RHCSA 系列(六): 使用 ACL(访问控制列表) 和挂载 Samba/NFS 共享 ================================================================================ -在上一篇文章([RHCSA 系列 Part 6][1])中,我们解释了如何使用 parted 和 ssm 来设置和配置本地系统存储。 +在上一篇文章([RHCSA 系列(六)][1])中,我们解释了如何使用 parted 和 ssm 来设置和配置本地系统存储。 ![配置 ACL 及挂载 NFS/Samba 共享](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-ACLs-and-Mounting-NFS-Samba-Shares.png) -RHCSA Series: 配置 ACL 及挂载 NFS/Samba 共享 – Part 7 +*RHCSA 系列: 配置 ACL 及挂载 NFS/Samba 共享 – Part 7* -我们也讨论了如何创建和在系统启动时使用一个密码来挂载加密的卷。另外,我们告诫过你要避免在挂载的文件系统上执行苛刻的存储管理操作。记住了这点后,现在,我们将回顾在 RHEL 7 中最常使用的文件系统格式,然后将涵盖有关手动或自动挂载、使用和卸载网络文件系统(CIFS 和 NFS)的话题以及在你的操作系统上实现访问控制列表的使用。 +我们也讨论了如何创建和在系统启动时使用一个密码来挂载加密的卷。另外,我们告诫过你要避免在挂载的文件系统上执行危险的存储管理操作。记住了这点后,现在,我们将回顾在 RHEL 7 中最常使用的文件系统格式,然后将涵盖有关手动或自动挂载、使用和卸载网络文件系统(CIFS 和 NFS)的话题以及在你的操作系统上实现访问控制列表(Access Control List)的使用。 #### 前提条件 #### -在进一步深入之前,请确保你可使用 Samba 服务和 NFS 服务(注意在 RHEL 7 中 NFSv2 已不再被支持)。 +在进一步深入之前,请确保你可使用 Samba 服务和 NFS 服务(注意在 RHEL 7 中 NFSv2 已不再被支持)。 -在本次指导中,我们将使用一个IP 地址为 192.168.0.10 且同时运行着 Samba 服务和 NFS 服务的机子来作为服务器,使用一个 IP 地址为 192.168.0.18 的 RHEL 7 机子来作为客户端。在这篇文章的后面部分,我们将告诉你在客户端上你需要安装哪些软件包。 +在本次指导中,我们将使用一个IP 地址为 192.168.0.10 且同时运行着 Samba 服务和 NFS 服务的机器来作为服务器,使用一个 IP 地址为 192.168.0.18 的 RHEL 7 机器来作为客户端。在这篇文章的后面部分,我们将告诉你在客户端上你需要安装哪些软件包。 ### RHEL 7 中的文件系统格式 ### -从 RHEL 7 开始,由于 XFS 的高性能和可扩展性,它已经被引入所有的架构中来作为默认的文件系统。 -根据 Red Hat 及其合作伙伴在主流硬件上执行的最新测试,当前 XFS 已支持最大为 500 TB 大小的文件系统。 +从 RHEL 7 开始,由于 XFS 的高性能和可扩展性,它已经被作为所有的架构中的默认文件系统。根据 Red Hat 及其合作伙伴在主流硬件上执行的最新测试,当前 XFS 已支持最大为 500 TB 大小的文件系统。 -另外, XFS 启用了 user_xattr(扩展用户属性) 和 acl( -POSIX 访问控制列表)来作为默认的挂载选项,而不像 ext3 或 ext4(对于 RHEL 7 来说, ext2 已过时),这意味着当挂载一个 XFS 文件系统时,你不必显式地在命令行或 /etc/fstab 中指定这些选项(假如你想在后一种情况下禁用这些选项,你必须显式地使用 no_acl 和 no_user_xattr)。 +另外,XFS 启用了 `user_xattr`(扩展用户属性) 和 `acl`(POSIX 访问控制列表)来作为默认的挂载选项,而不像 ext3 或 ext4(对于 RHEL 7 来说,ext2 已过时),这意味着当挂载一个 XFS 文件系统时,你不必显式地在命令行或 /etc/fstab 中指定这些选项(假如你想在后一种情况下禁用这些选项,你必须显式地使用 `no_acl` 和 `no_user_xattr`)。 -请记住扩展用户属性可以被指定到文件和目录中来存储任意的额外信息如 mime 类型,字符集或文件的编码,而用户属性中的访问权限由一般的文件权限位来定义。 +请记住扩展用户属性可以给文件和目录指定,用来存储任意的额外信息如 mime 类型,字符集或文件的编码,而用户属性中的访问权限由一般的文件权限位来定义。 #### 访问控制列表 #### -作为一名系统管理员,无论你是新手还是专家,你一定非常熟悉与文件和目录有关的常规访问权限,这些权限为所有者,所有组和"世界"(所有的其他人)指定了特定的权限(可读,可写及可执行)。但如若你需要稍微更新你的记忆,请随意参考 [RHCSA 系列的 Part 3][3]. +作为一名系统管理员,无论你是新手还是专家,你一定非常熟悉与文件和目录有关的常规访问权限,这些权限为所有者,所有组和“世界”(所有的其他人)指定了特定的权限(可读,可写及可执行)。但如若你需要稍微更新下你的记忆,请参考 [RHCSA 系列(三)][3]. 但是,由于标准的 `ugo/rwx` 集合并不允许为不同的用户配置不同的权限,所以 ACL 便被引入了进来,为的是为文件和目录定义更加详细的访问权限,而不仅仅是这些特别指定的特定权限。 事实上, ACL 定义的权限是由文件权限位所特别指定的权限的一个超集。下面就让我们看看这个转换是如何在真实世界中被应用的吧。 -1. 存在两种类型的 ACL:访问 ACL,可被应用到一个特定的文件或目录上,以及默认 ACL,只可被应用到一个目录上。假如目录中的文件没有 ACL,则它们将继承它们的父目录的默认 ACL 。 +1. 存在两种类型的 ACL:访问 ACL,可被应用到一个特定的文件或目录上;以及默认 ACL,只可被应用到一个目录上。假如目录中的文件没有 ACL,则它们将继承它们的父目录的默认 ACL 。 2. 从一开始, ACL 就可以为每个用户,每个组或不在文件所属组中的用户配置相应的权限。 -3. ACL 可使用 `setfacl` 来设置(和移除),可相应地使用 -m 或 -x 选项。 +3. ACL 可使用 `setfacl` 来设置(和移除),可相应地使用 -m 或 -x 选项。 例如,让我们创建一个名为 tecmint 的组,并将用户 johndoe 和 davenull 加入该组: @@ -53,36 +51,32 @@ POSIX 访问控制列表)来作为默认的挂载选项,而不像 ext3 或 ext ![检验用户](http://www.tecmint.com/wp-content/uploads/2015/04/Verify-Users.png) -检验用户 +*检验用户* -现在,我们在 /mnt 下创建一个名为 playground 的目录,并在该目录下创建一个名为 testfile.txt 的文件。我们将设定该文件的属组为 tecmint,并更改它的默认 ugo/rwx 权限为 770(即赋予该文件的属主和属组可读,可写和可执行权限): +现在,我们在 /mnt 下创建一个名为 playground 的目录,并在该目录下创建一个名为 testfile.txt 的文件。我们将设定该文件的属组为 tecmint,并更改它的默认 `ugo/rwx` 权限为 770(即赋予该文件的属主和属组可读、可写和可执行权限): # mkdir /mnt/playground # touch /mnt/playground/testfile.txt + # chown :tecmint /mnt/playground/testfile.txt # chmod 770 /mnt/playground/testfile.txt 接着,依次切换为 johndoe 和 davenull 用户,并在文件中写入一些信息: - echo "My name is John Doe" > /mnt/playground/testfile.txt - echo "My name is Dave Null" >> /mnt/playground/testfile.txt - -到目前为止,一切正常。现在我们让用户 gacanepa 来向该文件执行写操作 – 则写操作将会失败,这是可以预料的。 - -但实际上我们需要用户 gacanepa(TA 不是组 tecmint 的成员)在文件 /mnt/playground/testfile.txt 上有写权限,那又该怎么办呢?首先映入你脑海里的可能是将该用户添加到组 tecmint 中。但那将使得他在所有该组具有写权限位的文件上均拥有写权限,但我们并不想这样,我们只想他能够在文件 /mnt/playground/testfile.txt 上有写权限。 - - # touch /mnt/playground/testfile.txt - # chown :tecmint /mnt/playground/testfile.txt - # chmod 777 /mnt/playground/testfile.txt # su johndoe $ echo "My name is John Doe" > /mnt/playground/testfile.txt $ su davenull $ echo "My name is Dave Null" >> /mnt/playground/testfile.txt + +到目前为止,一切正常。现在我们让用户 gacanepa 来向该文件执行写操作 – 则写操作将会失败,这是可以预料的。 + $ su gacanepa $ echo "My name is Gabriel Canepa" >> /mnt/playground/testfile.txt ![管理用户的权限](http://www.tecmint.com/wp-content/uploads/2015/04/User-Permissions.png) -管理用户的权限 +*管理用户的权限* + +但实际上我们需要用户 gacanepa(他不是组 tecmint 的成员)在文件 /mnt/playground/testfile.txt 上有写权限,那又该怎么办呢?首先映入你脑海里的可能是将该用户添加到组 tecmint 中。但那将使得他在所有该组具有写权限位的文件上均拥有写权限,但我们并不想这样,我们只想他能够在文件 /mnt/playground/testfile.txt 上有写权限。 现在,让我们给用户 gacanepa 在 /mnt/playground/testfile.txt 文件上有读和写权限。 @@ -90,7 +84,7 @@ POSIX 访问控制列表)来作为默认的挂载选项,而不像 ext3 或 ext # setfacl -R -m u:gacanepa:rwx /mnt/playground -则你将成功地添加一条 ACL,运行 gacanepa 对那个测试文件可写。然后切换为 gacanepa 用户,并再次尝试向该文件写入一些信息: +则你将成功地添加一条 ACL,允许 gacanepa 对那个测试文件可写。然后切换为 gacanepa 用户,并再次尝试向该文件写入一些信息: $ echo "My name is Gabriel Canepa" >> /mnt/playground/testfile.txt @@ -100,9 +94,9 @@ POSIX 访问控制列表)来作为默认的挂载选项,而不像 ext3 或 ext ![检查文件的 ACL](http://www.tecmint.com/wp-content/uploads/2015/04/Check-ACL-of-File.png) -检查文件的 ACL +*检查文件的 ACL* -要为目录设定默认 ACL(它的内容将被该目录下的文件继承,除非另外被覆写),在规则前添加 `d:`并特别指定一个目录名,而不是文件名: +要为目录设定默认 ACL(它的内容将被该目录下的文件继承,除非另外被覆写),在规则前添加 `d:`并特别指定一个目录名,而不是文件名: # setfacl -m d:o:r /mnt/playground @@ -111,7 +105,7 @@ POSIX 访问控制列表)来作为默认的挂载选项,而不像 ext3 或 ext ![在 Linux 中设定默认 ACL](http://www.tecmint.com/wp-content/uploads/2015/04/Set-Default-ACL-in-Linux.png) -在 Linux 中设定默认 ACL +*在 Linux 中设定默认 ACL* [在官方的 RHEL 7 存储管理指导手册的第 20 章][3] 中提供了更多有关 ACL 的例子,我极力推荐你看一看它并将它放在身边作为参考。 @@ -129,7 +123,7 @@ POSIX 访问控制列表)来作为默认的挂载选项,而不像 ext3 或 ext ![检查可用的 NFS 共享](http://www.tecmint.com/wp-content/uploads/2015/04/Mount-NFS-Shares.png) -检查可用的 NFS 共享 +*检查可用的 NFS 共享* 要按照需求在本地客户端上使用命令行来挂载 NFS 网络共享,可使用下面的语法: @@ -139,7 +133,7 @@ POSIX 访问控制列表)来作为默认的挂载选项,而不像 ext3 或 ext # mount -t nfs 192.168.0.10:/NFS-SHARE /mnt/nfs -若你得到如下的错误信息:“Job for rpc-statd.service failed. See “systemctl status rpc-statd.service”及“journalctl -xn” for details.”,请确保 `rpcbind` 服务被启用且已在你的系统中启动了。 +若你得到如下的错误信息:`Job for rpc-statd.service failed. See "systemctl status rpc-statd.service" and "journalctl -xn" for details.`,请确保 `rpcbind` 服务被启用且已在你的系统中启动了。 # systemctl enable rpcbind.socket # systemctl restart rpcbind.service @@ -162,7 +156,7 @@ Samba 代表一个特别的工具,使得在由 *nix 和 Windows 机器组成 ![检查 Samba 共享](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Samba-Shares.png) -检查 Samba 共享 +*检查 Samba 共享* 要在本地客户端上挂载 Samba 网络共享,你需要已安装好 cifs-utils 软件包: @@ -176,14 +170,14 @@ Samba 代表一个特别的工具,使得在由 *nix 和 Windows 机器组成 # mount -t cifs -o credentials=~/.smbcredentials //192.168.0.10/gacanepa /mnt/samba -其中 `smbcredentials` +其中 `.smbcredentials` 的内容是: username=gacanepa password=XXXXXX -是一个位于 root 用户的家目录(/root/) 中的隐藏文件,其权限被设置为 600,所以除了该文件的属主外,其他人对该文件既不可读也不可写。 +它是一个位于 root 用户的家目录(/root/) 中的隐藏文件,其权限被设置为 600,所以除了该文件的属主外,其他人对该文件既不可读也不可写。 -请注意 samba_share 是 Samba 分享的名称,由上面展示的 `smbclient -L remote_host` 所返回。 +请注意 samba_share 是 Samba 共享的名称,由上面展示的 `smbclient -L remote_host` 所返回。 现在,若你需要在系统启动时自动地使得 Samba 分享可用,可以向 /etc/fstab 文件添加一个像下面这样的有效条目: @@ -197,7 +191,7 @@ Samba 代表一个特别的工具,使得在由 *nix 和 Windows 机器组成 在这篇文章中,我们已经解释了如何在 Linux 中设置 ACL,并讨论了如何在一个 RHEL 7 客户端上挂载 CIFS 和 NFS 网络共享。 -我建议你去练习这些概念,甚至混合使用它们(试着在一个挂载的网络共享上设置 ACL),直至你感觉舒适。假如你有问题或评论,请随时随意地使用下面的评论框来联系我们。另外,请随意通过你的社交网络分享这篇文章。 +我建议你去练习这些概念,甚至混合使用它们(试着在一个挂载的网络共享上设置 ACL),直至你感觉掌握了。假如你有问题或评论,请随时随意地使用下面的评论框来联系我们。另外,请随意通过你的社交网络分享这篇文章。 -------------------------------------------------------------------------------- @@ -205,11 +199,11 @@ via: http://www.tecmint.com/rhcsa-exam-configure-acls-and-mount-nfs-samba-shares 作者:[Gabriel Cánepa][a] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/rhcsa-exam-create-format-resize-delete-and-encrypt-partitions-in-linux/ -[2]:http://www.tecmint.com/rhcsa-exam-manage-users-and-groups/ +[1]:https://linux.cn/article-6257-1.html +[2]:https://linux.cn/article-6187-1.html [3]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Storage_Administration_Guide/ch-acls.html \ No newline at end of file diff --git a/translated/tech/RHCSA/RHCSA Series--Part 08--Securing SSH, Setting Hostname and Enabling Network Services.md b/published/RHCSA Series/RHCSA Series--Part 08--Securing SSH, Setting Hostname and Enabling Network Services.md similarity index 59% rename from translated/tech/RHCSA/RHCSA Series--Part 08--Securing SSH, Setting Hostname and Enabling Network Services.md rename to published/RHCSA Series/RHCSA Series--Part 08--Securing SSH, Setting Hostname and Enabling Network Services.md index 82245f33b1..3494bf7355 100644 --- a/translated/tech/RHCSA/RHCSA Series--Part 08--Securing SSH, Setting Hostname and Enabling Network Services.md +++ b/published/RHCSA Series/RHCSA Series--Part 08--Securing SSH, Setting Hostname and Enabling Network Services.md @@ -1,26 +1,27 @@ -RHCSA 系列:安全 SSH,设定主机名及开启网络服务 – Part 8 +RHCSA 系列(八): 加固 SSH,设定主机名及启用网络服务 ================================================================================ -作为一名系统管理员,你将经常使用一个终端模拟器来登陆到一个远程的系统中,执行一系列的管理任务。你将很少有机会坐在一个真实的(物理)终端前,所以你需要设定好一种方法来使得你可以登陆到你被要求去管理的那台远程主机上。 -事实上,当你必须坐在一台物理终端前的时候,就可能是你登陆到该主机的最后一种方法。基于安全原因,使用 Telnet 来达到以上目的并不是一个好主意,因为穿行在线缆上的流量并没有被加密,它们以文本方式在传送。 +作为一名系统管理员,你将经常使用一个终端模拟器来登录到一个远程的系统中,执行一系列的管理任务。你将很少有机会坐在一个真实的(物理)终端前,所以你需要设定好一种方法来使得你可以登录到你需要去管理的那台远程主机上。 + +事实上,当你必须坐在一台物理终端前的时候,就可能是你登录到该主机的最后一种方法了。基于安全原因,使用 Telnet 来达到以上目的并不是一个好主意,因为穿行在线缆上的流量并没有被加密,它们以明文方式在传送。 另外,在这篇文章中,我们也将复习如何配置网络服务来使得它在开机时被自动开启,并学习如何设置网络和静态或动态地解析主机名。 ![RHCSA: 安全 SSH 和开启网络服务](http://www.tecmint.com/wp-content/uploads/2015/05/Secure-SSH-Server-and-Enable-Network-Services.png) -RHCSA: 安全 SSH 和开启网络服务 – Part 8 +*RHCSA: 安全 SSH 和开启网络服务 – Part 8* ### 安装并确保 SSH 通信安全 ### -对于你来说,要能够使用 SSH 远程登陆到一个 RHEL 7 机子,你必须安装 `openssh`,`openssh-clients` 和 `openssh-servers` 软件包。下面的命令不仅将安装远程登陆程序,也会安装安全的文件传输工具以及远程文件复制程序: +对于你来说,要能够使用 SSH 远程登录到一个 RHEL 7 机子,你必须安装 `openssh`,`openssh-clients` 和 `openssh-servers` 软件包。下面的命令不仅将安装远程登录程序,也会安装安全的文件传输工具以及远程文件复制程序: # yum update && yum install openssh openssh-clients openssh-servers -注意,安装上服务器所需的相应软件包是一个不错的主意,因为或许在某个时刻,你想使用同一个机子来作为客户端和服务器。 +注意,也安装上服务器所需的相应软件包是一个不错的主意,因为或许在某个时刻,你想使用同一个机子来作为客户端和服务器。 -在安装完成后,如若你想安全地访问你的 SSH 服务器,你还需要考虑一些基本的事情。下面的设定应该在文件 `/etc/ssh/sshd_config` 中得以呈现。 +在安装完成后,如若你想安全地访问你的 SSH 服务器,你还需要考虑一些基本的事情。下面的设定应该出现在文件 `/etc/ssh/sshd_config` 中。 -1. 更改 sshd 守护进程的监听端口,从 22(默认的端口值)改为一个更高的端口值(2000 或更大),但首先要确保所选的端口没有被占用。 +1、 更改 sshd 守护进程的监听端口,从 22(默认的端口值)改为一个更高的端口值(2000 或更大),但首先要确保所选的端口没有被占用。 例如,让我们假设你选择了端口 2500 。使用 [netstat][1] 来检查所选的端口是否被占用: @@ -30,17 +31,17 @@ RHCSA: 安全 SSH 和开启网络服务 – Part 8 Port 2500 -2. 只允许协议 2: +2、 只允许协议 2(LCTT 译注:SSHv1 已经被证明不安全,默认情况下 SSHv1 和 SSHv2 都支持,所以应该显示去掉如下配置行的注释,并只支持 SSHv2。): Protocol 2 -3. 配置验证超时的时间为 2 分钟,不允许以 root 身份登陆,并将允许通过 ssh 登陆的人数限制到最小: +3、 配置验证超时的时间为 2 分钟,不允许以 root 身份登录,并将允许通过 ssh 登录的人数限制到最小: LoginGraceTime 2m PermitRootLogin no AllowUsers gacanepa -4. 假如可能,使用基于公钥的验证方式而不是使用密码: +4、 假如可能,使用基于公钥的验证方式而不是使用密码: PasswordAuthentication no RSAAuthentication yes @@ -48,13 +49,13 @@ RHCSA: 安全 SSH 和开启网络服务 – Part 8 这假设了你已经在你的客户端机子上创建了带有你的用户名的一个密钥对,并将公钥复制到了你的服务器上。 -- [开启 SSH 无密码登陆][2] +- [开启 SSH 无密码登录][2] ### 配置网络和名称的解析 ### -1. 每个系统管理员应该对下面这个系统配置文件非常熟悉: +1、 每个系统管理员都应该对下面这个系统配置文件非常熟悉: -- /etc/hosts 被用来在小型网络中解析名称 <---> IP 地址。 +- /etc/hosts 被用来在小型网络中解析“名称” <---> “IP 地址”。 文件 `/etc/hosts` 中的每一行拥有如下的结构: @@ -64,7 +65,7 @@ RHCSA: 安全 SSH 和开启网络服务 – Part 8 192.168.0.10 laptop laptop.gabrielcanepa.com.ar -2. `/etc/resolv.conf` 特别指定 DNS 服务器的 IP 地址和搜索域,它被用来在没有提供域名后缀时,将一个给定的查询名称对应为一个全称域名。 +2、 `/etc/resolv.conf` 特别指定 DNS 服务器的 IP 地址和搜索域,它被用来在没有提供域名后缀时,将一个给定的查询名称对应为一个全称域名。 在正常情况下,你不必编辑这个文件,因为它是由系统管理的。然而,若你非要改变 DNS 服务器的 IP 地址,建议你在该文件的每一行中,都应该遵循下面的结构: @@ -74,7 +75,7 @@ RHCSA: 安全 SSH 和开启网络服务 – Part 8 nameserver 8.8.8.8 -3. `/etc/host.conf` 特别指定在一个网络中主机名被解析的方法和顺序。换句话说,告诉名称解析器使用哪个服务,并以什么顺序来使用。 +3、 `/etc/host.conf` 特别指定在一个网络中主机名被解析的方法和顺序。换句话说,告诉名称解析器使用哪个服务,并以什么顺序来使用。 尽管这个文件由几个选项,但最为常见和基本的设置包含如下的一行: @@ -82,12 +83,12 @@ RHCSA: 安全 SSH 和开启网络服务 – Part 8 它意味着解析器应该首先查看 `resolv.conf` 中特别指定的域名服务器,然后到 `/etc/hosts` 文件中查找解析的名称。 -4. `/etc/sysconfig/network` 包含了所有网络接口的路由和全局主机信息。下面的值可能会被使用: +4、 `/etc/sysconfig/network` 包含了所有网络接口的路由和全局主机信息。下面的值可能会被使用: NETWORKING=yes|no HOSTNAME=value -其中的 value 应该是全称域名(FQDN)。 +其中的 value 应该是全称域名(FQDN)。 GATEWAY=XXX.XXX.XXX.XXX @@ -97,7 +98,7 @@ RHCSA: 安全 SSH 和开启网络服务 – Part 8 在一个带有多个网卡的机器中, value 为网关设备名,例如 enp0s3。 -5. 位于 `/etc/sysconfig/network-scripts` 中的文件(网络适配器配置文件)。 +5、 位于 `/etc/sysconfig/network-scripts` 中的文件(网络适配器配置文件)。 在上面提到的目录中,你将找到几个被命名为如下格式的文本文件。 @@ -107,26 +108,27 @@ RHCSA: 安全 SSH 和开启网络服务 – Part 8 ![检查网络连接状态](http://www.tecmint.com/wp-content/uploads/2015/05/Check-IP-Address.png) -检查网络连接状态 +*检查网络连接状态* 例如: ![网络文件](http://www.tecmint.com/wp-content/uploads/2015/05/Network-Files.png) -网络文件 +*网络文件* -除了环回接口,你还可以为你的网卡进行一个相似的配置。注意,假如设定了某些变量,它们将为这个特别的接口,覆盖掉 `/etc/sysconfig/network` 中定义的值。在这篇文章中,为了能够解释清楚,每行都被加上了注释,但在实际的文件中,你应该避免加上注释: +除了环回接口(loopback),你还可以为你的网卡指定相似的配置。注意,假如设定了某些变量,它们将为这个指定的接口覆盖掉 `/etc/sysconfig/network` 中定义的默认值。在这篇文章中,为了能够解释清楚,每行都被加上了注释,但在实际的文件中,你应该避免加上注释: - HWADDR=08:00:27:4E:59:37 # The MAC address of the NIC - TYPE=Ethernet # Type of connection - BOOTPROTO=static # This indicates that this NIC has been assigned a static IP. If this variable was set to dhcp, the NIC will be assigned an IP address by a DHCP server and thus the next two lines should not be present in that case. + HWADDR=08:00:27:4E:59:37 ### 网卡的 MAC 地址 + TYPE=Ethernet ### 连接类型 + BOOTPROTO=static ### 这代表着该网卡指定了一个静态地址。 + ### 如果这个值指定为 dhcp,这个网卡会从 DHCP 服务器获取 IP 地址,并且就不应该出现以下两行。 IPADDR=192.168.0.18 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 - NM_CONTROLLED=no # Should be added to the Ethernet interface to prevent NetworkManager from changing the file. + NM_CONTROLLED=no ### 应该给以太网卡设置,以便可以让 NetworkManager 可以修改这个文件。 NAME=enp0s3 UUID=14033805-98ef-4049-bc7b-d4bea76ed2eb - ONBOOT=yes # The operating system should bring up this NIC during boot + ONBOOT=yes ### 操作系统会在启动时打开这个网卡。 ### 设定主机名 ### @@ -138,7 +140,7 @@ RHCSA: 安全 SSH 和开启网络服务 – Part 8 ![在RHEL 7 中检查系统的主机名](http://www.tecmint.com/wp-content/uploads/2015/05/Check-System-hostname.png) -检查系统的主机名 +*检查系统的主机名* 要更改主机名,使用 @@ -148,13 +150,13 @@ RHCSA: 安全 SSH 和开启网络服务 – Part 8 # hostnamectl set-hostname cinderella -要想使得更改生效,你需要重启 hostnamed 守护进程(这样你就不必因为要应用更改而登出系统并再登陆系统): +要想使得更改生效,你需要重启 hostnamed 守护进程(这样你就不必因为要应用更改而登出并再登录系统): # systemctl restart systemd-hostnamed ![在 RHEL7 中设定系统主机名](http://www.tecmint.com/wp-content/uploads/2015/05/Set-System-Hostname.png) -设定系统主机名 +*设定系统主机名* 另外, RHEL 7 还包含 `nmcli` 工具,它可被用来达到相同的目的。要展示主机名,运行: @@ -170,13 +172,13 @@ RHCSA: 安全 SSH 和开启网络服务 – Part 8 ![使用 nmcli 命令来设定主机名](http://www.tecmint.com/wp-content/uploads/2015/05/nmcli-command.png) -使用 nmcli 命令来设定主机名 +*使用 nmcli 命令来设定主机名* ### 在开机时开启网络服务 ### -作为本文的最后部分,就让我们看看如何确保网络服务在开机时被自动开启。简单来说,这个可通过创建符号链接到某些由服务的配置文件中的 [Install] 小节中指定的文件来实现。 +作为本文的最后部分,就让我们看看如何确保网络服务在开机时被自动开启。简单来说,这个可通过创建符号链接到某些由服务的配置文件中的 `[Install]` 小节中指定的文件来实现。 -以 firewalld(/usr/lib/systemd/system/firewalld.service) 为例: +以 firewalld(/usr/lib/systemd/system/firewalld.service) 为例: [Install] WantedBy=basic.target @@ -192,11 +194,11 @@ RHCSA: 安全 SSH 和开启网络服务 – Part 8 ![在开机时开启服务](http://www.tecmint.com/wp-content/uploads/2015/05/Enable-Service-at-System-Boot.png) -在开机时开启服务 +*在开机时开启服务* ### 总结 ### -在这篇文章中,我们总结了如何安装 SSH 及使用它安全地连接到一个 RHEL 服务器,如何改变主机名,并在最后如何确保在系统启动时开启服务。假如你注意到某个服务启动失败,你可以使用 `systemctl status -l [service]` 和 `journalctl -xn` 来进行排错。 +在这篇文章中,我们总结了如何安装 SSH 及使用它安全地连接到一个 RHEL 服务器;如何改变主机名,并在最后如何确保在系统启动时开启服务。假如你注意到某个服务启动失败,你可以使用 `systemctl status -l [service]` 和 `journalctl -xn` 来进行排错。 请随意使用下面的评论框来让我们知晓你对本文的看法。提问也同样欢迎。我们期待着你的反馈! @@ -206,10 +208,10 @@ via: http://www.tecmint.com/rhcsa-series-secure-ssh-set-hostname-enable-network- 作者:[Gabriel Cánepa][a] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/gacanepa/ [1]:http://www.tecmint.com/20-netstat-commands-for-linux-network-management/ -[2]:http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/ \ No newline at end of file +[2]:https://linux.cn/article-5444-1.html \ No newline at end of file diff --git a/translated/tech/RHCSA/RHCSA Series--Part 09--Installing, Configuring and Securing a Web and FTP Server.md b/published/RHCSA Series/RHCSA Series--Part 09--Installing, Configuring and Securing a Web and FTP Server.md similarity index 58% rename from translated/tech/RHCSA/RHCSA Series--Part 09--Installing, Configuring and Securing a Web and FTP Server.md rename to published/RHCSA Series/RHCSA Series--Part 09--Installing, Configuring and Securing a Web and FTP Server.md index 190c32ece5..c1588ade99 100644 --- a/translated/tech/RHCSA/RHCSA Series--Part 09--Installing, Configuring and Securing a Web and FTP Server.md +++ b/published/RHCSA Series/RHCSA Series--Part 09--Installing, Configuring and Securing a Web and FTP Server.md @@ -1,16 +1,16 @@ -RHCSA 系列: 安装,配置及加固一个 Web 和 FTP 服务器 – Part 9 +RHCSA 系列(九): 安装、配置及加固一个 Web 和 FTP 服务器 ================================================================================ -Web 服务器(也被称为 HTTP 服务器)是在网络中将内容(最为常见的是网页,但也支持其他类型的文件)进行处理并传递给客户端的服务。 +Web 服务器(也被称为 HTTP 服务器)是在网络中将内容(最为常见的是网页,但也支持其他类型的文件)进行处理并传递给客户端的服务。 -FTP 服务器是最为古老且最常使用的资源之一(即便到今天也是这样),在身份认证不是必须的情况下,它可使得在一个网络里文件对于客户端可用,因为 FTP 使用没有加密的用户名和密码。 +FTP 服务器是最为古老且最常使用的资源之一(即便到今天也是这样),在身份认证不是必须的情况下,它可通过客户端在一个网络访问文件,因为 FTP 使用没有加密的用户名和密码,所以有些情况下不需要验证也行。 在 RHEL 7 中可用的 web 服务器是版本号为 2.4 的 Apache HTTP 服务器。至于 FTP 服务器,我们将使用 Very Secure Ftp Daemon (又名 vsftpd) 来建立用 TLS 加固的连接。 ![配置和加固 Apache 和 FTP 服务器](http://www.tecmint.com/wp-content/uploads/2015/05/Install-Configure-Secure-Apache-FTP-Server.png) -RHCSA: 安装,配置及加固 Apache 和 FTP 服务器 – Part 9 +*RHCSA: 安装,配置及加固 Apache 和 FTP 服务器 – Part 9* -在这篇文章中,我们将解释如何在 RHEL 7 中安装,配置和加固 web 和 FTP 服务器。 +在这篇文章中,我们将解释如何在 RHEL 7 中安装、配置和加固 web 和 FTP 服务器。 ### 安装 Apache 和 FTP 服务器 ### @@ -35,7 +35,7 @@ RHCSA: 安装,配置及加固 Apache 和 FTP 服务器 – Part 9 ![确认 Apache Web 服务器](http://www.tecmint.com/wp-content/uploads/2015/05/Confirm-Apache-Web-Server.png) -确认 Apache Web 服务器 +*确认 Apache Web 服务器* 对于 ftp 服务器,在确保它如期望中的那样工作之前,我们必须进一步地配置它,我们将在几分钟后来做这件事。 @@ -43,7 +43,7 @@ RHCSA: 安装,配置及加固 Apache 和 FTP 服务器 – Part 9 Apache 的主要配置文件位于 `/etc/httpd/conf/httpd.conf` 中,但它可能依赖 `/etc/httpd/conf.d` 中的其他文件。 -尽管默认的配置对于大多数的情形是充分的,熟悉描述在 [官方文档][1] 中的所有可用选项是一个不错的主意。 +尽管默认的配置对于大多数的情形都够用了,但熟悉在 [官方文档][1] 中介绍的所有可用选项是一个不错的主意。 同往常一样,在编辑主配置文件前先做一个备份: @@ -51,14 +51,14 @@ Apache 的主要配置文件位于 `/etc/httpd/conf/httpd.conf` 中,但它可 然后用你钟爱的文本编辑器打开它,并查找下面这些变量: -- ServerRoot: 服务器的配置,错误和日志文件保存的目录。 -- Listen: 通知 Apache 去监听特定的 IP 地址或端口。 -- Include: 允许包含其他配置文件,这个必须存在,否则,服务器将会崩溃。它恰好与 IncludeOptional 相反,假如特定的配置文件不存在,它将静默地忽略掉它们。 -- User 和 Group: 运行 httpd 服务的用户/组的名称。 -- DocumentRoot: Apache 为你的文档服务的目录。默认情况下,所有的请求将在这个目录中被获取,但符号链接和别名可能会被用于指向其他位置。 -- ServerName: 这个指令将设定用于识别它自身的主机名(或 IP 地址)和端口。 +- `ServerRoot`: 服务器的配置,错误和日志文件保存的目录。 +- `Listen`: 通知 Apache 去监听特定的 IP 地址或端口。 +- `Include`: 允许包含其他配置文件,要包含的文件必须存在,否则,服务器将会失败。它恰好与 IncludeOptional 相反,假如特定的配置文件不存在,它将静默地忽略掉它们。 +- `User` 和 `Group`: 运行 httpd 服务的用户/组的名称。 +- `DocumentRoot`: Apache 为你的文档所服务的目录。默认情况下,所有的请求将在这个目录中被获取,但符号链接和别名可能会被用于指向其他位置。 +- `ServerName`: 这个指令将设定用于识别它自身的主机名(或 IP 地址)和端口。 -安全措施的第一步将包含创建一个特定的用户和组(如 tecmint/tecmint)来运行 web 服务器以及更改默认的端口为一个更高的端口(在这个例子中为 9000): +安全措施的第一步将包含创建一个特定的用户和组(如 tecmint/tecmint)来运行 web 服务器,以及更改默认的端口为一个更高的端口(在这个例子中为 9000) (LCTT 译注:如果你的 Web 服务器对外公开提供服务,则不建议修改为非默认端口。): ServerRoot "/etc/httpd" Listen 192.168.0.18:9000 @@ -75,47 +75,46 @@ Apache 的主要配置文件位于 `/etc/httpd/conf/httpd.conf` 中,但它可 # systemctl restart httpd -并别忘了在防火墙中开启新的端口(和禁用旧的端口): - +并别忘了在防火墙中开启新的端口(并禁用旧的端口): # firewall-cmd --zone=public --remove-port=80/tcp --permanent # firewall-cmd --zone=public --add-port=9000/tcp --permanent # firewall-cmd --reload -请注意,由于 SELinux 的策略,你只可使用如下命令所返回的端口来分配给 web 服务器。 +请注意,由于 SELinux 策略,你只能给给 web 服务器使用如下命令所返回的端口。 # semanage port -l | grep -w '^http_port_t' -假如你想使用另一个端口(如 TCP 端口 8100)来给 httpd 服务,你必须将它加到 SELinux 的端口上下文: +假如你想让 httpd 服务使用另一个端口(如 TCP 端口 8100),你必须将它加到 SELinux 的端口上下文: # semanage port -a -t http_port_t -p tcp 8100 ![添加 Apache 端口到 SELinux 策略](http://www.tecmint.com/wp-content/uploads/2015/05/Add-Apache-Port-to-SELinux-Policies.png) -添加 Apache 端口到 SELinux 策略 +*添加 Apache 端口到 SELinux 策略* 为了进一步加固你安装的 Apache,请遵循以下步骤: 1. 运行 Apache 的用户不应该拥有访问 shell 的能力: - # usermod -s /sbin/nologin tecmint + # usermod -s /sbin/nologin tecmint -2. 禁用目录列表功能,为的是阻止浏览器展示一个未包含 index.html 文件的目录里的内容。 +2. 禁用目录列表功能,这是为了阻止浏览器展示一个未包含 index.html 文件的目录里的内容。 -编辑 `/etc/httpd/conf/httpd.conf` (和虚拟主机的配置文件,假如有的话),并确保 Options 指令在顶级和目录块级别中(注:感觉这里我的翻译不对)都被设置为 None: + 编辑 `/etc/httpd/conf/httpd.conf` (以及虚拟主机的配置文件,假如有的话),并确保出现在顶层的和Directory 块中的 Options 指令都被设置为 None: - Options None + Options None -3. 在 HTTP 回应中隐藏有关 web 服务器和操作系统的信息。像下面这样编辑文件 `/etc/httpd/conf/httpd.conf`: +3. 在 HTTP 响应中隐藏有关 web 服务器和操作系统的信息。像下面这样编辑文件 `/etc/httpd/conf/httpd.conf`: - ServerTokens Prod - ServerSignature Off + ServerTokens Prod + ServerSignature Off 现在,你已经做好了从 `/var/www/html` 目录开始服务内容的准备了。 ### 配置并加固 FTP 服务器 ### -和 Apache 的情形类似, Vsftpd 的主配置文件 `(/etc/vsftpd/vsftpd.conf)` 带有详细的注释,且虽然对于大多数的应用实例,默认的配置应该足够了,但为了更有效率地操作 ftp 服务器,你应该开始熟悉相关的文档和 man 页 `(man vsftpd.conf)`(对于这点,再多的强调也不为过!)。 +和 Apache 的情形类似, Vsftpd 的主配置文件 `/etc/vsftpd/vsftpd.conf` 带有详细的注释,且虽然对于大多数的应用实例,默认的配置应该足够了,但为了更有效率地操作 ftp 服务器,你应该开始熟悉相关的文档和 man 页 `man vsftpd.conf`(对于这点,再多的强调也不为过!)。 在我们的示例中,使用了这些指令: @@ -135,7 +134,7 @@ Apache 的主要配置文件位于 `/etc/httpd/conf/httpd.conf` 中,但它可 userlist_enable=YES tcp_wrappers=YES -通过使用 `chroot_local_user=YES`,(默认情况下)本地用户在登陆之后,将马上被置于一个位于用户家目录的 chroot 环境中(注:这里的翻译也不准确)。这意味着本地用户将不能访问除其家目录之外的任何文件。 +通过使用 `chroot_local_user=YES`,(默认情况下)本地用户在登录之后,将被限制在以用户的家目录为 chroot 监狱的环境中。这意味着本地用户将不能访问除其家目录之外的任何文件。 最后,为了让 ftp 能够在用户的家目录中读取文件,设置如下的 SELinux 布尔值: @@ -145,19 +144,19 @@ Apache 的主要配置文件位于 `/etc/httpd/conf/httpd.conf` 中,但它可 ![查看 FTP 连接](http://www.tecmint.com/wp-content/uploads/2015/05/Check-FTP-Connection.png) -查看 FTP 连接 +*查看 FTP 连接* 注意, `/var/log/xferlog` 日志将会记录下载和上传的情况,这与上图的目录列表一致: ![监视 FTP 的下载和上传情况](http://www.tecmint.com/wp-content/uploads/2015/05/Monitor-FTP-Download-Upload.png) -监视 FTP 的下载和上传情况 +*监视 FTP 的下载和上传情况* 另外请参考: [在 Linux 系统中使用 Trickle 来限制应用使用的 FTP 网络带宽][2] ### 总结 ### -在本教程中,我们解释了如何设置 web 和 ftp 服务器。由于这个主题的广泛性,涵盖这些话题的所有方面是不可能的(如虚拟网络主机)。因此,我推荐你也阅读这个网站中有关 [Apache][3] 的其他卓越的文章。 +在本教程中,我们解释了如何设置 web 和 ftp 服务器。由于这个主题的广泛性,涵盖这些话题的所有方面是不可能的(如虚拟主机)。因此,我推荐你也阅读这个网站中有关 [Apache][3] 的其他卓越的文章。 -------------------------------------------------------------------------------- @@ -165,11 +164,11 @@ via: http://www.tecmint.com/rhcsa-series-install-and-secure-apache-web-server-an 作者:[Gabriel Cánepa][a] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/gacanepa/ [1]:http://httpd.apache.org/docs/2.4/ -[2]:http://www.tecmint.com/manage-and-limit-downloadupload-bandwidth-with-trickle-in-linux/ +[2]:https://linux.cn/article-5517-1.html [3]:http://www.google.com/cse?cx=partner-pub-2601749019656699:2173448976&ie=UTF-8&q=virtual+hosts&sa=Search&gws_rd=cr&ei=Dy9EVbb0IdHisASnroG4Bw#gsc.tab=0&gsc.q=apache diff --git a/published/RHCSA Series/RHCSA Series--Part 10--Yum Package Management, Automating Tasks with Cron and Monitoring System Logs.md b/published/RHCSA Series/RHCSA Series--Part 10--Yum Package Management, Automating Tasks with Cron and Monitoring System Logs.md new file mode 100644 index 0000000000..b6805bbf4c --- /dev/null +++ b/published/RHCSA Series/RHCSA Series--Part 10--Yum Package Management, Automating Tasks with Cron and Monitoring System Logs.md @@ -0,0 +1,199 @@ +RHCSA 系列(九): Yum 包管理、Cron 自动任务计划和监控系统日志 +================================================================================ + +在这篇文章中,我们将回顾如何在 RHEL7 中安装,更新和删除软件包。我们还将介绍如何使用 cron 进行任务自动化,并完成如何查找和监控系统日志文件,以及为什么这些技能是系统管理员必备技能。 + +![Yum Package Management Cron Jobs Log Monitoring Linux](http://www.tecmint.com/wp-content/uploads/2015/05/Yum-Package-Management-Cron-Job-Log-Monitoring-Linux.jpg) + +*RHCSA: Yum包管理、任务计划和系统监控 – Part 10* + +### 使用yum 管理包 ### + +要安装一个包以及所有尚未安装的依赖包,您可以使用: + + # yum -y install package_name(s) + +package_name(s) 需要是至少一个真实的软件包名 + +例如,安装 httpd 和 mlocate(按顺序),输入。 + + # yum -y install httpd mlocate + +**注意**: 字符 y 表示绕过执行下载和安装前的确认提示。如果需要提示,你可以不用它。 + +默认情况下,yum 将安装与操作系统体系结构相匹配的包,除非通过在包名加入架构名。 + +例如,在 64 位系统上,`yum install package`将安装包的 x86_64 版本,而 `yum install package.x86`(如果有的话)将安装 32 位的。 + +有时,你想安装一个包,但不知道它的确切名称。`search all` 选项可以在当前启用的软件库中的包名称和包描述中搜索它,或者`search`选项可以在包名称中搜索。 + +比如, + + # yum search log + +将搜索安装的软件库中名字和摘要与该词(log)类似的软件,而 + + # yum search all log + +也将在包描述和网址中寻找寻找相同的关键字。 + +一旦搜索返回包列表,您可能希望在安装前显示一些信息。这时 info 选项派上了用场: + + # yum info logwatch + +![Search Package Information](http://www.tecmint.com/wp-content/uploads/2015/05/Search-Package-Information.png) + +*搜索包信息* + +您可以定期用以下命令检查更新: + + # yum check-update + +上述命令将返回可以更新的所有已安装的软件包。在下图所示的例子中,只有 rhel-7-server-rpms 有可用更新: + +![Check For Package Updates](http://www.tecmint.com/wp-content/uploads/2015/05/Check-For-Updates.png) + +*检查包更新* + +然后,您可以更新该包, + + # yum update rhel-7-server-rpms + +如果有几个包可以一同更新,可以使用 ` yum update` 一次性更新所有的包。 + +当你知道一个可执行文件的名称,如 ps2pdf,但不知道那个包提供了它?你可以通过 `yum whatprovides “*/[executable]”`找到: + + # yum whatprovides “*/ps2pdf” + +![Find Package Belongs to Which Package](http://www.tecmint.com/wp-content/uploads/2015/05/Find-Package-Information.png) + +*查找文件属于哪个包* + +当删除包时,你可以使用 `yum remove Package` ,很简单吧?Yum 是一个完整而强大的包管理器。 + + # yum remove httpd + +- 参见: [20 个管理 RHEL 7 软件包的 Yum 命令][1] + +### 文本式 RPM 工具 ### + +RPM(又名 RPM 包管理器,原意是 RedHat 软件包管理器)也可用于安装或更新独立的`rpm`格式的软件包。 + +往往使用 `-Uvh` 表明如果这个包没有安装就安装它,如果已存在就尝试更新。这里`-U`表示更新、`-v`表示显示详细输出,用`-h`显示进度条。例如 + + # rpm -Uvh package.rpm + +rpm 的另一个典型的使用方法是列出所有安装的软件包, + + # rpm -qa + +![Query All RPM Packages](http://www.tecmint.com/wp-content/uploads/2015/05/Query-All-RPM-Packages.png) + +*查询所有包* + +- 参见: [20 个管理 RHEL 7 软件包的 RPM 命令][2] + +### 使用 Cron 调度任务 ### + +Linux 和 UNIX 类操作系统包括一个称为 Cron 的工具,允许你周期性调度任务(即命令或 shell 脚本)。cron 会每分钟定时检查 /var/spool/cron 目录中有在 /etc/passwd 帐户文件中指定用户名的文件。 + +执行命令时,命令输出是发送到该 crontab 的所有者(或者可以在 /etc/crontab,通过 MAILTO 环境变量中指定用户)。 + +crontab 文件(可以通过键入 `crontab -e`并按 Enter 键创建)的格式如下: + +![Crontab Entries](http://www.tecmint.com/wp-content/uploads/2015/05/Crontab-Format.png) + +*crontab条目* + +因此,如果我们想在每个月第二天上午2:15更新本地文件数据库(用于按名字或通配模式定位文件),我们需要添加以下 crontab 条目: + + 15 02 2 * * /bin/updatedb + +以上的条目的意思是:”每年每月第二天的凌晨 2:15 运行 /bin/updatedb,无论是周几”,我想你也猜到了。星号作为通配符。 + +正如我们前面所提到的,添加一个 cron 任务后,你可以看到一个名为 root 的文件被添加在 /var/spool/cron。该文件列出了所有的 crond 守护进程应该运行的任务: + + # ls -l /var/spool/cron + +![Check All Cron Jobs](http://www.tecmint.com/wp-content/uploads/2015/05/Check-All-Cron-Jobs.png) + +*检查所有cron任务* + +在上图中,显示当前用户的 crontab 可以使用 `cat /var/spool/cron` 或 + + # crontab -l + +如果你需要在一个更精细的时间上运行的任务(例如,一天两次或每月三次),cron 也可以做到。 + +例如,每个月1号和15号运行 /my/script 并将输出导出到 /dev/null (丢弃输出),您可以添加如下两个crontab 条目: + + 01 00 1 * * /myscript > /dev/null 2>&1 + 01 00 15 * * /my/script > /dev/null 2>&1 + +不过为了简单,你可以将他们合并: + + 01 00 1,15 * * /my/script > /dev/null 2>&1 + +跟着前面的例子,我们可以在每三个月的第一天的凌晨1:30运行 /my/other/script。 + + 30 01 1 1,4,7,10 * /my/other/script > /dev/null 2>&1 + +但是当你必须每隔某分钟、小时、天或月来重复某个任务时,你可以通过所需的频率来划分正确的时间。以下与前一个 crontab 条目具有相同的意义: + + 30 01 1 */3 * /my/other/script > /dev/null 2>&1 + +或者也许你需要在一个固定的频率或系统启动后运行某个固定的工作,你可以使用下列五个字符串中的一个字符串来指示你想让你的任务计划工作的确切时间: + + @reboot 仅系统启动时运行 + @yearly 一年一次, 类似与 00 00 1 1 * + @monthly 一月一次, 类似与 00 00 1 * * + @weekly 一周一次, 类似与 00 00 * * 0 + @daily 一天一次, 类似与 00 00 * * * + @hourly 一小时一次, 类似与 00 * * * * + +- 参见:[11 个在 RHEL7 中调度任务的命令][3] + +### 定位和查看日志### + +系统日志存放(并轮转)在 /var/log 目录。根据 Linux 的文件系统层次标准(Linux Filesystem Hierarchy Standard),这个目录包括各种日志文件,并包含一些必要的子目录(如 audit、 httpd 或 samba ,如下图),并由相应的系统守护进程操作: + + # ls /var/log + +![Linux Log Files Location](http://www.tecmint.com/wp-content/uploads/2015/05/Linux-Log-Files.png) + +*Linux 日志的位置* + +其他感兴趣的日志比如 [dmesg][4](包括了所有内核层缓冲区的消息),secure(记录要求用户认证的连接请求),messages(系统级信息),和 wtmp(记录了所有用户的登录、登出)。 + +日志是非常重要的,它们让你可以看到任何时刻发生在你的系统的事情,以及已经过去的事情。他们是无价的工具,可以排错和监测一个 Linux 服务器,通常使用 `tail -f` 命令来实时显示正在发生和写入日志的事件。 + +举个例子,如果你想看你的内核相关的日志,你需要输入如下命令: + + # tail -f /var/log/dmesg + +同样的,如果你想查看你的 Web 服务器日志,你需要输入如下命令: + + # tail -f /var/log/httpd/access.log + +### 总结 ### + +如果你知道如何有效的管理包、调度任务、以及知道在哪寻找系统当前和过去操作的信息,你可以放松工作而不会总被吓到。我希望这篇文章能够帮你学习或回顾这些基础知识。 + +如果你有任何问题或意见,请使用下面的表单反馈给我们。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/yum-package-management-cron-job-scheduling-monitoring-linux-logs/ + +作者:[Gabriel Cánepa][a] +译者:[xiqingongzi](https://github.com/xiqingongzi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ +[2]:http://www.tecmint.com/20-practical-examples-of-rpm-commands-in-linux/ +[3]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/ +[4]:http://www.tecmint.com/dmesg-commands/ + diff --git a/translated/tech/RHCSA/RHCSA Series--Part 11--Firewall Essentials and Network Traffic Control Using FirewallD and Iptables.md b/published/RHCSA Series/RHCSA Series--Part 11--Firewall Essentials and Network Traffic Control Using FirewallD and Iptables.md similarity index 62% rename from translated/tech/RHCSA/RHCSA Series--Part 11--Firewall Essentials and Network Traffic Control Using FirewallD and Iptables.md rename to published/RHCSA Series/RHCSA Series--Part 11--Firewall Essentials and Network Traffic Control Using FirewallD and Iptables.md index 80e64c088d..f770d09353 100644 --- a/translated/tech/RHCSA/RHCSA Series--Part 11--Firewall Essentials and Network Traffic Control Using FirewallD and Iptables.md +++ b/published/RHCSA Series/RHCSA Series--Part 11--Firewall Essentials and Network Traffic Control Using FirewallD and Iptables.md @@ -1,25 +1,25 @@ -RHCSA 系列: 防火墙简要和使用 FirewallD 和 Iptables 来控制网络流量 – Part 11 +RHCSA 系列(十一): 使用 firewalld 和 iptables 来控制网络流量 ================================================================================ -简单来说,防火墙就是一个基于一系列预先定义的规则(例如流量包的目的地或来源,流量的类型等)的安全系统,它控制着一个网络中的流入和流出流量。 +简单来说,防火墙就是一个基于一系列预先定义的规则(例如流量包的目的地或来源,流量的类型等)的安全系统,它控制着一个网络中的流入和流出流量。 ![使用 FirewallD 和 Iptables 来控制网络流量](http://www.tecmint.com/wp-content/uploads/2015/05/Control-Network-Traffic-Using-Firewall.png) -RHCSA: 使用 FirewallD 和 Iptables 来控制网络流量 – Part 11 +*RHCSA: 使用 FirewallD 和 Iptables 来控制网络流量 – Part 11* -在本文中,我们将回顾 firewalld 和 iptables 的基础知识。前者是 RHEL 7 中的默认动态防火墙守护进程,而后者则是针对 Linux 的传统的防火墙服务,大多数的系统和网络管理员都非常熟悉它,并且在 RHEL 7 中也可以获取到。 +在本文中,我们将回顾 firewalld 和 iptables 的基础知识。前者是 RHEL 7 中的默认动态防火墙守护进程,而后者则是针对 Linux 的传统的防火墙服务,大多数的系统和网络管理员都非常熟悉它,并且在 RHEL 7 中也可以用。 ### FirewallD 和 Iptables 的一个比较 ### 在后台, firewalld 和 iptables 服务都通过相同的接口来与内核中的 netfilter 框架相交流,这不足为奇,即它们都通过 iptables 命令来与 netfilter 交互。然而,与 iptables 服务相反, firewalld 可以在不丢失现有连接的情况下,在正常的系统操作期间更改设定。 -在默认情况下, firewalld 应该已经安装在你的 RHEL 系统中了,尽管它可能没有在运行。你可以使用下面的命令来确认(firewall-config 是用户界面配置工具): +在默认情况下, firewalld 应该已经安装在你的 RHEL 系统中了,尽管它可能没有在运行。你可以使用下面的命令来确认(firewall-config 是用户界面配置工具): # yum info firewalld firewall-config ![检查 FirewallD 的信息](http://www.tecmint.com/wp-content/uploads/2015/05/Check-FirewallD-Information.png) -检查 FirewallD 的信息 +*检查 FirewallD 的信息* 以及, @@ -27,7 +27,7 @@ RHCSA: 使用 FirewallD 和 Iptables 来控制网络流量 – Part 11 ![检查 FirewallD 的状态](http://www.tecmint.com/wp-content/uploads/2015/05/Check-FirewallD-Status.png) -检查 FirewallD 的状态 +*检查 FirewallD 的状态* 另一方面, iptables 服务在默认情况下没有被包含在 RHEL 系统中,但可以被安装上。 @@ -38,13 +38,13 @@ RHCSA: 使用 FirewallD 和 Iptables 来控制网络流量 – Part 11 # systemctl start firewalld.service | iptables-service.service # systemctl enable firewalld.service | iptables-service.service -另外,请阅读:[管理 Systemd 服务的实用命令][1] (注: 本文已被翻译发表,在 https://linux.cn/article-5926-1.html) +另外,请阅读:[管理 Systemd 服务的实用命令][1] -至于配置文件, iptables 服务使用 `/etc/sysconfig/iptables` 文件(假如这个软件包在你的系统中没有被安装,则这个文件将不存在)。在一个被用作集群节点的 RHEL 7 机子上,这个文件长得像这样: +至于配置文件, iptables 服务使用 `/etc/sysconfig/iptables` 文件(假如这个软件包在你的系统中没有被安装,则这个文件将不存在)。在一个被用作集群节点的 RHEL 7 机子上,这个文件看起来是这样: ![Iptables 防火墙配置文件](http://www.tecmint.com/wp-content/uploads/2015/05/Iptables-Rules.png) -Iptables 防火墙配置文件 +*Iptables 防火墙配置文件* 而 firewalld 则在两个目录中存储它的配置文件,即 `/usr/lib/firewalld` 和 `/etc/firewalld`: @@ -52,33 +52,32 @@ Iptables 防火墙配置文件 ![FirewallD 的配置文件](http://www.tecmint.com/wp-content/uploads/2015/05/Firewalld-configuration.png) -FirewallD 的配置文件 +*FirewallD 的配置文件* -在这篇文章中后面,我们将进一步查看这些配置文件,在那之后,我们将在各处添加一些规则。 -现在,是时候提醒你了,你总可以使用下面的命令来找到更多有关这两个工具的信息。 +在这篇文章中后面,我们将进一步查看这些配置文件,在那之后,我们将在这两个地方添加一些规则。现在,是时候提醒你了,你总可以使用下面的命令来找到更多有关这两个工具的信息。 # man firewalld.conf # man firewall-cmd # man iptables -除了这些,记得查看一下当前系列的第一篇 [RHCSA 系列(一): 回顾基础命令及系统文档][2](注: 本文已被翻译发表,在 https://linux.cn/article-6133-1.html ),在其中我描述了几种渠道来得到安装在你的 RHEL 7 系统上的软件包的信息。 +除了这些,记得查看一下当前系列的第一篇 [RHCSA 系列(一): 回顾基础命令及系统文档][2],在其中我描述了几种渠道来得到安装在你的 RHEL 7 系统上的软件包的信息。 ### 使用 Iptables 来控制网络流量 ### -在进一步深入之前,或许你需要参考 Linux 基金会认证工程师(Linux Foundation Certified Engineer,LFCE) 系列中的 [配置 Iptables 防火墙 – Part 8][3] 来复习你脑中有关 iptables 的知识。 +在进一步深入之前,或许你需要参考 Linux 基金会认证工程师(Linux Foundation Certified Engineer,LFCE) 系列中的 [配置 Iptables 防火墙 – Part 8][3] 来复习你脑中有关 iptables 的知识。 **例 1:同时允许流入和流出的网络流量** -TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP) 和安全(HTTPS)网络流量的默认端口。你可以像下面这样在 enp0s3 接口上允许流入和流出网络流量通过这两个端口: +TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP)和安全(HTTPS)网络流量的默认端口。你可以像下面这样在 enp0s3 接口上允许流入和流出网络流量通过这两个端口: # iptables -A INPUT -i enp0s3 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT # iptables -A OUTPUT -o enp0s3 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT # iptables -A INPUT -i enp0s3 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT # iptables -A OUTPUT -o enp0s3 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT -**例 2:从某个特定网络中阻挡所有(或某些)流入连接** +**例 2:从某个特定网络中阻挡所有(或某些)流入连接** -或许有时你需要阻挡来自于某个特定网络的所有(或某些)类型的来源流量,比方说 192.168.1.0/24: +或许有时你需要阻挡来自于某个特定网络的所有(或某些)类型的来源流量,比方说 192.168.1.0/24: # iptables -I INPUT -s 192.168.1.0/24 -j DROP @@ -90,7 +89,7 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP) **例 3:将流入流量重定向到另一个目的地** -假如你不仅使用你的 RHEL 7 机子来作为一个软件防火墙,而且还将它作为一个硬件防火墙,使得它位于两个不同的网络之间,则在你的系统 IP 转发一定已经被开启了。假如没有开启,你需要编辑 `/etc/sysctl.conf` 文件并将 `net.ipv4.ip_forward` 的值设为 1,即: +假如你不仅使用你的 RHEL 7 机子来作为一个软件防火墙,而且还将它作为一个硬件防火墙,使得它位于两个不同的网络之间,那么在你的系统上 IP 转发一定已经被开启了。假如没有开启,你需要编辑 `/etc/sysctl.conf` 文件并将 `net.ipv4.ip_forward` 的值设为 1,即: net.ipv4.ip_forward = 1 @@ -98,27 +97,27 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP) # sysctl -p /etc/sysctl.conf -例如,你可能在一个内部的机子上安装了一个打印机,它的 IP 地址为 192.168.0.10,CUPS 服务在端口 631 上进行监听(同时在你的打印服务器和你的防火墙上)。为了从防火墙另一边的客户端传递打印请求,你应该添加下面的 iptables 规则: +例如,你可能在一个内部的机子上安装了一个打印机,它的 IP 地址为 192.168.0.10,CUPS 服务在端口 631 上进行监听(同时在你的打印服务器和你的防火墙上)。为了从防火墙另一边的客户端传递打印请求,你应该添加下面的 iptables 规则: # iptables -t nat -A PREROUTING -i enp0s3 -p tcp --dport 631 -j DNAT --to 192.168.0.10:631 -请记住 iptables 逐条地读取它的规则,所以请确保默认的策略或后面的规则不会重载上面例子中那些有下划线的规则。 +请记住 iptables 会逐条地读取它的规则,所以请确保默认的策略或后面的规则不会重载上面例子中那些规则。 ### FirewallD 入门 ### -引入 firewalld 的一个改变是区域(zone) (注:翻译参考了 https://fedoraproject.org/wiki/FirewallD/zh-cn) 的概念。它允许将网路划分为拥有不同信任级别的区域,由用户决定将设备和流量放置到哪个区域。 +firewalld 引入的一个变化是区域(zone) (注:翻译参考了 https://fedoraproject.org/wiki/FirewallD/zh-cn )。这个概念允许将网路划分为拥有不同信任级别的区域,由用户决定将设备和流量放置到哪个区域。 要获取活动的区域,使用: # firewall-cmd --get-active-zones -在下面的例子中,公用区域被激活了,并且 enp0s3 接口被自动地分配到了这个区域。要查看有关一个特定区域的所有信息,可使用: +在下面的例子中,public 区域是激活的,并且 enp0s3 接口被自动地分配到了这个区域。要查看有关一个特定区域的所有信息,可使用: # firewall-cmd --zone=public --list-all ![列出所有的 Firewalld 区域](http://www.tecmint.com/wp-content/uploads/2015/05/View-FirewallD-Zones.png) -列出所有的 Firewalld 区域 +*列出所有的 Firewalld 区域* 由于你可以在 [RHEL 7 安全指南][4] 中阅读到更多有关区域的知识,这里我们将仅列出一些特别的例子。 @@ -130,9 +129,9 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP) ![列出所有受支持的服务](http://www.tecmint.com/wp-content/uploads/2015/05/List-All-Supported-Services.png) -列出所有受支持的服务 +*列出所有受支持的服务* -要立刻且在随后的开机中使得 http 和 https 网络流量通过防火墙,可以这样: +要立刻生效且在随后重启后都可以让 http 和 https 网络流量通过防火墙,可以这样: # firewall-cmd --zone=MyZone --add-service=http # firewall-cmd --zone=MyZone --permanent --add-service=http @@ -140,13 +139,13 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP) # firewall-cmd --zone=MyZone --permanent --add-service=https # firewall-cmd --reload -假如 code>–zone 被忽略,则默认的区域(你可以使用 `firewall-cmd –get-default-zone`来查看)将会被使用。 +假如 `-–zone` 被忽略,则使用默认的区域(你可以使用 `firewall-cmd –get-default-zone`来查看)。 若要移除这些规则,可以在上面的命令中将 `add` 替换为 `remove`。 **例 5:IP 转发或端口转发** -首先,你需要查看在目标区域中,伪装是否被开启: +首先,你需要查看在目标区域中,伪装(masquerading)是否被开启: # firewall-cmd --zone=MyZone --query-masquerade @@ -154,7 +153,7 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP) ![在 firewalld 中查看伪装状态](http://www.tecmint.com/wp-content/uploads/2015/05/Check-masquerading.png) -查看伪装状态 +*查看伪装状态* 你可以为公共区域开启伪装: @@ -164,11 +163,11 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP) # firewall-cmd --zone=external --add-forward-port=port=631:proto=tcp:toport=631:toaddr=192.168.0.10 -并且别忘了重新加载防火墙。 +不要忘了重新加载防火墙。 -在 RHCSA 系列的 [Part 9][5] 你可以找到更深入的例子,在那篇文章中我们解释了如何允许或禁用通常被 web 服务器和 ftp 服务器使用的端口,以及在针对这两个服务所使用的默认端口被改变时,如何更改相应的规则。另外,你或许想参考 firewalld 的 wiki 来查看更深入的例子。 +在 RHCSA 系列的 [第九部分][5] 你可以找到更深入的例子,在那篇文章中我们解释了如何允许或禁用通常被 web 服务器和 ftp 服务器使用的端口,以及在针对这两个服务所使用的默认端口被改变时,如何更改相应的规则。另外,你或许想参考 firewalld 的 wiki 来查看更深入的例子。 -Read Also: [在 RHEL 7 中配置防火墙的几个实用的 firewalld 例子][6] +- 延伸阅读: [在 RHEL 7 中配置防火墙的几个实用的 firewalld 例子][6] ### 总结 ### @@ -180,14 +179,14 @@ via: http://www.tecmint.com/firewalld-vs-iptables-and-control-network-traffic-in 作者:[Gabriel Cánepa][a] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/manage-services-using-systemd-and-systemctl-in-linux/ -[2]:http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ +[1]:https://linux.cn/article-5926-1.html +[2]:https://linux.cn/article-6133-1.html [3]:http://www.tecmint.com/configure-iptables-firewall/ [4]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html -[5]:http://www.tecmint.com/rhcsa-series-install-and-secure-apache-web-server-and-ftp-in-rhel/ +[5]:https://linux.cn/article-6286-1.html [6]:http://www.tecmint.com/firewalld-rules-for-centos-7/ \ No newline at end of file diff --git a/published/RHCSA Series/RHCSA Series--Part 12--Automate RHEL 7 Installations Using 'Kickstart'.md b/published/RHCSA Series/RHCSA Series--Part 12--Automate RHEL 7 Installations Using 'Kickstart'.md new file mode 100644 index 0000000000..27ae044218 --- /dev/null +++ b/published/RHCSA Series/RHCSA Series--Part 12--Automate RHEL 7 Installations Using 'Kickstart'.md @@ -0,0 +1,143 @@ +RHCSA 系列(十二): 使用 Kickstart 完成 RHEL 7 的自动化安装 +================================================================================ + +无论是在数据中心还是实验室环境,Linux 服务器很少是独立的机器,很可能有时你需要安装多个以某种方式相互联系的机器。假如你将在单个服务器上手动安装 RHEL 7 所花的时间乘以你需要配置的机器数量,这将导致你必须做出一场相当长的努力,而通过使用被称为 kicksta 的无人值守安装工具则可以避免这样的麻烦。 + +在这篇文章中,我们将向你展示使用 kickstart 工具时所需的一切,以便在安装过程中,不用你时不时地照看“处在襁褓中”的服务器。 + +![RHEL 7 的自动化 Kickstart 安装](http://www.tecmint.com/wp-content/uploads/2015/05/Automatic-Kickstart-Installation-of-RHEL-7.jpg) + +*RHCSA: RHEL 7 的自动化 Kickstart 安装* + +#### Kickstart 和自动化安装简介 #### + +Kickstart 是一种被用来执行无人值守操作系统安装和配置的自动化安装方法,主要被 RHEL(以及其他 Fedora 的副产品,如 CentOS,Oracle Linux 等)所使用。因此,kickstart 安装方法可使得系统管理员只需考虑需要安装的软件包组和系统的配置,便可以得到相同的系统,从而省去必须手动安装这些软件包的麻烦。 + +### 准备 Kickstart 安装 ### + +要执行 kickstart 安装,我们需要遵循下面的这些步骤: + +1. 创建一个 Kickstart 文件,它是一个带有多个预定义配置选项的纯文本文件。 + +2. 将 Kickstart 文件保存在可移动介质上,如一个硬盘或一个网络位置。kickstart 客户端需要使用 `rhel-server-7.0-x86_64-boot.iso` 镜像文件,而你还需要可从一个网络资源上获取得到完整的 ISO 镜像 `rhel-server-7.0-x86_64-dvd.iso` ,例如通过一个 FTP 服务器的 HTTP 服务形式(在我们当前的例子中,我们将使用另一个 IP 地址为 192.168.0.18 的 RHEL 7 机器)。 + +3. 开始 Kickstart 安装。 + +要创建一个 kickstart 文件,请登录你的红帽客户门户网站(Red Hat Customer Portal)帐户,并使用 [Kickstart 配置工具][1] 来选择所需的安装选项。在向下滑动之前请仔细阅读每个选项,然后选择最适合你需求的选项: + +![Kickstart 配置工具](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-Configuration-Tool.png) + +*Kickstart 配置工具* + +假如你指定安装将通过 HTTP,FTP,NFS 来执行,请确保服务器上的防火墙允许这些服务通过。 + +尽管你可以使用红帽的在线工具来创建一个 kickstart 文件,但你还可以使用下面的代码来作为参考手动地创建它。例如,你可以注意到,下面的代码指定了安装过程将使用英语环境,使用拉丁美洲键盘布局,并设定时区为 America/Argentina/San_Luis 时区: + + lang en_US + keyboard la-latin1 + timezone America/Argentina/San_Luis --isUtc + rootpw $1$5sOtDvRo$In4KTmX7OmcOW9HUvWtfn0 --iscrypted + #platform x86, AMD64, or Intel EM64T + text + url --url=http://192.168.0.18//kickstart/media + bootloader --location=mbr --append="rhgb quiet crashkernel=auto" + zerombr + clearpart --all --initlabel + autopart + auth --passalgo=sha512 --useshadow + selinux --enforcing + firewall --enabled + firstboot --disable + %packages + @base + @backup-server + @print-server + %end + +在上面的在线配置工具中,在选择以 HTTP 来作为安装源后,设置好在安装过程中使用 192.168.0.18 来作为 HTTP 服务器的地址,`/kickstart/tecmint.bin` 作为 HTTP 目录。 + +在上面的 kickstart 示例文件中,你需要特别注意 + + url --url=http://192.168.0.18//kickstart/media + +这个目录是你展开 DVD 或 ISO 安装介质内容的地方。在执行解压之前,我们将把 ISO 安装文件作为一个回环设备挂载到 /media/rhel 目录下: + + # mount -o loop /var/www/html/kickstart/rhel-server-7.0-x86_64-dvd.iso /media/rhel + +![挂载 RHEL ISO 镜像](http://www.tecmint.com/wp-content/uploads/2015/05/Mount-RHEL-ISO-Image.png) + +*挂载 RHEL ISO 镜像* + +接下来,复制 /media/rhel 中的全部文件到 /var/www/html/kickstart/media 目录: + + # cp -R /media/rhel /var/www/html/kickstart/media + +这一步做完后,/var/www/html/kickstart/media 目录中的文件列表和磁盘使用情况将如下所示: + +![Kickstart 媒体文件](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-media-Files.png) + +*Kickstart 媒体文件* + +现在,我们已经准备好开始 kickstart 安装了。 + +不管你如何选择创建 kickstart 文件的方式,在执行安装之前检查下这个文件的语法是否有误总是一个不错的主意。为此,我们需要安装 pykickstart 软件包。 + + # yum update && yum install pykickstart + +然后使用 ksvalidator 工具来检查这个文件: + + # ksvalidator /var/www/html/kickstart/tecmint.bin + +假如文件中的语法正确,你将不会得到任何输出,反之,假如文件中存在错误,你得到警告,向你提示在某一行中语法不正确或出错原因未知。 + +### 执行 Kickstart 安装 ### + +首先,使用 rhel-server-7.0-x86_64-boot.iso 来启动你的客户端。当初始屏幕出现时,选择安装 RHEL 7.0 ,然后按 Tab 键来追加下面这一句,接着按 Enter 键: + + # inst.ks=http://192.168.0.18/kickstart/tecmint.bin + +![RHEL Kickstart 安装](http://www.tecmint.com/wp-content/uploads/2015/05/RHEL-Kickstart-Installation.png) + +*RHEL Kickstart 安装* + +其中 tecmint.bin 是先前创建的 kickstart 文件。 + +当你按了 Enter 键后,自动安装就开始了,且你将看到一个列有正在被安装的软件的列表(软件包的数目和名称根据你所选择的程序和软件包组而有所不同): + +![RHEL 7 的自动化 Kickstart 安装](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-Automatic-Installation.png) + +*RHEL 7 的自动化 Kickstart 安装* + +当自动化过程结束后,将提示你移除安装介质,接着你就可以启动到你新安装的系统中了: + +![RHEL 7 启动屏幕](http://www.tecmint.com/wp-content/uploads/2015/05/RHEL-7.png) + +*RHEL 7 启动屏幕* + +尽管你可以像我们前面提到的那样,手动地创建你的 kickstart 文件,但你应该尽可能地考虑使用受推荐的方式:你可以使用在线配置工具,或者使用在安装过程中创建的位于 root 家目录下的 anaconda-ks.cfg 文件。 + +这个文件实际上就是一个 kickstart 文件,你或许想在选择好所有所需的选项(可能需要更改逻辑卷布局或机器上所用的文件系统)后手动地安装第一个机器,接着使用产生的 anaconda-ks.cfg 文件来自动完成其余机器的安装过程。 + +另外,使用在线配置工具或 anaconda-ks.cfg 文件来引导将来的安装将允许你在系统安装时以加密的形式设置 root 密码。 + +### 总结 ### + +既然你知道了如何创建 kickstart 文件并如何使用它们来自动完成 RHEL 7 服务器的安装,你就可以不用时时照看安装进度的过程了。这将给你时间来做其他的事情,或者若你足够幸运,你还可以用来休闲一番。 + +无论以何种方式,请使用下面的评论栏来让我们知晓你对这篇文章的看法。提问也同样欢迎! + +另外,请阅读:[使用 PXE 和 kickstart 来自动化安装多个 RHEL/CentOS 7 发行版本][2] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/automatic-rhel-installations-using-kickstart/ + +作者:[Gabriel Cánepa][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://access.redhat.com/labs/kickstartconfig/ +[2]:http://www.tecmint.com/multiple-centos-installations-using-kickstart/ diff --git a/published/RHCSA Series/RHCSA Series--Part 13--Mandatory Access Control Essentials with SELinux in RHEL 7.md b/published/RHCSA Series/RHCSA Series--Part 13--Mandatory Access Control Essentials with SELinux in RHEL 7.md new file mode 100644 index 0000000000..8e77f8495e --- /dev/null +++ b/published/RHCSA Series/RHCSA Series--Part 13--Mandatory Access Control Essentials with SELinux in RHEL 7.md @@ -0,0 +1,179 @@ +RHCSA 系列(十三): 在 RHEL 7 中使用 SELinux 进行强制访问控制 +================================================================================ + +在本系列的前面几篇文章中,我们已经详细地探索了至少两种访问控制方法:标准的 ugo/rwx 权限([RHCSA 系列(三): 如何管理 RHEL7 的用户和组][1]) 和访问控制列表([RHCSA 系列(七): 使用 ACL(访问控制列表) 和挂载 Samba/NFS 共享][2])。 + +![RHCSA 认证:SELinux 精要和控制文件系统的访问](http://www.tecmint.com/wp-content/uploads/2015/06/SELinux-Control-File-System-Access.png) + +*RHCSA 认证:SELinux 精要和控制文件系统的访问* + +尽管作为第一级别的权限和访问控制机制是必要的,但它们同样有一些局限,而这些局限则可以由安全增强 Linux(Security Enhanced Linux,简称为 SELinux) 来处理。 + +这些局限的一种情形是:某个用户可能通过一个泛泛的 chmod 命令将文件或目录暴露出现了安全违例,从而引起访问权限的意外传播。结果,由该用户开启的任意进程可以对属于该用户的文件进行任意的操作,最终一个恶意的或有其它缺陷的软件可能会取得整个系统的 root 级别的访问权限。 + +考虑到这些局限性,美国国家安全局(NSA) 率先设计出了 SELinux,一种强制的访问控制方法,它根据最小权限模型去限制进程在系统对象(如文件,目录,网络接口等)上的访问或执行其他的操作的能力,而这些限制可以在之后根据需要进行修改。简单来说,系统的每一个元素只给某个功能所需要的那些权限。 + +在 RHEL 7 中,SELinux 被并入了内核中,且默认情况下以强制模式(Enforcing)开启。在这篇文章中,我们将简要地介绍有关 SELinux 及其相关操作的基本概念。 + +### SELinux 的模式 ### + +SELinux 可以以三种不同的模式运行: + +- 强制模式(Enforcing):SELinux 基于其策略规则来拒绝访问,这些规则是用以控制安全引擎的一系列准则; +- 宽容模式(Permissive):SELinux 不会拒绝访问,但对于那些如果运行在强制模式下会被拒绝访问的行为进行记录; +- 关闭(Disabled) (不言自明,即 SELinux 没有实际运行). + +使用 `getenforce` 命令可以展示 SELinux 当前所处的模式,而 `setenforce` 命令(后面跟上一个 1 或 0) 则被用来将当前模式切换到强制模式(Enforcing)或宽容模式(Permissive),但只对当前的会话有效。 + +为了使得在登出和重启后上面的设置还能保持作用,你需要编辑 `/etc/selinux/config` 文件并将 SELINUX 变量的值设为 enforcing,permissive,disabled 中之一: + + # getenforce + # setenforce 0 + # getenforce + # setenforce 1 + # getenforce + # cat /etc/selinux/config + +![设置 SELinux 模式](http://www.tecmint.com/wp-content/uploads/2015/05/Set-SELinux-Mode.png) + +*设置 SELinux 模式* + +通常情况下,你应该使用 `setenforce` 来在 SELinux 模式间进行切换(从强制模式到宽容模式,或反之),以此来作为你排错的第一步。假如 SELinux 当前被设置为强制模式,而你遇到了某些问题,但当你把 SELinux 切换为宽容模式后问题不再出现了,则你可以确信你遇到了一个 SELinux 权限方面的问题。 + +### SELinux 上下文 ### + +一个 SELinux 上下文(Context)由一个访问控制环境所组成,在这个环境中,决定的做出将基于 SELinux 的用户,角色和类型(和可选的级别): + +- 一个 SELinux 用户是通过将一个常规的 Linux 用户账户映射到一个 SELinux 用户账户来实现的,反过来,在一个会话中,这个 SELinux 用户账户在 SELinux 上下文中被进程所使用,以便能够明确定义它们所允许的角色和级别。 +- 角色的概念是作为域和处于该域中的 SELinux 用户之间的媒介,它定义了 SELinux 可以访问到哪个进程域和哪些文件类型。这将保护您的系统免受提权漏洞的攻击。 +- 类型则定义了一个 SELinux 文件类型或一个 SELinux 进程域。在正常情况下,进程将会被禁止访问其他进程正使用的文件,并禁止对其他进程进行访问。这样只有当一个特定的 SELinux 策略规则允许它访问时,才能够进行访问。 + +下面就让我们看看这些概念是如何在下面的例子中起作用的。 + +**例 1:改变 sshd 守护进程的默认端口** + +在 [RHCSA 系列(八): 加固 SSH,设定主机名及启用网络服务][3] 中,我们解释了更改 sshd 所监听的默认端口是加固你的服务器免受外部攻击的首要安全措施。下面,就让我们编辑 `/etc/ssh/sshd_config` 文件并将端口设置为 9999: + + Port 9999 + +保存更改并重启 sshd: + + # systemctl restart sshd + # systemctl status sshd + +![更改 SSH 的端口](http://www.tecmint.com/wp-content/uploads/2015/05/Change-SSH-Port.png) + +*重启 SSH 服务* + +正如你看到的那样, sshd 启动失败,但为什么会这样呢? + +快速检查 `/var/log/audit/audit.log` 文件会发现 sshd 已经被拒绝在端口 9999 上开启(SELinux 的日志信息包含单词 "AVC",所以这类信息可以被轻易地与其他信息相区分),因为这个端口是 JBoss 管理服务的保留端口: + + # cat /var/log/audit/audit.log | grep AVC | tail -1 + +![查看 SSH 日志](http://www.tecmint.com/wp-content/uploads/2015/05/Inspect-SSH-Logs.png) + +*查看 SSH 日志* + +在这种情况下,你可以像先前解释的那样禁用 SELinux(但请不要这样做!),并尝试重启 sshd,且这种方法能够起效。但是, `semanage` 应用可以告诉我们在哪些端口上可以开启 sshd 而不会出现任何问题。 + +运行: + + # semanage port -l | grep ssh + +便可以得到一个 SELinux 允许 sshd 在哪些端口上监听的列表: + +![Semanage 工具](http://www.tecmint.com/wp-content/uploads/2015/05/SELinux-Permission.png) + +*Semanage 工具* + +所以让我们在 `/etc/ssh/sshd_config` 中将端口更改为 9998 端口,增加这个端口到 ssh_port_t 的上下文,然后重启 sshd 服务: + + # semanage port -a -t ssh_port_t -p tcp 9998 + # systemctl restart sshd + # systemctl is-active sshd + +![Semanage 添加端口](http://www.tecmint.com/wp-content/uploads/2015/05/Semenage-Add-Port.png) + +*semanage 添加端口* + +如你所见,这次 sshd 服务被成功地开启了。这个例子告诉我们一个事实:SELinux 用它自己的端口类型的内部定义来控制 TCP 端口号。 + +**例 2:允许 httpd 访问 sendmail** + +这是一个 SELinux 管理一个进程来访问另一个进程的例子。假如在你的 RHEL 7 服务器上,[你要为 Apache 配置 mod\_security 和 mod\_evasive][6],你需要允许 httpd 访问 sendmail,以便在遭受到 (D)DoS 攻击时能够用邮件来提醒你。在下面的命令中,如果你不想使得更改在重启后仍然生效,请去掉 `-P` 选项。 + + # semanage boolean -1 | grep httpd_can_sendmail + # setsebool -P httpd_can_sendmail 1 + # semanage boolean -1 | grep httpd_can_sendmail + +![允许 Apache 发送邮件](http://www.tecmint.com/wp-content/uploads/2015/05/Allow-Apache-to-Send-Mails.png) + +*允许 Apache 发送邮件* + +从上面的例子中,你可以知道 SELinux 布尔设定(或者只是布尔值)分别对应于 true 或 false,被嵌入到了 SELinux 策略中。你可以使用 `semanage boolean -l` 来列出所有的布尔值,也可以管道至 grep 命令以便筛选输出的结果。 + +**例 3:在一个特定目录而非默认目录下提供一个静态站点服务** + +假设你正使用一个不同于默认目录(`/var/www/html`)的目录来提供一个静态站点服务,例如 `/websites` 目录(这种情形会出现在当你把你的网络文件存储在一个共享网络设备上,并需要将它挂载在 /websites 目录时)。 + +a). 在 /websites 下创建一个 index.html 文件并包含如下的内容: + + +

SELinux test

+ + +假如你执行 + + # ls -lZ /websites/index.html + +你将会看到这个 index.html 已经被标记上了 default_t SELinux 类型,而 Apache 不能访问这类文件: + +![检查 SELinux 文件的权限](http://www.tecmint.com/wp-content/uploads/2015/05/Check-File-Permssion.png) + +*检查 SELinux 文件的权限* + +b). 将 `/etc/httpd/conf/httpd.conf` 中的 DocumentRoot 改为 /websites,并不要忘了 +更新相应的 Directory 块。然后重启 Apache。 + +c). 浏览 `http://`,则你应该会得到一个 503 Forbidden 的 HTTP 响应。 + +d). 接下来,递归地改变 /websites 的标志,将它的标志变为 `httpd_sys_content_t` 类型,以便赋予 Apache 对这些目录和其内容的只读访问权限: + + # semanage fcontext -a -t httpd_sys_content_t "/websites(/.*)?" + +e). 最后,应用在 d) 中创建的 SELinux 策略: + + # restorecon -R -v /websites + +现在重启 Apache 并再次浏览到 `http://`,则你可以看到被正确展现出来的 html 文件: + +![确认 Apache 页面](http://www.tecmint.com/wp-content/uploads/2015/05/08part13.png) + +*确认 Apache 页面* + +### 总结 ### + +在本文中,我们详细地介绍了 SELinux 的基础知识。请注意,由于这个主题的广泛性,在单篇文章中做出一个完全详尽的解释是不可能的,但我们相信,在这个指南中列出的基本原则将会对你进一步了解更高级的话题有所帮助,假如你想了解的话。 + +假如可以,请让我推荐两个必要的资源来入门 SELinux:[NSA SELinux 页面][4] 和 [针对用户和系统管理员的 RHEL 7 SELinux 指南][5]。 + +假如你有任何的问题或评论,请不要犹豫,让我们知晓吧。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/selinux-essentials-and-control-filesystem-access/ + +作者:[Gabriel Cánepa][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://linux.cn/article-6187-1.html +[2]:https://linux.cn/article-6263-1.html +[3]:https://linux.cn/article-6266-1.html +[4]:https://www.nsa.gov/research/selinux/index.shtml +[5]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/SELinux_Users_and_Administrators_Guide/part_I-SELinux.html +[6]:https://linux.cn/article-5639-1.html diff --git a/published/RHCSA Series/RHCSA Series--Part 14--Setting Up LDAP-based Authentication in RHEL 7.md b/published/RHCSA Series/RHCSA Series--Part 14--Setting Up LDAP-based Authentication in RHEL 7.md new file mode 100644 index 0000000000..a071f4dc33 --- /dev/null +++ b/published/RHCSA Series/RHCSA Series--Part 14--Setting Up LDAP-based Authentication in RHEL 7.md @@ -0,0 +1,275 @@ +RHCSA 系列(十四): 在 RHEL 7 中设置基于 LDAP 的认证 +================================================================================ +在这篇文章中,我们将首先罗列一些 LDAP 的基础知识(它是什么,它被用于何处以及为什么会被这样使用),然后向你展示如何使用 RHEL 7 系统来设置一个 LDAP 服务器以及配置一个客户端来使用它达到认证的目的。 + +![设置 LDAP 服务器及客户端认证](http://www.tecmint.com/wp-content/uploads/2015/06/setup-ldap-server-and-configure-client-authentication.png) + +*RHCSA 系列:设置 LDAP 服务器及客户端认证 – Part 14* + +正如你将看到的那样,关于认证,还存在其他可能的应用场景,但在这篇指南中,我们将只关注基于 LDAP 的认证。另外,请记住,由于这个话题的广泛性,在这里我们将只涵盖它的基础知识,但你可以参考位于总结部分中列出的文档,以此来了解更加深入的细节。 + +基于相同的原因,你将注意到:为了简洁起见,我已经决定省略了几个位于 man 页中 LDAP 工具的参考,但相应命令的解释是近在咫尺的(例如,输入 man ldapadd)。 + +那还是让我们开始吧。 + +**我们的测试环境** + +我们的测试环境包含两台 RHEL 7机器: + + Server: 192.168.0.18. FQDN: rhel7.mydomain.com + Client: 192.168.0.20. FQDN: ldapclient.mydomain.com + +如若你想,你可以使用在 [RHCSA 系列(十二): 使用 Kickstart 完成 RHEL 7 的自动化安装][1] 中使用 Kickstart 安装的机子来作为客户端。 + +#### LDAP 是什么? #### + +LDAP 代表轻量级目录访问协议(Lightweight Directory Access Protocol),并包含在一系列协议之中,这些协议允许一个客户端通过网络去获取集中存储的信息(例如所登录的 shell 的路径,家目录的绝对路径,或者其他典型的系统用户信息),而这些信息可以从不同的地方访问到或被很多终端用户获取到(另一个例子是含有某个公司所有雇员的家庭地址和电话号码的目录)。 + +对于那些被赋予了权限可以使用这些信息的人来说,将这些信息进行集中管理意味着可以更容易地维护和获取。 + +下面的图表提供了一个简化了的关于 LDAP 的示意图,在下面将会进行更多的描述: + +![LDAP 示意图](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Diagram.png) + +*LDAP 示意图* + +下面是对上面示意图的一个详细解释。 + +- 在一个 LDAP 目录中,一个条目(entry)代表一个独立单元或信息,被所谓的 Distinguished Name(DN,区别名) 唯一识别。 +- 一个属性(attribute)是一些与某个条目相关的信息(例如地址,有效的联系电话号码和邮箱地址)。 +- 每个属性被分配有一个或多个值(value),这些值被包含在一个以空格为分隔符的列表中。每个条目中那个唯一的值被称为一个 Relative Distinguished Name(RDN,相对区别名)。 + +接下来,就让我们进入到有关服务器和客户端安装的内容。 + +### 安装和配置一个 LDAP 服务器和客户端 ### + +在 RHEL 7 中, LDAP 由 OpenLDAP 实现。为了安装服务器和客户端,分别使用下面的命令: + + # yum update && yum install openldap openldap-clients openldap-servers + # yum update && yum install openldap openldap-clients nss-pam-ldapd + +一旦安装完成,我们还需要关注一些事情。除非显示地提示,下面的步骤都只在服务器上执行: + +**1. 在服务器和客户端上,为了确保 SELinux 不会妨碍挡道,长久地开启下列的布尔值:** + + # setsebool -P allow_ypbind=0 authlogin_nsswitch_use_ldap=0 + +其中 `allow_ypbind` 为基于 LDAP 的认证所需要,而 `authlogin_nsswitch_use_ldap`则可能会被某些应用所需要。 + +**2. 开启并启动服务:** + + # systemctl enable slapd.service + # systemctl start slapd.service + +记住你也可以使用 [systemctl][2] 来禁用,重启或停止服务: + + # systemctl disable slapd.service + # systemctl restart slapd.service + # systemctl stop slapd.service + +**3. 由于 slapd 服务是由 ldap 用户来运行的(你可以使用 `ps -e -o pid,uname,comm | grep slapd` 来验证),为了使得服务器能够更改由管理工具创建的条目,该用户应该有目录 `/var/lib/ldap` 的所有权,而这些管理工具仅可以由 root 用户来运行(紧接着有更多这方面的内容)。** + +在递归地更改这个目录的所有权之前,将 slapd 的示例数据库配置文件复制进这个目录: + + # cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG + # chown -R ldap:ldap /var/lib/ldap + +**4. 设置一个 OpenLDAP 管理用户并设置密码:** + + # slappasswd + +正如下一幅图所展示的那样: + +![设置 LDAP 管理密码](http://www.tecmint.com/wp-content/uploads/2015/06/Set-LDAP-Admin-Password.png) + +*设置 LDAP 管理密码* + +然后以下面的内容创建一个 LDIF 文件(`ldaprootpasswd.ldif`): + + dn: olcDatabase={0}config,cn=config + changetype: modify + add: olcRootPW + olcRootPW: {SSHA}PASSWORD + +其中: + +- PASSWORD 是先前得到的经过哈希处理的字符串。 +- cn=config 指的是全局配置选项。 +- olcDatabase 指的是一个特定的数据库实例的名称,并且通常可以在 `/etc/openldap/slapd.d/cn=config` 目录中发现。 + +根据上面提供的理论背景,`ldaprootpasswd.ldif` 文件将添加一个条目到 LDAP 目录中。在那个条目中,每一行代表一个属性键值对(其中 dn,changetype,add 和 olcRootPW 为属性,每个冒号右边的字符串为相应的键值)。 + +随着我们的进一步深入,请记住上面的这些,并注意到在这篇文章的余下部分,我们使用相同的 Common Names(通用名) `(cn=)`,而这些余下的步骤中的每一步都将与其上一步相关。 + +**5. 现在,通过特别指定相对于 ldap 服务的 URI ,添加相应的 LDAP 条目,其中只有 protocol/host/port 这几个域被允许使用。** + + # ldapadd -H ldapi:/// -f ldaprootpasswd.ldif + +上面命令的输出应该与下面的图像相似: + +![LDAP 配置](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Configuration.png) + +*LDAP 配置* + +接着从 `/etc/openldap/schema` 目录导入一个基本的 LDAP 定义: + + # for def in cosine.ldif nis.ldif inetorgperson.ldif; do ldapadd -H ldapi:/// -f /etc/openldap/schema/$def; done + +![LDAP 定义](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Definitions.png) + +*LDAP 定义* + +**6. 让 LDAP 在它的数据库中使用你的域名。** + +以下面的内容创建另一个 LDIF 文件,我们称之为 `ldapdomain.ldif`, 然后酌情替换这个文件中的域名(在域名部分(Domain Component) dc=) 和密码: + + dn: olcDatabase={1}monitor,cn=config + changetype: modify + replace: olcAccess + olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" + read by dn.base="cn=Manager,dc=mydomain,dc=com" read by * none + + dn: olcDatabase={2}hdb,cn=config + changetype: modify + replace: olcSuffix + olcSuffix: dc=mydomain,dc=com + + dn: olcDatabase={2}hdb,cn=config + changetype: modify + replace: olcRootDN + olcRootDN: cn=Manager,dc=mydomain,dc=com + + dn: olcDatabase={2}hdb,cn=config + changetype: modify + add: olcRootPW + olcRootPW: {SSHA}PASSWORD + + dn: olcDatabase={2}hdb,cn=config + changetype: modify + add: olcAccess + olcAccess: {0}to attrs=userPassword,shadowLastChange by + dn="cn=Manager,dc=mydomain,dc=com" write by anonymous auth by self write by * none + olcAccess: {1}to dn.base="" by * read + olcAccess: {2}to * by dn="cn=Manager,dc=mydomain,dc=com" write by * read + +接着使用下面的命令来加载: + + # ldapmodify -H ldapi:/// -f ldapdomain.ldif + +![LDAP 域名配置](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Domain-Configuration.png) + +*LDAP 域名配置* + +**7. 现在,该是添加一些条目到我们的 LDAP 目录的时候了。在下面的文件中,属性和键值由一个冒号`(:)` 所分隔,这个文件我们将命名为 `baseldapdomain.ldif`:** + + dn: dc=mydomain,dc=com + objectClass: top + objectClass: dcObject + objectclass: organization + o: mydomain com + dc: mydomain + + dn: cn=Manager,dc=mydomain,dc=com + objectClass: organizationalRole + cn: Manager + description: Directory Manager + + dn: ou=People,dc=mydomain,dc=com + objectClass: organizationalUnit + ou: People + + dn: ou=Group,dc=mydomain,dc=com + objectClass: organizationalUnit + ou: Group + +添加条目到 LDAP 目录中: + + # ldapadd -x -D cn=Manager,dc=mydomain,dc=com -W -f baseldapdomain.ldif + +![添加 LDAP 域名,属性和键值](http://www.tecmint.com/wp-content/uploads/2015/06/Add-LDAP-Domain-Configuration.png) + +*添加 LDAP 域名,属性和键值* + +**8. 创建一个名为 ldapuser 的 LDAP 用户(`adduser ldapuser`),然后在`ldapgroup.ldif` 中为一个 LDAP 组创建定义。** + + # adduser ldapuser + # vi ldapgroup.ldif + +添加下面的内容: + + dn: cn=Manager,ou=Group,dc=mydomain,dc=com + objectClass: top + objectClass: posixGroup + gidNumber: 1004 + +其中 gidNumber 是 ldapuser 在 `/etc/group` 中的 GID,然后加载这个文件: + + # ldapadd -x -W -D "cn=Manager,dc=mydomain,dc=com" -f ldapgroup.ldif + +**9. 为用户 ldapuser 添加一个带有定义的 LDIF 文件(`ldapuser.ldif`):** + + dn: uid=ldapuser,ou=People,dc=mydomain,dc=com + objectClass: top + objectClass: account + objectClass: posixAccount + objectClass: shadowAccount + cn: ldapuser + uid: ldapuser + uidNumber: 1004 + gidNumber: 1004 + homeDirectory: /home/ldapuser + userPassword: {SSHA}fiN0YqzbDuDI0Fpqq9UudWmjZQY28S3M + loginShell: /bin/bash + gecos: ldapuser + shadowLastChange: 0 + shadowMax: 0 + shadowWarning: 0 + +并加载它: + + # ldapadd -x -D cn=Manager,dc=mydomain,dc=com -W -f ldapuser.ldif + +![LDAP 用户配置](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-User-Configuration.png) + +*LDAP 用户配置* + +相似地,你可以删除你刚刚创建的用户条目: + + # ldapdelete -x -W -D cn=Manager,dc=mydomain,dc=com "uid=ldapuser,ou=People,dc=mydomain,dc=com" + +**10. 允许有关 ldap 的通信通过防火墙:** + + # firewall-cmd --add-service=ldap + +**11. 最后,但并非最不重要的是使用 LDAP 开启客户端的认证。** + +为了在最后一步中对我们有所帮助,我们将使用 authconfig 工具(一个配置系统认证资源的界面)。 + +使用下面的命令,在通过 LDAP 服务器认证成功后,假如请求的用户的家目录不存在,则将会被创建: + + # authconfig --enableldap --enableldapauth --ldapserver=rhel7.mydomain.com --ldapbasedn="dc=mydomain,dc=com" --enablemkhomedir --update + +![LDAP 客户端认证](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Client-Configuration.png) + +*LDAP 客户端认证* + +### 总结 ### + +在这篇文章中,我们已经解释了如何利用一个 LDAP 服务器来设置基本的认证。若想对当前这个指南里描述的设置进行更深入的配置,请参考位于 RHEL 系统管理员指南里的 [第 13 章 – LDAP 的配置][3],并特别注意使用 TLS 来进行安全设定。 + +请随意使用下面的评论框来留下你的提问。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/setup-ldap-server-and-configure-client-authentication/ + +作者:[Gabriel Cánepa][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://linux.cn/article-6335-1.html +[2]:http://www.tecmint.com/manage-services-using-systemd-and-systemctl-in-linux/ +[3]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Directory_Servers.html diff --git a/published/RHCSA Series/RHCSA Series--Part 15--Essentials of Virtualization and Guest Administration with KVM.md b/published/RHCSA Series/RHCSA Series--Part 15--Essentials of Virtualization and Guest Administration with KVM.md new file mode 100644 index 0000000000..03ea45452e --- /dev/null +++ b/published/RHCSA Series/RHCSA Series--Part 15--Essentials of Virtualization and Guest Administration with KVM.md @@ -0,0 +1,193 @@ +RHCSA 系列(十五): 虚拟化基础和使用 KVM 进行虚拟机管理 +================================================================================ + +假如你在词典中查一下单词 “虚拟化(virtualize)”,你将会发现它的意思是 “创造某些事物的一个虚拟物(而非真实的)”。在计算机行业中,术语虚拟化(virtualization)指的是:在相同的物理(硬件)系统上,同时运行多个操作系统,且这几个系统相互隔离的**可能性**,而那个硬件在虚拟化架构中被称作宿主机(host)。 + +![KVM 虚拟化基础和 KVM 虚拟机管理](http://www.tecmint.com/wp-content/uploads/2015/06/RHCSA-Part15.png) + +*RHCSA 系列: 虚拟化基础和使用 KVM 进行虚拟机管理 – Part 15* + +通过使用虚拟机监视器(也被称为虚拟机管理程序(hypervisor)),虚拟机(被称为 guest)由底层的硬件来供给虚拟资源(举几个例子来说,如 CPU,RAM,存储介质,网络接口等)。 + +考虑到这一点就可以清楚地看出,虚拟化的主要优点是节约成本(在设备和网络基础设施,及维护工作等方面)和显著地减少容纳所有必要硬件所需的物理空间。 + +由于这个简单的指南不能涵盖所有的虚拟化方法,我鼓励你参考在总结部分中列出的文档,以此对这个话题做更深入的了解。 + +请记住当前文章只是用于在 RHEL 7 中用命令行工具使用 [KVM][1] (Kernel-based Virtual Machine(基于内核的虚拟机)) 学习虚拟化基础知识的一个起点,而并不是对这个话题的深入探讨。 + +### 检查硬件要求并安装软件包 ### + +为了设置虚拟化,你的 CPU 必须能够支持它。你可以使用下面的命令来查看你的系统是否满足这个要求: + + # grep -E 'svm|vmx' /proc/cpuinfo + +在下面的截图中,我们可以看到当前的系统(带有一个 AMD 的微处理器)支持虚拟化,svm 字样的存在暗示了这一点。假如我们有一个 Intel 系列的处理器,我们将会看到上面命令的结果将会出现 vmx 字样。 + +![检查 KVM 支持](http://www.tecmint.com/wp-content/uploads/2015/06/Check-KVM-Support.png) + +*检查 KVM 支持* + +另外,你需要在你宿主机的硬件(BIOS 或 UEFI)中开启虚拟化。 + +现在,安装必要的软件包: + +- qemu-kvm 是一个开源的虚拟机程序,为 KVM 虚拟机监视器提供硬件仿真,而 qemu-img 则提供了一个操纵磁盘镜像的命令行工具。 +- libvirt 包含与操作系统的虚拟化功能交互的工具。 +- libvirt-python 包含一个模块,它允许用 Python 写的应用来使用由 libvirt 提供的接口。 +- libguestfs-tools 包含各式各样的针对虚拟机的系统管理员命令行工具。 +- virt-install 包含针对虚拟机管理的其他命令行工具。 + +命令如下: + + # yum update && yum install qemu-kvm qemu-img libvirt libvirt-python libguestfs-tools virt-install + +一旦安装完成,请确保你启动并开启了 libvirtd 服务: + + # systemctl start libvirtd.service + # systemctl enable libvirtd.service + +默认情况下,每个虚拟机将只能够与放在相同的物理服务器上的虚拟机以及宿主机自身通信。要使得虚拟机能够访问位于局域网或因特网中的其他机器,我们需要像下面这样在我们的宿主机上设置一个桥接接口(比如说 br0): + +1、 添加下面的一行到我们的 NIC 主配置中(类似 `/etc/sysconfig/network-scripts/ifcfg-enp0s3` 这样的文件): + + BRIDGE=br0 + +2、 使用下面的内容(注意,你可能需要更改 IP 地址,网关地址和 DNS 信息)为 br0 创建一个配置文件(`/etc/sysconfig/network-scripts/ifcfg-br0`): + + + DEVICE=br0 + TYPE=Bridge + BOOTPROTO=static + IPADDR=192.168.0.18 + NETMASK=255.255.255.0 + GATEWAY=192.168.0.1 + NM_CONTROLLED=no + DEFROUTE=yes + PEERDNS=yes + PEERROUTES=yes + IPV4_FAILURE_FATAL=no + IPV6INIT=yes + IPV6_AUTOCONF=yes + IPV6_DEFROUTE=yes + IPV6_PEERDNS=yes + IPV6_PEERROUTES=yes + IPV6_FAILURE_FATAL=no + NAME=br0 + ONBOOT=yes + DNS1=8.8.8.8 + DNS2=8.8.4.4 + +3、 最后在文件`/etc/sysctl.conf` 中设置: + + net.ipv4.ip_forward = 1 + +来开启包转发并加载更改到当前的内核配置中: + + # sysctl -p + +注意,你可能还需要告诉 firewalld 让这类的流量应当被允许通过防火墙。假如你需要这样做,记住你可以参考这个系列的 [使用 firewalld 和 iptables 来控制网络流量][2]。 + +### 创建虚拟机镜像 ### + +默认情况下,虚拟机镜像将会被创建到 `/var/lib/libvirt/images` 中,且强烈建议你不要更改这个设定,除非你真的需要那么做且知道你在做什么,并能自己处理有关 SELinux 的设定(这个话题已经超出了本教程的讨论范畴,但你可以参考这个系列的第 13 部分 [使用 SELinux 来进行强制访问控制][3],假如你想更新你的知识的话)。 + +这意味着你需要确保你在文件系统中分配了必要的空间来容纳你的虚拟机。 + +下面的命令将使用位于 `/home/gacanepa/ISOs`目录下的 rhel-server-7.0-x86_64-dvd.iso 镜像文件和 br0 这个网桥来创建一个名为 `tecmint-virt01` 的虚拟机,它有一个虚拟 CPU,1 GB(=1024 MB)的 RAM,20 GB 的磁盘空间(由`/var/lib/libvirt/images/tecmint-virt01.img`所代表): + + + # virt-install \ + --network bridge=br0 + --name tecmint-virt01 \ + --ram=1024 \ + --vcpus=1 \ + --disk path=/var/lib/libvirt/images/tecmint-virt01.img,size=20 \ + --graphics none \ + --cdrom /home/gacanepa/ISOs/rhel-server-7.0-x86_64-dvd.iso + --extra-args="console=tty0 console=ttyS0,115200" + +假如安装文件位于一个 HTTP 服务器上,而不是存储在你磁盘中的镜像中,你必须将上面的 `-cdrom` 替换为 `-location`,并明确地指出在线存储仓库的地址。 + +至于上面的 `–graphics none` 选项,它告诉安装程序只以文本模式执行安装过程。假如你使用一个 GUI 界面和一个 VNC 窗口来访问主虚拟机控制台,则可以省略这个选项。最后,使用 `–extra-args` 参数,我们将传递内核启动参数给安装程序,以此来设置一个串行的虚拟机控制台。 + +现在,所安装的虚拟机应当可以作为一个正常的(真实的)服务来运行了。假如没有,请查看上面列出的步骤。 + +### 管理虚拟机 ### + +作为一个系统管理员,还有一些典型的管理任务需要你在虚拟机上去完成。注:下面所有的命令都需要在你的宿主机上运行: + +**1. 列出所有的虚拟机:** + + # virsh list --all + +你必须留意上面命令输出中的虚拟机 ID(尽管上面的命令还会返回虚拟机的名称和当前的状态),因为你需要它来执行有关某个虚拟机的大多数管理任务。 + +**2. 显示某个虚拟机的信息:** + + # virsh dominfo [VM Id] + +**3. 开启,重启或停止一个虚拟机操作系统:** + + # virsh start | reboot | shutdown [VM Id] + +**4. 假如网络无法连接且在宿主机上没有运行 X 服务器,可以使用下面的命令来访问虚拟机的串行控制台:** + + # virsh console [VM Id] + +**注**:这需要你添加一个串行控制台配置信息到 `/etc/grub.conf` 文件中(参考刚才创建虚拟机时传递给`-extra-args`选项的参数)。 + +**5. 修改分配的内存或虚拟 CPU:** + +首先,关闭虚拟机: + + # virsh shutdown [VM Id] + +为 RAM 编辑虚拟机的配置: + + # virsh edit [VM Id] + +然后更改 + + [内存大小,注意不要加上方括号] + +使用新的设定重启虚拟机: + + # virsh create /etc/libvirt/qemu/tecmint-virt01.xml + +最后,可以使用下面的命令来动态地改变内存的大小: + + # virsh setmem [VM Id] [内存大小,这里没有括号] + +对于 CPU,使用: + + # virsh edit [VM Id] + +然后更改 + + [CPU 数目,这里没有括号] + +至于更深入的命令和细节,请参考 RHEL 5 虚拟化指南(这个指南尽管有些陈旧,但包括了用于管理虚拟机的 virsh 命令的详尽清单)的第 26 章里的表 26.1。 + +### 总结 ### + +在这篇文章中,我们涵盖了在 RHEL 7 中如何使用 KVM 和虚拟化的一些基本概念,这个话题是一个广泛且令人着迷的话题。并且我希望它能成为你在随后阅读官方的 [RHEL 虚拟化入门][4] 和 [RHEL 虚拟化部署和管理指南][5] ,探索更高级的主题时的起点教程,并给你带来帮助。 + +另外,为了分辨或拓展这里解释的某些概念,你还可以参考先前包含在 [KVM 系列][6] 中的文章。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/kvm-virtualization-basics-and-guest-administration/ + +作者:[Gabriel Cánepa][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.linux-kvm.org/page/Main_Page +[2]:https://linux.cn/article-6315-1.html +[3]:https://linux.cn/article-6339-1.html +[4]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Getting_Started_Guide/index.html +[5]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/index.html +[6]:http://www.tecmint.com/install-and-configure-kvm-in-linux/ diff --git a/translated/talk/The history of Android/06 - The history of Android.md b/published/The history of Android/06 - The history of Android.md similarity index 61% rename from translated/talk/The history of Android/06 - The history of Android.md rename to published/The history of Android/06 - The history of Android.md index 030bb83ca8..363fd85a84 100644 --- a/translated/talk/The history of Android/06 - The history of Android.md +++ b/published/The history of Android/06 - The history of Android.md @@ -1,48 +1,48 @@ -The history of Android +安卓编年史(6) ================================================================================ ![T-Mobile G1](http://cdn.arstechnica.net/wp-content/uploads/2014/04/t-mobile_g1.jpg) -T-Mobile G1 -T-Mobile供图 + +*T-Mobile G1 [T-Mobile供图]* ### 安卓1.0——谷歌系app和实体硬件的引入 ### -到了2008年10月,安卓1.0已经准备好发布,这个系统在[T-Mobile G1][1](又以HTC Dream为人周知)上初次登台。G1进入了被iPhone 3G和[Nokia 1680 classic][2]所主宰的市场。(这些手机并列获得了2008年[销量最佳手机][3]称号,各自卖出了350万台。)G1的销量数字已难以获得,但T-Mobile宣称截至2009年4月该设备的销量突破了100万台。无论从哪方面来说这在竞争中都处于落后地位。 +到了2008年10月,安卓1.0已经准备好发布,这个系统在[T-Mobile G1][1](又以HTC Dream为人周知)上初次登台。G1进入了被iPhone 3G和[Nokia 1680 classic][2]所主宰的市场。(这些手机并列获得了2008年[销量最佳手机][3]称号,各自卖出了350万台。)G1的具体销量数字已难以获得,但T-Mobile宣称截至2009年4月该设备的销量突破了100万台。无论从哪方面来说这在竞争中都处于落后地位。 -G1拥有单核528Mhz的ARM 11处理器,一个Adreno 130的GPU,192MB内存,以及多达256MB的存储空间供给系统以及应用使用。它有一块3.2英寸,320x480分辨率的显示屏,被布置在一个含有实体全键盘的滑动结构之上。所以尽管安卓软件的确走过了很长的一段路,硬件也是的。时至今日,我们可以在厂商的一个手表中得到比这更好的参数:最新的[三星智能手表][4]拥有512MB内存以及1GHz的双核处理器。 +G1拥有单核528Mhz的ARM 11处理器,一个Adreno 130的GPU,192MB内存,以及多达256MB的存储空间提供给系统以及应用使用。它有一块3.2英寸、320x480分辨率的显示屏,被布置在一个含有实体全键盘的滑动结构之上。所以尽管安卓软件的确走过了很长的一段路,硬件也是的。时至今日,我们可以在一个厂商提供手表中得到比这更好的参数:最新的[三星智能手表][4]拥有512MB内存以及1GHz的双核处理器。 -当iPhone有着最少数量的按键的时候,G1确实完全相反的,按键几乎支持每个硬件控制。它有拨通和挂断按钮,home键,后退,以及菜单键,一个相机快门键,音量控制键,一个轨迹球,当然,还有50个键盘按钮。未来安卓设备将会慢慢离开按键多多的界面设计,几乎每部新旗舰都在减少按键的数量。 +当iPhone有着最少数量的按键的时候,G1确实完全相反的,按键几乎支持每个硬件控制。它有拨通和挂断按钮,home键,后退,以及菜单键,一个相机快门键,音量控制键,一个轨迹球,当然,还有50个键盘按键。未来安卓设备将会慢慢离开按键多多的界面设计,几乎每部新旗舰都在减少按键的数量。 但是这是第一次,人们见到了运行在实机上的安卓,而不是跑在一个令人沮丧的慢吞吞的模拟器上。安卓1.0没有iPhone那样顺滑流畅,闪亮耀眼,或拥有那么多的新闻报道。它也不像Windows Mobile 6.5那样才华横溢。但这仍然是个好的开始。 ![安卓1.0和0.9的默认应用列表。](http://cdn.arstechnica.net/wp-content/uploads/2013/12/apps.png) -安卓1.0和0.9的默认应用列表。 -Ron Amadeo供图 -安卓1.0的核心与两个月前发布的beta版本相比看起来并没有什么引人注目的不同,但消费者产品带来了不少应用,包括一套完整的谷歌系应用。日历,电子邮件,Gmail,即时通讯,市场,设置,语音拨号,以及YouTube都是全新登场。那时候,音乐是智能手机上占据主宰地位的媒体类型,其王者是iTunes音乐商店。谷歌没有自家的音乐服务,所以它选择了亚马逊并绑定了亚马逊MP3商店。 +*安卓1.0和0.9的默认应用列表。[Ron Amadeo供图]* -安卓最重要的新增是谷歌商店的首次登场,叫做“安卓市场Beta”。与此同时大部分公司满足于将它们的软件目录称作一些不同的“应用商店”——意思是一个出售应用的商店,并且只出售应用——谷歌明显有着更大的野心。它搭配了一个更为通用的名字,“安卓市场”。这个名字的想法是安卓市场不仅仅拥有应用,还拥有一切你的安卓设备所需要的东西。 +安卓1.0的核心与两个月前发布的beta版本相比看起来并没有什么引人注目的不同,但这个消费产品带来了不少应用,包括一套完整的谷歌系应用。日历,电子邮件,Gmail,即时通讯,市场,设置,语音拨号,以及YouTube都是全新登场。那时候,音乐是智能手机上占据主宰地位的媒体类型,其王者是iTunes音乐商店。谷歌没有自家的音乐服务,所以它选择了亚马逊并绑定了亚马逊MP3商店。 + +安卓最重要的新增内容是首次登场的谷歌商店,叫做“安卓市场Beta”。与此同时大部分公司满足于将它们的软件目录称作各种“应用商店”——意思是一个出售应用的商店,并且只出售应用——谷歌明显有着更大的野心。它搭配了一个更为通用的名字,“安卓市场”。这个名字的想法是安卓市场不仅仅拥有应用,还拥有一切你的安卓设备所需要的东西。 ![第一个安卓市场客户端。截图展示了主页,“我的下载”,一个应用页面,以及一个应用权限页面。](http://cdn.arstechnica.net/wp-content/uploads/2013/12/market.png) -第一个安卓市场客户端。截图展示了主页,“我的下载”,一个应用页面,以及一个应用权限页面。 -[Google][5]供图 -那时候,安卓市场只提供应用和游戏,开发者们甚至还不能为它们收费。苹果的App Store相对与安卓市场有4个月的先发优势,但是谷歌的主要差异化在于安卓的商店几乎是完全开放的。在iPhone上,应用受制于苹果的审查,必须遵循设计和技术指南。潜在的新应用不允许在功能上复制已有应用。在安卓市场,开发者可以自由地做任何想做的,包括开发替代已有的应用。控制的缺失会转变成祝福同时也是诅咒。它允许开发者革新已有的功能,但同时意味着甚至是毫无价值的垃圾应用也被允许进入市场。 +*第一个安卓市场客户端。截图展示了主页,“我的下载”,一个应用页面,以及一个应用权限页面。[[Google][5]供图]* -现在,这个客户端是又一个不再能够和谷歌服务器通讯的应用。幸运的是,它也是在因特网上被[真正记录][6]的为数不多的早期安卓应用之一。主页提供了通向一般区域的连接,像应用,游戏,搜索,以及下载,顶部有横向滚动显示的特色应用图标。搜索结果和“我的下载”页面以滚动列表的方式显示应用,显示应用名,开发者,费用(在那时都是免费的),以及评分。单独的应用页面展示了一个简短的描述,安装数,用户评论和评分,以及最重要的安装按钮。早期的安卓市场不支持图片,开发者唯一能使用的区域是应用描述,还有着500字的限制。这使得类似维护一个更新日志变的十分困难,因为只有描述的位置可以供其使用。 +那时候,安卓市场只提供应用和游戏,开发者们甚至还不能为它们收费。苹果的App Store相对与安卓市场有4个月的先发优势,但是谷歌的主要差异化在于安卓的商店几乎是完全开放的。在iPhone上,应用受制于苹果的审查,必须遵循设计和技术指南。潜在的新应用不允许在功能上复制已有应用。在安卓市场,开发者可以自由地做任何想做的,包括开发替代已有的应用。控制的缺失导致福祸相依。它允许开发者革新已有的功能,但同时意味着甚至是毫无价值的垃圾应用也被允许进入市场。 + +时至今日,这个安卓市场的客户端是又一个不再能够和谷歌服务器通讯的应用。幸运的是,它也是在因特网上被[真正记录][6]的为数不多的早期安卓应用之一。主页提供了通向一般区域的连接,像应用,游戏,搜索,以及下载,顶部有横向滚动显示的特色应用图标。搜索结果和“我的下载”页面以滚动列表的方式显示应用,显示应用名,开发者,费用(在那时都是免费的),以及评分。单独的应用页面展示了一个简短的描述,安装数,用户评论和评分,以及最重要的安装按钮。早期的安卓市场不支持图片,开发者唯一能使用的区域是应用描述,还有着500字的限制。这使得类似维护一个更新日志变的十分困难,因为只有描述的位置可以供其使用。 就在安装之前,安卓市场显示了应用所需要的权限。这是苹果直至2012年之前都避免做的,那年一个iOS应用被发现在用户不知情的情况下[将完整的通讯录上传][7]到云端。权限显示给出了一个完整的应用用到的权限列表,尽管这个版本强迫用户同意应用权限。界面有个“OK”按钮,但是除了后退按钮没有办法取消。 ![Gmail展示收件箱,打开菜单的收件箱。 ](http://cdn.arstechnica.net/wp-content/uploads/2013/12/gmail1.01.png) -Gmail展示收件箱,打开菜单的收件箱。 -Ron Amadeo供图 -下一个重要的应用也许就是Gmail。大多数基本的功能此时已经准备好了。未读邮件以加粗显示,标签是个有颜色的标记。在收件箱中每封独立邮件显示着主题,发件人,以及一个会话中的回复数。Gmail加星标志也在这里——快速点击即可给邮件加星或取消。一如往常,对于早期版本的安卓,菜单里有收件箱视图应有的所有按钮。但是,一旦打开了一封邮件,界面看起来就更加的现代了,“回复”和“转发”按钮永久固定在了屏幕底部。各个独立回复可以点击它们来展开和收缩。 +*Gmail展示收件箱,打开菜单的收件箱。[Ron Amadeo供图]* + +下一个重要的应用也许就是Gmail。大多数基本的功能此时已经准备好了。未读邮件以加粗显示,标签是个有颜色的标记。在收件箱中每封独立邮件显示着主题,发件人,以及一个会话中的回复数。Gmail加星标志也在这里——快速点击即可给邮件加星或取消。一如往常,对于早期版本的安卓,菜单里有收件箱视图应有的所有按钮。但是,一旦打开了一封邮件,界面看起来就更加的现代了,“回复”和“转发”按钮永久固定在了屏幕底部。单独回复可以点击它们来展开和收缩。 圆角,阴影,以及气泡图标给了整个应用“卡通”的外表,但是这是个好的开始。安卓的功能第一哲学真正从此开始:Gmail支持标签,邮件会话,搜索,以及邮件推送。 ![Gmail在安卓1.0的标签视图,写邮件界面,以及设置。](http://cdn.arstechnica.net/wp-content/uploads/2013/12/gmail3.png) -Gmail在安卓1.0的标签视图,写邮件界面,以及设置。 -Ron Amadeo供图 + +*Gmail在安卓1.0的标签视图,写邮件界面,以及设置。[Ron Amadeo供图]* 但是如果你认为Gmail很丑,电子邮件应用又拉低了下限。它没有分离的收件箱或文件夹视图——所有东西都糊在一个界面。应用呈现给你一个文件夹列表,点击一个文件夹会以内嵌的方式展开内容。未读邮件左侧有条绿色的线指示,这就是电子邮件应用的界面。这个应用支持IMAP和POP3,但是没有Exchange。 @@ -58,7 +58,7 @@ Ron Amadeo供图 via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/6/ -译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) +译者:[alim0x](https://github.com/alim0x) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/talk/The history of Android/07 - The history of Android.md b/published/The history of Android/07 - The history of Android.md similarity index 51% rename from translated/talk/The history of Android/07 - The history of Android.md rename to published/The history of Android/07 - The history of Android.md index 583e847d6e..9777963d63 100644 --- a/translated/talk/The history of Android/07 - The history of Android.md +++ b/published/The history of Android/07 - The history of Android.md @@ -1,90 +1,90 @@ -安卓编年史 +安卓编年史(7) ================================================================================ ![电子邮件应用的所有界面。前两张截图展示了标签/收件箱结合的视图,最后一张截图展示了一封邮件。](http://cdn.arstechnica.net/wp-content/uploads/2014/01/email2lol.png) -电子邮件应用的所有界面。前两张截图展示了标签/收件箱结合的视图,最后一张截图展示了一封邮件。 -Ron Amadeo供图 -邮件视图是——令人惊讶的!——白色。安卓的电子邮件应用从历史角度来说算是个打了折扣的Gmail应用,你可以在这里看到紧密的联系。读邮件以及写邮件视图几乎没有任何修改地就从Gmail那里直接取过来使用。 +*电子邮件应用的所有界面。前两张截图展示了标签/收件箱结合的视图,最后一张截图展示了一封邮件。 [Ron Amadeo供图]* + +邮件视图是——令人惊讶的!居然是白色。安卓的电子邮件应用从历史角度来说算是个打了折扣的Gmail应用,你可以在这里看到紧密的联系。读邮件以及写邮件视图几乎没有任何修改地就从Gmail那里直接取过来使用。 ![即时通讯应用。截图展示了服务提供商选择界面,朋友列表,以及一个对话。](http://cdn.arstechnica.net/wp-content/uploads/2013/12/IM2.png) -即时通讯应用。截图展示了服务提供商选择界面,朋友列表,以及一个对话。 -Ron Amadeo供图 -在Google Hangouts之前,甚至是Google Talk之前,就有“IM”——安卓1.0带来的唯一一个即时通讯客户端。令人惊奇的是,它支持多种IM服务:用户可以从AIM,Google Talk,Windows Live Messenger以及Yahoo中挑选。还记得操作系统开发者什么时候关心过互通性吗? +*即时通讯应用。截图展示了服务提供商选择界面,朋友列表,以及一个对话。[Ron Amadeo供图]* -朋友列表是聊天中带有白色聊天气泡的黑色背景界面。状态用一个带颜色的圆形来指示,右侧的小安卓机器人指示出某人正在使用移动设备。IM应用相比Google Hangouts远比它有沟通性,这真是十分神奇的。绿色代表着某人正在使用设备并且已经登录,黄色代表着他们登录了但处于空闲状态,红色代表他们手动设置状态为忙,不想被打扰,灰色表示离线。现在Hangouts只显示用户是否打开了应用。 +在Google Hangouts之前,甚至是Google Talk之前,就有了“IM”——安卓1.0带来的唯一一个即时通讯客户端。令人惊奇的是,它支持多种IM服务:用户可以从AIM,Google Talk,Windows Live Messenger以及Yahoo中挑选。还记得操作系统开发者什么时候关心过互通性吗? + +朋友列表是黑色背景界面,如果在聊天中则带有白色聊天气泡。状态用一个带颜色的圆形来指示,右侧的小安卓机器人指示出某人正在使用移动设备。IM应用相比Google Hangouts远比它有沟通性,这真是十分神奇的。绿色代表着某人正在使用设备并且已经登录,黄色代表着他们登录了但处于空闲状态,红色代表他们手动设置状态为忙,不想被打扰,灰色表示离线。现在Hangouts只显示用户是否打开了应用。 聊天对话界面明显基于信息应用,聊天的背景从白色和蓝色被换成了白色和绿色。但是没人更改信息输入框的颜色,所以加上橙色的高亮效果,界面共使用了白色,绿色,蓝色和橙色。 ![安卓1.0上的YouTube。截图展示了主界面,打开菜单的主界面,分类界面,视频播放界面。](http://cdn.arstechnica.net/wp-content/uploads/2013/12/yt5000.png) -安卓1.0上的YouTube。截图展示了主界面,打开菜单的主界面,分类界面,视频播放界面。 -Ron Amadeo供图 -YouTube仅仅以G1的320p屏幕和3G网络速度可能不会有今天这样的移动意识,但谷歌的视频服务在安卓1.0上就被置入发布了。主界面看起来就像是安卓市场调整过的版本,顶部带有一个横向滚动选择部分,下面有垂直滚动分类列表。谷歌的一些分类选择还真是奇怪:“最热门”和“最多观看”有什么区别? +*安卓1.0上的YouTube。截图展示了主界面,打开菜单的主界面,分类界面,视频播放界面。[Ron Amadeo供图]* -一个谷歌没有意识到YouTube最终能达到多庞大的标志——有一个视频分类是“最近更新”。在今天,每分钟有[100小时时长的视频][1]上传到Youtube上,如果这个分类能正常工作的话,它会是一个快速滚动的视频列表,快到以至于变为一片无法阅读的模糊。 +以G1的320p屏幕和3G网络速度,YouTube可能不会有今天这样的手机上的表现,但谷歌的视频服务在安卓1.0上就被置入发布了。主界面看起来就像是安卓市场调整过的版本,顶部带有一个横向滚动选择部分,下面有垂直滚动分类列表。谷歌的一些分类选择还真是奇怪:“最热门”和“最多观看”有什么区别? -菜单含有搜索,喜爱,分类,设置。设置(没有图片)是有史以来最简陋的,只有个清除搜索历史的选项。分类都是一样的平淡,仅仅是个黑色的文本列表。 +这是一个谷歌没有意识到YouTube最终能达到多庞大的标志——有一个视频分类是“最近更新”。在今天,每分钟有[100小时时长的视频][1]上传到Youtube上,如果这个分类能正常工作的话,它会是一个快速滚动的视频列表,快到以至于变为一片无法阅读的模糊。 + +菜单含有搜索,喜爱,分类,设置。设置(没有该图片)是有史以来最简陋的,只有个清除搜索历史的选项。分类都是一样的平淡,仅仅是个黑色的文本列表。 最后一张截图展示了视频播放界面,只支持横屏模式。尽管自动隐藏的播放控制有个进度条,但它还是很奇怪地包含了后退和前进按钮。 ![YouTube的视频菜单,描述页面,评论。](http://cdn.arstechnica.net/wp-content/uploads/2013/12/yt3.png) -YouTube的视频菜单,描述页面,评论。 -Ron Amadeo供图 -每个视频的更多选项可以通过点击菜单按钮来打开。在这里你可以把视频标记为喜爱,查看详细信息,以及阅读评论。所有的这些界面,和视频播放一样,是锁定横屏模式的。 +*YouTube的视频菜单,描述页面,评论。[Ron Amadeo供图]* + +每个视频的更多选项可以通过点击菜单按钮来打开。在这里你可以把视频标记为“喜爱”,查看详细信息,以及阅读评论。所有的这些界面,和视频播放一样,是锁定横屏模式的。 然而“共享”不会打开一个对话框,它只是向Gmail邮件中加入了视频的链接。想要把链接通过短信或即时消息发送给别人是不可能的。你可以阅读评论,但是没办法评价他们或发表自己的评论。你同样无法给视频评分或赞。 ![相机应用的拍照界面,菜单,照片浏览模式。](http://cdn.arstechnica.net/wp-content/uploads/2013/12/camera.png) -相机应用的拍照界面,菜单,照片浏览模式。 -Ron Amadeo供图 -在实体机上跑上真正的安卓意味着相机功能可以正常运作,即便那里没什么太多可关注的。左边的黑色方块是相机的界面,原本应该显示取景器图像,但SDK的截图工具没办法捕捉下来。G1有个硬件实体的拍照键(还记得吗?),所以相机没必要有个屏幕上的快门键。相机没有曝光,白平衡,或HDR设置——你可以拍摄照片,仅此而已。 +*相机应用的拍照界面,菜单,照片浏览模式。[Ron Amadeo供图]* + +在实体机上跑真正的安卓意味着相机功能可以正常运作,即便那里没什么太多可关注的。左边的黑色方块是相机的界面,原本应该显示取景器图像,但SDK的截图工具没办法捕捉下来。G1有个硬件实体的拍照键(还记得吗?),所以相机没必要有个屏幕上的快门键。相机没有曝光,白平衡,或HDR设置——你可以拍摄照片,仅此而已。 菜单按钮显示两个选项:跳转到相册应用和带有两个选项的设置界面。第一个设置选项是是否给照片加上地理标记,第二个是在每次拍摄后显示提示菜单,你可以在上面右边看到截图。同样的,你目前还只能拍照——还不支持视频拍摄。 ![日历的月视图,打开菜单的周视图,日视图,以及日程。](http://cdn.arstechnica.net/wp-content/uploads/2013/12/calviews.png) -日历的月视图,打开菜单的周视图,日视图,以及日程。 -Ron Amadeo供图 + +*日历的月视图,打开菜单的周视图,日视图,以及日程。[Ron Amadeo供图]* 就像这个时期的大多数应用一样,日历的主命令界面是菜单。菜单用来切换视图,添加新事件,导航至当天,选择要显示的日程,以及打开设置。菜单扮演着每个单独按钮的入口的作用。 月视图不能显示约会事件的文字。每个日期旁边有个侧边,约会会显示为侧边上的绿色部分,通过位置来表示约会是在一天中的什么时候。周视图同样不能显示预约文字——G1的320×480的显示屏像素还不够密——所以你会在日历中看到一个带有颜色指示条的白块。唯一一个显示文字的是日程和日视图。你可以用滑动来切换日期——左右滑动切换周和日,上下滑动切换月份和日程。 ![设置主界面,无线设置,关于页面的底部。](http://cdn.arstechnica.net/wp-content/uploads/2013/12/settings.png) -设置主界面,无线设置,关于页面的底部。 -Ron Amadeo供图 -安卓1.0最终带来了设置界面。这个界面是个带有文字的黑白界面,粗略地分为各个部分。每个列表项边的下箭头让人误以为点击它会展开折叠的更多东西,但是触摸列表项的任何位置只会加载下一屏幕。所有的界面看起来确实无趣,都差不多一样,但是嘿,这可是设置啊。 +*设置主界面,无线设置,关于页面的底部。[Ron Amadeo供图]* -任何带有开/关状态的选项都使用了卡通风的复选框。安卓1.0最初的复选框真是奇怪——就算是在“未选中”状态时,它们还是有个灰色的勾选标记在里面。安卓把勾选标记当作了灯泡,打开时亮起来,关闭的时候变得黯淡,但这不是复选框的工作方式。然而我们最终还是见到了“关于”页面。安卓1.0运行Linux内核2.6.25版本。 +安卓1.0最终带来了设置界面。这个界面是个带有文字的黑白界面,粗略地分为各个部分。每个列表项边上的下箭头让人误以为点击它会展开折叠的更多东西,但是触摸列表项的任何位置只会加载下一屏幕。所有的界面看起来确实无趣,都差不多一样,但是嘿,这可是设置啊。 + +任何带有开/关状态的选项都使用了卡通风格的复选框。安卓1.0最初的复选框真是奇怪——就算是在“未选中”状态时,它们还是有个灰色的勾选标记在里面。安卓把勾选标记当作了灯泡,打开时亮起来,关闭的时候变得黯淡,但这不是复选框的工作方式。然而我们最终还是见到了“关于”页面。安卓1.0运行Linux内核2.6.25版本。 设置界面意味着我们终于可以打开安全设置并更改锁屏。安卓1.0只有两种风格,安卓0.9那样的灰色方形锁屏,以及需要你在9个点组成的网格中画出图案的图形解锁。像这样的滑动图案相比PIN码更加容易记忆和输入,尽管它没有增加多少安全性。 ![语音拨号,图形锁屏,电池低电量警告,时间设置。](http://cdn.arstechnica.net/wp-content/uploads/2013/12/grabbag.png) -语音拨号,图形锁屏,电池低电量警告,时间设置。 -Ron Amadeo供图 -语音功能和语音拨号一同来到了1.0。这个特性以各种功能实现在AOSP徘徊了一段时间,然而它是一个简单的拨打号码和联系人的语音命令应用。语音拨号是个和谷歌未来的语音产品完全无关的应用,但是,它的工作方式和非智能机上的语音拨号一样。 +*语音拨号,图形锁屏,电池低电量警告,时间设置。[Ron Amadeo供图]* + +语音功能和语音拨号一同来到了1.0。这个特性以各种功能实现在AOSP徘徊了一段时间,然而它是一个简单的拨打号码和联系人的语音命令应用。语音拨号是个和谷歌未来的语音产品完全无关的应用,它的工作方式和非智能机上的语音拨号一样。 关于最后一个值得注意的,当电池电量低于百分之十五的时候会触发低电量弹窗。这是个有趣的图案,它把电源线错误的一端插入手机。谷歌,那可不是(现在依然不是)手机应该有的充电方式。 -安卓1.0是个伟大的开头,但是功能上仍然有许多缺失。实体键盘和大量硬件按钮被强制要求配备,因为不带有十字方向键或轨迹球的安卓设备依然不被允许销售。另外,基本的智能手机功能比如自动旋转依然缺失。内置应用不可能像今天这样通过安卓市场来更新。所有的谷歌系应用和系统交织在一起。如果谷歌想要升级一个单独的应用,需要通过运营商推送整个系统的更新。安卓依然还有许多工作要做。 +安卓1.0是个伟大的开端,但是功能上仍然有许多缺失。强制配备了实体键盘和大量硬件按钮,因为不带有十字方向键或轨迹球的安卓设备依然不被允许销售。另外,基本的智能手机功能比如自动旋转依然缺失。内置应用不可能像今天这样通过安卓市场来更新。所有的谷歌系应用和系统交织在一起。如果谷歌想要升级一个单独的应用,需要通过运营商推送整个系统的更新。安卓依然还有许多工作要做。 ### 安卓1.1——第一个真正的增量更新 ### ![安卓1.1的所有新特性:语音搜索,安卓市场付费应用支持,谷歌纵横,设置中的新“系统更新”选项。](http://cdn.arstechnica.net/wp-content/uploads/2013/12/11.png) -安卓1.1的所有新特性:语音搜索,安卓市场付费应用支持,谷歌纵横,设置中的新“系统更新”选项。 -Ron Amadeo供图 -安卓1.0发布四个半月后,2009年2月,安卓在安卓1.1中得到了它的第一个公开更新。系统方面没有太多变化,谷歌向1.1中添加新东西现如今也都已被关闭。谷歌语音搜索是安卓向云端语音搜索的第一个突击,它在应用抽屉里有自己的图标。尽管这个应用已经不能与谷歌服务器通讯,你可以[在iPhone上][2]看到它以前是怎么工作的。它还没有语音操作,但你可以说出想要搜索的,结果会显示在一个简单的谷歌搜索中。 +*安卓1.1的所有新特性:语音搜索,安卓市场付费应用支持,谷歌纵横,设置中的新“系统更新”选项。[Ron Amadeo供图]* -安卓市场添加了对付费应用的支持,但是就像beta客户端中一样,这个版本的安卓市场不再能够连接Google Play服务器。我们最多能够看到分类界面,你可以在免费应用,付费应用和全部应用中选择。 +安卓1.0发布四个半月后,2009年2月,安卓在安卓1.1中得到了它的第一个公开更新。系统方面没有太多变化,谷歌向1.1中添加的新东西现如今也都已被关闭。谷歌语音搜索是安卓向云端语音搜索的第一个突击,它在应用抽屉里有自己的图标。尽管这个应用已经不能与谷歌服务器通讯,你可以[在iPhone上][2]看到它以前是怎么工作的。它还没有语音操作,但你可以说出想要搜索的,结果会显示在一个简单的谷歌搜索中。 + +安卓市场添加了对付费应用的支持,但是就像beta客户端中一样,这个版本的安卓市场已经不能连接Google Play服务器。我们最多能够看到分类界面,你可以在免费应用、付费应用和全部应用中选择。 地图添加了[谷歌纵横][3],一个向朋友分享自己位置的方法。纵横在几个月前为了支持Google+而被关闭并且不再能够工作。地图菜单里有个纵横的选项,但点击它现在只会打开一个带载入中圆圈的画面,并永远停留在这里。 -安卓世界的系统更新来得更加迅速——或者至少是一条在运营商和OEM推送之前获得更新的途径——谷歌向“关于手机”界面添加了检查系统更新按钮。 +安卓世界的系统更新来得更加迅速——或者至少是一条在运营商和OEM推送之前获得更新的途径——谷歌也在“关于手机”界面添加了检查系统更新按钮。 ---------- @@ -98,7 +98,7 @@ Ron Amadeo供图 via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/7/ -译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) +译者:[alim0x](https://github.com/alim0x) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/sign.md b/sign.md index 1c413aba40..960d450a96 100644 --- a/sign.md +++ b/sign.md @@ -19,4 +19,4 @@ via:来源链接 [6]: [7]: [8]: -[9]: \ No newline at end of file +[9]: diff --git a/sources/share/20150824 Great Open Source Collaborative Editing Tools.md b/sources/share/20150824 Great Open Source Collaborative Editing Tools.md deleted file mode 100644 index 4696862569..0000000000 --- a/sources/share/20150824 Great Open Source Collaborative Editing Tools.md +++ /dev/null @@ -1,229 +0,0 @@ -cygmris is translating... -Great Open Source Collaborative Editing Tools -================================================================================ -In a nutshell, collaborative writing is writing done by more than one person. There are benefits and risks of collaborative working. Some of the benefits include a more integrated / co-ordinated approach, better use of existing resources, and a stronger, united voice. For me, the greatest advantage is one of the most transparent. That's when I need to take colleagues' views. Sending files back and forth between colleagues is inefficient, causes unnecessary delays and leaves people (i.e. me) unhappy with the whole notion of collaboration. With good collaborative software, I can share notes, data and files, and use comments to share thoughts in real-time or asynchronously. Working together on documents, images, video, presentations, and tasks is made less of a chore. - -There are many ways to collaborate online, and it has never been easier. This article highlights my favourite open source tools to collaborate on documents in real time. - -Google Docs is an excellent productivity application with most of the features I need. It serves as a collaborative tool for editing documents in real time. Documents can be shared, opened, and edited by multiple users simultaneously and users can see character-by-character changes as other collaborators make edits. While Google Docs is free for individuals, it is not open source. - -Here is my take on the finest open source collaborative editors which help you focus on writing without interruption, yet work mutually with others. - ----------- - -### Hackpad ### - -![Hackpad in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Hackpad.png) - -Hackpad is an open source web-based realtime wiki, based on the open source EtherPad collaborative document editor. - -Hackpad allows users to share your docs realtime and it uses color coding to show which authors have contributed to which content. It also allows in line photos, checklists and can also be used for coding as it offers syntax highlighting. - -While Dropbox acquired Hackpad in April 2014, it is only this month that the software has been released under an open source license. It has been worth the wait. - -Features include: - -- Very rich set of functions, similar to those offered by wikis -- Take collaborative notes, share data and files, and use comments to share your thoughts in real-time or asynchronously -- Granular privacy permissions enable you to invite a single friend, a dozen teammates, or thousands of Twitter followers -- Intelligent execution -- Directly embed videos from popular video sharing sites -- Tables -- Syntax highlighting for most common programming languages including C, C#, CSS, CoffeeScript, Java, and HTML - -- Website: [hackpad.com][1] -- Source code: [github.com/dropbox/hackpad][2] -- Developer: [Contributors][3] -- License: Apache License, Version 2.0 -- Version Number: - - ----------- - -### Etherpad ### - -![Etherpad in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Etherpad.png) - -Etherpad is an open source web-based collaborative real-time editor, allowing authors to simultaneously edit a text document leave comments, and interact with others using an integrated chat. - -Etherpad is implemented in JavaScript, on top of the AppJet platform, with the real-time functionality achieved using Comet streaming. - -Features include: - -- Well designed spartan interface -- Simple text formatting features -- "Time slider" - explore the history of a pad -- Download documents in plain text, PDF, Microsoft Word, Open Document, and HTML -- Auto-saves the document at regular, short intervals -- Highly customizable -- Client side plugins extend the editor functionality -- Hundreds of plugins extend Etherpad including support for email notifications, pad management, authentication -- Accessibility enabled -- Interact with Pad contents in real time from within Node and from your CLI - -- Website: [etherpad.org][4] -- Source code: [github.com/ether/etherpad-lite][5] -- Developer: David Greenspan, Aaron Iba, J.D. Zamfiresc, Daniel Clemens, David Cole -- License: Apache License Version 2.0 -- Version Number: 1.5.7 - ----------- - -### Firepad ### - -![Firepad in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Firepad.png) - -Firepad is an open source, collaborative text editor. It is designed to be embedded inside larger web applications with collaborative code editing added in only a few days. - -Firepad is a full-featured text editor, with capabilities like conflict resolution, cursor synchronization, user attribution, and user presence detection. It uses Firebase as a backend, and doesn't need any server-side code. It can be added to any web app. Firepad can use either the CodeMirror editor or the Ace editor to render documents, and its operational transform code borrows from ot.js. - -If you want to extend your web application capabilities by adding the simple document and code editor, Firepad is perfect. - -Firepad is used by several editors, including the Atlassian Stash Realtime Editor, Nitrous.IO, LiveMinutes, and Koding. - -Features include: - -- True collaborative editing -- Intelligent OT-based merging and conflict resolution -- Support for both rich text and code editing -- Cursor position synchronization -- Undo / redo -- Text highlighting -- User attribution -- Presence detection -- Version checkpointing -- Images -- Extend Firepad through its API -- Supports all modern browsers: Chrome, Safari, Opera 11+, IE8+, Firefox 3.6+ - -- Website: [www.firepad.io][6] -- Source code: [github.com/firebase/firepad][7] -- Developer: Michael Lehenbauer and the team at Firebase -- License: MIT -- Version Number: 1.1.1 - ----------- - -### OwnCloud Documents ### - -![ownCloud Documents in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-ownCloud.png) - -ownCloud Documents is an ownCloud app to work with office documents alone and/or collaboratively. It allows up to 5 individuals to collaborate editing .odt and .doc files in a web browser. - -ownCloud is a self-hosted file sync and share server. It provides access to your data through a web interface, sync clients or WebDAV while providing a platform to view, sync and share across devices easily. - -Features include: - -- Cooperative edit, with multiple users editing files simultaneously -- Document creation within ownCloud -- Document upload -- Share and edit files in the browser, and then share them inside ownCloud or through a public link -- ownCloud features like versioning, local syncing, encryption, undelete -- Seamless support for Microsoft Word documents by way of transparent conversion of file formats - -- Website: [owncloud.org][8] -- Source code: [github.com/owncloud/documents][9] -- Developer: OwnCloud Inc. -- License: AGPLv3 -- Version Number: 8.1.1 - ----------- - -### Gobby ### - -![Gobby in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Gobby.png) - -Gobby is a collaborative editor supporting multiple documents in one session and a multi-user chat. All users could work on the file simultaneously without the need to lock it. The parts the various users write are highlighted in different colours and it supports syntax highlighting of various programming and markup languages. - -Gobby allows multiple users to edit the same document together over the internet in real-time. It integrates well with the GNOME environment. It features a client-server architecture which supports multiple documents in one session, document synchronisation on request, password protection and an IRC-like chat for communication out of band. Users can choose a colour to highlight the text they have written in a document. - -A dedicated server called infinoted is also provided. - -Features include: - -- Full-fledged text editing capabilities including syntax highlighting using GtkSourceView -- Real-time, lock-free collaborative text editing through encrypted connections (including PFS) -- Integrated group chat -- Local group undo: Undo does not affect changes of remote users -- Shows cursors and selections of remote users -- Highlights text written by different users with different colors -- Syntax highlighting for most programming languages, auto indentation, configurable tab width -- Zeroconf support -- Encrypted data transfer including perfect forward secrecy (PFS) -- Sessions can be password-protected -- Sophisticated access control with Access Control Lists (ACLs) -- Highly configurable dedicated server -- Automatic saving of documents -- Advanced search and replace options -- Internationalisation -- Full Unicode support - -- Website: [gobby.github.io][10] -- Source code: [github.com/gobby][11] -- Developer: Armin Burgmeier, Philipp Kern and contributors -- License: GNU GPLv2+ and ISC -- Version Number: 0.5.0 - ----------- - -### OnlyOffice ### - -![OnlyOffice in action](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-OnlyOffice.png) - -ONLYOFFICE (formerly known as Teamlab Office) is a multifunctional cloud online office suite integrated with CRM system, document and project management toolset, Gantt chart and email aggregator. - -It allows you to organize business tasks and milestones, store and share your corporate or personal documents, use social networking tools such as blogs and forums, as well as communicate with your team members via corporate IM. - -Manage documents, projects, team and customer relations in one place. OnlyOffice combines text, spreadsheet and presentation editors that include features similar to Microsoft desktop editors (Word, Excel and PowerPoint), but then allow to co-edit, comment and chat in real time. - -OnlyOffice is written in ASP.NET, based on HTML5 Canvas element, and translated to 21 languages. - -Features include: - -- As powerful as a desktop editor when working with large documents, paging and zooming -- Document sharing in view / edit modes -- Document embedding -- Spreadsheet and presentation editors -- Co-editing -- Commenting -- Integrated chat -- Mobile applications -- Gantt charts -- Time management -- Access right management -- Invoicing system -- Calendar -- Integration with file storage systems: Google Drive, Box, OneDrive, Dropbox, OwnCloud -- Integration with CRM, email aggregator and project management module -- Mail server -- Mail aggregator -- Edit documents, spreadsheets and presentations of the most popular formats: DOC, DOCX, ODT, RTF, TXT, XLS, XLSX, ODS, CSV, PPTX, PPT, ODP - -- Website: [www.onlyoffice.com][12] -- Source code: [github.com/ONLYOFFICE/DocumentServer][13] -- Developer: Ascensio System SIA -- License: GNU GPL v3 -- Version Number: 7.7 - --------------------------------------------------------------------------------- - -via: http://www.linuxlinks.com/article/20150823085112605/CollaborativeEditing.html - -作者:Frazer Kline -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[1]:https://hackpad.com/ -[2]:https://github.com/dropbox/hackpad -[3]:https://github.com/dropbox/hackpad/blob/master/CONTRIBUTORS -[4]:http://etherpad.org/ -[5]:https://github.com/ether/etherpad-lite -[6]:http://www.firepad.io/ -[7]:https://github.com/firebase/firepad -[8]:https://owncloud.org/ -[9]:http://github.com/owncloud/documents/ -[10]:https://gobby.github.io/ -[11]:https://github.com/gobby -[12]:https://www.onlyoffice.com/free-edition.aspx -[13]:https://github.com/ONLYOFFICE/DocumentServer diff --git a/sources/share/20150826 Five Super Cool Open Source Games.md b/sources/share/20150826 Five Super Cool Open Source Games.md deleted file mode 100644 index 0d3d3c8bfd..0000000000 --- a/sources/share/20150826 Five Super Cool Open Source Games.md +++ /dev/null @@ -1,66 +0,0 @@ -Translating by H-mudcup -Five Super Cool Open Source Games -================================================================================ -In 2014 and 2015, Linux became home to a list of popular commercial titles such as the popular Borderlands, Witcher, Dead Island, and Counter Strike series of games. While this is exciting news, what of the gamer on a budget? Commercial titles are good, but even better are free-to-play alternatives made by developers who know what players like. - -Some time ago, I came across a three year old YouTube video with the ever optimistic title [5 Open Source Games that Don’t Suck][1]. Although the video praises some open source games, I’d prefer to approach the subject with a bit more enthusiasm, at least as far as the title goes. So, here’s my list of five super cool open source games. - -### Tux Racer ### - -![Tux Racer](http://fossforce.com/wp-content/uploads/2015/08/tuxracer-550x413.jpg) - -Tux Racer - -[Tux Racer][2] is the first game on this list because I’ve had plenty of experience with it. On a [recent trip to Mexico][3] that my brother and I took with [Kids on Computers][4], Tux Racer was one of the games that kids and teachers alike enjoyed. In this game, players use the Linux mascot, the penguin Tux, to race on downhill ski slopes in time trials in which players challenge their own personal bests. Currently there’s no multiplayer version available, but that could be subject to change. Available for Linux, OS X, Windows, and Android. - -### Warsow ### - -![Warsow](http://fossforce.com/wp-content/uploads/2015/08/warsow-550x413.jpg) - -Warsow - -The [Warsow][5] website explains: “Set in a futuristic cartoonish world, Warsow is a completely free fast-paced first-person shooter (FPS) for Windows, Linux and Mac OS X. Warsow is the Art of Respect and Sportsmanship Over the Web.” I was reluctant to include games from the FPS genre on this list, because many have played games in this genre, but I was amused by Warsow. It prioritizes lots of movement and the game is fast paced with a set of eight weapons to start with. The cartoonish style makes playing feel less serious and more casual, something for friends and family to play together. However, it boasts competitive play, and when I experienced the game I found there were, indeed, some expert players around. Available for Linux, Windows and OS X. - -### M.A.R.S – A ridiculous shooter ### - -![M.A.R.S. - A ridiculous shooter](http://fossforce.com/wp-content/uploads/2015/08/MARS-screenshot-550x344.jpg) - -M.A.R.S. – A ridiculous shooter - -[M.A.R.S – A ridiculous shooter][6] is appealing because of it’s vibrant coloring and style. There is support for two players on the same keyboard, but an online multiplayer version is currently in the works — meaning plans to play with friends have to wait for now. Regardless, it’s an entertaining space shooter with a few different ships and weapons to play as. There are different shaped ships, ranging from shotguns, lasers, scattered shots and more (one of the random ships shot bubbles at my opponents, which was funny amid the chaotic gameplay). There are a few modes of play, such as the standard death match against opponents to score a certain limit or score high, along with other modes called Spaceball, Grave-itation Pit and Cannon Keep. Available for Linux, Windows and OS X. - -### Valyria Tear ### - -![Valyria Tear](http://fossforce.com/wp-content/uploads/2015/08/bronnan-jump-to-enemy-550x413.jpg) - -Valyria Tear - -[Valyria Tear][7] resembles many fan favorite role-playing games (RPGs) spanning the years. The story is set in the usual era of fantasy games, full of knights, kingdoms and wizardry, and follows the main character Bronann. The design team did great work in designing the world and gives players everything expected from the genre: hidden chests, random monster encounters, non-player character (NPC) interaction, and something no RPG would be complete without: grinding for experience on lower level slime monsters until you’re ready for the big bosses. When I gave it a try, time didn’t permit me to play too far into the campaign, but for those interested there is a ‘[Let’s Play][8]‘ series by YouTube user Yohann Ferriera. Available for Linux, Windows and OS X. - -### SuperTuxKart ### - -![SuperTuxKart](http://fossforce.com/wp-content/uploads/2015/08/hacienda_tux_antarctica-550x293.jpg) - -SuperTuxKart - -Last but not least is [SuperTuxKart][9], a clone of Mario Kart that is every bit as fun as the original. It started development around 2000-2004 as Tux Kart, but there were errors in its production which led to a cease in development for a few years. Since development picked up again in 2006, it’s been improving, with version 0.9 debuting four months ago. In the game, our old friend Tux starts in the role of Mario and a few other open source mascots. One recognizable face among them is Suzanne, the monkey mascot for Blender. The graphics are solid and gameplay is fluent. While online play is in the planning stages, split screen multiplayer action is available, with up to four players supported on a single computer. Available for Linux, Windows, OS X, AmigaOS 4, AROS and MorphOS. - --------------------------------------------------------------------------------- - -via: http://fossforce.com/2015/08/five-super-cool-open-source-games/ - -作者:Hunter Banks -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[1]:https://www.youtube.com/watch?v=BEKVl-XtOP8 -[2]:http://tuxracer.sourceforge.net/download.html -[3]:http://fossforce.com/2015/07/banks-family-values-texas-linux-fest/ -[4]:http://www.kidsoncomputers.org/an-amazing-week-in-oaxaca -[5]:https://www.warsow.net/download -[6]:http://mars-game.sourceforge.net/ -[7]:http://valyriatear.blogspot.com/ -[8]:https://www.youtube.com/channel/UCQ5KrSk9EqcT_JixWY2RyMA -[9]:http://supertuxkart.sourceforge.net/ diff --git a/sources/share/20150826 Mosh Shell--A SSH Based Client for Connecting Remote Unix or Linux Systems.md b/sources/share/20150826 Mosh Shell--A SSH Based Client for Connecting Remote Unix or Linux Systems.md deleted file mode 100644 index f36e1b21df..0000000000 --- a/sources/share/20150826 Mosh Shell--A SSH Based Client for Connecting Remote Unix or Linux Systems.md +++ /dev/null @@ -1,110 +0,0 @@ -Mosh Shell – A SSH Based Client for Connecting Remote Unix/Linux Systems -================================================================================ -Mosh, which stands for Mobile Shell is a command-line application which is used for connecting to the server from a client computer, over the Internet. It can be used as SSH and contains more feature than Secure Shell. It is an application similar to SSH, but with additional features. The application is written originally by Keith Winstein for Unix like operating system and released under GNU GPL v3. - -![Mosh Shell SSH Client](http://www.tecmint.com/wp-content/uploads/2015/08/Mosh-Shell-SSH-Client.png) - -Mosh Shell SSH Client - -#### Features of Mosh #### - -- It is a remote terminal application that supports roaming. -- Available for all major UNIX-like OS viz., Linux, FreeBSD, Solaris, Mac OS X and Android. -- Intermittent Connectivity supported. -- Provides intelligent local echo. -- Line editing of user keystrokes supported. -- Responsive design and Robust Nature over wifi, cellular and long-distance links. -- Remain Connected even when IP changes. It usages UDP in place of TCP (used by SSH). TCP time out when connect is reset or new IP assigned but UDP keeps the connection open. -- The Connection remains intact when you resume the session after a long time. -- No network lag. Shows users typed key and deletions immediately without network lag. -- Same old method to login as it was in SSH. -- Mechanism to handle packet loss. - -### Installation of Mosh Shell in Linux ### - -On Debian, Ubuntu and Mint alike systems, you can easily install the Mosh package with the help of [apt-get package manager][1] as shown. - - # apt-get update - # apt-get install mosh - -On RHEL/CentOS/Fedora based distributions, you need to turn on third party repository called [EPEL][2], in order to install mosh from this repository using [yum package manager][3] as shown. - - # yum update - # yum install mosh - -On Fedora 22+ version, you need to use [dnf package manager][4] to install mosh as shown. - - # dnf install mosh - -### How do I use Mosh Shell? ### - -1. Let’s try to login into remote Linux server using mosh shell. - - $ mosh root@192.168.0.150 - -![Mosh Shell Remote Connection](http://www.tecmint.com/wp-content/uploads/2015/08/Mosh-Shell-Remote-Connection.png) - -Mosh Shell Remote Connection - -**Note**: Did you see I got an error in connecting since the port was not open in my remote CentOS 7 box. A quick but not recommended solution I performed was: - - # systemctl stop firewalld [on Remote Server] - -The preferred way is to open a port and update firewall rules. And then connect to mosh on a predefined port. For in-depth details on firewalld you may like to visit this post. - -- [How to Configure Firewalld][5] - -2. Let’s assume that the default SSH port 22 was changed to port 70, in this case you can define custom port with the help of ‘-p‘ switch with mosh. - - $ mosh -p 70 root@192.168.0.150 - -3. Check the version of installed Mosh. - - $ mosh --version - -![Check Mosh Version](http://www.tecmint.com/wp-content/uploads/2015/08/Check-Mosh-Version.png) - -Check Mosh Version - -4. You can close mosh session type ‘exit‘ on the prompt. - - $ exit - -5. Mosh supports a lot of options, which you may see as: - - $ mosh --help - -![Mosh Shell Options](http://www.tecmint.com/wp-content/uploads/2015/08/Mosh-Shell-Options.png) - -Mosh Shell Options - -#### Cons of Mosh Shell #### - -- Mosh requires additional prerequisite for example, allow direct connection via UDP, which was not required by SSH. -- Dynamic port allocation in the range of 60000-61000. The first open fort is allocated. It requires one port per connection. -- Default port allocation is a serious security concern, especially in production. -- IPv6 connections supported, but roaming on IPv6 not supported. -- Scrollback not supported. -- No X11 forwarding supported. -- No support for ssh-agent forwarding. - -### Conclusion ### - -Mosh is a nice small utility which is available for download in the repository of most of the Linux Distributions. Though it has a few discrepancies specially security concern and additional requirement it’s features like remaining connected even while roaming is its plus point. My recommendation is Every Linux-er who deals with SSH should try this application and mind it, Mosh is worth a try. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/install-mosh-shell-ssh-client-in-linux/ - -作者:[Avishek Kumar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/useful-basic-commands-of-apt-get-and-apt-cache-for-package-management/ -[2]:http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/ -[3]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ -[4]:http://www.tecmint.com/dnf-commands-for-fedora-rpm-package-management/ -[5]:http://www.tecmint.com/configure-firewalld-in-centos-7/ \ No newline at end of file diff --git a/sources/share/20150901 5 best open source board games to play online.md b/sources/share/20150901 5 best open source board games to play online.md deleted file mode 100644 index 505ca76f10..0000000000 --- a/sources/share/20150901 5 best open source board games to play online.md +++ /dev/null @@ -1,194 +0,0 @@ -5 best open source board games to play online -================================================================================ -I have always had a fascination with board games, in part because they are a device of social interaction, they challenge the mind and, most importantly, they are great fun to play. In my misspent youth, myself and a group of friends gathered together to escape the horrors of the classroom, and indulge in a little escapism. The time provided an outlet for tension and rivalry. Board games help teach diplomacy, how to make and break alliances, bring families and friends together, and learn valuable lessons. - -I had a panache for abstract strategy games such as chess and draughts, as well as word games. I can still never resist a game of Escape from Colditz, a strategy card and dice-based board game, or Risk; two timeless multi-player strategy board games. But Catan remains my favourite board game. - -Board games have seen a resurgence in recent years, and Linux has a good range of board games to choose from. There is a credible implementation of Catan called Pioneers. But for my favourite implementations of classic board games to play online, check out the recommendations below. - ----------- - -### TripleA ### - -![TripleA in action](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-TripleA.png) - -TripleA is an open source online turn based strategy game. It allows people to implement and play various strategy board games (ie. Axis & Allies). The TripleA engine has full networking support for online play, support for sounds, XML support for game files, and has its own imaging subsystem that allows for customized user editable maps to be used. TripleA is versatile, scalable and robust. - -TripleA started out as a World War II simulation, but now includes different conflicts, as well as variations and mods of popular games and maps. TripleA comes with multiple games and over 100 more games can be downloaded from the user community. - -Features include: - -- Good interface and attractive graphics -- Optional scenarios -- Multiplayer games -- TripleA comes with the following supported games that uses its game engine (just to name a few): - - Axis & Allies : Classic edition (2nd, 3rd with options enabled) - - Axis & Allies : Revised Edition - - Pact of Steel A&A Variant - - Big World 1942 A&A Variant - - Four if by Sea - - Battle Ship Row - - Capture The Flag - - Minimap -- Hot-seat -- Play By EMail mode allows persons to play a game via EMail without having to be connected to each other online - - More time to think out moves - - Only need to come online to send your turn to the next player - - Dice rolls are done by a dedicated dice server that is independent of TripleA - - All dice rolls are PGP Verified and email to every player - - Every move and every dice roll is logged and saved in TripleA's History Window - - An online game can be later continued under PBEM mode - - Hard for others to cheat -- Hosted online lobby -- Utilities for editing maps -- Website: [triplea.sourceforge.net][1] -- Developer: Sean Bridges (original developer), Mark Christopher Duncan -- License: GNU GPL v2 -- Version Number: 1.8.0.7 - ----------- - -### Domination ### - -![Domination in action](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Domination.png) - -Domination is an open source game that shares common themes with the hugely popular Risk board game. It has many game options and includes many maps. - -In the classic “World Domination” game of military strategy, you are battling to conquer the world. To win, you must launch daring attacks, defend yourself to all fronts, and sweep across vast continents with boldness and cunning. But remember, the dangers, as well as the rewards, are high. Just when the world is within your grasp, your opponent might strike and take it all away! - -Features include: - -- Simple to learn - - Domination - you must occupy all countries on the map, and thereby eliminate all opponents. These can be long, drawn out games - - Capital - each player has a country they have selected as a Capital. To win the game, you must occupy all Capitals - - Mission - each player draws a random mission. The first to complete their mission wins. Missions may include the elimination of a certain colour, occupation of a particular continent, or a mix of both -- Map editor -- Simple map format -- Multiplayer network play -- Single player -- Hotseat -- 5 user interfaces -- Game types: -- Play online -- Website: [domination.sourceforge.net][2] -- Developer: Yura Mamyrin, Christian Weiske, Mike Chaten, and many others -- License: GNU GPL v3 -- Version Number: 1.1.1.5 - ----------- - -### PyChess ### - -![Micro-Max in action](http://www.linuxlinks.com/portal/content/reviews/Games/Screenshot-Pychess.jpg) - -PyChess is a Gnome inspired chess client written in Python. - -The goal of PyChess, is to provide a fully featured, nice looking, easy to use chess client for the gnome-desktop. - -The client should be usable both to those totally new to chess, those who want to play an occasional game, and those who wants to use the computer to further enhance their play. - -Features include: - -- Attractive interface -- Chess Engine Communication Protocol (CECP) and Univeral Chess Interface (UCI) Engine support -- Free online play on the Free Internet Chess Server (FICS) -- Read and writes PGN, EPD and FEN chess file formats -- Built-in Python based engine -- Undo and pause functions -- Board and piece animation -- Drag and drop -- Tabbed interface -- Hints and spyarrows -- Opening book sidepanel using sqlite -- Score plot sidepanel -- "Enter game" in pgn dialog -- Optional sounds -- Legal move highlighting -- Internationalised or figure pieces in notation -- Website: [www.pychess.org][3] -- Developer: Thomas Dybdahl Ahle -- License: GNU GPL v2 -- Version Number: 0.12 Anderssen rc4 - ----------- - -### Scrabble ### - -![Scrabble in action](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Scrabble3D.png) - -Scrabble3D is a highly customizable Scrabble game that not only supports Classic Scrabble and Superscrabble but also 3D games and own boards. You can play local against the computer or connect to a game server to find other players. - -Scrabble is a board game with the goal to place letters crossword like. Up to four players take part and get a limited amount of letters (usually 7 or 8). Consecutively, each player tries to compose his letters to one or more word combining with the placed words on the game array. The value of the move depends on the letters (rare letter get more points) and bonus fields which multiply the value of a letter or the whole word. The player with most points win. - -This idea is extended with Scrabble3D to the third dimension. Of course, a classic game with 15x15 fields or Superscrabble with 21x21 fields can be played and you may configure any field setting by yourself. The game can be played by the provided freeware program against Computer, other local players or via internet. Last but not least it's possible to connect to a game server to find other players and to obtain a rating. Most options are configurable, including the number and valuation of letters, the used dictionary, the language of dialogs and certainly colors, fonts etc. - -Features include: - -- Configurable board, letterset and design -- Board in OpenGL graphics with user-definable wavefront model -- Game against computer with support of multithreading -- Post-hoc game analysis with calculation of best move by computer -- Match with other players connected on a game server -- NSA rating and highscore at game server -- Time limit of games -- Localization; use of non-standard digraphs like CH, RR, LL and right to left reading -- Multilanguage help / wiki -- Network games are buffered and asynchronous games are possible -- Running games can be kibitzed -- International rules including italian "Cambio Secco" -- Challenge mode, What-if-variant, CLABBERS, etc -- Website: [sourceforge.net/projects/scrabble][4] -- Developer: Heiko Tietze -- License: GNU GPL v3 -- Version Number: 3.1.3 - ----------- - -### Backgammon ### - -![Backgammon in action](http://www.linuxlinks.com/portal/content/reviews/Games/Screenshot-gnubg.png) - -GNU Backgammon (gnubg) is a strong backgammon program (world-class with a bearoff database installed) usable either as an engine by other programs or as a standalone backgammon game. It is able to play and analyze both money games and tournament matches, evaluate and roll out positions, and more. - -In addition to supporting simple play, it also has extensive analysis features, a tutor mode, adjustable difficulty, and support for exporting annotated games. - -It currently plays at about the level of a championship flight tournament player and is gradually improving. - -gnubg can be played on numerous on-line backgammon servers, such as the First Internet Backgammon Server (FIBS). - -Features include: - -- A command line interface (with full command editing features if GNU readline is available) that lets you play matches and sessions against GNU Backgammon with a rough ASCII representation of the board on text terminals -- Support for a GTK+ interface with a graphical board window. Both 2D and 3D graphics are available -- Tournament match and money session cube handling and cubeful play -- Support for both 1-sided and 2-sided bearoff databases: 1-sided bearoff database for 15 checkers on the first 6 points and optional 2-sided database kept in memory. Optional larger 1-sided and 2-sided databases stored on disk -- Automated rollouts of positions, with lookahead and race variance reduction where appropriate. Rollouts may be extended -- Functions to generate legal moves and evaluate positions at varying search depths -- Neural net functions for giving cubeless evaluations of all other contact and race positions -- Automatic and manual annotation (analysis and commentary) of games and matches -- Record keeping of statistics of players in games and matches (both native inside GNU Backgammon and externally using relational databases and Python) -- Loading and saving analyzed games and matches as .sgf files (Smart Game Format) -- Exporting positions, games and matches to: (.eps) Encapsulated Postscript, (.gam) Jellyfish Game, (.html) HTML, (.mat) Jellyfish Match, (.pdf) PDF, (.png) Portable Network Graphics, (.pos) Jellyfish Position, (.ps) PostScript, (.sgf) Gnu Backgammon File, (.tex) LaTeX, (.txt) Plain Text, (.txt) Snowie Text -- Import of matches and positions from a number of file formats: (.bkg) Hans Berliner's BKG Format, (.gam) GammonEmpire Game, (.gam) PartyGammon Game, (.mat) Jellyfish Match, (.pos) Jellyfish Position, (.sgf) Gnu Backgammon File, (.sgg) GamesGrid Save Game, (.tmg) TrueMoneyGames, (.txt) Snowie Text -- Python Scripting -- Native language support; 10 languages complete or in progress -- Website: [www.gnubg.org][5] -- Developer: Joseph Heled, Oystein Johansen, Jonathan Kinsey, David Montgomery, Jim Segrave, Joern Thyssen, Gary Wong and contributors -- License: GPL v2 -- Version Number: 1.05.000 - --------------------------------------------------------------------------------- - -via: http://www.linuxlinks.com/article/20150830011533893/BoardGames.html - -作者:Frazer Kline -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[1]:http://triplea.sourceforge.net/ -[2]:http://domination.sourceforge.net/ -[3]:http://www.pychess.org/ -[4]:http://sourceforge.net/projects/scrabble/ -[5]:http://www.gnubg.org/ \ No newline at end of file diff --git a/sources/talk/20150709 Interviews--Linus Torvalds Answers Your Question.md b/sources/talk/20150709 Interviews--Linus Torvalds Answers Your Question.md deleted file mode 100644 index bb04ddf0c8..0000000000 --- a/sources/talk/20150709 Interviews--Linus Torvalds Answers Your Question.md +++ /dev/null @@ -1,184 +0,0 @@ -Interviews: Linus Torvalds Answers Your Question -================================================================================ -Last Thursday you had a chance to [ask Linus Torvalds][1] about programming, hardware, and all things Linux. You can read his answers to those questions below. If you'd like to see what he had to say the last time we sat down with him, [you can do so here][2]. - -**Productivity** -by DoofusOfDeath - -> You've somehow managed to originate two insanely useful pieces of software: Linux, and Git. Do you think there's anything in your work habits, your approach to choosing projects, etc., that have helped you achieve that level of productivity? Or is it just the traditional combination of talent, effort, and luck? - -**Linus**: I'm sure it's pretty much always that "talent, effort and luck". I'll leave it to others to debate how much of each... - -I'd love to point out some magical work habit that makes it all happen, but I doubt there really is any. Especially as the work habits I had wrt the kernel and Git have been so different. - -With Git, I think it was a lot about coming at a problem with fresh eyes (not having ever really bought into the traditional SCM mindset), and really trying to think about the issues, and spending a fair amount of time thinking about what the real problems were and what I wanted the design to be. And then the initial self-hosting code took about a day to write (ok, that was "self-hosting" in only the weakest sense, but still). - -And with Linux, obviously, things were very different - the big designs came from the outside, and it took half a year to host itself, and it hadn't even started out as a kernel to begin with. Clearly not a lot of thinking ahead and planning involved ;). So very different circumstances indeed. - -What both the kernel and Git have, and what I think is really important (and I guess that counts as a "work habit"), is a maintainer that stuck to it, and was responsive, responsible and sane. Too many projects falter because they don't have people that stick with them, or have people who have an agenda that doesn't match reality or the user expectations. - -But it's very important to point out that for Git, that maintainer was not me. Junio Hamano really should get pretty much all the credit for Git. Credit where credit is due. I'll take credit for the initial implementation and design of Git - it may not be perfect, but ten years on it still is very solid and very clearly the same basic design. But I'll take even _more_ credit for recognizing that Junio had his head screwed on right, and was the person to drive the project. And all the rest of the credit goes to him. - -Of course, that kind of segues into something else the kernel and Git do have in common: while I still maintain the kernel, I did end up finding a lot of smart people to maintain all the different parts of it. So while one important work habit is that "stick to it" persistence that you need to really take a project from a not-quite-usable prototype to something bigger and better, another important work-habit is probably to also "let go" and not try to own and control the project too much. Let other people really help you - guide the process but don't get in their way. - -**init system** -by lorinc - -> There wasn't a decent unix-like kernel, you wrote one which ultimately became the most used. There wasn't a decent version control software, you wrote one which ultimately became the most love. Do you think we already have a decent init system, or do you have plan to write one that will ultimately settle the world on that hot topic? - -**Linus**: You can say the word "systemd", It's not a four-letter word. Seven letters. Count them. - -I have to say, I don't really get the hatred of systemd. I think it improves a lot on the state of init, and no, I don't see myself getting into that whole area. - -Yeah, it may have a few odd corners here and there, and I'm sure you'll find things to despise. That happens in every project. I'm not a huge fan of the binary logging, for example. But that's just an example. I much prefer systemd's infrastructure for starting services over traditional init, and I think that's a much bigger design decision. - -Yeah, I've had some personality issues with some of the maintainers, but that's about how you handle bug reports and accept blame (or not) for when things go wrong. If people thought that meant that I dislike systemd, I will have to disappoint you guys. - -**Can Valve change the Linux gaming market?** -by Anonymous Coward - -> Do you think Valve is capable of making Linux a primary choice for gamers? - -**Linus**: "Primary"? Probably not where it's even aiming. I think consoles (and all those handheld and various mobile platforms that "real gamers" seem to dismiss as toys) are likely much more primary, and will stay so. - -I think Valve wants to make sure they can control their own future, and Linux and ValveOS is probably partly to explore a more "console-like" Valve experience (ie the whole "get a box set up for a single main purpose", as opposed to a more PC-like experience), and partly as a "second source" against Microsoft, who is a competitor in the console area. Keeping your infrastructure suppliers honest by making sure you have alternatives sounds like a good strategy, and particularly so when those suppliers may be competing with you directly elsewhere. - -So I don't think the aim is really "primary". "Solid alternative" is I think the aim. Of course, let's see where it goes after that. - -But I really have not been involved. People like Greg and the actual graphics driver guys have been in much more direct contact with Valve. I think it's great to see gaming on Linux, but at the same time, I'm personally not really much of a gamer. - -**The future of RT-Linux?** -by nurhussein - -> According to Thomas Gleixner, [the future of the realtime patchset to Linux is in doubt][2], as it is difficult to secure funding from interested parties on this functionality even though it is both useful and important: What are your thoughts on this, and what do you think we need to do to get more support behind the RT patchset, especially considering Linux's increasing use in embedded systems where realtime functionality is undoubtedly useful. - -**Linus**: So I think this is one of those things where the markets decide how important rtLinux ends up being, and I suspect there are more than enough companies who end up wanting and using rtLinux that the project isn't really going anywhere. The complaints by Thomas were - I think - a wake-up call to the companies who end up wanting the extended hard realtime patches. - -So I suspect there are companies and groups like OSADL that end up funding and helping with rtLinux, and that it isn't going away. - -**Rigor and developments** -by hcs_$reboot - -> The most complex program running on a machine is arguably its OS, especially the kernel. Linux (kernel) reached the top level in terms of performance, reliability and versatility. You have been criticized quite a few times for some virulent mails addressed to developers. Do you think Linux would be where it is without managing the project with an iron fist? To go further, do you think some other main OSS project would benefit from a more rigorous management approach? - -**Linus**: One of the nice things about open source is how it allows people to really concentrate on what they are good at, and it has been a huge advantage for Linux that we've had people who are interested in the marketing side and selling Linux, as well as the legal side etc. - -And that is all in addition, of course, to the original "we're motivated by the technology" people like me. And even within that "we're motivated by technology" group, you most certainly don't need to find _everything_ interesting, you can find the area you are passionate about and really care about and want to work on. - -That's _fundamentally_ how open source works. - -Now, if somebody is passionate about some "good management" thing, go wild, and try to get involved, and try to manage things. It's not what _I_ am interested in, but hey, the proof is in the pudding - anybody who thinks they have a new rigorous management approach that they think will help some part of the process, go wild. - -Now, I personally suspect that it wouldn't work - not only are tech people an ornery lot to begin with (that whole "herding cats" thing), just look at all the crazy arguments on the internet. And ask yourself what actually holds an open source project like the kernel together? I think you need to be very oriented towards the purely technical solutions, simply because then you have tangible and real issues you can discuss (and argue about) with fairly clear-cut hard answers. It's the only thing people can really agree on in the big picture. - -So the Linux approach to "management" has been to put technology first. That's rigorous enough for me. But as mentioned, it's a free-for-all. Anybody can come in and try to do better. Really. - -And btw, it's worth noting that there are obviously specific smaller development teams where other management models work fine. Most of the individual developers are parts of teams inside particular companies, and within the confines of that company, there may well be a very strict rigorous management model. Similarly, within the confines of a particular productization effort there may be particular goals and models for that particular team that transcend that general "technical issues" thing. - -Just to give a concrete example, the "development kernel" tree that I maintain works fundamentally differently and with very different rules from the "stable tree" that Greg does, which in turn is maintained very differently from what a distribution team within a Linux company does inside its maintenance kernel team. - -So there's certainly room for different approaches to managing those very different groups. But do I think you can "rigorously manage" people on the internet? No. - -**Functional languages?** -by EmeraldBot - -> While historically you've been a C and Assembly guy (and the odd shell scripting and such), what do you think of functional languages such as Lisp, Closure, Haskell, etc? Do you see any advantages to them, or do you view them as frivolous and impractical? If you decide to do so, thanks for taking the time to answer my question! You're a legend at what you do, and I think it's awesome that the significantly less interesting me can ask you a question like this. - -**Linus**: I may be a fan of C (with a certain fondness for assembly, just because it's so close to the machine), but that's very much about a certain context. I work at a level where those languages make sense. I certainly don't think that tools like Haskell etc are "frivolous and impractical" in general, although on a kernel level (or in a source control management system) I suspect they kind of are. - -Many moons ago I worked on sparse (the C parser and analyzer), and one of my coworkers was a Haskell fan, and did incredible example transformations in very simple (well, to him) code - stuff that is just nasty to write in C because it's pretty high-level, there's tons of memory management, and you're really talking about implementing fairly abstract and high-level rules with pattern matching etc. - -So I'm definitely not a functional language kind of guy - it's not how I learnt programming, and it really isn't very relevant to what I do, and I wouldn't recognize Haskell code if it bit me in the ass and called me names. But no, I wouldn't call them frivolous. - -**Critical software to the use of Linux** -by TWX - -> Mr. Torvalds, For many uses of Linux such as on the desktop, other software beyond the kernel and the base GNU tools are required. What other projects would you like to see given priority, and what would you like to see implemented or improved? Admittedly I thought most about X-Windows when asking this question; but I don't doubt that other daemons or systems can be just as important to the user experience. Thank you for your efforts all these years. - -**Linus**: Hey, I don't really have any particular project I would want to champion, largely because we all have so different requirements on the desktop. There's just no single thing that stands out as being hugely more important than others to me. - -What I do wish particularly desktop developers cared about is "consistency of experience". And by that I don't mean some kind of enforced visual consistency between different applications to make things "look coherent". No, I'm just talking about the pain and uncertainty users go through with upgrades, and understanding that while your project may be the most important project to *you* (because it's what you do), to your users, your project is likely just a fairly small and irrelevant part of their experience, and it's not very central at all, and they've learnt the quirks about that thing they don't even care about, and you really shouldn't break their expectations. Because it turns out that that is how you really make people hate their desktop. - -This is not at all Linux-specific, of course - just look at the less than enthusiastic reception that other operating system redesigns have received. But I really wish that we hadn't had *both* of the major Linux desktop environments have to learn this (well, I hope they learnt) the hard way, and both of them ending up blaming their users rather than themselves. - -**"anykernel"-style portable drivers?** -by staalmannen - -> What do you think about the "anykernel" concept (invented by another Finn btw) used in NetBSD? Basically, they have modularized the code so that a driver can be built either in a monolithic kernel or for user space without source code changes ( rumpkernel.org ). The drivers are highly portable and used in Genode os (L4 type kernels), minix etc... Would this be possible or desirable for Linux? Apparently there is one attempt called "libos"... - -**Linus**: So I have bad experiences with "portable" drivers. Writing drivers to some common environment tends to force some ridiculously nasty impedance matching abstractions that just get in the way and make things really hard to read and modify. It gets particularly nasty when everybody ends up having complicated - and differently so - driver subsystems to handle a lot of commonalities for a certain class of drivers (say a network driver, or a USB driver), and the different operating systems really have very different approaches and locking rules etc. - -I haven't seen anykernel drivers, but from past experience my reaction to "portable device drivers" is to run away, screaming like little girl. As they say in Swedish "Bränt barn luktar illa". - -**Processor Architecture** -by swv3752 - -> Several years ago, you were employed by Transmeta designing the Crusoe processor. I understand you are quite knowledgeable about cpu architecture. What are your thoughts on the Current Intel and AMD x86 CPUs particularly in comparison with ARM and IBM's Power8 CPUs? Where do you see the advantages of each one? - -**Linus**: I'm no CPU architect, I just play one on TV. - -But yes, I've been close to the CPU both as part of my kernel work, and as part of a processor company, and working at that level for a long time just means that you end up having fairly strong opinions. One of the things that my experiences at Transmeta convinced me of, for example, was that there's definitely very much a limit to what software should care about. I loved working at Transmeta, I loved the whole startup company environment, I loved working with really smart people, but in the end I ended up absolutely *not* loving to work with overly simple hardware (I also didn't love the whole IPO process, and what that did to the company culture, but that's a different thing). - -Because there's only so much that software can do to compensate. - -Something similar happened with my kernel work on the alpha architecture, which also started out as being an overly simplified implementation in the name of being small and supposedly running really fast. While I really started out liking the alpha architecture for being so clean, I ended up detesting how fragile the architecture implementations were (and by the time that got fixed in the 21264, I had given up on alpha). - -So I've come to absolutely detest CPU's that need a lot of compiler smarts or special tuning to go fast. Life is too short to waste on in-order CPU's, or on hardware designers who think software should take care of the pieces that they find to be too complicated to handle themselves, and as a result just left undone. "Weak memory ordering" is just another example. - -Thankfully, most of the industry these days seems to agree. Yes, there are still in-order cores, but nobody tries to make excuses for them any more: they are for the truly cheap and low-end market. - -I tend to really like the modern Intel cores in particular, which tend to take that "let's not be stupid" really to heart. With the kernel being so threaded, I end up caring a lot about things like memory ordering etc, and the Intel big-core CPU's tend to be in a class of their own there. As a software person who cares about performance and looks at instruction profiles etc, it's just so *nice* to see that the CPU doesn't have some crazy glass jaw where you have to be very careful. - -**GPU kernels** -by maraist - -> Is there any inspiration that a GPU based kernel / scheduler has for you? How might Linux be improved to better take advantage of GPU-type batch execution models. Given that you worked transmeta and JIT compiled host-targeted runtimes. GPUs 1,000-thread schedulers seem like the next great paradigm for the exact type of machines that Linux does best on. - -**Linus**: I don't think we'll see the kernel ever treat GPU threads the way we treat CPU threads. Not with the current model of GPU's (and that model doesn't really seem to be changing all that much any more). - -Yes, GPU's are getting much better, and now generally have virtual memory and the ability to preempt execution, and you could run an OS on them. But the scheduling latencies are pretty high, and the threads are not really "independent" (ie they tend to share a lot of state - like the virtual address space and a large shared register set), so GPU "threads" don't tend to work like CPU threads. You'd schedule them all-or-nothing, so if you were to switch processes, you'd treat the GPU as one entity where you switch all the threads at once. - -So it really wouldn't look like a thousand threads to the kernel. The GPU would still be scheduled as one single entity (or maybe a couple of entities depending on how the GPU is partitioned). The fact that that single entity works by doing a lot of things in massive parallelism is kind of immaterial for the kernel that doesn't end up seeing that parallelism as separate threads. - -**alleged danger of Artificial Intelligence** -by peter303 - -> Some computer experts like Marvin Minsky, Larry Page, Ray Kuzweil think A.I. will be a great gift to Mankind. Others like Bill Joy and Elon Musk are fearful of potential danger. Where do you stand, Linus? - -**Linus**: I just don't see the thing to be fearful of. - -We'll get AI, and it will almost certainly be through something very much like recurrent neural networks. And the thing is, since that kind of AI will need training, it won't be "reliable" in the traditional computer sense. It's not the old rule-based prolog days, when people thought they'd *understand* what the actual decisions were in an AI. - -And that all makes it very interesting, of course, but it also makes it hard to productize. Which will very much limit where you'll actually find those neural networks, and what kinds of network sizes and inputs and outputs they'll have. - -So I'd expect just more of (and much fancier) rather targeted AI, rather than anything human-like at all. Language recognition, pattern recognition, things like that. I just don't see the situation where you suddenly have some existential crisis because your dishwasher is starting to discuss Sartre with you. - -The whole "Singularity" kind of event? Yeah, it's science fiction, and not very good SciFi at that, in my opinion. Unending exponential growth? What drugs are those people on? I mean, really.. - -It's like Moore's law - yeah, it's very impressive when something can (almost) be plotted on an exponential curve for a long time. Very impressive indeed when it's over many decades. But it's _still_ just the beginning of the "S curve". Anybody who thinks any different is just deluding themselves. There are no unending exponentials. - -**Is the kernel basically a finished project?** -by NaCh0 - -> Aside from adding drivers and refactoring algorithms when performance limits are discovered, is there anything left for the kernel? Maybe it's a failure of tech journalism but we never hear about the next big thing in kernel land anymore. - -**Linus**: I don't think there's much of a "next big thing" in the kernel. - -I wouldn't say that there is nothing but drivers (and architectures are kind of "CPU drivers) and improving scalability left, because I'm constantly amazed by how many new things people figure out are still good ideas. But they tend to still be pretty incremental improvements. An OS kernel doesn't look *that* radically different from what it was 40 years ago, and that's fine. I think radical new ideas are often overrated, and the thing that really matters in the end is that plodding detail work. That's how technology evolves. - -And judging by how our kernel releases are going, there's no end in sight for that "plodding detail work". And it's still as interesting as it ever was. - --------------------------------------------------------------------------------- - -via: http://linux.slashdot.org/story/15/06/30/0058243/interviews-linus-torvalds-answers-your-question - -作者:[samzenpus][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:samzenpus@slashdot.org -[1]:http://interviews.slashdot.org/story/15/06/24/1718247/interview-ask-linus-torvalds-a-question -[2]:http://meta.slashdot.org/story/12/10/11/0030249/linus-torvalds-answers-your-questions -[3]:https://lwn.net/Articles/604695/ diff --git a/sources/talk/20150716 Interview--Larry Wall.md b/sources/talk/20150716 Interview--Larry Wall.md deleted file mode 100644 index f3fea9c596..0000000000 --- a/sources/talk/20150716 Interview--Larry Wall.md +++ /dev/null @@ -1,127 +0,0 @@ -translating... - -Interview: Larry Wall -================================================================================ -> Perl 6 has been 15 years in the making, and is now due to be released at the end of this year. We speak to its creator to find out what’s going on. - -Larry Wall is a fascinating man. He’s the creator of Perl, a programming language that’s widely regarded as the glue holding the internet together, and mocked by some as being a “write-only” language due to its density and liberal use of non-alphanumeric characters. Larry also has a background in linguistics, and is well known for delivering entertaining “State of the Onion” presentations about the future of Perl. - -At FOSDEM 2015 in Brussels, we caught up with Larry to ask him why Perl 6 has taken so long (Perl 5 was released in 1994), how difficult it is to manage a project when everyone has strong opinions and pulling in different directions, and how his background in linguistics influenced the design of Perl from the start. Get ready for some intriguing diversions… - -![](http://www.linuxvoice.com/wp-content/uploads/2015/07/wall1.jpg) - -**Linux Voice: You once had a plan to go and find an undocumented language somewhere in the world and create a written script for it, but you never had the opportunity to fulfil this plan. Is that something you’d like to go back and do now?** - -Larry Wall: You have to be kind of young to be able to carry that off! It’s actually a lot of hard work, and organisations that do these things don’t tend to take people in when they’re over a certain age. Partly this is down to health and vigour, but also because people are much better at picking up new languages when they’re younger, and you have to learn the language before making a script for it. - -I started trying to teach myself Japanese about 10 years ago, and I could speak it quite well, because of my phonology and phonetics training – but it’s very hard for me to understand what anybody says. So I can go to Japan and ask for directions, but I can’t really understand the answers! - -> “With Perl 6, we found some ways to make the computer more sure about what the user is talking about.” - -So usually learning a language well enough to develop a writing system, and to at least be conversational in the language, takes some period of years before you can get to the point where you can actually do literacy and start educating people on their own culture, as it were. And then you teach them to write about their own culture as well. - -Of course, if you have language helpers – and we were told not to call them “language informants”, or everyone would think we were working for the CIA! – if you have these people, you can get them to come in and help you learn the foreign language. They are not teachers but there are ways of eliciting things from someone who’s not a language teacher – they can still teach you how to speak. They can take a stick and point to it and say “that’s a stick”, and drop it and say “the stick falls”. Then you start writing things down and systematising things. - -The motivation that most people have, going out to these groups, is to translate the Bible into their languages. But that’s only one part of it; the other is also culture preservation. Missionaries get kind of a bad rep on that, because anthropologists think they should be left to sit their in their own culture. But somebody is probably going to change their culture anyway – it’s usually the army, or businesses coming in, like Coca Cola or the sewing machine people, or missionaries. And of those three, the missionaries are the least damaging, if they’re doing their job right. - -**LV: Many writing systems are based on existing scripts, and then you have invented ones like Greenlandic…** - -LW: The Cherokee invented their own just by copying letters, and they have no mapping much to what we think of letters, and it’s fairly arbitrary in that sense. It just has to represent how the people themselves think of the language, and sufficiently well to communicate. Often there will be variations on Western orthography, using characters from Latin where possible. Tonal languages have to mark the tones somehow, by accents or by numbers. - -As soon as you start leaning towards a phoenetic or phonological representation, then you also start to lose dialectical differences – or you have to write the dialectal differences. Or you have conventional spelling like we have in English, but pronunciation that doesn’t really match it. - -**LV: When you started working on Perl, what did you take from your background in linguistics that made you think: “this is really important in a programming language”?** - -LW: I thought a lot about how people use languages. In real languages, you have a system of nouns and verbs and adjectives, and you kind of know which words are which type. And in real natural languages, you have a lot of instances of shoving one word into a different slot. The linguistic theory I studied was called tagmemics, and it accounts for how this works in a natural language – that you could have something that you think of as a noun, but you can verb it, and people do that all time. - -You can pretty much shove anything in any slot, and you can communicate. One of my favourite examples is shoving an entire sentence in as an adjective. The sentence goes like this: “I don’t like your I-can-use-anything-as-an-adjective attitude”! - -So natural language is very flexible this way because you have a very intelligent listener – or at least, compared with a computer – who you can rely on to figure out what you must have meant, in case of ambiguity. Of course, in a computer language you have to manage the ambiguity much more closely. - -Arguably in Perl 1 through to 5 we didn’t manage it quite adequately enough. Sometimes the computer was confused when it really shouldn’t be. With Perl 6, we discovered some ways to make the computer more sure about what the user is talking about, even if the user is confused about whether something is really a string or a number. The computer knows the exact type of it. We figured out ways of having stronger typing internally but still have the allomorphic “you can use this as that” idea. - -![](http://www.linuxvoice.com/wp-content/uploads/2015/07/wall2.jpg) - -**LV: For a long time Perl was seen as the “glue” language of the internet, for fitting bits and pieces together. Do you see Perl 6 as a release to satisfy the needs of existing users, or as a way to bring in new people, and bring about a resurgence in the language?** - -LW: The initial intent was to make a better Perl for Perl programmers. But as we looked at the some of the inadequacies of Perl 5, it became apparent that if we fixed these inadequacies, Perl 6 would be more applicable, as I mentioned in my talk – like how J. R. R. Tolkien talked about applicability [see http://tinyurl.com/nhpr8g2]. - -The idea that “easy things should be easy and hard things should be possible” goes way back, to the boundary between Perl 2 and Perl 3. In Perl 2, we couldn’t handle binary data or embedded nulls – it was just C-style strings. I said then that “Perl is just a text processing language – you don’t need those things in a text processing language”. - -But it occurred to me at the time that there were a large number of problems that were mostly text, and had a little bit of binary data in them – network addresses and things like that. You use binary data to open the socket but then text to process it. So the applicability of the language more than doubled by making it possible to handle binary data. - -That began a trade-off about what things should be easy in a language. Nowadays we have a principle in Perl, and we stole the phrase Huffman coding for it, from the bit encoding system where you have different sizes for characters. Common characters are encoded in a fewer number of bits, and rarer characters are encoded in more bits. - -> “There had to be a very careful balancing act. There were just so many good ideas at the beginning.” - -We stole that idea as a general principle for Perl, for things that are commonly used, or when you have to type them very often – the common things need to be shorter or more succinct. Another bit of that, however, is that they’re allowed to be more irregular. In natural language, it’s actually the most commonly used verbs that tend to be the most irregular. - -And there’s a reason for that, because you need more differentiation of them. One of my favourite books is called The Search for the Perfect Language by Umberto Eco, and it’s not about computer languages; it’s about philosophical languages, and the whole idea that maybe some ancient language was the perfect language and we should get back to it. - -All of those languages make the mistake of thinking that similar things should always be encoded similarly. But that’s not how you communicate. If you have a bunch of barnyard animals, and they all have related names, and you say “Go out and kill the Blerfoo”, but you really wanted them to kill the Blerfee, you might get a cow killed when you want a chicken killed. - -So in realms like that it’s actually better to differentiate the words, for more redundancy in the communication channel. The common words need to have more of that differentiation. It’s all about communicating efficiently, and then there’s also this idea of self-clocking codes. If you look at a UPC label on a product – a barcode – that’s actually a self-clocking code where each pair of bars and spaces is always in a unit of seven columns wide. You rely on that – you know the width of the bars will always add up to that. So it’s self-clocking. - -There are other self-clocking codes used in electronics. In the old transmission serial protocols there were stop and start bits so you could keep things synced up. Natural languages also do this. For instance, in the writing of Japanese, they don’t use spaces. Because the way they write it, they will have a Kanji character from Chinese at the head of each phrase, and then the endings are written in the a syllabary. - -**LV: Hiragana, right?** - -LW: Yes, Hiragana. So naturally the head of each phrase really stands out with this system. Similarly, in ancient Greek, most of the verbs were declined or conjugated. So they had standard endings were sort-of a clocking mechanism. Spaces were optional in their writing system as well – it was a more modern invention to put the spaces in. - -So similarly in computer languages, there’s value in having a self-clocking code. We rely on this heavily in Perl, and even more heavily in Perl 6 than in previous releases. The idea that when you’re parsing an expression, you’re either expecting a term or an infix operator. When you’re expecting a term you might also get a prefix operator – that’s kind-of in the same expectation slot – and when you’re expecting an infix you might also get a postfix for the previous term. - -But it flips back and forth. And if the compiler actually knows which it is expecting, you can overload those a little bit, and Perl does this. So a slash when it’s expecting a term will introduce a regular expression, whereas a slash when you’re expecting an infix will be division. On the other hand, we don’t want to overload everything, because then you lose the self-clocking redundancy. - -Most of our best error messages, for syntax errors, actually come out of noticing that you have two terms in a row. And then we try to figure out why there are two terms in a row – “oh, you must have left a semicolon out on the previous line”. So we can produce much better error messages than the more ad-hoc parsers. - -![](http://www.linuxvoice.com/wp-content/uploads/2015/07/wall3.jpg) - -**LV: Why has Perl 6 taken fifteen years? It must be hard overseeing a language when everyone has different opinions about things, and there’s not always the right way to do things, and the wrong way.** - -LW: There had to be a very careful balancing act. There were just so many good ideas at the beginning – well, I don’t want to say they were all good ideas. There were so many pain points, like there were 361 RFCs [feature proposal documents] when I expected maybe 20. We had to sit back and actually look at them all, and ignore the proposed solutions, because they were all over the map and all had tunnel vision. Each one many have just changed one thing, but if we had done them all, it would’ve been a complete mess. - -So we had to re-rationalise based on how people were actually hurting when they tried to use Perl 5. We started to look at the unifying, underlying ideas. Many of these RFCs were based on the fact that we had an inadequate type system. By introducing a more coherent type system we could fix many problems in a sane fashion and a cohesive fashion. - -And we started noticing other ways how we could unify the featuresets and start reusing ideas in different areas. Not necessarily that they were the same thing underneath. We have a standard way of writing pairs – well, two ways in Perl! But the way of writing pairs with a colon could also be reused for radix notation, or for literal numbers in any base. It could also be used for various alternative forms of quoting. We say in Perl that it’s “strangely consistent”. - -> “People who made early implementations of Perl 6 came back to me, cap in hand, and said “We really need a language designer.”” - -Similar ideas pop up, and you say “I’m already familiar with how that syntax works, but I see it’s being used for something else”. So it took some unity of vision to find these unifications. People who had the various ideas and made early implementations of Perl 6 came back to me, cap-in-hand, and said “We really need a language designer. Could you be our benevolent dictator?” - -So I was the language designer, but I was almost explicitly told: “Stay out of the implementation! We saw what you did made out of Perl 5, and we don’t like it!” It was really funny because the innards of the new implementation started looking a whole lot like Perl 5 inside, and maybe that’s why some of the early implementations didn’t work well. - -Because we were still feeling our way into the whole design, the implementations made a lot of assumptions about what VM should do and shouldn’t do, so we ended up with something like an object oriented assembly language. That sort of problem was fairly pervasive at the beginning. Then the Pugs guys came along and said “Let’s use Haskell, because it makes you think very clearly about what you’re doing. Let’s use it to clarify our semantic model underneath.” - -So we nailed down some of those semantic models, but more importantly, we started building the test suite at that point, to be consistent with those semantic models. Then after that, the Parrot VM continued developing, and then another implementation, Niecza, came along and it was based on .NET. It was by a young fellow who was very smart and implemented a large subset of Perl 6, but he was kind of a loner, didn’t really figure out a way to get other people involved in his project. - -At the same time the Parrot project was getting too big for anyone to really manage it inside, and very difficult to refactor. At that point the fellows working on Rakudo decided that we probably needed to be on more platforms than just the Parrot VM. So they invented a portability layer called NQP which stands for “Not Quite Perl”. They ported it to first of all run on the JVM (Java Virtual Machine), and while they were doing that they were also secretly working on a new VM called MoarVM. That became public a little over a year ago. - -Both MoarVM and JVM run a pretty much equivalent set of regression tests – Parrot is kind-of trailing back in some areas. So that has been very good to flush out VM-specific assumptions, and we’re starting to think about NQP targeting other things. There was a Google Summer of Code project year to target NQP to JavaScript, and that might fit right in, because MoarVM also uses Node.js for much of its more mundane processing. - -We probably need to concentrate on MoarVM for the rest of this year, until we actually define 6.0, and then the rest will catch up. - -**LV: Last year in the UK, the government kicked off the Year of Code, an attempt to get young people interested in programming. There are lots of opinions about how this should be done – like whether you should teach low-level languages at the start, so that people really understand memory usage, or a high-level language. What’s your take on that?** - -LW: Up until now, the Python community has done a much better job of getting into the lower levels of education than we have. We’d like to do something in that space too, and that’s partly why we have the butterfly logo, because it’s going to be appealing to seven year old girls! - -But we do think that Perl 6 will be learnable as a first language. A number of people have surprised us by learning Perl 5 as their first language. And you know, there are a number of fairly powerful concepts even in Perl 5, like closures, lexical scoping, and features you generally get from functional programming. Even more so in Perl 6. - -> “Until now, the Python community has done a much better job of getting into the lower levels of education.” - -Part of the reason the Perl 6 has taken so long is that we have around 50 different principles we try to stick to, and in language design you’re end up juggling everything and saying “what’s really the most important principle here”? There has been a lot of discussion about a lot of different things. Sometimes we commit to a decision, work with it for a while, and then realise it wasn’t quite the right decision. - -We didn’t design or specify pretty much anything about concurrent programming until someone came along who was smart enough about it and knew what the different trade-offs were, and that’s Jonathan Worthington. He has blended together ideas from other languages like Go and C#, with concurrent primitives that compose well. Composability is important in the rest of the language. - -There are an awful lot of concurrent and parallel programming systems that don’t compose well – like threads and locks, and there have been lots of ways to do it poorly. So in one sense, it’s been worth waiting this extra time to see some of these languages like Go and C# develop really good high-level primitives – that’s sort of a contradiction in terms – that compose well. - --------------------------------------------------------------------------------- - -via: http://www.linuxvoice.com/interview-larry-wall/ - -作者:[Mike Saunders][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.linuxvoice.com/author/mike/ diff --git a/sources/talk/20150806 Torvalds 2.0--Patricia Torvalds on computing college feminism and increasing diversity in tech.md b/sources/talk/20150806 Torvalds 2.0--Patricia Torvalds on computing college feminism and increasing diversity in tech.md index 36f5642c10..10a30119e1 100644 --- a/sources/talk/20150806 Torvalds 2.0--Patricia Torvalds on computing college feminism and increasing diversity in tech.md +++ b/sources/talk/20150806 Torvalds 2.0--Patricia Torvalds on computing college feminism and increasing diversity in tech.md @@ -78,4 +78,4 @@ via: http://opensource.com/life/15/8/patricia-torvalds-interview [4]:https://www.facebook.com/guerrillafeminism [5]:https://modelviewculture.com/ [6]:https://www.aspirations.org/ -[7]:https://www.facebook.com/groups/LadiesStormHackathons/ \ No newline at end of file +[7]:https://www.facebook.com/groups/LadiesStormHackathons/ diff --git a/sources/talk/20150818 A Linux User Using Windows 10 After More than 8 Years--See Comparison.md b/sources/talk/20150818 A Linux User Using Windows 10 After More than 8 Years--See Comparison.md deleted file mode 100644 index cf472613c4..0000000000 --- a/sources/talk/20150818 A Linux User Using Windows 10 After More than 8 Years--See Comparison.md +++ /dev/null @@ -1,344 +0,0 @@ -A Linux User Using ‘Windows 10′ After More than 8 Years – See Comparison -================================================================================ -Windows 10 is the newest member of windows NT family of which general availability was made on July 29, 2015. It is the successor of Windows 8.1. Windows 10 is supported on Intel Architecture 32 bit, AMD64 and ARMv7 processors. - -![Windows 10 and Linux Comparison](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-vs-Linux.jpg) - -Windows 10 and Linux Comparison - -As a Linux-user for more than 8 continuous years, I thought to test Windows 10, as it is making a lots of news these days. This article is a breakthrough of my observation. I will be seeing everything from the perspective of a Linux user so you may find it a bit biased towards Linux but with absolutely no false information. - -1. I searched Google with the text “download windows 10” and clicked the first link. - -![Search Windows 10](http://www.tecmint.com/wp-content/uploads/2015/08/Search-Windows-10.jpg) - -Search Windows 10 - -You may directly go to link : [https://www.microsoft.com/en-us/software-download/windows10ISO][1] - -2. I was supposed to select a edition from ‘windows 10‘, ‘windows 10 KN‘, ‘windows 10 N‘ and ‘windows 10 single language‘. - -![Select Windows 10 Edition](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Windows-10-Edition.jpg) - -Select Windows 10 Edition - -For those who want to know details of different editions of Windows 10, here is the brief details of editions. - -- Windows 10 – Contains everything offered by Microsoft for this OS. -- Windows 10N – This edition comes without Media-player. -- Windows 10KN – This edition comes without media playing capabilities. -- Windows 10 Single Language – Only one Language Pre-installed. - -3. I selected the first option ‘Windows 10‘ and clicked ‘Confirm‘. Then I was supposed to select a product language. I choose ‘English‘. - -I was provided with Two Download Links. One for 32-bit and other for 64-bit. I clicked 64-bit, as per my architecture. - -![Download Windows 10](http://www.tecmint.com/wp-content/uploads/2015/08/Download-Windows-10.jpg) - -Download Windows 10 - -With my download speed (15Mbps), it took me 3 long hours to download it. Unfortunately there were no torrent file to download the OS, which could otherwise have made the overall process smooth. The OS iso image size is 3.8 GB. - -I could not find an image of smaller size but again the truth is there don’t exist net-installer image like things for Windows. Also there is no way to calculate hash value after the iso image has been downloaded. - -Wonder why so ignorance from windows on such issues. To verify if the iso is downloaded correctly I need to write the image to a disk or to a USB flash drive and then boot my system and keep my finger crossed till the setup is finished. - -Lets start. I made my USB flash drive bootable with the windows 10 iso using dd command, as: - - # dd if=/home/avi/Downloads/Win10_English_x64.iso of=/dev/sdb1 bs=512M; sync - -It took a few minutes to complete the process. I then rebooted the system and choose to boot from USB flash Drive in my UEFI (BIOS) settings. - -#### System Requirements #### - -If you are upgrading - -- Upgrade supported only from Windows 7 SP1 or Windows 8.1 - -If you are fresh Installing - -- Processor: 1GHz or faster -- RAM : 1GB and Above(32-bit), 2GB and Above(64-bit) -- HDD: 16GB and Above(32-bit), 20GB and Above(64-bit) -- Graphic card: DirectX 9 or later + WDDM 1.0 Driver - -### Installation of Windows 10 ### - -1. Windows 10 boots. Yet again they changed the logo. Also no information on whats going on. - -![Windows 10 Logo](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-Logo.jpg) - -Windows 10 Logo - -2. Selected Language to install, Time & currency format and keyboard & Input methods before clicking Next. - -![Select Language and Time](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Language-and-Time.jpg) - -Select Language and Time - -3. And then ‘Install Now‘ Menu. - -![Install Windows 10](http://www.tecmint.com/wp-content/uploads/2015/08/Install-Windows-10.jpg) - -Install Windows 10 - -4. The next screen is asking for Product key. I clicked ‘skip’. - -![Windows 10 Product Key](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-Product-Key.jpg) - -Windows 10 Product Key - -5. Choose from a listed OS. I chose ‘windows 10 pro‘. - -![Select Install Operating System](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Install-Operating-System.jpg) - -Select Install Operating System - -6. oh yes the license agreement. Put a check mark against ‘I accept the license terms‘ and click next. - -![Accept License](http://www.tecmint.com/wp-content/uploads/2015/08/Accept-License.jpg) - -Accept License - -7. Next was to upgrade (to windows 10 from previous versions of windows) and Install Windows. Don’t know why custom: Windows Install only is suggested as advanced by windows. Anyway I chose to Install windows only. - -![Select Installation Type](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Installation-Type.jpg) - -Select Installation Type - -8. Selected the file-system and clicked ‘next’. - -![Select Install Drive](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Install-Drive.jpg) - -Select Install Drive - -9. The installer started to copy files, getting files ready for installation, installing features, installing updates and finishing up. It would be better if the installer would have shown verbose output on the action is it taking. - -![Installing Windows](http://www.tecmint.com/wp-content/uploads/2015/08/Installing-Windows.jpg) - -Installing Windows - -10. And then windows restarted. They said reboot was needed to continue. - -![Windows Installation Process](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-Installation-Process.jpg) - -Windows Installation Process - -11. And then all I got was the below screen which reads “Getting Ready”. It took 5+ minutes at this point. No idea what was going on. No output. - -![Windows Getting Ready](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-Getting-Ready.jpg) - -Windows Getting Ready - -12. yet again, it was time to “Enter Product Key”. I clicked “Do this later” and then used expressed settings. - -![Enter Product Key](http://www.tecmint.com/wp-content/uploads/2015/08/Enter-Product-Key.jpg) - -Enter Product Key - -![Select Express Settings](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Express-Settings.jpg) - -Select Express Settings - -14. And then three more output screens, where I as a Linuxer expected that the Installer will tell me what it is doing but all in vain. - -![Loading Windows](http://www.tecmint.com/wp-content/uploads/2015/08/Loading-Windows.jpg) - -Loading Windows - -![Getting Updates](http://www.tecmint.com/wp-content/uploads/2015/08/Getting-Updates.jpg) - -Getting Updates - -![Still Loading Windows](http://www.tecmint.com/wp-content/uploads/2015/08/Still-Loading-Windows.jpg) - -Still Loading Windows - -15. And then the installer wanted to know who owns this machine “My organization” or I myself. Chose “I own it” and then next. - -![Select Organization](http://www.tecmint.com/wp-content/uploads/2015/08/Select-Organization.jpg) - -Select Organization - -16. Installer prompted me to join “Azure Ad” or “Join a domain”, before I can click ‘continue’. I chooses the later option. - -![Connect Windows](http://www.tecmint.com/wp-content/uploads/2015/08/Connect-Windows.jpg) - -Connect Windows - -17. The Installer wants me to create an account. So I entered user_name and clicked ‘Next‘, I was expecting an error message that I must enter a password. - -![Create Account](http://www.tecmint.com/wp-content/uploads/2015/08/Create-Account.jpg) - -Create Account - -18. To my surprise Windows didn’t even showed warning/notification that I must create password. Such a negligence. Anyway I got my desktop. - -![Windows 10 Desktop](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-Desktop.jpg) - -Windows 10 Desktop - -#### Experience of a Linux-user (Myself) till now #### - -- No Net-installer Image -- Image size too heavy -- No way to check the integrity of iso downloaded (no hash check) -- The booting and installation remains same as it was in XP, Windows 7 and 8 perhaps. -- As usual no output on what windows Installer is doing – What file copying or what package installing. -- Installation was straight forward and easy as compared to the installation of a Linux distribution. - -### Windows 10 Testing ### - -19. The default Desktop is clean. It has a recycle bin Icon on the default desktop. Search web directly from the desktop itself. Additionally icons for Task viewing, Internet browsing, folder browsing and Microsoft store is there. As usual notification bar is present on the bottom right to sum up desktop. - -![Deskop Shortcut Icons](http://www.tecmint.com/wp-content/uploads/2015/08/Deskop-Shortcut-icons.jpg) - -Deskop Shortcut Icons - -20. Internet Explorer replaced with Microsoft Edge. Windows 10 has replace the legacy web browser Internet Explorer also known as IE with Edge aka project spartan. - -![Microsoft Edge Browser](http://www.tecmint.com/wp-content/uploads/2015/08/Edge-browser.jpg) - -Microsoft Edge Browser - -It is fast at least as compared to IE (as it seems it testing). Familiar user Interface. The home screen contains news feed updates. There is also a search bar title that reads ‘Where to next?‘. The browser loads time is considerably low which result in improving overall speed and performance. The memory usages of Edge seems normal. - -![Windows Performance](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-Performance.jpg) - -Windows Performance - -Edge has got cortana – Intelligent Personal Assistant, Support for chrome-extension, web Note – Take notes while Browsing, Share – Right from the tab without opening any other TAB. - -#### Experience of a Linux-user (Myself) on this point #### - -21. Microsoft has really improved web browsing. Lets see how stable and fine it remains. It don’t lag as of now. - -22. Though RAM usages by Edge was fine for me, a lots of users are complaining that Edge is notorious for Excessive RAM Usages. - -23. Difficult to say at this point if Edge is ready to compete with Chrome and/or Firefox at this point of time. Lets see what future unfolds. - -#### A few more Virtual Tour #### - -24. Start Menu redesigned – Seems clear and effective. Metro icons make it live. Populated with most commonly applications viz., Calendar, Mail, Edge, Photos, Contact, Temperature, Companion suite, OneNote, Store, Xbox, Music, Movies & TV, Money, News, Store, etc. - -![Windows Look and Feel](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-Look.jpg) - -Windows Look and Feel - -In Linux on Gnome Desktop Environment, I use to search required applications simply by pressing windows key and then type the name of the application. - -![Search Within Desktop](http://www.tecmint.com/wp-content/uploads/2015/08/Search-Within-Desktop.jpg) - -Search Within Desktop - -25. File Explorer – seems clear Designing. Edges are sharp. In the left pane there is link to quick access folders. - -![Windows File Explorer](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-File-Explorer.jpg) - -Windows File Explorer - -Equally clear and effective file explorer on Gnome Desktop Environment on Linux. Removed UN-necessary graphics and images from icons is a plus point. - -![File Browser on Gnome](http://www.tecmint.com/wp-content/uploads/2015/08/File-Browser.jpg) - -File Browser on Gnome - -26. Settings – Though the settings are a bit refined on Windows 10, you may compare it with the settings on a Linux Box. - -**Settings on Windows** - -![Windows 10 Settings](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-Settings.jpg) - -Windows 10 Settings - -**Setting on Linux Gnome** - -![Gnome Settings](http://www.tecmint.com/wp-content/uploads/2015/08/Gnome-Settings.jpg) - -Gnome Settings - -27. List of Applications – List of Application on Linux is better than what they use to provide (based upon my memory, when I was a regular windows user) but still it stands low as compared to how Gnome3 list application. - -**Application Listed by Windows** - -![Application List on Windows 10](http://www.tecmint.com/wp-content/uploads/2015/08/Application-List-on-Windows-10.jpg) - -Application List on Windows 10 - -**Application Listed by Gnome3 on Linux** - -![Gnome Application List on Linux](http://www.tecmint.com/wp-content/uploads/2015/08/Gnome-Application-List-on-Linux.jpg) - -Gnome Application List on Linux - -28. Virtual Desktop – Virtual Desktop feature of Windows 10 is one of those topic which are very much talked about these days. - -Here is the virtual Desktop in Windows 10. - -![Windows Virtual Desktop](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-Virtual-Desktop.jpg) - -Windows Virtual Desktop - -and the virtual Desktop on Linux we are using for more than 2 decades. - -![Virtual Desktop on Linux](http://www.tecmint.com/wp-content/uploads/2015/08/Virtual-Desktop-on-Linux.jpg) - -Virtual Desktop on Linux - -#### A few other features of Windows 10 #### - -29. Windows 10 comes with wi-fi sense. It shares your password with others. Anyone who is in the range of your wi-fi and connected to you over Skype, Outlook, Hotmail or Facebook can be granted access to your wifi network. And mind it this feature has been added as a feature by microsoft to save time and hassle-free connection. - -In a reply to question raised by Tecmint, Microsoft said – The user has to agree to enable wifi sense, everytime on a new network. oh! What a pathetic taste as far as security is concerned. I am not convinced. - -30. Up-gradation from Windows 7 and Windows 8.1 is free though the retail cost of Home and pro editions are approximately $119 and $199 respectively. - -31. Microsoft released first cumulative update for windows 10, which is said to put system into endless crash loop for a few people. Windows perhaps don’t understand such problem or don’t want to work on that part don’t know why. - -32. Microsoft’s inbuilt utility to block/hide unwanted updates don’t work in my case. This means If a update is there, there is no way to block/hide it. Sorry windows users! - -#### A few features native to Linux that windows 10 have #### - -Windows 10 has a lots of features that were taken directly from Linux. If Linux were not released under GNU License perhaps Microsoft would never had the below features. - -33. Command-line package management – Yup! You heard it right. Windows 10 has a built-in package management. It works only in Windows Power Shell. OneGet is the official package manager for windows. Windows package manager in action. - -![Windows 10 Package Manager](http://www.tecmint.com/wp-content/uploads/2015/08/Windows-10-Package-Manager.jpg) - -Windows 10 Package Manager - -- Border-less windows -- Flat Icons -- Virtual Desktop -- One search for Online+offline search -- Convergence of mobile and desktop OS - -### Overall Conclusion ### - -- Improved responsiveness -- Well implemented Animation -- low on resource -- Improved battery life -- Microsoft Edge web-browser is rock solid -- Supported on Raspberry pi 2. -- It is good because windows 8/8.1 was not upto mark and really bad. -- It is a the same old wine in new bottle. Almost the same things with brushed up icons. - -What my testing suggest is Windows 10 has improved on a few things like look and feel (as windows always did), +1 for Project spartan, Virtual Desktop, Command-line package management, one search for online and offline search. It is overall an improved product but those who thinks that Windows 10 will prove to be the last nail in the coffin of Linux are mistaken. - -Linux is years ahead of Windows. Their approach is different. In near future windows won’t stand anywhere around Linux and there is nothing for which a Linux user need to go to Windows 10. - -That’s all for now. Hope you liked the post. I will be here again with another interesting post you people will love to read. Provide us with your valuable feedback in the comments below. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/a-linux-user-using-windows-10-after-more-than-8-years-see-comparison/ - -作者:[vishek Kumar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:https://www.microsoft.com/en-us/software-download/windows10ISO \ No newline at end of file diff --git a/sources/talk/20150820 LinuxCon's surprise keynote speaker ​Linus Torvalds muses about open-source software.md b/sources/talk/20150820 LinuxCon's surprise keynote speaker ​Linus Torvalds muses about open-source software.md deleted file mode 100644 index c045233630..0000000000 --- a/sources/talk/20150820 LinuxCon's surprise keynote speaker ​Linus Torvalds muses about open-source software.md +++ /dev/null @@ -1,46 +0,0 @@ -LinuxCon's surprise keynote speaker ​Linus Torvalds muses about open-source software -================================================================================ -> In a broad-ranging question and answer session, Linus Torvalds, Linux's founder, shared his thoughts on the current state of open source and Linux. - -**SEATTLE** -- [LinuxCon][1] attendees got an early Christmas present when the Wednesday morning "surprise" keynote speaker turned out to be Linux's founder, Linus Torvalds. - -![zemlin-and-torvalds-08192015-1.jpg](http://zdnet2.cbsistatic.com/hub/i/2015/08/19/9951f05a-fedf-4bf4-a4a1-3b4a15458de6/c19c89ded58025eccd090787ba40e803/zemlin-and-torvalds-08192015-1.jpg) - -Jim Zemlin and Linus Torvalds shooting the breeze at LinuxCon in Seattle. -- sjvn - -Jim Zemlin, the Linux Foundation's executive director, opened the question and answer session by quoting from a recent article about Linus, "[Torvalds may be the most influential individual economic force][2] of the past 20 years. ... Torvalds has, in effect, been as instrumental in retooling the production lines of the modern economy as Henry Ford was 100 years earlier." - -Torvalds replied, "I don't think I'm all that powerful, but I'm glad to get all the credit for open source." For someone who's arguably been more influential on technology than Bill Gates, Steve Jobs, or Larry Ellison, Torvalds remains amusingly modest. That's probably one reason [Torvalds, who doesn't suffer fools gladly][3], remains the unchallenged leader of Linux. - -It also helps that he doesn't take himself seriously, except when it comes to code quality. Zemlin reminded him that he was also described in the same article as being "5-feet, ho-hum tall with a paunch, ... his body type and gait resemble that of Tux, the penguin mascot of Linux." Torvald's reply was to grin and say "What is this? A roast?" He added that 5'8" was a perfectly good height. - -More seriously, Zemlin asked Torvalds what he thought about the current excitement over containers. Indeed, at times LinuxCon has felt like DockerCon. Torvalds replied, "I'm glad that the kernel is far removed from containers and other buzzwords. We only care about just the kernel. I'm so focused on the kernel I really don't care. I don't get involved in the politics above the kernel and I'm really happy that I don't know." - -Moving on, Zemlin asked Torvalds what he thought about the demand from the Internet of Things (IoT) for an even smaller Linux kernel. "Everyone has always wished for a smaller kernel," Torvalds said. "But, with all the modules it's still tens of MegaBytes in size. It's shocking that it used to fit into a MB. We'd like it to be mean lean, mean IT machine again." - -But, "Torvalds continued, "It's hard to get rid of unnecessary fat. Things tend to grow. Realistically I don't think we can get down to the sizes we were 20 years ago." - -As for security, the next topic, Torvalds said, "I'm at odds with the security community. They tend to see technology as black and white. If it's not security they don't care at all about it." The truth is "security is bugs. Most of the security issues we've had in the kernel hasn't been that big. Most of them have been really stupid and then some clever person takes advantage of it." - -The bottom line is, "We'll never get rid of bugs so security will never be perfect. We do try to be really careful about code. With user space we have to be very strict." But, "Bugs happen and all you can do is mitigate them. Open source is doing fairly well, but anyone who thinks we'll ever be completely secure is foolish." - -Zemlin concluded by asking Torvalds where he saw Linux ten years from now. Torvalds replied that he doesn't look at it this way. "I'm plodding, pedestrian, I look ahead six months, I don't plan 10 years ahead. I think that's insane." - -Sure, "companies plan ten years, and their plans use open source. Their whole process is very forward thinking. But I'm not worried about 10 years ahead. I look to the next release and the release beyond that." - -For Torvalds, who works at home where "the FedEx guy is no longer surprised to find me in my bathrobe at 2 in the afternoon," looking ahead a few months works just fine. And so do all the businesses -- both technology-based Amazon, Google, Facebook and more mainstream, WalMart, the New York Stock Exchange, and McDonalds -- that live on Linux every day. - --------------------------------------------------------------------------------- - -via: http://www.zdnet.com/article/linus-torvalds-muses-about-open-source-software/ - -作者:[Steven J. Vaughan-Nichols][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.zdnet.com/meet-the-team/us/steven-j-vaughan-nichols/ -[1]:http://events.linuxfoundation.org/events/linuxcon-north-america -[2]:http://www.bloomberg.com/news/articles/2015-06-16/the-creator-of-linux-on-the-future-without-him -[3]:http://www.zdnet.com/article/linus-torvalds-finds-gnome-3-4-to-be-a-total-user-experience-design-failure/ \ No newline at end of file diff --git a/sources/talk/20150820 Which Open Source Linux Distributions Would Presidential Hopefuls Run.md b/sources/talk/20150820 Which Open Source Linux Distributions Would Presidential Hopefuls Run.md deleted file mode 100644 index 2a850a7468..0000000000 --- a/sources/talk/20150820 Which Open Source Linux Distributions Would Presidential Hopefuls Run.md +++ /dev/null @@ -1,53 +0,0 @@ -Which Open Source Linux Distributions Would Presidential Hopefuls Run? -================================================================================ -![Republican presidential candidate Donald Trump -](http://thevarguy.com/site-files/thevarguy.com/files/imagecache/medium_img/uploads/2015/08/donaldtrump.jpg) - -Republican presidential candidate Donald Trump - -If people running for president used Linux or another open source operating system, which distribution would it be? That's a key question that the rest of the press—distracted by issues of questionable relevance such as "policy platforms" and whether it's appropriate to add an exclamation point to one's Christian name—has been ignoring. But the ignorance ends here: Read on for this sometime-journalist's take on presidential elections and Linux distributions. - -If this sounds like a familiar topic to those of you who have been reading my drivel for years (is anyone, other than my dear editor, unfortunate enough to have actually done that?), it's because I wrote a [similar post][1] during the last presidential election cycle. Some kind readers took that article more seriously than I intended, so I'll take a moment to point out that I don't actually believe that open source software and political campaigns have anything meaningful to do with one another. I am just trying to amuse myself at the start of a new week. - -But you can make of this what you will. You're the reader, after all. - -### Linux Distributions of Choice: Republicans ### - -Today, I'll cover just the Republicans. And I won't even discuss all of them, since the candidates hoping for the Republican party's nomination are too numerous to cover fully here in one post. But for starters: - -If **Jeb (Jeb!?) Bush** ran Linux, it would be [Debian][2]. It's a relatively boring distribution designed for serious, grown-up hackers—the kind who see it as their mission to be the adults in the pack and clean up the messes that less-experienced open source fans create. Of course, this also makes Debian relatively unexciting, and its user base remains perennially small as a result. - -**Scott Walker**, for his part, would be a [Damn Small Linux][3] (DSL) user. Requiring merely 50MB of disk space and 16MB of RAM to run, DSL can breathe new life into 20-year-old 486 computers—which is exactly what a cost-cutting guru like Walker would want. Of course, the user experience you get from DSL is damn primitive; the platform barely runs a browser. But at least you won't be wasting money on new computer hardware when the stuff you bought in 1993 can still serve you perfectly well. - -How about **Chris Christie**? He'd obviously be clinging to [Relax-and-Recover Linux][4], which bills itself as a "setup-and-forget Linux bare metal disaster recovery solution." "Setup-and-forget" has basically been Christie's political strategy ever since that unfortunate incident on the George Washington Bridge stymied his political momentum. Disaster recovery may or may not bring back everything for Christie in the end, but at least he might succeed in recovering a confidential email or two that accidentally disappeared when his computer crashed. - -As for **Carly Fiorina**, she'd no doubt be using software developed for "[The Machine][5]" operating system from [Hewlett-Packard][6] (HPQ), the company she led from 1999 to 2005. The Machine actually may run several different operating systems, which may or may not be based on Linux—details remain unclear—and its development began well after Fiorina's tenure at HP came to a conclusion. Still, her roots as a successful executive in the IT world form an important part of her profile today, meaning that her ties to HP have hardly been severed fully. - -Last but not least—and you knew this was coming—there's **Donald Trump**. He'd most likely pay a team of elite hackers millions of dollars to custom-build an operating system just for him—even though he could obtain a perfectly good, ready-made operating system for free—to show off how much money he has to waste. He'd then brag about it being the best operating system ever made, though it would of course not be compliant with POSIX or anything else, because that would mean catering to the establishment. The platform would also be totally undocumented, since, if Trump explained how his operating system actually worked, he'd risk giving away all his secrets to the Islamic State—obviously. - -Alternatively, if Trump had to go with a Linux platform already out there, [Ubuntu][7] seems like the most obvious choice. Like Trump, the Ubuntu developers have taken a we-do-what-we-want approach to building open source software by implementing their own, sometimes proprietary applications and interfaces. Free-software purists hate Ubuntu for that, but plenty of ordinary people like it a lot. Of course, whether playing purely by your own rules—in the realms of either software or politics—is sustainable in the long run remains to be seen. - -### Stay Tuned ### - -If you're wondering why I haven't yet mentioned the Democratic candidates, worry not. I am not leaving them out of today's writing because I like them any more or less than the Republicans. (Personally, I think the peculiar American practice of having only two viable political parties—which virtually no other functioning democracy does—is ridiculous, and I am suspicious of all of these candidates as a result.) - -On the contrary, there's plenty to say about the Linux distributions the Democrats might use, too. And I will, in a future post. Stay tuned. - --------------------------------------------------------------------------------- - -via: http://thevarguy.com/open-source-application-software-companies/081715/which-open-source-linux-distributions-would-presidential- - -作者:[Christopher Tozzi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://thevarguy.com/author/christopher-tozzi -[1]:http://thevarguy.com/open-source-application-software-companies/aligning-linux-distributions-presidential-hopefuls -[2]:http://debian.org/ -[3]:http://www.damnsmalllinux.org/ -[4]:http://relax-and-recover.org/ -[5]:http://thevarguy.com/open-source-application-software-companies/061614/hps-machine-open-source-os-truly-revolutionary -[6]:http://hp.com/ -[7]:http://ubuntu.com/ \ No newline at end of file diff --git a/sources/talk/20150820 Why did you start using Linux.md b/sources/talk/20150820 Why did you start using Linux.md deleted file mode 100644 index 3ddf90c560..0000000000 --- a/sources/talk/20150820 Why did you start using Linux.md +++ /dev/null @@ -1,148 +0,0 @@ -KevinSJ translating -Why did you start using Linux? -================================================================================ -> In today's open source roundup: What got you started with Linux? Plus: IBM's Linux only Mainframe. And why you should skip Windows 10 and go with Linux - -### Why did you start using Linux? ### - -Linux has become quite popular over the years, with many users defecting to it from OS X or Windows. But have you ever wondered what got people started with Linux? A redditor asked that question and got some very interesting answers. - -SilverKnight asked his question on the Linux subreddit: - -> I know this has been asked before, but I wanted to hear more from the younger generation why it is that they started using linux and what keeps them here. -> -> I dont want to discourage others from giving their linux origin stories, because those are usually pretty good, but I was mostly curious about our younger population since there isn't much out there from them yet. -> -> I myself am 27 and am a linux dabbler. I have installed quite a few different distros over the years but I haven't made the plunge to full time linux. I guess I am looking for some more reasons/inspiration to jump on the bandwagon. -> -> [More at Reddit][1] - -Fellow redditors in the Linux subreddit responded with their thoughts: - -> **DoublePlusGood**: "I started using Backtrack Linux (now Kali) at 12 because I wanted to be a "1337 haxor". I've stayed with Linux (Archlinux currently) because it lets me have the endless freedom to make my computer do what I want." -> -> **Zack**: "I'm a Linux user since, I think, the age of 12 or 13, I'm 15 now. -> -> It started when I got tired with Windows XP at 11 and the waiting, dammit am I impatient sometimes, but waiting for a basic task such as shutting down just made me tired of Windows all together. -> -> A few months previously I had started participating in discussions in a channel on the freenode IRC network which was about a game, and as freenode usually goes, it was open source and most of the users used Linux. -> -> I kept on hearing about this Linux but wasn't that interested in it at the time. However, because the channel (and most of freenode) involved quite a bit of programming I started learning Python. -> -> A year passed and I was attempting to install GNU/Linux (specifically Ubuntu) on my new (technically old, but I had just got it for my birthday) PC, unfortunately it continually froze, for reasons unknown (probably a bad hard drive, or a lot of dust or something else...). -> -> Back then I was the type to give up on things, so I just continually nagged my dad to try and install Ubuntu, he couldn't do it for the same reasons. -> -> After wanting Linux for a while I became determined to get Linux and ditch windows for good. So instead of Ubuntu I tried Linux Mint, being a derivative of Ubuntu(?) I didn't have high hopes, but it worked! -> -> I continued using it for another 6 months. -> -> During that time a friend on IRC gave me a virtual machine (which ran Ubuntu) on their server, I kept it for a year a bit until my dad got me my own server. -> -> After the 6 months I got a new PC (which I still use!) I wanted to try something different. -> -> I decided to install openSUSE. -> -> I liked it a lot, and on the same Christmas I obtained a Raspberry Pi, and stuck with Debian on it for a while due to the lack of support other distros had for it." -> -> **Cqz**: "Was about 9 when the Windows 98 machine handed down to me stopped working for reasons unknown. We had no Windows install disk, but Dad had one of those magazines that comes with demo programs and stuff on CDs. This one happened to have install media for Mandrake Linux, and so suddenly I was a Linux user. Had no idea what I was doing but had a lot of fun doing it, and although in following years I often dual booted with various Windows versions, the FLOSS world always felt like home. Currently only have one Windows installation, which is a virtual machine for games." -> -> **Tosmarcel**: "I was 15 and was really curious about this new concept called 'programming' and then I stumbled upon this Harvard course, CS50. They told users to install a Linux vm to use the command line. But then I asked myself: "Why doesn't windows have this command line?!". I googled 'linux' and Ubuntu was the top result -Ended up installing Ubuntu and deleted the windows partition accidentally... It was really hard to adapt because I knew nothing about linux. Now I'm 16 and running arch linux, never looked back and I love it!" -> -> **Micioonthet**: "First heard about Linux in the 5th grade when I went over to a friend's house and his laptop was running MEPIS (an old fork of Debian) instead of Windows XP. -> -> Turns out his dad was a socialist (in America) and their family didn't trust Microsoft. This was completely foreign to me, and I was confused as to why he would bother using an operating system that didn't support the majority of software that I knew. -> -> Fast forward to when I was 13 and without a laptop. Another friend of mine was complaining about how slow his laptop was, so I offered to buy it off of him so I could fix it up and use it for myself. I paid $20 and got a virus filled, unusable HP Pavilion with Windows Vista. Instead of trying to clean up the disgusting Windows install, I remembered that Linux was a thing and that it was free. I burned an Ubuntu 12.04 disc and installed it right away, and was absolutely astonished by the performance. -> -> Minecraft (one of the few early Linux games because it ran on Java), which could barely run at 5 FPS on Vista, ran at an entirely playable 25 FPS on a clean install of Ubuntu. -> -> I actually still have that old laptop and use it occasionally, because why not? Linux doesn't care how old your hardware is. -> -> I since converted my dad to Linux and we buy old computers at lawn sales and thrift stores for pennies and throw Linux Mint or some other lightweight distros on them." -> -> **Webtm**: "My dad had every computer in the house with some distribution on it, I think a couple with OpenSUSE and Debian, and his personal computer had Slackware on it. So I remember being little and playing around with Debian and not really getting into it much. So I had a Windows laptop for a few years and my dad asked me if I wanted to try out Debian. It was a fun experience and ever since then I've been using Debian and trying out distributions. I currently moved away from Linux and have been using FreeBSD for around 5 months now, and I am absolutely happy with it. -> -> The control over your system is fantastic. There are a lot of cool open source projects. I guess a lot of the fun was figuring out how to do the things I want by myself and tweaking those things in ways to make them do something else. Stability and performance is also a HUGE plus. Not to mention the level of privacy when switching." -> -> **Wyronaut**: "I'm currently 18, but I first started using Linux when I was 13. Back then my first distro was Ubuntu. The reason why I wanted to check out Linux, was because I was hosting little Minecraft game servers for myself and a couple of friends, back then Minecraft was pretty new-ish. I read that the defacto operating system for hosting servers was Linux. -> -> I was a big newbie when it came to command line work, so Linux scared me a little, because I had to take care of a lot of things myself. But thanks to google and a few wiki pages I managed to get up a couple of simple servers running on a few older PC's I had lying around. Great use for all that older hardware no one in the house ever uses. -> -> After running a few game servers I started running a few web servers as well. Experimenting with HTML, CSS and PHP. I worked with those for a year or two. Afterwards, took a look at Java. I made the terrible mistake of watching TheNewBoston video's. -> -> So after like a week I gave up on Java and went to pick up a book on Python instead. That book was Learn Python The Hard Way by Zed A. Shaw. After I finished that at the fast pace of two weeks, I picked up the book C++ Primer, because at the time I wanted to become a game developer. Went trough about half of the book (~500 pages) and burned out on learning. At that point I was spending a sickening amount of time behind my computer. -> -> After taking a bit of a break, I decided to pick up JavaScript. Read like 2 books, made like 4 different platformers and called it a day. -> -> Now we're arriving at the present. I had to go through the horrendous process of finding a school and deciding what job I wanted to strive for when I graduated. I ruled out anything in the gaming sector as I didn't want anything to do with graphics programming anymore, I also got completely sick of drawing and modelling. And I found this bachelor that had something to do with netsec and I instantly fell in love. I picked up a couple books on C to shred this vacation period and brushed up on some maths and I'm now waiting for the new school year to commence. -> -> Right now, I am having loads of fun with Arch Linux, made couple of different arrangements on different PC's and it's going great! -> -> In a sense Linux is what also got me into programming and ultimately into what I'm going to study in college starting this september. I probably have my future life to thank for it." -> -> **Linuxllc**: "You also can learn from old farts like me. -> -> The crutch, The crutch, The crutch. Getting rid of the crutch will inspired you and have good reason to stick with Linux. -> -> I got rid of my crutch(Windows XP) back in 2003. Took me only 5 days to get all my computer task back and running at a 100% workflow. Including all my peripheral devices. Minus any Windows games. I just play native Linux games." -> -> **Highclass**: "Hey I'm 28 not sure if this is the age group you are looking for. -> -> To be honest, I was always interested in computers and the thought of a free operating system was intriguing even though at the time I didn't fully grasp the free software philosophy, to me it was free as in no cost. I also did not find the CLI too intimidating as from an early age I had exposure to DOS. -> -> I believe my first distro was Mandrake, I was 11 or 12, I messed up the family computer on several occasions.... I ended up sticking with it always trying to push myself to the next level. Now I work in the industry with Linux everyday. -> -> /shrug" -> -> Matto: "My computer couldn't run fast enough for XP (got it at a garage sale), so I started looking for alternatives. Ubuntu came up in Google. I was maybe 15 or 16 at the time. Now I'm 23 and have a job working on a product that uses Linux internally." -> -> [More at Reddit][2] - -### IBM's Linux only Mainframe ### - -IBM has a long history with Linux, and now the company has created a Mainframe that features Ubuntu Linux. The new machine is named LinuxOne. - -Ron Miller reports for TechCrunch: - -> The new mainframes come in two flavors, named for penguins (Linux — penguins — get it?). The first is called Emperor and runs on the IBM z13, which we wrote about in January. The other is a smaller mainframe called the Rockhopper designed for a more “entry level” mainframe buyer. -> -> You may have thought that mainframes went the way of the dinosaur, but they are still alive and well and running in large institutions throughout the world. IBM as part of its broader strategy to promote the cloud, analytics and security is hoping to expand the potential market for mainframes by running Ubuntu Linux and supporting a range of popular open source enterprise software such as Apache Spark, Node.js, MongoDB, MariaDB, PostgreSQL and Chef. -> -> The metered mainframe will still sit inside the customer’s on-premises data center, but billing will be based on how much the customer uses the system, much like a cloud model, Mauri explained. -> -> ...IBM is looking for ways to increase those sales. Partnering with Canonical and encouraging use of open source tools on a mainframe gives the company a new way to attract customers to a small, but lucrative market. -> -> [More at TechCrunch][3] - -### Why you should skip Windows 10 and opt for Linux ### - -Since Windows 10 has been released there has been quite a bit of media coverage about its potential to spy on users. ZDNet has listed some reasons why you should skip Windows 10 and opt for Linux instead on your computer. - -SJVN reports for ZDNet: - -> You can try to turn Windows 10's data-sharing ways off, but, bad news: Windows 10 will keep sharing some of your data with Microsoft anyway. There is an alternative: Desktop Linux. -> -> You can do a lot to keep Windows 10 from blabbing, but you can't always stop it from talking. Cortana, Windows 10's voice activated assistant, for example, will share some data with Microsoft, even when it's disabled. That data includes a persistent computer ID to identify your PC to Microsoft. -> -> So, if that gives you a privacy panic attack, you can either stick with your old operating system, which is likely Windows 7, or move to Linux. Eventually, when Windows 7 is no longer supported, if you want privacy you'll have no other viable choice but Linux. -> -> There are other, more obscure desktop operating systems that are also desktop-based and private. These include the BSD Unix family such as FreeBSD, PCBSD, and NetBSD and eComStation, OS/2 for the 21st century. Your best choice, though, is a desktop-based Linux with a low learning curve. -> -> [More at ZDNet][4] - --------------------------------------------------------------------------------- - -via: http://www.itworld.com/article/2972587/linux/why-did-you-start-using-linux.html - -作者:[Jim Lynch][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.itworld.com/author/Jim-Lynch/ -[1]:https://www.reddit.com/r/linux/comments/3hb2sr/question_for_younger_users_why_did_you_start/ -[2]:https://www.reddit.com/r/linux/comments/3hb2sr/question_for_younger_users_why_did_you_start/ -[3]:http://techcrunch.com/2015/08/16/ibm-teams-with-canonical-on-linux-mainframe/ -[4]:http://www.zdnet.com/article/sick-of-windows-spying-on-you-go-linux/ diff --git a/sources/talk/20150821 Linux 4.3 Kernel To Add The MOST Driver Subsystem.md b/sources/talk/20150821 Linux 4.3 Kernel To Add The MOST Driver Subsystem.md deleted file mode 100644 index 5b4ad2251f..0000000000 --- a/sources/talk/20150821 Linux 4.3 Kernel To Add The MOST Driver Subsystem.md +++ /dev/null @@ -1,28 +0,0 @@ -Linux 4.3 Kernel To Add The MOST Driver Subsystem -================================================================================ - While the [Linux 4.2][1] kernel hasn't been officially released yet, Greg Kroah-Hartman sent in early his pull requests for the various subsystems he maintains for the Linux 4.3 merge window. - -The pull requests sent in by Greg KH on Thursday include the Linux 4.3 merge window updates for the driver core, TTY/serial, USB driver, char/misc, and the staging area. These pull requests don't offer any really shocking changes but mostly routine work on improvements / additions / bug-fixes. The staging area once again is heavy with various fixes and clean-ups but there's also a new driver subsystem. - -Greg mentioned of the [4.3 staging changes][2], "Lots of things all over the place, almost all of them trivial fixups and changes. The usual IIO updates and new drivers and we have added the MOST driver subsystem which is getting cleaned up in the tree. The ozwpan driver is finally being deleted as it is obviously abandoned and no one cares about it." - -The MOST driver subsystem is short for the Media Oriented Systems Transport. The documentation to be added in the Linux 4.3 kernel explains, "The Media Oriented Systems Transport (MOST) driver gives Linux applications access a MOST network: The Automotive Information Backbone and the de-facto standard for high-bandwidth automotive multimedia networking. MOST defines the protocol, hardware and software layers necessary to allow for the efficient and low-cost transport of control, real-time and packet data using a single medium (physical layer). Media currently in use are fiber optics, unshielded twisted pair cables (UTP) and coax cables. MOST also supports various speed grades up to 150 Mbps." As explained, MOST is mostly about Linux in automotive applications. - -While Greg KH sent in his various subsystem updates for Linux 4.3, he didn't yet propose the [KDBUS][5] kernel code be pulled. He's previously expressed plans for [KDBUS in Linux 4.3][3] so we'll wait until the 4.3 merge window officially gets going to see what happens. Stay tuned to Phoronix for more Linux 4.3 kernel coverage next week when the merge window will begin, [assuming Linus releases 4.2][4] this weekend. - --------------------------------------------------------------------------------- - -via: http://www.phoronix.com/scan.php?page=news_item&px=Linux-4.3-Staging-Pull - -作者:[Michael Larabel][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.michaellarabel.com/ -[1]:http://www.phoronix.com/scan.php?page=search&q=Linux+4.2 -[2]:http://lkml.iu.edu/hypermail/linux/kernel/1508.2/02604.html -[3]:http://www.phoronix.com/scan.php?page=news_item&px=KDBUS-Not-In-Linux-4.2 -[4]:http://www.phoronix.com/scan.php?page=news_item&px=Linux-4.2-rc7-Released -[5]:http://www.phoronix.com/scan.php?page=search&q=KDBUS \ No newline at end of file diff --git a/sources/talk/20150823 How learning data structures and algorithms make you a better developer.md b/sources/talk/20150823 How learning data structures and algorithms make you a better developer.md deleted file mode 100644 index 7152efa1ed..0000000000 --- a/sources/talk/20150823 How learning data structures and algorithms make you a better developer.md +++ /dev/null @@ -1,126 +0,0 @@ -How learning data structures and algorithms make you a better developer -================================================================================ - -> "I'm a huge proponent of designing your code around the data, rather than the other way around, and I think it's one of the reasons git has been fairly successful […] I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important." --- Linus Torvalds - ---- - -> "Smart data structures and dumb code works a lot better than the other way around." --- Eric S. Raymond, The Cathedral and The Bazaar - -Learning about data structures and algorithms makes you a stonking good programmer. - -**Data structures and algorithms are patterns for solving problems.** The more of them you have in your utility belt, the greater variety of problems you'll be able to solve. You'll also be able to come up with more elegant solutions to new problems than you would otherwise be able to. - -You'll understand, ***in depth***, how your computer gets things done. This informs any technical decisions you make, regardless of whether or not you're using a given algorithm directly. Everything from memory allocation in the depths of your operating system, to the inner workings of your RDBMS to how your networking stack manages to send data from one corner of Earth to another. All computers rely on fundamental data structures and algorithms, so understanding them better makes you understand the computer better. - -Cultivate a broad and deep knowledge of algorithms and you'll have stock solutions to large classes of problems. Problem spaces that you had difficulty modelling before often slot neatly into well-worn data structures that elegantly handle the known use-cases. Dive deep into the implementation of even the most basic data structures and you'll start seeing applications for them in your day-to-day programming tasks. - -You'll also be able to come up with novel solutions to the somewhat fruitier problems you're faced with. Data structures and algorithms have the habit of proving themselves useful in situations that they weren't originally intended for, and the only way you'll discover these on your own is by having a deep and intuitive knowledge of at least the basics. - -But enough with the theory, have a look at some examples - -###Figuring out the fastest way to get somewhere### -Let's say we're creating software to figure out the shortest distance from one international airport to another. Assume we're constrained to following routes: - -![](http://www.happybearsoftware.com/assets/posts/how-learning-data-structures-and-algorithms-makes-you-a-better-developer/airport-graph-d2e32b3344b708383e405d67a80c29ea.svg) - -graph of destinations and the distances between them, how can we find the shortest distance say, from Helsinki to London? **Dijkstra's algorithm** is the algorithm that will definitely get us the right answer in the shortest time. - -In all likelihood, if you ever came across this problem and knew that Dijkstra's algorithm was the solution, you'd probably never have to implement it from scratch. Just ***knowing*** about it would point you to a library implementation that solves the problem for you. - -If you did dive deep into the implementation, you'd be working through one of the most important graph algorithms we know of. You'd know that in practice it's a little resource intensive so an extension called A* is often used in it's place. It gets used everywhere from robot guidance to routing TCP packets to GPS pathfinding. - -###Figuring out the order to do things in### -Let's say you're trying to model courses on a new Massive Open Online Courses platform (like Udemy or Khan Academy). Some of the courses depend on each other. For example, a user has to have taken Calculus before she's eligible for the course on Newtonian Mechanics. Courses can have multiple dependencies. Here's are some examples of what that might look like written out in YAML: - - # Mapping from course name to requirements - # - # If you're a physcist or a mathematicisn and you're reading this, sincere - # apologies for the completely made-up dependency tree :) - courses: - arithmetic: [] - algebra: [arithmetic] - trigonometry: [algebra] - calculus: [algebra, trigonometry] - geometry: [algebra] - mechanics: [calculus, trigonometry] - atomic_physics: [mechanics, calculus] - electromagnetism: [calculus, atomic_physics] - radioactivity: [algebra, atomic_physics] - astrophysics: [radioactivity, calculus] - quantumn_mechanics: [atomic_physics, radioactivity, calculus] - -Given those dependencies, as a user, I want to be able to pick any course and have the system give me an ordered list of courses that I would have to take to be eligible. So if I picked `calculus`, I'd want the system to return the list: - - arithmetic -> algebra -> trigonometry -> calculus - -Two important constraints on this that may not be self-evident: - - - At every stage in the course list, the dependencies of the next course must be met. - - We don't want any duplicate courses in the list. - -This is an example of resolving dependencies and the algorithm we're looking for to solve this problem is called topological sort (tsort). Tsort works on a dependency graph like we've outlined in the YAML above. Here's what that would look like in a graph (where each arrow means `requires`): - -![](http://www.happybearsoftware.com/assets/posts/how-learning-data-structures-and-algorithms-makes-you-a-better-developer/course-graph-2f60f42bb0dc95319954ce34c02705a2.svg) - -topological sort does is take a graph like the one above and find an ordering in which all the dependencies are met at each stage. So if we took a sub-graph that only contained `radioactivity` and it's dependencies, then ran tsort on it, we might get the following ordering: - - arithmetic - algebra - trigonometry - calculus - mechanics - atomic_physics - radioactivity - -This meets the requirements set out by the use case we described above. A user just has to pick `radioactivity` and they'll get an ordered list of all the courses they have to work through before they're allowed to. - -We don't even need to go into the details of how topological sort works before we put it to good use. In all likelihood, your programming language of choice probably has an implementation of it in the standard library. In the worst case scenario, your Unix probably has the `tsort` utility installed by default, run man `tsort` and have a play with it. - -###Other places tsort get's used### - - - **Tools like** `make` allow you to declare task dependencies. Topological sort is used under the hood to figure out what order the tasks should be executed in. - - **Any programming language that has a `require` directive**, indicating that the current file requires the code in a different file to be run first. Here topological sort can be used to figure out what order the files should be loaded in so that each is only loaded once and all dependencies are met. - - **Project management tools with Gantt charts**. A Gantt chart is a graph that outlines all the dependencies of a given task and gives you an estimate of when it will be complete based on those dependencies. I'm not a fan of Gantt charts, but it's highly likely that tsort will be used to draw them. - -###Squeezing data with Huffman coding### -[Huffman coding](http://en.wikipedia.org/wiki/Huffman_coding) is an algorithm used for lossless data compression. It works by analyzing the data you want to compress and creating a binary code for each character. More frequently occurring characters get smaller codes, so `e` might be encoded as `111` while `x` might be `10010`. The codes are created so that they can be concatenated without a delimeter and still be decoded accurately. - -Huffman coding is used along with LZ77 in the DEFLATE algorithm which is used by gzip to compress things. gzip is used all over the place, in particular for compressing files (typically anything with a `.gz` extension) and for http requests/responses in transit. - -Knowing how to implement and use Huffman coding has a number of benefits: - - - You'll know why a larger compression context results in better compression overall (e.g. the more you compress, the better the compression ratio). This is one of the proposed benefits of SPDY: that you get better compression on multiple HTTP requests/responses. - - You'll know that if you're compressing your javascript/css in transit anyway, it's completely pointless to run a minifier on them. Sames goes for PNG files, which use DEFLATE internally for compression already. - - If you ever find yourself trying to forcibly decipher encrypted information , you may realize that since repeating data compresses better, the compression ratio of a given bit of ciphertext will help you determine it's [block cipher mode of operation](http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation). - -###Picking what to learn next is hard### -Being a programmer involves learning constantly. To operate as a web developer you need to know markup languages, high level languages like ruby/python, regular expressions, SQL and JavaScript. You need to know the fine details of HTTP, how to drive a unix terminal and the subtle art of object oriented programming. It's difficult to navigate that landscape effectively and choose what to learn next. - -I'm not a fast learner so I have to choose what to spend time on very carefully. As much as possible, I want to learn skills and techniques that are evergreen, that is, won't be rendered obsolete in a few years time. That means I'm hesitant to learn the javascript framework of the week or untested programming languages and environments. - -As long as our dominant model of computation stays the same, data structures and algorithms that we use today will be used in some form or another in the future. You can safely spend time on gaining a deep and thorough knowledge of them and know that they will pay dividends for your entire career as a programmer. - -###Sign up to the Happy Bear Software List### -Find this article useful? For a regular dose of freshly squeezed technical content delivered straight to your inbox, **click on the big green button below to sign up to the Happy Bear Software mailing list.** - -We'll only be in touch a few times per month and you can unsubscribe at any time. - --------------------------------------------------------------------------------- - -via: http://www.happybearsoftware.com/how-learning-data-structures-and-algorithms-makes-you-a-better-developer - -作者:[Happy Bear][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.happybearsoftware.com/ -[1]:http://en.wikipedia.org/wiki/Huffman_coding -[2]:http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation - - - diff --git a/sources/talk/20150824 LinuxCon exclusive--Mark Shuttleworth says Snappy was born long before CoreOS and the Atomic Project.md b/sources/talk/20150824 LinuxCon exclusive--Mark Shuttleworth says Snappy was born long before CoreOS and the Atomic Project.md deleted file mode 100644 index 2c45b6064b..0000000000 --- a/sources/talk/20150824 LinuxCon exclusive--Mark Shuttleworth says Snappy was born long before CoreOS and the Atomic Project.md +++ /dev/null @@ -1,92 +0,0 @@ -LinuxCon exclusive: Mark Shuttleworth says Snappy was born long before CoreOS and the Atomic Project -================================================================================ -![](http://images.techhive.com/images/article/2015/08/mark-100608730-primary.idge.jpg) - -Mark Shuttleworth at LinuxCon Credit: Swapnil Bhartiya - -> Mark Shuttleworth, founder of Canonical and Ubuntu, made a surprise visit at LinuxCon. I sat down with him for a video interview and talked about Ubuntu on IBM’s new LinuxONE systems, Canonical’s plans for containers, open source in the enterprise space and much more. - -### You made a surprise entry during the keynote. What brought you to LinuxCon? ### - -**Mark Shuttleworth**: I am here at LinuxCon to support IBM and Canonical in their announcement of Ubuntu on their new Linux-only super-high-end mainframe LinuxONE. These are the biggest machines in the world, purpose-built to run only Linux. And we will be bringing Ubuntu to them, which is a real privilege for us and is going to be incredible for developers. - -![mark selfie](http://images.techhive.com/images/article/2015/08/mark-selfie-100608731-large.idge.jpg) - -Swapnil Bhartiya - -Mark Shuttleworth and Swapnil Bhartiya, mandatory selfie at LinuxCon - -### Only Red Hat and SUSE were supported on it. Why was Ubuntu missing from the mainframe scene? ### - -**Mark**: Ubuntu has always been about developers. It has been about enabling the free software platform from where it is collaboratively built to be available at no cost to developers in the world, so they are limited only by their imagination—not by money, not by geography. - -There was an incredible story told today about a 12-year-old kid who started out with Ubuntu; there are incredible stories about people building giant businesses with Ubuntu. And for me, being able to empower people, whether they come from one part of the world or another to express their ideas on free software, is what Ubuntu is all about. It's been a journey for us essentially, going to the platforms those developers care about, and just in the last year, we suddenly saw a flood of requests from companies who run mainframes, who are using Ubuntu for their infrastructure—70% of OpenStack deployments are on Ubuntu. Those same people said, “Look, there is the mainframe, and we like to unleash it and think of it as a region in the cloud.” So when IBM started talking to us, saying that they have this project in the works, it felt like a very natural fit: You are going to be able to take your Ubuntu laptop, build code there and ship it straight to every cloud, every virtualization environment, every bare metal in every architecture including the mainframe, and that's going to be beautiful. - -### Will Canonical be offering support for these systems? ### - -**Mark**: Yes. Ubuntu on z Systems is going to be completely supported. We will make long-term commitments to that. The idea is to bring together scale-out-fast cloud-like workloads, which is really born on Ubuntu; 70% of workloads on Amazon and other public clouds run on Ubuntu. Now you can think of running that on a mainframe if that makes sense to you. - -We are going to provide exactly the same platform that we do on the cloud, and we are going to provide that on the mainframe as well. We are also going to expose it to the OpenStack API so you can consume it on a mainframe with exactly the same tools and exactly the same processes that you would consume on a laptop, or OpenStack or public cloud resources. So all of the things that Ubuntu builds to make your life easy as a developer are going to be available across that full range of platforms and systems, and all of that is commercially supported. - -### Canonical is doing a lot of things: It is into enterprise, and it’s in the consumer space with mobile and desktop. So what is the core focus of Canonical now? ### - -**Mark**: The trick for us is to enable the reuse of specifically the same parts [of our technology] in as many useful ways as possible. So if you look at the work that we do at z Systems, it's absolutely defined by the work that we do on the cloud. We want to deliver exactly the same libraries on exactly the same date for the mainframe as we do for public clouds and for x86, ARM and Power servers today. - -We don't allow Ubuntu or our focus to fragment very dramatically because we don't allow different products managers to find Ubuntu in different ways in different environments. We just want to bring that standard experience that developers love to this new environment. - -Similarly if you look at the work we are doing on IoT [Internet of Things], Snappy Ubuntu is the heart of the phone. It’s the phone without the GUI. So the definitions, the tools, the kernels, the mechanisms are shared across those projects. So we are able to multiply the impact of the work. We have an incredible community, and we try to enable the community to do things that they want to do that we can’t do. So that's why we have so many buntus, and it's kind of incredible for me to see what they do with that. - -We also see the community climbing in. We see hundreds of developers working with Snappy for IoT, and we see developers working with Snappy on mobile, for personal computing as convergence becomes real. And, of course, there is the cloud server story: 70% of the world is Ubuntu, so there is a huge audience. We don't have to do all the work that we do; we just have to be open and willing to, kind of, do the core infrastructure and then reuse it as efficiently as possible. - -### Is Snappy a response to Atomic or CoreOS? ### - -**Mark**: Snappy as a project was born four years ago when we started working on the phone, which was long before the CoreOS, long before Atomic. I think the principles of atomicity, transactionality are beautiful, but remember: We needed to build the same things for the phone. And with Snappy, we have the ability to deliver transactional updates to any of these systems—phones, servers and cloud devices. - -Of course, it feels a little different because in order to provide those guarantees, we have to shape the system in such a way that we can guarantee the guarantees. And that's why Snappy is snappy; it's a new thing. It's not based on an old packaging system. Though we will keep both of them: All Snaps for us that Canonical makes, the core snaps that define the OS, are all built from Debian packages. They are two different faces of the same coin for us, and developers will use them as tools. We use the right tools for the job. - -There are couple of key advantages for Snappy over CoreOS and Atomic, and the main one is this: We took the view that we wanted the base idea to be extensible. So with Snappy, the core operating system is tiny. You make all the choices, and you take all the decisions about things you want to bolt on that: you want to bolt on Docker; you want to bolt on Kubernete; you want to bolt on Mesos; you want to bolt on Lattice from Pivotal; you want to bolt on OpenStack. Those are the things you choose to add with Snappy. Whereas with Atomic and CoreOS, it's one blob and you have to do it exactly the way they want you to do it. You have to live with the versions of software and the choices they make. - -Whereas with Snappy, we really preserve this idea of the choices you have got in Ubuntu are now transactionally available on Snappy systems. That makes the core much smaller, and it gives you the choice of different container systems, different container management systems, different cloud infrastructure systems or different apps of every description. I think that's the winning idea. In fullness of time, people will realize that they wanted to make those choices themselves; they just want Canonical to do the work of providing the updates in a really efficient manner. - -### There is so much competition in the container space with Docker, Rocket and many other players. Where will Canonical stand amid this competition? ### - -**Mark**: Canonical is focused on platform tools, and we see things like the Rocket and Docker as things super-useful for developers; we just make sure that those work best on Ubuntu. Docker, for years, ran only Ubuntu because we work very closely with them, and we are glad now that it's available everywhere else. But if you look at the numbers, the vast majority of Docker containers are on Ubuntu. Because we work really hard, as developers, you get the best experience with all of these tools on Ubuntu. We don't want to try and control everything, and it’s great for us to have those guys competing. - -I think in the end people will see that there is really two kinds of containers. 1) There are cases where a container is just like a VM machine. It feels like a whole machine, it runs all processes, all the logs and cron jobs are there. It's like a VM, just that it's much cheaper, much lighter, much faster, and that's LXD. 2) And then there would be process containers, which are like Docker or Rocket; they are there to run a specific application very fast. I think we lead the world in general machine container story, which is our hypervisor LXD, and I think Docker leads the story when it comes to applications containers, process containers. And those two work together really beautifully. - -### Microsoft and Canonical are working together on LXD? Can you tell us about this engagement? ### - -Mark: LXD is two things. First, it's an implementation on top of Canonical's work on the kernel so that you can start to create full machine containers on any host. But it's also a REST API. That’s the transitions from LXC to LXD. We got a daemon there so you can talk to the daemon over the network, if it's listening on the network, and says tell me about the containers on that machine, tell me about the file systems on that machine, the networks on that machine, start or stop the container. - -So LXD becomes a distributed hypervisor effectively. Very interestingly, last week Microsoft announced that they like REST API. It is very clean, very simple, very well engineered, and they are going to implement the same API for Windows machines. It's completely cross-platform, which means you will be able to talk to any machine—Linux or Windows. So it gives you very clean and simple APIs to talk about containers on any host on the network. - -Of course, we have led the work in [OpenStack to bind LXD to Nova][1], which is the control system to compute in OpenStack, so that's how we create a whole cloud with OpenStack API with the individual VMs being actually containers, so much denser, much faster, much lighter, much cheaper. - -### Open Source is becoming a norm in the enterprise segment. What do you think is driving the adoption of open source in the enterprise? ### - -**Mark**: The reason why open source has become so popular in the enterprise is because it enables them to go faster. We are all competing at some level, and if you can't make progress because you have to call up some vendor, you can't dig in and help yourself go faster, then you feel frustrated. And given the choice between frustration and at least the ability to dig into a problem, enterprises over time will always choose to give themselves the ability to dig in and help themselves. So that is why open source is phenomenal. - -I think it goes a bit deeper than that. I think people have started to realize as much as we compete, 99% of what we need to do is shared, and there is something meaningful about contributing to something that is shared. As I have seen Ubuntu go from something that developers love, to something that CIOs love that developers love Ubuntu. As that happens, it's not a one-way ticket. They often want to say how can we help contribute to make this whole thing go faster. - -We have always seen a curve of complexity, and open source has traditionally been higher up on the curve of complexity and therefore considered threatening or difficult or too uncertain for people who are not comfortable with the complexity. What's wonderful to me is that many open source projects have identified that as a blocker for their own future. So in Ubuntu we have made user experience, design and “making it easy” a first-class goal. We have done the same for OpenStack. With Ubuntu tools for OpenStack anybody can build an OpenStack cloud in an hour, and if you want, that cloud can run itself, scale itself, manage itself, can deal with failures. It becomes something you can just fire up and forget, which also makes it really cheap. It also makes it something that's not a distraction, and so by making open source easier and easier, we are broadening its appeal to consumers and into the enterprise and potentially into the government. - -### How open are governments to open source? Can you tell us about the utilization of open source by governments, especially in the U.S.? ### - -**Mark**: I don't track the usage in government, but part of government utilization in the modern era is the realization that how untrustworthy other governments might be. There is a desire for people to be able to say, “Look, I want to review or check and potentially self-build all the things that I depend on.” That's a really important mission. At the end of the day, some people see this as a game where maybe they can get something out of the other guy. I see it as a game where we can make a level playing field, where everybody gets to compete. I have a very strong interest in making sure that Ubuntu is trustworthy, which means the way we build it, the way we run it, the governance around it is such that people can have confidence in it as an independent thing. - -### You are quite vocal about freedom, privacy and other social issues on Google+. How do you see yourself, your company and Ubuntu playing a role in making the world a better place? ### - -**Mark**: The most important thing for us to do is to build confidence in trusted platforms, platforms that are freely available but also trustworthy. At any given time, there will always be people who can make arguments about why they should have access to something. But we know from history that at the end of the day, due process of law, justice, doesn't depend on the abuse of privacy, abuse of infrastructure, the abuse of data. So I am very strongly of the view that in the fullness of time, all of the different major actors will come to the view that their primary interest is in having something that is conceptually trustworthy. This isn't about what America can steal from Germany or what China can learn in Russia. This is about saying we’re all going to be able to trust our infrastructure; that's a generational journey. But I believe Ubuntu can be right at the center of people's thinking about that. - --------------------------------------------------------------------------------- - -via: http://www.itworld.com/article/2973116/linux/linuxcon-exclusive-mark-shuttleworth-says-snappy-was-born-long-before-coreos-and-the-atomic-project.html - -作者:[Swapnil Bhartiya][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.itworld.com/author/Swapnil-Bhartiya/ -[1]:https://wiki.openstack.org/wiki/HypervisorSupportMatrix \ No newline at end of file diff --git a/sources/talk/20150827 The Strangest Most Unique Linux Distros.md b/sources/talk/20150827 The Strangest Most Unique Linux Distros.md deleted file mode 100644 index 04ff47952a..0000000000 --- a/sources/talk/20150827 The Strangest Most Unique Linux Distros.md +++ /dev/null @@ -1,67 +0,0 @@ -The Strangest, Most Unique Linux Distros -================================================================================ -From the most consumer focused distros like Ubuntu, Fedora, Mint or elementary OS to the more obscure, minimal and enterprise focused ones such as Slackware, Arch Linux or RHEL, I thought I've seen them all. Couldn't have been any further from the truth. Linux eco-system is very diverse. There's one for everyone. Let's discuss the weird and wacky world of niche Linux distros that represents the true diversity of open platforms. - -![strangest linux distros](http://2.bp.blogspot.com/--cSL2-6rIgA/VcwNc5hFebI/AAAAAAAAJzk/AgB55mVtJVQ/s1600/Puppy-Linux.png) - -**Puppy Linux**: An operating system which is about 1/10th the size of an average DVD quality movie rip, that's Puppy Linux for you. The OS is just 100 MB in size! And it can run from RAM making it unusually fast even in older PCs. You can even remove the boot medium after the operating system has started! Can it get any better than that? System requirements are bare minimum, most hardware are automatically detected, and it comes loaded with software catering to your basic needs. [Experience Puppy Linux][1]. - -![suicide linux](http://3.bp.blogspot.com/-dfeehRIQKpo/VdMgRVQqIJI/AAAAAAAAJz0/TmBs-n2K9J8/s1600/suicide-linux.jpg) - -**Suicide Linux**: Did the name scare you? Well it should. 'Any time - any time - you type any remotely incorrect command, the interpreter creatively resolves it into rm -rf / and wipes your hard drive'. Simple as that. I really want to know the ones who are confident enough to risk their production machines with [Suicide Linux][2]. **Warning: DO NOT try this on production machines!** The whole thing is available in a neat [DEB package][3] if you're interested. - -![top 10 strangest linux distros](http://3.bp.blogspot.com/-Q0hlEMCD9-o/VdMieAiXY1I/AAAAAAAAJ0M/iS_ZjVaZAk8/s1600/papyros.png) - -**PapyrOS**: "Strange" in a good way. PapyrOS is trying to adapt the material design language of Android into their brand new Linux distribution. Though the project is in early stages, it already looks very promising. The project page says the OS is 80% complete and one can expect the first Alpha release anytime soon. We did a small write up on [PapyrOS][4] when it was announced and by the looks of it, PapyrOS might even become a trend-setter of sorts. Follow the project on [Google+][5] and contribute via [BountySource][6] if you're interested. - -![10 most unique linux distros](http://3.bp.blogspot.com/-8aOtnTp3Yxk/VdMo_KWs4sI/AAAAAAAAJ0o/3NTqhaw60jM/s1600/qubes-linux.png) - -**Qubes OS**: Qubes is an open-source operating system designed to provide strong security using a Security by Compartmentalization approach. The assumption is that there can be no perfect, bug-free desktop environment. And by implementing a 'Security by Isolation' approach, [Qubes Linux][7] intends to remedy that. Qubes is based on Xen, the X Window System, and Linux, and can run most Linux applications and supports most Linux drivers. Qubes was selected as a finalist of Access Innovation Prize 2014 for Endpoint Security Solution. - -![top10 linux distros](http://3.bp.blogspot.com/-2Sqvb_lilC0/VdMq_ceoXnI/AAAAAAAAJ00/kot20ugVJFk/s1600/ubuntu-satanic.jpg) - -**Ubuntu Satanic Edition**: Ubuntu SE is a Linux distribution based on Ubuntu. "It brings together the best of free software and free metal music" in one comprehensive package consisting of themes, wallpapers, and even some heavy-metal music sourced from talented new artists. Though the project doesn't look actively developed anymore, Ubuntu Satanic Edition is strange in every sense of that word. [Ubuntu SE (Slightly NSFW)][8]. - -![10 strange linux distros](http://2.bp.blogspot.com/-ZtIVjGMqdx0/VdMv136Pz1I/AAAAAAAAJ1E/-q34j-TXyUY/s1600/tiny-core-linux.png) - -**Tiny Core Linux**: Puppy Linux not small enough? Try this. Tiny Core Linux is a 12 MB graphical Linux desktop! Yep, you read it right. One major caveat: It is not a complete desktop nor is all hardware completely supported. It represents only the core needed to boot into a very minimal X desktop typically with wired internet access. There is even a version without the GUI called Micro Core Linux which is just 9MB in size. [Tiny Core Linux][9] folks. - -![top 10 unique and special linux distros](http://4.bp.blogspot.com/-idmCvIxtxeo/VdcqcggBk1I/AAAAAAAAJ1U/DTQCkiLqlLk/s1600/nixos.png) - -**NixOS**: A very experienced-user focused Linux distribution with a unique approach to package and configuration management. In other distributions, actions such as upgrades can be dangerous. Upgrading a package can cause other packages to break, upgrading an entire system is much less reliable than reinstalling from scratch. And top of all that you can't safely test what the results of a configuration change will be, there's no "Undo" so to speak. In NixOS, the entire operating system is built by the Nix package manager from a description in a purely functional build language. This means that building a new configuration cannot overwrite previous configurations. Most of the other features follow this pattern. Nix stores all packages in isolation from each other. [More about NixOS][10]. - -![strangest linux distros](http://4.bp.blogspot.com/-rOYfBXg-UiU/VddCF7w_xuI/AAAAAAAAJ1w/Nf11bOheOwM/s1600/gobolinux.jpg) - -**GoboLinux**: This is another very unique Linux distro. What makes GoboLinux so different from the rest is its unique re-arrangement of the filesystem. It has its own subdirectory tree, where all of its files and programs are stored. GoboLinux does not have a package database because the filesystem is its database. In some ways, this sort of arrangement is similar to that seen in OS X. [Get GoboLinux][11]. - -![strangest linux distros](http://1.bp.blogspot.com/-3P22pYfih6Y/VdcucPOv4LI/AAAAAAAAJ1g/PszZDbe83sQ/s1600/hannah-montana-linux.jpg) - -**Hannah Montana Linux**: Here is a Linux distro based on Kubuntu with a Hannah Montana themed boot screen, KDM, icon set, ksplash, plasma, color scheme, and wallpapers (I'm so sorry). [Link][12]. Project not active anymore. - -**RLSD Linux**: An extremely minimalistic, small, lightweight and security-hardened, text-based operating system built on Linux. "It's a unique distribution that provides a selection of console applications and home-grown security features which might appeal to hackers," developers claim. [RLSD Linux][13]. - -Did we miss anything even stranger? Let us know. - --------------------------------------------------------------------------------- - -via: http://www.techdrivein.com/2015/08/the-strangest-most-unique-linux-distros.html - -作者:Manuel Jose -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[1]:http://puppylinux.org/main/Overview%20and%20Getting%20Started.htm -[2]:http://qntm.org/suicide -[3]:http://sourceforge.net/projects/suicide-linux/files/ -[4]:http://www.techdrivein.com/2015/02/papyros-material-design-linux-coming-soon.html -[5]:https://plus.google.com/communities/109966288908859324845/stream/3262a3d3-0797-4344-bbe0-56c3adaacb69 -[6]:https://www.bountysource.com/teams/papyros -[7]:https://www.qubes-os.org/ -[8]:http://ubuntusatanic.org/ -[9]:http://tinycorelinux.net/ -[10]:https://nixos.org/ -[11]:http://www.gobolinux.org/ -[12]:http://hannahmontana.sourceforge.net/ -[13]:http://rlsd2.dimakrasner.com/ \ No newline at end of file diff --git a/sources/talk/20150901 Is Linux Right For You.md b/sources/talk/20150901 Is Linux Right For You.md deleted file mode 100644 index 89044347ec..0000000000 --- a/sources/talk/20150901 Is Linux Right For You.md +++ /dev/null @@ -1,63 +0,0 @@ -Is Linux Right For You? -================================================================================ -> Not everyone should opt for Linux -- for many users, remaining with Windows or OSX is the better choice. - -I enjoy using Linux on the desktop. Not because of software politics or because I despise other operating systems. I simply like Linux because it just works. - -It's been my experience that not everyone is cut out for the Linux lifestyle. In this article, I'll help you run through the pros and cons of making the switch to Linux so you can determine if switching is right for you. - -### When to make the switch ### - -Switching to Linux makes sense when there is a decisive reason to do so. The same can be said about moving from Windows to OS X or vice versa. In order to have success with switching, you must be able to identify your reason for jumping ship in the first place. - -For some people, the reason for switching is frustration with their current platform. Maybe the latest upgrade left them with a lousy experience and they're ready to chart new horizons. In other instances, perhaps it's simply a matter of curiosity. Whatever the motivation, you must have a good reason for switching operating systems. If you're pushing yourself in this direction without a good reason, then no one wins. - -However, there are exceptions to every rule. And if you're really interested in trying Linux on the desktop, then maybe coming to terms with a workable compromise is the way to go. - -### Starting off slow ### - -After trying Linux for the first time, I've seen people blast their Windows installation to bits because they had a good experience with Ubuntu on a flash drive for 20 minutes. Folks, this isn't a test. Instead I'd suggest the following: - -- Run the [Linux distro in a virtual machine][1] for a week. This means you are committing to running that distro for all browser work, email and other tasks you might otherwise do on that machine. -- If running a VM for a week is too resource intensive, try doing the same with a USB drive running Linux that offers [some persistent storage][2]. This will allow you to leave your main OS alone and intact. At the same time, you'll still be able to "live inside" of your Linux distribution for a week. -- If you find that everything is successful after a week of running Linux, the next step is to examine how many times you booted into Windows that week. If only occasionally, then the next step is to look into [dual-booting Windows][3] and Linux. For those of you that only found themselves using their Linux distro, it might be worth considering making the switch full time. -- Before you hose your Windows partition completely, it might make more sense to purchase a second hard drive to install Linux onto instead. This allows you to dual-boot, but to do so with ample hard drive space. It also makes Windows available to you if something should come up. - -### What do you gain adopting Linux? ### - -So what does one gain by switching to Linux? Generally it comes down to personal freedom for most people. With Linux, if something isn't to your liking, you're free to change it. Using Linux also saves users oodles of money in avoiding hardware upgrades and unnecessary software expenses. Additionally, you're not burdened with tracking down lost license keys for software. And if you dislike the direction a particular distribution is headed, you can switch to another distribution with minimal hassle. - -The sheer volume of desktop choice on the Linux desktop is staggering. This level of choice might even seem overwhelming to the newcomer. But if you find a distro base (Debian, Fedora, Arch, etc) that you like, the hard work is already done. All you need to do now is find a variation of the distro and the desktop environment you prefer. - -Now one of the most common complaints I hear is that there isn't much in the way of software for Linux. However, this isn't accurate at all. While other operating systems may have more of it, today's Linux desktop has applications to do just about anything you can think of. Video editing (home and pro-level), photography, office management, remote access, music (listening and creation), plus much, much more. - -### What you lose adopting Linux? ### - -As much as I enjoy using Linux, my wife's home office relies on OS X. She's perfectly content using Linux for some tasks, however she relies on OS X for specific software not available for Linux. This is a common problem that many people face when first looking at making the switch. You must decide whether or not you're going to be losing out on critical software if you make the switch. - -Sometimes the issue is because the software has content locked down with it. In other cases, it's a workflow and functionality that was found with the legacy applications and not with the software available for Linux. I myself have never experienced this type of challenge, but I know those who have. Many of the software titles available for Linux are also available for other operating systems. So if there is a concern about such things, I encourage you to try out comparable apps on your native OS first. - -Another thing you might lose by switching to Linux is the luxury of local support when you need it. People scoff at this, but I know of countless instances where a newcomer to Linux was dismayed to find their only recourse for solving Linux challenges was from strangers on the Web. This is especially problematic if their only PC is the one having issues. Windows and OS X users are spoiled in that there are endless support techs in cities all over the world that support their platform(s). - -### How to proceed from here ### - -Perhaps the single biggest piece of advice to remember is always have a fallback plan. Remember, once you wipe that copy of Windows 10 from your hard drive, you may find yourself spending money to get it reinstalled. This is especially true for those of you who upgrade from other Windows releases. Accepting this, persistent flash drives with Linux or dual-booting Windows and Linux is always a preferable way forward for newcomers. Odds are that you may be just fine and take to Linux like a fish to water. But having that fallback plan in place just means you'll sleep better at night. - -If instead you've been relying on a dual-boot installation for weeks and feel ready to take the plunge, then by all means do it. Wipe your drive and start off with a clean installation of your favorite Linux distribution. I've been a full time Linux enthusiast for years and I can tell you for certain, it's a great feeling. How long? Let's just say my first Linux experience was with early Red Hat. I finally installed a dedicated installation on my laptop by 2003. - -Existing Linux enthusiasts, where did you first get started? Was your switch an exciting one or was it filled with angst? Hit the Comments and share your experiences. - --------------------------------------------------------------------------------- - -via: http://www.datamation.com/open-source/is-linux-right-for-you.html - -作者:[Matt Hartley][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.datamation.com/author/Matt-Hartley-3080.html -[1]:http://www.psychocats.net/ubuntu/virtualbox -[2]:http://www.howtogeek.com/howto/14912/create-a-persistent-bootable-ubuntu-usb-flash-drive/ -[3]:http://www.linuxandubuntu.com/home/dual-boot-ubuntu-15-04-14-10-and-windows-10-8-1-8-step-by-step-tutorial-with-screenshots \ No newline at end of file diff --git a/sources/talk/20151023 Mark Shuttleworth--The Man Behind Ubuntu Operating System.md b/sources/talk/20151023 Mark Shuttleworth--The Man Behind Ubuntu Operating System.md new file mode 100644 index 0000000000..3390c232ac --- /dev/null +++ b/sources/talk/20151023 Mark Shuttleworth--The Man Behind Ubuntu Operating System.md @@ -0,0 +1,119 @@ +Mark Shuttleworth – The Man Behind Ubuntu Operating System +================================================================================ +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Mark-Shuttleworth-652x445.jpg) + +**Mark Richard Shuttleworth** is the founder of **Ubuntu** or the man behind the Debian as they call him. He was born in 1973 in Welkom, South Africa. He’s an entrepreneur and also space tourist who became later **1st citizen of independent African country who could travel to the space**. + +Mark also founded **Thawte** in 1996, the Internet commerce security company, while he was studying finance and IT at University of Cape Town. + +In 2000, Mark founded the HBD, as an investment company, and also he created the Shuttleworth Foundation in order to fund the innovative leaders in the society with combination of fellowships and some investments. + +> “The mobile world is crucial to the future of the PC. This month, for example, it became clear that the traditional PC is shrinking in favor of tablets. So if we want to be relevant on the PC, we have to figure out how to be relevant in the mobile world first. Mobile is also interesting because there’s no pirated Windows market. So if you win a device to your OS, it stays on your OS. In the PC world, we are constantly competing with “free Windows”, which presents somewhat unique challenges. So our focus now is to establish a great story around Ubuntu and mobile form factors – the tablet and the phone – on which we can build deeper relationships with everyday consumers.” +> +> — Mark Shuttleworth + +In 2002, he flew to International Space Station as member of their crew of Soyuz mission TM-34, after 1 year of training in the Star City, Russia. And after running campaign to promote the science, code, and mathematics to the aspiring astronauts and the other ambitious types at schools in SA, Mark founded the **Canonical Ltd**. and in 2013, he provided leadership for Ubuntu operating system for software development purposes. + +Today, Shuttleworth holds dual citizenship of United Kingdom and South Africa currently lives on lovely Mallards botanical garden in Isle of Man, with 18 precocious ducks, equally his lovely girlfriend Claire, 2 black bitches and occasional itinerant sheep. + +> “Computer is not a device anymore. It is an extension of your mind and your gateway to other people.” +> +> — Mark Shuttleworth + +### Mark Shuttleworth’s Early life ### + +As we mentioned above, Mark was born in Welkom, South Africa’s Orange Free State as son of surgeon and nursery-school teacher, Mark attended the school at Western Province Preparatory School where he became eventually the Head Boy in 1986, followed by 1 term at Rondebosch Boys’ High School, and later at Bishops/Diocesan College where he was again Head Boy in 1991. + +Mark obtained the Bachelor of Business Science degree in the Finance and Information Systems at University of Cape Town, where he lived there in Smuts Hall. He became, as a student, involved in installations of the 1st residential Internet connections at his university. + +> “There are many examples of companies and countries that have improved their competitiveness and efficiency by adopting open source strategies. The creation of skills through all levels is of fundamental importance to both companies and countries.” +> +> — Mark Shuttleworth + +### Mark Shuttleworth’s Career ### + +Mark founded Thawte in 1995, which was specialized in the digital certificates and Internet security, then he sold it to VeriSign in 1999, earning about $575 million at the time. + +In 2000, Mark formed the HBD Venture Capital (Here be Dragons), the business incubator and venture capital provider. In 2004, he formed the Canonical Ltd., for promotion and commercial support of the free software development projects, especially Ubuntu operating system. In 2009, Mark stepped down as CEO of Canonical, Ltd. + +> “In the early days of the DCC I preferred to let the proponents do their thing and then see how it all worked out in the end. Now we are pretty close to the end.” +> +> — Mark Shuttleworth + +### Linux and FOSS with Mark Shuttleworth ### + +In the late 1990s, Mark participated as one of developers of Debian operating system. + +In 2001, Mark formed the Shuttleworth Foundation, It is non-profit organization dedicated to the social innovation that also funds free, educational, and open source software projects in South Africa, including Freedom Toaster. + +In 2004, Mark returned to free software world by funding software development of Ubuntu, as it was Linux distribution based on Debian, throughout his company Canonical Ltd. + +In 2005, Mark founded Ubuntu Foundation and made initial investment of 10 million dollars. In Ubuntu project, Mark is often referred to with tongue-in-cheek title “**SABDFL (Self-Appointed Benevolent Dictator for Life)**”. To come up with list of names of people in order to hire for the entire project, Mark took about six months of Debian mailing list archives with him during his travelling to Antarctica aboard icebreaker Kapitan Khlebnikov in 2004. In 2005, Mark purchased 65% stake of Impi Linux. + +> “I urge telecommunications regulators to develop a commercial strategy for delivering effective access to the continent.” +> +> — Mark Shuttleworth + +In 2006, it was announced that Shuttleworth became **first patron of KDE**, which was highest level of sponsorship available at the time. This patronship ended in 2012, with financial support together for Kubuntu, which was Ubuntu variant with KDE as a main desktop. + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/shuttleworth-kde.jpg) + +In 2009, Shuttleworth announced that, he would step down as the CEO of Canonical in order to focus more energy on partnership, product design, and the customers. Jane Silber, took on this job as the CEO at Canonical after he was the COO at Canonical since 2004. + +In 2010, Mark received the honorary degree from Open University for that work. + +In 2012, Mark and Kenneth Rogoff took part together in debate opposite Peter Thiel and Garry Kasparov at Oxford Union, this debate was entitled “**The Innovation Enigma**”. + +In 2013, Mark and Ubuntu were awarded **Austrian anti-privacy Big Brother Award** for sending the local Ubuntu Unity Dash searches to the Canonical servers by default. One year earlier in 2012, Mark had defended the anonymization method that was used. + +> “All the major PC companies now ship PC’s with Ubuntu pre-installed. So we have a very solid set of working engagements in the industry. But those PC companies are nervous to promote something new to PC buyers. If we can get PC buyers familiar with Ubuntu as a phone and tablet experience, then they may be more willing buy it on the PC too. Because no OS ever succeeded by emulating another OS. Android is great, but if we want to succeed we need to bring something new and better to market. We are all at risk of stagnating if we don’t pursue the future, vigorously. But if you pursue the future, you have to accept that not everybody will agree with your vision.” +> +> — Mark Shuttleworth + +### Mark Shuttleworth’s Spaceflight ### + +Mark gained worldwide fame in 2002 as a second self-funded space tourist and the first South African who could travel to the space. Flying through Space Adventures, Mark launched aboard Russian Soyuz TM-34 mission as spaceflight participant, and he paid approximately $20 million for that voyage. 2 days later, Soyuz spacecraft arrived at International Space Station, where Mark spent 8 days participating in the experiments related to the AIDS and the GENOME research. Later in 2002, Mark returned to the Earth on the Soyuz TM-33. To participate in that flight, Mark had to undergo 1 year of preparation and training, including 7 months spent in the Star City, Russia. + +![](http://1426826955.rsc.cdn77.org/wp-content/uploads/2015/10/Mark-Shuttleworth1.jpg) + +While in space, Mark had radio conversation with Nelson Mandela and another 14 year old South African girl, called Michelle Foster, who asked Mark to marry her. Of course Mark politely dodged that question, stating that he was much honored to this question before cunningly change the subject. The terminally ill Foster was also provided the opportunity to have conversation with Mark and Nelson Mandela by Reach for Dream foundation. + +Upon returning, Mark traveled widely and also spoke about that spaceflight to schoolchildren around the world. + +> “The raw numbers suggest that Ubuntu continues to grow in terms of actual users. And our partnerships – Dell, HP, Lenovo on the hardware front, and gaming companies like EA, Valve joining up on the software front – make me feel like we continue to lead where it matters.” +> +> — Mark Shuttleworth + +### Mark Shuttleworth’s Transport ### + +Mark has his private jet, Bombardier Global Express that is often referred to as Canonical One but it’s in fact owned through the HBD Venture Capital Company. The dragon depicted on side of the plane is Norman, HBD Venture Capital mascot. + +### The Legal Clash with South African Reserve Bank ### + +Upon the moving R2.5 billion in the capital from South Africa to Isle of Man, South African Reserve Bank imposed R250 million levy to release Mark’s assets. Mark appealed, and then after lengthy legal battle, Reserve Bank was ordered to repay Mark his R250 million, plus the interest. Mark announced that he would be donating that entire amount to trust that will be established in order to help others take cases to Constitutional Court. + +> “The exit charge was not inconsistent with the Constitution. The dominant purpose of the exit charge was not to raise revenue but rather to regulate conduct by discouraging the export of capital to protect the domestic economy.” +> +> — Judge Dikgang Moseneke + +In 2015, Constitutional Court of South Africa reversed and set-aside findings of lower courts, ruling that dominant purpose of the exit charge was in order to regulate conduct rather than for raising the revenue. + +### Mark Shuttleworth’s likes ### + +Cesária Évora, mp3s,Spring, Chelsea, finally seeing something obvious for first time, coming home, Sinatra, daydreaming, sundowners, flirting, d’Urberville, string theory, Linux, particle physics, Python, reincarnation, mig-29s, snow, travel, Mozilla, lime marmalade, body shots, the African bush, leopards, Rajasthan, Russian saunas, snowboarding, weightlessness, Iain m banks, broadband, Alastair Reynolds, fancy dress, skinny-dipping, flashes of insight, post-adrenaline euphoria, the inexplicable, convertibles, Clifton, country roads, international space station, machine learning, artificial intelligence, Wikipedia, Slashdot, kitesurfing, and Manx lanes. + +### Shuttleworth’s dislikes ### + +Admin, salary negotiations, legalese, and public speaking. + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/mark-shuttleworth-man-behind-ubuntu-operating-system/ + +作者:[M.el Khamlichi][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/pirat9/ \ No newline at end of file diff --git a/sources/talk/20151117 How bad a boss is Linus Torvalds.md b/sources/talk/20151117 How bad a boss is Linus Torvalds.md new file mode 100644 index 0000000000..7ebba90483 --- /dev/null +++ b/sources/talk/20151117 How bad a boss is Linus Torvalds.md @@ -0,0 +1,78 @@ +sonofelice translating +How bad a boss is Linus Torvalds? +================================================================================ +![linus torvalds](http://images.techhive.com/images/article/2015/08/linus_torvalds-100600260-primary.idge.jpg) + +*Linus Torvalds addressed a packed auditorium of Linux enthusiasts during his speech at the LinuxWorld show in San Jose, California, on August 10, 1999. Credit: James Niccolai* + +**It depends on context. In the world of software development, he’s what passes for normal. The question is whether that situation should be allowed to continue.** + +I've known Linus Torvalds, Linux's inventor, for over 20 years. We're not chums, but we like each other. + +Lately, Torvalds has been getting a lot of flack for his management style. Linus doesn't suffer fools gladly. He has one way of judging people in his business of developing the Linux kernel: How good is your code? + +Nothing else matters. As Torvalds said earlier this year at the Linux.conf.au Conference, "I'm not a nice person, and I don't care about you. [I care about the technology and the kernel][1] -- that's what's important to me." + +Now, I can deal with that kind of person. If you can't, you should avoid the Linux kernel community, where you'll find a lot of this kind of meritocratic thinking. Which is not to say that I think everything in Linuxland is hunky-dory and should be impervious to calls for change. A meritocracy I can live with; a bastion of male dominance where women are subjected to scorn and disrespect is a problem. + +That's why I see the recent brouhaha about Torvalds' management style -- or more accurately, his total indifference to the personal side of management -- as nothing more than standard operating procedure in the world of software development. And at the same time, I see another instance that has come to light as evidence of a need for things to really change. + +The first situation arose with the [release of Linux 4.3][2], when Torvalds used the Linux Kernel Mailing List to tear into a developer who had inserted some networking code that Torvalds thought was -- well, let's say "crappy." "[[A]nd it generates [crappy] code.][3] It looks bad, and there's no reason for it." He goes on in this vein for quite a while. Besides the word "crap" and its earthier synonym, he uses the word "idiotic" pretty often. + +Here's the thing, though. He's right. I read the code. It's badly written and it does indeed seem to have been designed to use the new "overflow_usub()" function just for the sake of using it. + +Now, some people see this diatribe as evidence that Torvalds is a bad-tempered bully. I see a perfectionist who, within his field, doesn't put up with crap. + +Many people have told me that this is not how professional programmers should act. People, have you ever worked with top developers? That's exactly how they act, at Apple, Microsoft, Oracle and everywhere else I've known them. + +I've heard Steve Jobs rip a developer to pieces. I've cringed while a senior Oracle developer lead tore into a room of new programmers like a piranha through goldfish. + +In Accidental Empires, his classic book on the rise of PCs, Robert X. Cringely described Microsoft's software management style when Bill Gates was in charge as a system where "Each level, from Gates on down, screams at the next, goading and humiliating them." Ah, yes, that's the Microsoft I knew and hated. + +The difference between the leaders at big proprietary software companies and Torvalds is that he says everything in the open for the whole world to see. The others do it in private conference rooms. I've heard people claim that Torvalds would be fired in their company. Nope. He'd be right where he is now: on top of his programming world. + +Oh, and there's another difference. If you get, say, Larry Ellison mad at you, you can kiss your job goodbye. When you get Torvalds angry at your work, you'll get yelled at in an email. That's it. + +You see, Torvalds isn't anyone's boss. He's the guy in charge of a project with about 10,000 contributors, but he has zero hiring and firing authority. He can hurt your feelings, but that's about it. + +That said, there is a serious problem within both open-source and proprietary software development circles. No matter how good a programmer you are, if you're a woman, the cards are stacked against you. + +No case shows this better than that of Sarah Sharp, an Intel developer and formerly a top Linux programmer. [In a post on her blog in October][4], she explained why she had stopped contributing to the Linux kernel more than a year earlier: "I finally realized that I could no longer contribute to a community where I was technically respected, but I could not ask for personal respect.... I did not want to work professionally with people who were allowed to get away with subtle sexist or homophobic jokes." + +Who can blame her? I can't. Torvalds, like almost every software manager I've ever known, I'm sorry to say, has permitted a hostile work environment. + +He would probably say that it's not his job to ensure that Linux contributors behave with professionalism and mutual respect. He's concerned with the code and nothing but the code. + +As Sharp wrote: + +> I have the utmost respect for the technical efforts of the Linux kernel community. They have scaled and grown a project that is focused on maintaining some of the highest coding standards out there. The focus on technical excellence, in combination with overloaded maintainers, and people with different cultural and social norms, means that Linux kernel maintainers are often blunt, rude, or brutal to get their job done. Top Linux kernel developers often yell at each other in order to correct each other's behavior. +> +> That's not a communication style that works for me. … +> +> Many senior Linux kernel developers stand by the right of maintainers to be technically and personally brutal. Even if they are very nice people in person, they do not want to see the Linux kernel communication style change. + +She's right. + +Where I differ from other observers is that I don't think that this problem is in any way unique to Linux or open-source communities. With five years of work in the technology business and 25 years as a technology journalist, I've seen this kind of immature boy behavior everywhere. + +It's not Torvalds' fault. He's a technical leader with a vision, not a manager. The real problem is that there seems to be no one in the software development universe who can set a supportive tone for teams and communities. + +Looking ahead, I hope that companies and organizations, such as the Linux Foundation, can find a way to empower community managers or other managers to encourage and enforce civil behavior. + +We won't, unfortunately, find that kind of managerial finesse in our pure technical or business leaders. It's not in their DNA. + +-------------------------------------------------------------------------------- + +via: http://www.computerworld.com/article/3004387/it-management/how-bad-a-boss-is-linus-torvalds.html + +作者:[Steven J. Vaughan-Nichols][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.computerworld.com/author/Steven-J.-Vaughan_Nichols/ +[1]:http://www.computerworld.com/article/2874475/linus-torvalds-diversity-gaffe-brings-out-the-best-and-worst-of-the-open-source-world.html +[2]:http://www.zdnet.com/article/linux-4-3-released-after-linus-torvalds-scraps-brain-damage-code/ +[3]:http://lkml.iu.edu/hypermail/linux/kernel/1510.3/02866.html +[4]:http://sarah.thesharps.us/2015/10/05/closing-a-door/ diff --git a/sources/talk/20160505 Confessions of a cross-platform developer.md b/sources/talk/20160505 Confessions of a cross-platform developer.md new file mode 100644 index 0000000000..0f6af84070 --- /dev/null +++ b/sources/talk/20160505 Confessions of a cross-platform developer.md @@ -0,0 +1,76 @@ +vim-kakali translating + + + +Confessions of a cross-platform developer +============================================= + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/business_clouds.png?itok=cucHuJnU) + +[Andreia Gaita][1] is giving a talk at this year's OSCON, titled [Confessions of a cross-platform developer][2]. She's a long-time open source and [Mono][3] contributor, and develops primarily in C#/C++. Andreia works at GitHub, where she's focused on building the GitHub Extension manager for Visual Studio. + +I caught up with Andreia ahead of her talk to ask about cross-platform development and what she's learned in her 16 years as a cross-platform developer. + +![](https://opensource.com/sites/default/files/images/life/Interview%20banner%20Q%26A.png) + +**What languages have you found easiest and hardest to develop cross-platform code for?** + +It's less about which languages are good and more about the libraries and tooling available for those languages. The compilers/interpreters/build systems available for languages determine how easy it is to do cross-platform work with them (or whether it's even possible), and the libraries available for UI and native system access determine how deep you can integrate with the OS. With that in mind, I found C# to be the best for cross-platform work. The language itself includes features that allow fast native calls and accurate memory mapping, which you really need if you want your code to talk to the OS and native libraries. When I need very specific OS integration, I switch to C or C++. + +**What cross-platform toolkits/abstractions have you used?** + +Most of my cross-platform work has been developing tools, libraries and bindings for other people to develop cross-platform applications with, mostly in Mono/C# and C/C++. I don't get to use a lot of abstractions at that level, beyond glib and friends. I mostly rely on Mono for any cross-platform app that includes a UI, and Unity3D for the occasional game development. I play with Electron every now and then. + +**What has been your approach to build systems, and how does this vary by language or platform?** + +I try to pick the build system that is most suited for the language(s) I'm using. That way, it'll (hopefully) give me less headaches. It needs to allow for platform and architecture selection, be smart about build artifact locations (for multiple parallel builds), and be decently configurable. Most of the time I have projects combining C/C++ and C# and I want to build all the different configurations at the same time from the same source tree (Debug, Release, Windows, OSX, Linux, Android, iOS, etc, etc.), and that usually requires selecting and invoking different compilers with different flags per output build artifact. So the build system has to let me do all of this without getting (too much) in my way. I try out different build systems every now and then, just to see what's new, but in the end, I end up going back to makefiles and a combination of either shell and batch scripts or Perl scripts for driving them (because if I want users to build my things, I'd better pick a command line script language that is available everywhere). + +**How do you balance the desire for native look and feel with the need for uniform user interfaces?** + +Cross-platform UI is hard! I've implemented several cross-platform GUIs over the years, and it's the one thing for which I don't think there's an optimal solution. There's basically two options. You can pick a cross-platform GUI toolkit and do a UI that doesn't feel quite right in all the platforms you support, with a small codebase and low maintenance cost. Or you can choose to develop platform-specific UIs that will look and feel native and well integrated with a larger codebase and higher maintenance cost. The decision really depends on the type of app, how many features it has, how many resources you have, and how many platforms you're shipping to. + +In the end, I think there's an increase in users' tolerance for "One UI To Rule Them All" with frameworks like Electron. I have a Chromium+C+C# framework side project that will one day hopefully allow me build Electron-style apps in C#, giving me the best of both worlds. + +**Has building/packaging dependencies been an issue for you?** + +I'm very conservative about my use of dependencies, having been bitten so many times by breaking ABIs, clashing symbols, and missing packages. I decide which OS version(s) I'm targeting and pick the lowest common denominator release available of a dependency to minimize issues. That usually means having five different copies of Xcode and OSX Framework libraries, five different versions of Visual Studio installed side-to-side on the same machine, multiple clang and gcc versions, and a bunch of VMs running various other distros. If I'm unsure of the state of packages in the OS I'm targeting, I will sometimes link statically and sometimes submodule dependencies to make sure they're always available. And most of all, I avoid the bleeding edge unless I really, really need something there. + +**Do you use continuous integration, code review, and related tools?** + +All the time! It's the only way to keep sane. The first thing I do on a project is set up cross-platform build scripts to ensure everything is automateable as early as possible. When you're targeting multiple platforms, CI is essential. It's impossible for everyone to build all the different combinations of platforms in one machine, and as soon as you're not building all of them you're going to break something without being aware of it. In a shared multi-platform codebase, different people own different platforms and features, so the only way to guarantee quality is to have cross-team code reviews combined with CI and other analysis tools. It's no different than other software projects, there's just more points of failure. + +**Do you rely on automated build testing, or do you tend to build on each platform and test locally?** + +For tools and libraries that don't include UIs, I can usually get away with automated build testing. If there's a UI, then I need to do both—reliable, scriptable UI automation for existing GUI toolkits is rare to non-existent, so I would have to either invest in creating UI automation tools that work across all the platforms I want to support, or I do it manually. If a project uses a custom UI toolkit (like, say, an OpenGL UI like Unity3D does), then it's fairly easy to develop scriptable automation tools and automate most of that stuff. Still, there's nothing like the human ability to break things with a couple of clicks! + +**If you are developing cross-platform, do you support cross-editor build systems so that you can use Visual Studio on Windows, Qt Creator on Linux, and XCode on Mac? Or do you tend toward supporting one platform such as Eclipse on all platforms?** + +I favor cross-editor build systems. I prefer generating project files for different IDEs (preferably in a way that makes it easier to add more IDEs), with build scripts that can drive builds from the IDEs for the platform they're on. Editors are the most important tool for a developer. It takes time and effort to learn them, and they're not interchangeable. I have my favorite editors and tools, and everyone else should be able to use their favorite tool, too. + +**What is your preferred editor/development environment/IDE for cross-platform development?** + +The cross-platform developer is cursed with having to pick the lowest common denominator editor that works across the most platforms. I love Visual Studio, but I can't rely on it for anything except Windows work (and you really don't want to make Windows your primary cross-compiling platform), so I can't make it my primary IDE. Even if I could, an essential skill of cross-platform development is to know and use as many platforms as possible. That means really knowing them—using the platform's editors and libraries, getting to know the OS and its assumptions, behaviors, and limitations, etc. To do that and keep my sanity (and my shortcut muscle memory), I have to rely on cross-platform editors. So, I use Emacs and Sublime. + +**What are some of your favorite past and current cross-platform projects?** + +Mono is my all-time favorite, hands down, and most of the others revolve around it in some way. Gluezilla was a Mozilla binding I did years ago to allow C# apps to embed web browser views, and that one was a doozy. At one point I had a Winforms app, built on Linux, running on Windows with an embedded GTK view in it that was running a Mozilla browser view. The CppSharp project (formerly Cxxi, formerly CppInterop) is a project I started to generate C# bindings for C++ libraries so that you could call, create instances of, and subclass C++ classes from C#. It was done in such a way that it would detect at runtime what platform you'd be running on and what compiler was used to create the native library and generate the correct C# bindings for it. That was fun! + +**Where do you see cross-platform development heading in the future?** + +The way we build native applications is already changing, and I feel like the visual differences between the various desktop operating systems are going to become even more blurred so that it will become easier to build cross-platform apps that integrate reasonably well without being fully native. Unfortunately, that might mean applications will be worse in terms of accessibility and less innovative when it comes to using the OS to its full potential. Cross-platform development of tools, libraries, and runtimes is something that we know how to do well, but there's still a lot of work to do with cross-platform application development. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/business/16/5/oscon-interview-andreia-gaita + +作者:[Marcus D. Hanwell ][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/mhanwell +[1]: https://twitter.com/sh4na +[2]: http://conferences.oreilly.com/oscon/open-source-us/public/schedule/detail/48702 +[3]: http://www.mono-project.com/ diff --git a/sources/talk/20160506 Linus Torvalds Talks IoT Smart Devices Security Concerns and More.md b/sources/talk/20160506 Linus Torvalds Talks IoT Smart Devices Security Concerns and More.md new file mode 100644 index 0000000000..e17c33bd81 --- /dev/null +++ b/sources/talk/20160506 Linus Torvalds Talks IoT Smart Devices Security Concerns and More.md @@ -0,0 +1,46 @@ +Linus Torvalds Talks IoT, Smart Devices, Security Concerns, and More[video] +=========================================================================== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/elc-linus-b.jpg?itok=6WwnCSjL) +>Dirk Hohndel interviews Linus Torvalds at ELC. + +For the first time in the 11-year history of the [Embedded Linux Conference (ELC)][0], held in San Diego, April 4-6, the keynotes included a discussion with Linus Torvalds. The creator and lead overseer of the Linux kernel, and “the reason we are all here,” in the words of his interviewer, Intel Chief Linux and Open Source Technologist Dirk Hohndel, seemed upbeat about the state of Linux in embedded and Internet of Things applications. Torvalds very presence signaled that embedded Linux, which has often been overshadowed by Linux desktop, server, and cloud technologies, had come of age. + +![](https://www.linux.com/sites/lcom/files/styles/floated_images/public/elc-linus_0.jpg?itok=FNPIDe8k) +>Linus Torvalds speaking at Embedded Linux Conference. + +IoT was the main topic at ELC, which included an OpenIoT Summit track, and the chief topic in the Torvalds interview. + +“Maybe you won’t see Linux at the IoT leaf nodes, but anytime you have a hub, you will need it,” Torvalds told Hohndel. “You need smart devices especially if you have 23 [IoT standards]. If you have all these stupid devices that don’t necessarily run Linux, and they all talk with slightly different standards, you will need a lot of smart devices. We will never have one completely open standard, one ring to rule them all, but you will have three of four major protocols, and then all these smart hubs that translate.” + +Torvalds remained customarily philosophical when Hohndel asked about the gaping security holes in IoT. “I don’t worry about security because there’s not a lot we can do,” he said. “IoT is unpatchable -- it’s a fact of life.” + +The Linux creator seemed more concerned about the lack of timely upstream contributions from one-off embedded projects, although he noted there have been significant improvements in recent years, partially due to consolidation on hardware. + +“The embedded world has traditionally been hard to interact with as an open source developer, but I think that’s improving,” Torvalds said. “The ARM community has become so much better. Kernel people can now actually keep up with some of the hardware improvements. It’s improving, but we’re not nearly there yet.” + +Torvalds admitted to being more at home on the desktop than in embedded and to having “two left hands” when it comes to hardware. + +“I’ve destroyed things with a soldering iron many times,” he said. “I’m not really set up to do hardware.” On the other hand, Torvalds guessed that if he were a teenager today, he would be fiddling around with a Raspberry Pi or BeagleBone. “The great part is if you’re not great at soldering, you can just buy a new one.” + +Meanwhile, Torvalds vowed to continue fighting for desktop Linux for another 25 years. “I’ll wear them down,” he said with a smile. + +Watch the full video, below. + +Get the Latest on Embedded Linux and IoT. Access 150+ recorded sessions from Embedded Linux Conference 2016. [Watch Now][1]. + +[video](https://youtu.be/tQKUWkR-wtM) + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/linus-torvalds-talks-iot-smart-devices-security-concerns-and-more-video + +作者:[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 +[0]: http://events.linuxfoundation.org/events/embedded-linux-conference +[1]: http://go.linuxfoundation.org/elc-openiot-summit-2016-videos?utm_source=lf&utm_medium=blog&utm_campaign=linuxcom diff --git a/sources/talk/20160510 65% of companies are contributing to open source projects.md b/sources/talk/20160510 65% of companies are contributing to open source projects.md new file mode 100644 index 0000000000..ad3b4ef680 --- /dev/null +++ b/sources/talk/20160510 65% of companies are contributing to open source projects.md @@ -0,0 +1,63 @@ +65% of companies are contributing to open source projects +========================================================== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BUSINESS_openseries.png?itok=s7lXChId) + +This year marks the 10th annual Future of Open Source Survey to examine trends in open source, hosted by Black Duck and North Bridge. The big takeaway from the survey this year centers around the mainstream acceptance of open source today and how much has changed over the last decade. + +The [2016 Future of Open Source Survey][1] analyzed responses from nearly 3,400 professionals. Developers made their voices heard in the survey this year, comprising roughly 70% of the participants. The group that showed exponential growth were security professionals, whose participation increased by over 450%. Their participation shows the increasing interest in ensuring that the open source community pays attention to security issues in open source software and securing new technologies as they emerge. + +Black Duck's [Open Source Rookies][2] of the Year awards identify some of these emerging technologies, like Docker and Kontena in containers. Containers themselves have seen huge growth this year–76% of respondents say their company has some plans to use containers. And an amazing 59% of respondents are already using containers in a variety of deployments, from development and testing to internal and external production environment. The developer community has embraced containers as a way to get their code out quickly and easily. + +It's not surprising that the survey shows a miniscule number of organizations having no developers contributing to open source software. When large corporations like Microsoft and Apple open source some of their solutions, developers gain new opportunities to participate in open source. I certainly hope this trend will continue, with more software developers contributing to open source projects at work and outside of work. + +### Highlights from the 2016 survey + +#### Business value + +* Open source is an essential element in development strategy with more than 65% of respondents relying on open source to speed development. +* More than 55% leverage open source within their production environments. + +#### Engine for innovation + +* Respondents reported use of open source to drive innovation through faster, more agile development; accelerated time to market and vastly superior interoperability. +* Additional innovation is afforded by open source's quality of solutions; competitive features and technical capabilities; and ability to customize. + +#### Proliferation of open source business models and investment + +* More diverse business models are emerging that promise to deliver more value to open source companies than ever before. They are not as dependent on SaaS and services/support. +* Open source private financing has increased almost 4x in five years. + +#### Security and management + +The development of best-in-class open source security and management practices has not kept pace with growth in adoption. Despite a proliferation of expensive, high-profile open source breaches in recent years, the survey revealed that: + +* 50% of companies have no formal policy for selecting and approving open source code. +* 47% of companies don’t have formal processes in place to track open source code, limiting their visibility into their open source and therefore their ability to control it. +* More than one-third of companies have no process for identifying, tracking or remediating known open source vulnerabilities. + +#### Open source participation on the rise + +The survey revealed an active corporate open source community that spurs innovation, delivers exponential value and shares camaraderie: + +* 67% of respondents report actively encouraging developers to engage in and contribute to open source projects. +* 65% of companies are contributing to open source projects. +* One in three companies have a fulltime resource dedicated to open source projects. +* 59% of respondents participate in open source projects to gain competitive edge. + +Black Duck and North Bridge learned a great deal this year about security, policy, business models and more from the survey, and we’re excited to share these findings. Thank you to our many collaborators and all the respondents for taking the time to take the survey. It’s been a great ten years, and I am happy that we can safely say that the future of open source is full of possibilities. + +Learn more, see the [full results][3]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/business/16/5/2016-future-open-source-survey + +作者:[Haidee LeClair][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +[a]: https://opensource.com/users/blackduck2016 +[1]: http://www.slideshare.net/blackducksoftware/2016-future-of-open-source-survey-results +[2]: https://info.blackducksoftware.com/OpenSourceRookies2015.html +[3]: http://www.slideshare.net/blackducksoftware/2016-future-of-open-source-survey-results%C2%A0 diff --git a/sources/talk/20160516 Linux will be the major operating system of 21st century cars.md b/sources/talk/20160516 Linux will be the major operating system of 21st century cars.md new file mode 100644 index 0000000000..ec7a33aaa6 --- /dev/null +++ b/sources/talk/20160516 Linux will be the major operating system of 21st century cars.md @@ -0,0 +1,38 @@ +Linux will be the major operating system of 21st century cars +=============================================================== + +>Cars are more than engines and good looking bodies. They're also complex computing devices so, of course, Linux runs inside them. + +Linux doesn't just run your servers and, via Android, your phones. It also runs your cars. Of course, no one has ever bought a car for its operating system. But Linux is already powering the infotainment, heads-up display and connected car 4G and Wi-Fi systems for such major car manufacturers as Toyota, Nissan, and Jaguar Land Rover and [Linux is on its way to Ford][1], Mazda, Mitsubishi, and Subaru cars. + +![](http://zdnet4.cbsistatic.com/hub/i/2016/05/10/743f0c14-6458-4d1e-8723-d2d94d0d0e69/c297b7d52e27e97d8721d4cb46bb371b/agl-logo.jpg) +>All the Linux and open-source car software efforts have now been unified under the Automotive Grade Linux project. + +Software companies are also getting into this Internet of mobile things act. Movimento, Oracle, Qualcomm, Texas Instruments, UIEvolution and VeriSilicon have all [joined the Automotive Grade Linux (AGL)][2] project. The [AGL][3] is a collaborative open-source project devoted to creating a common, Linux-based software stack for the connected car. + +AGL has seen tremendous growth over the past year as demand for connected car technology and infotainment are rapidly increasing," said Dan Cauchy, the Linux Foundation's General Manager of Automotive, in a statement. + +Cauchy continued, "Our membership base is not only growing rapidly, but it is also diversifying across various business interests, from semiconductors and in-vehicle software to IoT and connected cloud services. This is a clear indication that the connected car revolution has broad implications across many industry verticals." + +These companies have joined after AGL's recent announcement of a new AGL Unified Code Base (UCB). This new Linux distribution is based on AGL and two other car open-source projects: [Tizen][4] and the [GENIVI Alliance][5]. UCB is a second-generation car Linux. It was built from the ground up to address automotive specific applications. It handles navigation, communications, safety, security and infotainment functionality, + +"The automotive industry needs a standard open operating system and framework to enable automakers and suppliers to quickly bring smartphone-like capabilities to the car," said Cauchy. "This new distribution integrates the best components from AGL, Tizen, GENIVI and related open-source code into a single AGL Unified Code Base, allowing car-makers to leverage a common platform for rapid innovation. The AGL UCB distribution will play a huge role in the adoption of Linux-based systems for all functions in the vehicle." + +He's right. Since its release in January 2016, four car companies and ten new software businesses have joined AGL. Esso, now Exxon, made the advertising slogan, "Put a tiger in your tank!" famous. I doubt that "Put a penguin under your hood" will ever become well-known, but that's exactly what's happening. Linux is well on its way to becoming the major operating system of 21st century cars. + +------------------------------------------------------------------------------ + +via: http://www.zdnet.com/article/the-linux-in-your-car-movement-gains-momentum/ + +作者:[Steven J. Vaughan-Nichols][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.zdnet.com/meet-the-team/us/steven-j-vaughan-nichols/ +[1]: https://www.automotivelinux.org/news/announcement/2016/01/ford-mazda-mitsubishi-motors-and-subaru-join-linux-foundation-and +[2]: https://www.automotivelinux.org/news/announcement/2016/05/oracle-qualcomm-innovation-center-texas-instruments-and-others-support +[3]: https://www.automotivelinux.org/ +[4]: https://www.tizen.org/ +[5]: http://www.genivi.org/ diff --git a/sources/talk/20160516 Open source from a recruiter's perspective.md b/sources/talk/20160516 Open source from a recruiter's perspective.md new file mode 100644 index 0000000000..e8d48f77d0 --- /dev/null +++ b/sources/talk/20160516 Open source from a recruiter's perspective.md @@ -0,0 +1,52 @@ +eriwoon 翻译中 -- 2106-May-19 +Open source from a recruiter's perspective +============================================ + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BIZ_workplay.png?itok=uQqFssrf) + +I fell in love with technology when I went to my first open source convention in 2012. + +After spending years in recruiting, I decided to take a job specializing in big data at [Greythorn][1]. I had been trying to learn the ropes for a few months leading up to [OSCON][2], but going to the conference sped that process up like crazy. There were so many brilliant people all in one place, and everyone was willing to share what they knew. It wasn't because they were trying to sell me anything, but because they were all so passionate about what they were working on. + +I soon realized that, in many ways, the open source and big data industry was less an industry and more of a community. That's why I now try to pay it forward and share what I've learned about open source with those who are just getting started in their careers. + +### Why employers want open source contributors + +Many clients tell me that although they want a candidate who has an exceptional technical mind, the ideal person should also really like this stuff. When you are passionate about something, you find yourself working on it even when you aren't getting paid. + +My clients often ask, "Do they code in their spare time?" "Can I find their work anywhere?" "What do they really enjoy?" Open source contributors are often at an advantage because they check these boxes, and not only are their projects out in the open—so is the evidence of their coding proficiency. + +#### Why recruiters search for open source contributors + +Solid tech recruiters understand the technologies and roles they're recruiting for, and they're going to assess your skills accordingly. But I'll admit that many of us have found that the best candidates we've come across have a tendency to be involved in open source, so we often just start our search there. Recruiters provide value to clients when they find candidates who are motivated to work on a team to create something awesome, because that's basically the description of a top-performing employee. + +It makes sense to me: When you take really smart people and give them the chance to be collaborative—for the sake of making something that works really well or may change the landscape of our everyday lives—it creates an energy that can be addictive. + +### What open source contributors can do to build a happy career + +There are obvious things you can do to leverage your open source work to build your career: Put your code on GitHub, participate in projects, go to conferences and join panels and workshops, etc. These are worthwhile, but more than anything you need to know what will make you happy in your work. + +Ask yourself questions like... + +* **Is it important to work for a company that gives back to the open source and software community?** I find that some of my best candidates insist on this, and it makes a huge difference in their job satisfaction. +* **Do you want to work for a company that is based on open source?** The culture is often different in these environments, and it helps to know if that's where you think you'll fit best. +* **Are there people you'd specifically like to work with?** Although you can always try to join the same projects, the odds of collaborating with and learning from someone you admire are better if your day jobs align at the same company. + +Once you know your own career priorities, it's easier to filter out the jobs that won't move you closer to your goals—and if you're working with a recruiter, it helps them match you with the right employer and team. + +Although I don't contribute code, I'll always share what I've learned with those who are working on their career in open source. This community is made up of supportive and smart people, and I love that I've been able to be a small part of it. + + +------------------------------------------------------------------------------ + +via: https://opensource.com/business/16/5/open-source-recruiters-perspective + +作者:[Lindsey Thorne][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/lindsey-thorne +[1]: http://www.greythorn.com/ +[2]: http://conferences.oreilly.com/oscon diff --git a/sources/talk/The history of Android/18 - The history of Android.md b/sources/talk/The history of Android/18 - The history of Android.md deleted file mode 100644 index 8b303033bc..0000000000 --- a/sources/talk/The history of Android/18 - The history of Android.md +++ /dev/null @@ -1,85 +0,0 @@ -alim0x translating - -The history of Android -================================================================================ -![Yet another Android Market redesign dips its toe into the "cards" interface that would become a Google staple.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/play-store.png) -Yet another Android Market redesign dips its toe into the "cards" interface that would become a Google staple. -Photo by Ron Amadeo - -The Android Market released its fourth new design in Android's two-and-a-half years on the market. This new design was hugely important as it came really close to Google's "cards" interface. By displaying Apps or other content in little blocks, Google could seamlessly transition its app design between screens of various sizes with minimal effort. Content could be displayed just like photos in a gallery app—feed the layout renderer a big list of content blocks, enable screen wrapping, and you were done. Bigger screens saw more blocks of content, and smaller screens only saw a few at a time. With the content display out of the way, Google added a "Categories" fragment to the right side and a big featured app carousel at the top. - -While the design was ready for an easily configurable interface, the functionality was not. The original shipping version of the market was locked to a landscape orientation and was Honeycomb-exclusive. - -![The app page and "My Apps" interface.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/device-2014-02-12-190002.png) -The app page and "My Apps" interface. -Photo by Ron Amadeo - -This new market sold not only apps, but brought Books and Movies rentals into the fold as well. Google was selling books since 2010; it was only ever through a Website. The new market unified all of Google's content sales in a single location and brought it one step closer to taking on Apple's iTunes juggernaut, though selling all of these items under the "Android Market" was a bit of a branding snafu, as much of the content didn't require Android to use. - -![The browser did its best to look like Chrome, and Contacts used a two-pane interface.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/browsercontactst.png) -The browser did its best to look like Chrome, and Contacts used a two-pane interface. -Photo by Ron Amadeo - -The new Browser added an honest-to-goodness tabs strip at the top of the interface. While this browser wasn't Chrome, it aped a lot of Chrome's design and features. Besides the pioneering tabs-on-top interface, it added Incognito tabs, which kept no history or autocomplete records. There was also an option to have a Chrome-style new tab page consisting of thumbnails of your most-viewed webpages. - -The new Browser even synced with Chrome. After signing in to the browser, it would download your Chrome bookmarks and automatically sign in to Google Web pages with your account. Bookmarking a page was as easy as tapping on the star icon in the address bar. Just like Google Maps, the browser dumped the zoom buttons and went with all gesture controls. - -The contacts app was finally removed from the phone app and broken out into a standalone app. The previous contacts/dialer hybrid was far too phone-centric for how people use a modern smartphone. Contacts housed information for e-mails, IM, texting, addresses, birthdays, and social networks, so tying it to the phone app makes just as much sense as trying it to Google Maps. With the telephony requirements out of the way, contacts could be simplified to a tab-less list of people. Honeycomb went with a dual pane view showing the full contact list on the left and contacts on the right. This again made use of a Fragments API; a hypothetical phone version of this app could show each panel as a single screen. - -The Honeycomb version of Contacts was the first version to have a quick scroll feature. When grabbing the left scroll bar, you could quickly scroll up and down, and a letter preview showed your current spot in the list. - -![The new YouTube app looked like something out of the Matrix.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/youtubes.png) -The new YouTube app looked like something out of the Matrix. -Photo by Ron Amadeo - -YouTube thankfully dumped the "unique" design Google came up with for 2.3 and gave the video service a cohesive design that looked like it belonged in Android. The main screen was a horizontally scrolling curved wall of video thumbnails that showed a most popular or (when signed in) personalized selection of videos. While Google never brought this design to phones, it could be considered an easily reconfigurable card interface. The action bar shined here as a reconfigurable toolbar. When not signed it, the action bar was filled with a search bar. When you were signed in, search shrank down to a button, and tabs for "Home," "Browse," and "Your Channel" were shown. - -![Honeycomb really liked to drive home that it was a computer interface with blue scaffolding. Movie Studio completes the Tron look with an orange theme.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/other2.png) -Honeycomb really liked to drive home that it was a computer interface with blue scaffolding. Movie Studio completes the Tron look with an orange theme. -Photo by Ron Amadeo - -The lone new app in Honeycomb was "Movie Studio," which was not a self-explanatory app and arrived with no explanations or instructions. As far as we could tell, you could import video clips, cut them up, and add text and scene transitions. Editing video—one of the most time consuming, difficult, and processor-intensive things you can do on a computer—on a tablet felt just a little too ambitious, and Google would completely remove this app in later versions. Our favorite part of Movie Studio was that it really completed the Tron theme. While the rest of the OS used blue highlights, this was all orange. (Movie Studio is an evil program!) - -![Widgets!](http://cdn.arstechnica.net/wp-content/uploads/2014/02/device-2014-02-12-202224.png) -Widgets! -Photo by Ron Amadeo - -Honeycomb brought a new widget framework that allowed for scrolling widgets, and the Gmail, Email, and Calendar widgets were upgraded to support it. YouTube and Books used a new widget that auto-scrolled through cards of content. By flicking up or down on the widget, you could scroll through the cards. We're not sure what the point of being constantly reminded of your book collection was, but it's there if you want it. While all of these widgets worked great on a 10-inch screen, Google never redesigned them for phones, making them practically useless on Android's most popular form factor. All the widgets had massive identifying headers and usually took up half the screen to show only a few items. - -![The scrollable Recent Apps and resizable widgets in Android 3.1.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/31new.jpg) -The scrollable Recent Apps and resizable widgets in Android 3.1. -Photo by Ron Amadeo - -Later versions of Honeycomb would fix many of the early problems 3.0 had. Android 3.1 was released three months after the first version of Honeycomb, and it brought several improvements. Resizable widgets were one of the biggest features added. After long pressing on a widget, a blue outline with grabbable handles would pop up around it, and dragging the handles around would resize the widget. The Recent Apps panel could now scroll vertically and held many more apps. The only feature missing from it at this point was the ability to swipe away apps. - -Today, an 0.1 upgrade is a major release, but in Honeycomb, point releases were considerably smaller. Besides the few UI tweaks, 3.1 added support for gamepads, keyboards, mice, and other input devices over USB and Bluetooth. It also offered a few more developer APIs. - -![Android 3.2's compatibility zoom and a typical stretched-out app on an Android tablet.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/device-2014-02-14-131132.jpg) -Android 3.2's compatibility zoom and a typical stretched-out app on an Android tablet. -Photo by Ron Amadeo - -Android 3.2 launched two months after 3.1, adding support for smaller sized tablets in the seven- to eight-inch range. It finally enabled SD card support, which the Xoom carried like a vestigial limb for the first five months of its life. - -Honeycomb was rushed out the door in order to be an ecosystem builder. No one will want an Android tablet if the tablet-specific apps aren't there, and Google knew it needed to get something in the hands of developers ASAP. At this early stage of Android's tablet ecosystem, the apps just weren't there. It was the biggest problem people had with the Xoom. - -3.2 added "Compatibility Zoom," which gave users a new option of stretching apps to the screen (as shown in the right picture) or zooming the normal app layout to fit the screen. Neither option was ideal, and without the app ecosystem to support it, Honeycomb devices sold pretty poorly. Google's tablet moves would eventually pay off though. Today, Android tablets have [taken the market share crown from iOS][1]. - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work. - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/18/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://techcrunch.com/2014/03/03/gartner-195m-tablets-sold-in-2013-android-grabs-top-spot-from-ipad-with-62-share/ -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo diff --git a/sources/talk/The history of Android/19 - The history of Android.md b/sources/talk/The history of Android/19 - The history of Android.md deleted file mode 100644 index 32841f5be9..0000000000 --- a/sources/talk/The history of Android/19 - The history of Android.md +++ /dev/null @@ -1,71 +0,0 @@ -The history of Android -================================================================================ -![Google Music Beta running on Gingerbread.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/device-2014-03-31-110613.png) -Google Music Beta running on Gingerbread. -Photo by Ron Amadeo - -### Google Music Beta—cloud storage in lieu of a content store ### - -While Honeycomb revamped the Google Music interface, the Music app didn't go directly from the Honeycomb design to Ice Cream Sandwich. In May 2011, Google launched "[Google Music Beta][1]," an online music locker that came along with a new Google Music app. - -The new Google Music app for 2.2 and up took a few design cues from the Cooliris Gallery, of all things, going with a changing, blurry image for the background. Just about everything was transparent: the pop-up menus, the tabs at the top, and the now-playing bar at the bottom. Individual songs or entire playlists could be downloaded to the device for offline playback, making Google Music an easy way to make sure your music was on all your devices. Besides the mobile app, there was also a Webapp, which allowed Google Music to work on any desktop computer. - -Google didn't have content deals in place with the record companies to start a music store yet, so its stop-gap solution was to allow users to store songs online and stream them to a device. Today, Google has content deals for individual song purchases and all-you-can-eat subscription modes, along with the music locker service. - -### Android 4.0, Ice Cream Sandwich—the modern era ### - -![The Samsung Galaxy Nexus, Android 4.0's launch device.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/samsung-i9250-galaxy-nexus-51.jpg) -The Samsung Galaxy Nexus, Android 4.0's launch device. - -Released in October 2011, Android 4.0, Ice Cream Sandwich, got the OS back on track with a release spanning phones and tablets, and it was once again open source. It was the first update to come to phones since Gingerbread, which meant the majority of Android's user base went almost a year without seeing an update. 4.0 was all about shrinking the Honeycomb design to smaller devices, bringing on-screen buttons, the action bar, and the new design language to phones. - -Ice Cream Sandwich debuted on the Samsung Galaxy Nexus, one of the first Android phones with a 720p screen. Along with the higher resolution, the Galaxy Nexus pushed phones to even larger sizes with a 4.65-inch screen—almost a full inch larger than the original Nexus One. This was called "too big" by many critics, but today many Android phones are even bigger. (Five inches is "normal" now.) Ice Cream Sandwich required a lot more power than Gingerbread did, and the Galaxy Nexus delivered with a dual core, 1.2Ghz TI OMAP processor and 1GB of RAM. - -In the US, the Galaxy Nexus debuted on Verizon with an LTE modem. Unlike previous Nexus devices, the most popular model—the Verizon version—was under the control of a carrier, and Google's software and updates had to be approved by Verizon before the phone could be updated. This led to delays in updates and the removal of software Verizon didn't like, namely Google Wallet. - -Thanks to the software improvements in Ice Cream Sandwich, Google finally achieved peak button removal on a phone. With the on-screen navigation buttons, the capacitive buttons could be removed, leaving the Galaxy Nexus with only power and volume buttons. - -![Android 4.0 shrunk down a lot of the Honeycomb design.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/2home.png) -Android 4.0 shrunk down a lot of the Honeycomb design. -Photo by Ron Amadeo - -The Tron aesthetic in Honeycomb was a little much. Immediately in Ice Cream Sandwich, Google started turning down some of the more sci-fi aspects of the design. The sci-fi clock font changed from a folded over semi-transparent thing to a thin, elegant, normal-looking font. The water ripple touch effect on the unlock circle was removed, and the alien Honeycomb clock widget was scrapped in favor of a more minimal design. The system buttons were redesigned, too, changing from blue outlines with the occasional thick side to thin, even, white outlines. The default wallpaper changed from the blue Honeycomb spaceship interior to a streaky, broken rainbow, which added some much-needed color to the default layout. - -The Honeycomb system bar features were split into a two-bar design for phones. At the top was the traditional status bar, and at the bottom was the new system bar, which housed the three system buttons: Back, Home, and Recent. A permanent search bar was added to the top of the home screen. The bar persisted on the screen the same way the dock did, so over the five home screens, it took up 20 icon spots. On the Honeycomb unlock screen, the small inner circle could be moved anywhere outside the larger circle to unlock the device. In Ice Cream Sandwich, you had to actually hit the unlock icon with the inner circle. This new accuracy requirement allowed Google to add another option to the lock screen: a camera shortcut. Dragging the inner circle to the camera icon would directly launch the camera, skipping the home screen. - -![A Phone OS meant a ton more apps, and the notification panel became a full-screen interface again.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/appsandnotic40.png) -A Phone OS meant a ton more apps, and the notification panel became a full-screen interface again. -Photo by Ron Amadeo - -The App drawer was still tabbed, but the "My Apps" tab from Honeycomb was replaced with "Widgets," which was a simple 2×3 thumbnail view of widgets. Like Honeycomb, this app drawer was paginated and had to be swiped through horizontally. (Android still uses this app drawer design today.) New in the app drawer was an Android Google+ app, which existed separately for some time. Along with it came a shortcut to "Messenger," the Google+ private messaging service. ("Messenger" is not to be confused with "Messaging," the stock SMS app.) - -Since we're back to a phone now, Messaging, News and Weather, Phone, and Voice Dialer returned, and Cordy, a tablet game, was removed. Our screenshots are from the Verizon variant, which, despite being a Nexus device, was sullied by crapware like "My Verizon Mobile," and "VZ Backup Assistant." In keeping with the de-Tronification theme of Ice Cream Sandwich, the Calendar and Camera icons now looked more like something from Planet Earth rather than alien artifacts. Clock, Downloads, Phone, and Android Market got new icons, too, and "Contacts" got a new icon and a new name, becoming "People." - -The Notification panel got a big overhaul, especially when compared to the [previous Gingerbread design][2]. There was now a top header featuring the date, a settings shortcut, and a "clear all." While first Honeycomb allowed users to dismiss individual notifications by tapping on an "X" in the notification, Ice Cream Sandwich's implementation was much more elegant: just swipe the individual notifications to the left or right and they cleared. Honeycomb had blue highlights, but the blue tone was all over the place. Ice Cream Sandwich unified almost everything to a single blue (hex code #33B5E5, if you want to get specific). The background of the notification panel was made transparent, and the "handle" at the bottom changed to a minimal blue circle with an opaque black background. - -![The main page of the Android Market changed back to black.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/market.png) -The main page of the Android Market changed back to black. -Photo by Ron Amadeo - -The Market got yet another redesign. It finally supported portrait mode again and added Music to the lineup of content you can buy in the store. The new Market extended the cards concept that debuted in Honeycomb and was the first version to use the same application on tablets and phones. The cards on the main page usually didn't link to apps, instead pointing to special promotional pages like "staff picks" or seasonal promotions. - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work. - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/19/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://arstechnica.com/gadgets/2011/05/hands-on-grooving-on-the-go-with-impressive-google-music-beta/ -[2]:http://cdn.arstechnica.net/wp-content/uploads/2014/02/32.png -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo \ No newline at end of file diff --git a/sources/talk/The history of Android/20 - The history of Android.md b/sources/talk/The history of Android/20 - The history of Android.md deleted file mode 100644 index 30db4ce5c2..0000000000 --- a/sources/talk/The history of Android/20 - The history of Android.md +++ /dev/null @@ -1,93 +0,0 @@ -The history of Android -================================================================================ -![Another Market design that was nothing like the old one. This lineup shows the categories page, featured, a top apps list, and an app page.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/market-pages.png) -Another Market design that was nothing like the old one. This lineup shows the categories page, featured, a top apps list, and an app page. -Photo by Ron Amadeo - -These screenshots give us our first look at the refined version of the Action Bar in Ice Cream Sandwich. Almost every app got a bar at the top of the screen that housed the app icon, title of the screen, several function buttons, and a menu button on the right. The right-aligned menu button was called the "overflow" button, because it housed items that didn't fit on the main action bar. The overflow menu wasn't static, though, it gave the action bar more screen real-estate—like in horizontal mode or on a tablet—and more of the overflow menu items were shown on the action bar as actual buttons. - -New in Ice Cream Sandwich was this design style of "swipe tabs," which replaced the 2×3 interstitial navigation screen Google was previously pushing. A tab bar sat just under the Action Bar, with the center title showing the current tab and the left and right having labels for the pages to the left and right of this screen. A swipe in either direction would change tabs, or you could tap on a title to go to that tab. - -One really cool design touch on the individual app screen was that, after the pictures, it would dynamically rearrange the page based on your history with that app. If you never installed the app before, the description would be the first box. If you used the app before, the first section would be the reviews bar, which would either invite you to review the app or remind you what you thought of the app last time you installed it. The second section for a previously used app was “What’s New," since an existing user would most likely be interested in changes. - -![Recent apps and the browser were just like Honeycomb, but smaller.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/recentbrowser.png) -Recent apps and the browser were just like Honeycomb, but smaller. -Photo by Ron Amadeo - -Recent apps toned the Tron look way down. The blue outline around the thumbnails was removed, along with the eerie, uneven blue glow in the background. It now looked like a neutral UI piece that would be at home in any time period. - -The Browser did its best to bring a tabbed experience to phones. Multi-tab browsing was placed front and center, but instead of wasting precious screen space on a tab strip, a tab button would open a Recent Apps-like interface that would show you your open tabs. Functionally, there wasn't much difference between this and the "window" view that was present in past versions of the Browser. The best addition to the Browser was a "Request desktop site" menu item, which would switch from the default mobile view to the normal site. The Browser showed off the flexibility of Google's Action Bar design, which, despite not having a top-left app icon, still functioned like any other top bar design. - -![Gmail and Google Talk—they're like Honeycomb, but smaller!](http://cdn.arstechnica.net/wp-content/uploads/2014/03/gmail2.png) -Gmail and Google Talk—they're like Honeycomb, but smaller! -Photo by Ron Amadeo - -Gmail and Google Talk both looked like smaller versions of their Honeycomb designs, but with a few tweaks to work better on smaller screens. Gmail featured a dual Action Bar—one on the top of the screen and one on the bottom. The top of the bar showed your current folder, account, and number of unread messages, and tapping on the bar opened a navigation menu. The bottom featured all the normal buttons you would expect along with the overflow button. This dual layout was used in order display more buttons on the surface level, but in landscape mode where vertical space was at a premium, the dual bars merged into a single top bar. - -In the message view, the blue bar was "sticky" when you scrolled down. It stuck to the top of the screen, so you could always see who wrote the current message, reply, or star it. Once in a message, the thin, dark gray bar at the bottom showed your current spot in the inbox (or whatever list brought you here), and you could swipe left and right to get to other messages. - -Google Talk would let you swipe left and right to change chat windows, just like Gmail, but there the bar was at the top. - -![The new dialer and the incoming call screen, both of which we haven't seen since Gingerbread.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/inc-calls.png) -The new dialer and the incoming call screen, both of which we haven't seen since Gingerbread. -Photo by Ron Amadeo - -Since Honeycomb was only for tablets, some UI pieces were directly preceded by Gingerbread instead. The new Ice Cream Sandwich dialer was, of course, black and blue, and it used smaller tabs that could be swiped through. While Ice Cream Sandwich finally did the sensible thing and separated the main phone and contacts interfaces, the phone app still had its own contacts tab. There were now two spots to view your contact list—one with a dark theme and one with a light theme. With a hardware search button no longer being a requirement, the bottom row of buttons had the voicemail shortcut swapped out for a search icon. - -Google liked to have the incoming call interface mirror the lock screen, which meant Ice Cream Sandwich got a circle-unlock design. Besides the usual decline or accept options, a new button was added to the top of the circle, which would let you decline a call by sending a pre-defined text message to the caller. Swiping up and picking a message like "Can't talk now, call you later" was (and still is) much more informative than an endlessly ringing phone. - -![Honeycomb didn't have folders or a texting app, so here's Ice Cream Sandwich versus Gingerbread.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/thenonmessedupversion.png) -Honeycomb didn't have folders or a texting app, so here's Ice Cream Sandwich versus Gingerbread. -Photo by Ron Amadeo - -Folders were now much easier to make. In Gingerbread, you had to long press on the screen, pick "folders," and then pick "new folder." In Ice Cream Sandwich, just drag one icon on top of another, and a folder is created containing those two icons. It was dead simple and much easier than finding the hidden long-press command. - -The design was much improved, too. Gingerbread used a generic beige folder icon, but Ice Cream Sandwich actually showed you what was in the folder by stacking the first three icons on top of each other, drawing a circle around them, and using that as the folder icon. Open folder containers resized to fit the amount of icons in the folder rather than being a full-screen, mostly empty box. It looked way, way better. - -![YouTube switched to a more modern white theme and used a list view instead of the crazy 3D scrolling](http://cdn.arstechnica.net/wp-content/uploads/2014/03/youtubes.png) -YouTube switched to a more modern white theme and used a list view instead of the crazy 3D scrolling -Photo by Ron Amadeo - -YouTube was completely redesigned and looked less like something from The Matrix and more like, well, YouTube. It was a simple white list of vertically scrolling videos, just like the website. Making videos on your phone was given prime real estate, with the first button on the action bar dedicated to recording a video. Strangely, different screens used different YouTube logos in the top left, switching between a horizontal YouTube logo and a square one. - -YouTube used swipe tabs just about everywhere. They were placed on the main page to browse and view your account and on the video pages to switch between comments, info, and related videos. The 4.0 app showed the first signs of Google+ YouTube integration, placing a "+1" icon next to the traditional rating buttons. Eventually Google+ would completely take over YouTube, turning the comments and author pages into Google+ activity. - -![Ice Cream Sandwich tried to make things easier on everyone. Here is a screen for tracking data usage, the new developer options with tons of analytics enabled, and the intro tutorial.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/data.png) -Ice Cream Sandwich tried to make things easier on everyone. Here is a screen for tracking data usage, the new developer options with tons of analytics enabled, and the intro tutorial. -Photo by Ron Amadeo - -Data Usage allowed users to easily keep track of and control their data usage. The main page showed a graph of this month's data usage, and users could set thresholds to be warned about data consumption or even set a hard usage limit to avoid overage charges. All of this was done easily by dragging the horizontal orange and red threshold lines higher or lower on the chart. The vertical white bars allowed users to select a slice of time in the graph. At the bottom of the page, the data usage for the selected time was broken down by app, so users could select a spike and easily see what app was sucking up all their data. When times got really tough, in the overflow button was an option to restrict all background data. Then, only apps running in the foreground could have access to the Internet connection. - -The Developer Options typically only housed a tiny handful of settings, but in Ice Cream Sandwich the section received a huge expansion. Google added all sorts of on-screen diagnostic overlays to help app developers understand what was happening inside their app. You could view CPU usage, pointer location, and view screen updates. There were also options to change the way the system functioned, like control over animation speed, background processing, and GPU rendering. - -One of the biggest differences between Android and the iOS is Android's app drawer interface. In Ice Cream Sandwich's quest to be more user-friendly, the initial startup launched a small tutorial showing users where the app drawer was and how to drag icons out of the drawer and onto the homescreen. With the removal of the off-screen menu button and changes like this, Android 4.0 made a big push to be more inviting to new smartphone users and switchers. - -![The "touch to beam" NFC support, Google Earth, and App Info, which would let you disable crapware.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/2014-03-06-03.57.png) -The "touch to beam" NFC support, Google Earth, and App Info, which would let you disable crapware. - -Built into Ice Cream Sandwich was full support for [NFC][1]. While previous devices like the Nexus S had NFC, support was limited and the OS couldn't do much with the chip. 4.0 added a feature called Android Beam, which would let two NFC-equipped Android 4.0 devices transfer data back and forth. NFC would transmit data related to whatever was on the screen at the time, so tapping when a phone displayed a webpage would send that page to the other phone. You could also send contact information, directions, and YouTube links. When the two phones were put together, the screen zoomed out, and tapping on the zoomed-out display would send the information. - -In Android, users are not allowed to uninstall system apps, which are often integral to the function of the device. Carriers and OEMs took advantage of this and started putting crapware in the system partition, which they would often stick with software they didn't want. Android 4.0 allowed users to disable any app that couldn't be uninstalled, meaning the app remained on the system but didn't show up in the app drawer and couldn't be run. If users were willing to dig through the settings, this gave them an easy way to take control of their phone. - -Android 4.0 can be thought of as the start of the modern Android era. Most of the Google apps released around this time only worked on Android 4.0 and above. There were so many new APIs that Google wanted to take advantage of that—initially at least—support for versions below 4.0 was limited. After Ice Cream Sandwich and Honeycomb, Google was really starting to get serious about software design. In January 2012, the company [finally launched][2] *Android Design*, a design guideline site that taught Android app developers how to create apps to match the look and feel of Android. This was something iOS not only had from the start of third-party app support, but Apple enforced design so seriously that apps that did not meet the guidelines were blocked from the App Store. The fact that Android went three years without any kind of public design documents from Google shows just how bad things used to be. But with Duarte in charge of Android's design revolution, the company was finally addressing basic design needs. - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work. - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/20/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://arstechnica.com/gadgets/2011/02/near-field-communications-a-technology-primer/ -[2]:http://arstechnica.com/business/2012/01/google-launches-style-guide-for-android-developers/ -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo \ No newline at end of file diff --git a/sources/talk/The history of Android/21 - The history of Android.md b/sources/talk/The history of Android/21 - The history of Android.md deleted file mode 100644 index 265e7a867b..0000000000 --- a/sources/talk/The history of Android/21 - The history of Android.md +++ /dev/null @@ -1,103 +0,0 @@ -The history of Android -================================================================================ -![](http://cdn.arstechnica.net/wp-content/uploads/2014/03/playicons2.png) -Photo by Ron Amadeo - -### Google Play and the return of direct-to-consumer device sales ### - -On March 6, 2012, Google unified all of its content offerings under the banner of "Google Play." The Android Market became the Google Play Store, Google Books became Google Play Books, Google Music became Google Play Music, and Android Market Movies became Google Play Movies & TV. While the app interfaces didn't change much, all four content apps got new names and icons. Content purchased in the Play Store would be downloaded to the appropriate app, and the Play Store and Play content apps all worked together to provide a fairly organized content experience. - -The Google Play update was Google's first big out-of-cycle update. Four packed-in apps were all changed without having to issue a system update—they were all updated through the Android Market/Play Store. Enabling out-of-cycle updates to individual apps was a big focus for Google, and being able to do an update like this was the culmination of an engineering effort that started in the Gingerbread era. Google had been working on "decoupling" the apps from the operating system and making everything portable enough to be distributed through the Android Market/Play Store. - -While one or two apps (mostly Maps and Gmail) had previously lived on the Android Market, from here on you'll see a lot more significant updates that have nothing to do with an operating system release. System updates require the cooperation of OEMs and carriers, so they are difficult to push out to every user. Play Store updates are completely controlled by Google, though, providing the company a direct line to users' devices. For the launch of Google Play, the Android Market updated itself to the Google Play Store, and from there, Books, Music, and Movies were all issued Google Play-flavored updates. - -The design of the Google Play apps was still all over the place. Each app looked and functioned differently, but for now, a cohesive brand was a good start. And removing "Android" from the branding was necessary because many services were available in the browser and could be used without touching an Android device at all. - -In April 2012, Google started [selling devices though the Play Store again][1], reviving the direct-to-customer model it had experimented with for the launch of the Nexus One. While it was only two years after ending the Nexus One sales, Internet shopping was now more common place, and buying something before you could hold it didn't seem as crazy as it did in 2010. - -Google also saw how price-conscious consumers became when faced with the Nexus One's $530 price tag. The first device for sale was an unlocked, GSM version of the Galaxy Nexus for $399. From there, price would go even lower. $350 has been the entry-level price for the last two Nexus smartphones, and 7-inch Nexus tablets would come in at only $200 to $220. - -Today, the Play Store sells eight different Android devices, four Chromebooks, a thermostat, and tons of accessories, and the device store is the de-facto location for a new Google product launch. New phone launches are so popular, the site usually breaks under the load, and new Nexus phones sell out in a few hours. - -### Android 4.1, Jelly Bean—Google Now points toward the future ### - -![The Asus-made Nexus 7, Android 4.1's launch device.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/ASUS_Google_Nexus_7_4_11.jpg) -The Asus-made Nexus 7, Android 4.1's launch device. - -With the release of Android 4.1, Jelly Bean in July 2012, Google settled into an Android release cadence of about every six months. The platform matured to the point where a release every three months was unnecessary, and the slower release cycle gave OEMs a chance to catch their breath. Unlike Honeycomb, point releases were now fairly major updates, with 4.1 bringing major UI and framework changes. - -One of the biggest changes in Jelly Bean that you won't be able to see in screenshots is "Project Butter," the name for a concerted effort by Google's engineers to make Android animations run smoothly at 30FPS. Core changes were made, like Vsync and triple buffering, and individual animations were optimized so they could be drawn smoothly. Animation and scrolling smoothness had always been a weak point of Android when compared to iOS. After some work on both the core animation framework and on individual apps, Jelly Bean brought Android a lot closer to iOS' smoothness. - -Along with Jelly Bean came the [Nexus][2] 7, a 7-inch tablet manufactured by Asus. Unlike the primarily horizontal Xoom, the Nexus 7 was meant to be used in portrait mode, like a large phone. The Nexus 7 showed that, after almost a year-and-a-half of ecosystem building, Google was ready to commit to the tablet market with a flagship device. Like the Nexus One and GSM Galaxy Nexus, the Nexus 7 was sold online directly by Google. While those earlier devices had shockingly high prices for consumers that were used to carrier subsidies, the Nexus 7 hit a mass market price point of only $200. The price bought you a device with a 7-inch, 1280x800 display, a quad core, 1.2 GHz Tegra 3 processor, 1GB of RAM, and 8GB of storage. The Nexus 7 was such a good value that many wondered if Google was making any money at all on its flagship tablet. - -This smaller, lighter, 7-inch form factor would be a huge success for Google, and it put the company in the rare position of being an industry trendsetter. Apple, which started with a 10-inch iPad, was eventually forced to answer the Nexus 7 and tablets like it with the iPad Mini. - -![4.1's new lock screen design, wallpaper, and the new on-press highlight on the system buttons.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/picture.png) -4.1's new lock screen design, wallpaper, and the new on-press highlight on the system buttons. -Photo by Ron Amadeo - -The Tron look introduced in Honeycomb was toned down a little in Ice Cream Sandwich, and Jelly Bean took things a step further. It started removing blue from large chunks of the operating system. The hint was the on-press highlights on the system buttons, which changed from blue to gray. - -![A composite image of the new app lineup and the new notification panel with expandable notifications.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/jb-apps-and-notications.png) -A composite image of the new app lineup and the new notification panel with expandable notifications. -Photo by Ron Amadeo - -The Notification panel was completely revamped, and we've finally arrived at the design used today in KitKat. The new panel extended to the top of the screen and covered the usual status icons, meaning the status bar was no longer visible when the panel was open. The time was prominently displayed in the top left corner, along with the date and a settings shortcut. The clear all notions button, which was represented by an "X" in Ice Cream Sandwich, changed to a stairstep icon, symbolizing the staggered sliding animation that cleared the notification panel. The bottom handle changed from a circle to a single line that ran the length of the notification panel. All the typography was changed—the notification panel now used bigger, thinner fonts for everything. This was another screen where the blue introduced in Ice Cream Sandwich and Honeycomb was removed. The notification panel was entirely gray now except for on-touch highlights. - -There was new functionality in the panel, too. Notifications were now expandable and could show much more information than the previous two-line design. It now showed up to eight lines of text and could even show buttons at the bottom of the notification. The screenshot notification had a share button at the bottom, and you could call directly from a missed call notification, or you could snooze a ringing alarm all from the notification panel. New notifications were expanded by default, but as they piled up they would collapse back to the traditional size. Dragging down on a notification with two fingers would expand it. - -![The new Google Search app, with Google Now cards, voice search, and text search.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/googlenow.png) -The new Google Search app, with Google Now cards, voice search, and text search. -Photo by Ron Amadeo - -The biggest feature addition to Jelly Bean for not only Android, but for Google as a whole, was the new version of the Google Search application. This introduced "Google Now," a predictive search feature. Google Now was displayed as several cards that sit below the search box, and it would offer results to searches Google thinks you care about. These were things like Google Maps searches for places you've recently looked at on your desktop computer or calendar appointment locations, the weather, and time at home while traveling. - -The new Google Search app could, of course, be launched with the Google icon, but it could also be accessed from any screen with a swipe up from the system bar. Long pressing on the system bar brought up a ring that worked similarly to the lock screen ring. The card section scrolled vertically, and cards could be a swipe away if you didn't want to see them. Voice Search was a big part of the updates. Questions weren't just blindly entered into Google; if Google knew the answer, it would also talk back using a text-To-Speech engine. And old-school text searches were, of course, still supported. Just tap on the bar and start typing. - -Google frequently called Google Now "the future of Google Search." Telling Google what you wanted wasn't good enough. Google wanted to know what you wanted before you did. Google Now put all of Google's data mining knowledge about you to work for you, and it was the company's biggest advantage against rival search services like Bing. Smartphones knew more about you than any other device you own, so the service debuted on Android. But Google slowly worked Google Now into Chrome, and eventually it will likely end up on Google.com. - -While the functionality was important, it became clear that Google Now was the most important design work to ever come out of the company, too. The white card aesthetic that this app introduced would become the foundation for Google's design of just about everything. Today, this card style is used in the Google Play Store and in all of the Play content apps, YouTube, Google Maps, Drive, Keep, Gmail, Google+, and many others. It's not just Android apps, either. Many of Google's desktop sites and iOS apps are inspired by this design. Design was historically one of Google's weak areas, but Google Now was the point where the company finally got its act together with a cohesive, company-wide design language. - -![Yet another YouTube redesign. Information density went way down.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/yotuube.png) -Yet another YouTube redesign. Information density went way down. -Photo by Ron Amadeo - -Another version, another YouTube redesign. This time the list view was primarily thumbnail-based, with giant images taking up most of the screen real estate. Information density tanked with the new list design. Before YouTube would display around six items per screen, now it could only display three. - -YouTube was one of the first apps to add a sliding drawer to the left side of an app, a feature which would become a standard design style across Google's apps. The drawer has links for your account and channel subscriptions, which allowed Google to kill the tabs-on-top design. - -![Google Play Service's responsibilities versus the rest of Android.](http://cdn.arstechnica.net/wp-content/uploads/2013/08/playservicesdiagram2.png) -Google Play Service's responsibilities versus the rest of Android. -Photo by Ron Amadeo - -### Google Play Services—fragmentation and making OS versions (nearly) obsolete ### - -It didn't seem like a big deal at the time, but in September 2012, Google Play Services 1.0 was automatically pushed out to every Android phone running 2.2 and up. It added a few Google+ APIs and support for OAuth 2.0. - -While this update might sound boring, Google Play Services would eventually grow to become an integral part of Android. Google Play Services acts as a shim between the normal apps and the installed Android OS, allowing Google to update or replace some core components and add APIs without having to ship out a new Android version. - -With Play Services, Google had a direct line to the core of an Android phone without having to go through OEM updates and carrier approval processes. Google used Play Services to add an entirely new location system, a malware scanner, remote wipe capabilities, and new Google Maps APIs, all without shipping an OS update. Like we mentioned at the end of the Gingerbread section, thanks to all the "portable" APIs implemented in Play Services, Gingerbread can still download a modern version of the Play Store and many other Google Apps. - -The other big benefit was compatibility with Android's user base. The newest release of an Android OS can take a very long time to get out to the majority of users, which means APIs that get tied to the latest version of the OS won't be any good to developers until the majority of the user base upgrades. Google Play Services is compatible with Froyo and above, which is 99 percent of active devices, and the updates pushed directly to phones through the Play Store. By including APIs in Google Play Services instead of Android, Google can push a new API out to almost all users in about a week. It's [a great solution][3] to many of the problems caused by version fragmentation. - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work. - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/21/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://arstechnica.com/gadgets/2012/04/unlocked-samsung-galaxy-nexus-can-now-be-purchased-from-google/ -[2]:http://arstechnica.com/gadgets/2012/07/divine-intervention-googles-nexus-7-is-a-fantastic-200-tablet/ -[3]:http://arstechnica.com/gadgets/2013/09/balky-carriers-and-slow-oems-step-aside-google-is-defragging-android/ -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo \ No newline at end of file diff --git a/sources/talk/The history of Android/22 - The history of Android.md b/sources/talk/The history of Android/22 - The history of Android.md deleted file mode 100644 index 79cf7bd2a5..0000000000 --- a/sources/talk/The history of Android/22 - The history of Android.md +++ /dev/null @@ -1,84 +0,0 @@ -The history of Android -================================================================================ -### Android 4.2, Jelly Bean—new Nexus devices, new tablet interface ### - -The Android Platform was rapidly maturing, and with Google hosting more and more apps in the Play Store, there was less and less that needed to go out in the OS update. Still, the relentless march of updates must continue, and in November 2012 Android 4.2 was released. 4.2 was still called "Jelly Bean," a nod to the relatively small amount of changes that were present in this release. - -![The LG-made Nexus 4 and Samsung-made Nexus 10.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/unnamed.jpg) -The LG-made Nexus 4 and Samsung-made Nexus 10. -Photo by Google/Ron Amadeo - -Along with Android 4.2 came two flagship devices, the Nexus 4 and the Nexus 10, both of which were sold direct by Google on the Play Store. The Nexus 4 applied the Nexus 7 strategy of a quality device at a shockingly low price and sold for $300 unlocked. The Nexus 4 had a quad-core 1.5 GHz Snapdragon S4 Pro, 2GB of RAM and a 4.7-inch 1280×768 LCD. Google's new flagship phone was manufactured by LG, and with the manufacturer switch came a focus on materials and build quality. The Nexus 4 had a glass front and back, and while you couldn't drop it, it was one of the nicest-feeling Android phones to date. The biggest downside to the Nexus 4 was the lack of LTE at a time when most phones, including the Verizon Galaxy Nexus, came with the faster modem. Still, demand for the Nexus 4 greatly exceeded Google's expectations—the launch rush crashed the Play Store Web site on launch day. The device sold out in under an hour. - -The Nexus 10 was Google's first 10-inch Nexus tablet. The highlight of the device was the 2560×1600 display, which was the highest resolution in its class. All those pixels were powered by a dual core, 1.7GHz Cortex A15 processor and 2GB of RAM. With each passing month, it's looking more and more like the Nexus 10 is the first and last 10-inch Nexus tablet. Usually these devices are upgraded every year, but the Nexus 10 is now 16 months old, and there's no sign of the new model on the horizon. Google is doing well with smaller-sized 7-inch tablets, and it seems content to let partners [like Samsung][1] explore the larger end of the tablet spectrum. - -![The new lock screen, wallpaper, and clock widget design.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/JBvsjb.jpg) -The new lock screen, wallpaper, and clock widget design. -Photo by Ron Amadeo - -4.2 brought lots of changes to the lock screen. The font was centered and used an extremely thick weight for the hour and a thin font for the minutes. The lock screen was now paginated and could be customized with widgets. Rather than a simple clock on the lock screen, users could replace it with another widget or add extra pages to the lock screen for more widgets. - -![The lock screen's add widget page, the list of widgets, the Gmail widget on the lock screen, and swiping over to the camera.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/locksc2reen.jpg) -The lock screen's add widget page, the list of widgets, the Gmail widget on the lock screen, and swiping over to the camera. -Photo by Ron Amadeo - -The lock screen now worked like a stripped-down version of the home screen. Page outlines would pop up on the left and right sides of the lock screen to hint to users that they could swipe to other pages with other widgets. Swiping to the left would show a simple blank page with a plus sign in the center, and tapping on it would bring up a list of widgets that were compatible with the lock screen. Lock screens were limited to one widget per page and could be expanded or collapsed by dragging up or down on the widget. The right-most page was reserved for the camera—a simple over would open the camera interface, but you weren't able to swipe back. - -![The new Quick Settings panel and a composite image of the app lineup.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/42fix.png) -The new Quick Settings panel and a composite image of the app lineup. -Photo by Ron Amadeo - -One of the biggest additions to 4.2 was the new "Quick Settings" panel. Android 3.0 brought a way to quickly change power settings to tablets, and 4.2 finally brought that ability to phones. A new icon was added to the top right corner of the notification panel that would switch between the normal list of notifications and the new quick settings screen. Quick Settings offered faster access to screen brightness, network connections, and battery and data usage without having to dig through the full settings screen. The top level settings button in Android 4.1 was removed, and a square was added to the Quick Settings screen for it. - -There were lots of changes to the app drawer and 4.2's lineup of apps and icons. Thanks to the wider aspect ratio of the Nexus 4 (5:3 vs 16:9 on the Galaxy Nexus), the app drawer on that device could now show a five-wide grid of icons. 4.2 replaced the stock browser with Google Chrome and the stock calendar with Google Calendar, both of which brought new icon designs. The Clock and Camera apps were revamped in 4.2, and new icons were part of the deal. "Google Settings" was a new app that offered shortcuts to all the existing Google Account settings around the OS, and it had a unified look with Google Search and the new Google+ icon. Google Maps got a new icon, and Google Latitude, which was part of Google Maps, was retired in favor of Google+ location. - -![The browser was replaced with Chrome, and the new camera interface with a full screen viewfinder.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/chroemcam.jpg) -The browser was replaced with Chrome, and the new camera interface with a full screen viewfinder. -Photo by Ron Amadeo - -The stock browser did its best Chrome imitation for a while—it took many cues from Chrome’s interface, many Chrome features, and was even using Chrome’s javascript engine—but by the time Android 4.2 rolled around, Google deemed the Android version of Chrome ready to replace the imitator. On the surface, it didn't seem like much of a difference; the interface looked different, and early versions of Chrome for Android didn't scroll as smoothly as the stock browser. Under the hood, though, everything was different. Development of Android's main browser was now handled by the Google Chrome team instead of being a side project of the Android team. Android's default browser moved from being a stagnant app tied to Android releases to a Play Store app that was continually updated. Today there is even a beta channel that receives several updates per month. - -The camera interface was redesigned. It was now a completely full-screen app, showing a live view of the camera and places controls on top of it. The layout aesthetic had a lot in common with the [camera design][2] of Android 1.5: minimal controls with a focus on the viewfinder output. The circle of controls in the center appeared when you either held your finger on the screen or pressed the circle icon in the bottom right corner. When holding your finger down, you could slide around to pick the options around the circle, often expanding out into a sub-menu. Releasing over a highlighted item would select it. This was clearly inspired by the Quick Controls in the Android 4.0 browser, but arranging the options in a circle meant your finger was almost always blocking part of the interface. - -![The clock app, which went from a two-screen app to a feature-packed, useful application.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/clock-1.jpg) -The clock app, which went from a two-screen app to a feature-packed, useful application. -Photo by Ron Amadeo - -The clock application was completely revamped, going from a simple two-screen alarm clock to a world clock, alarm, timer, and stopwatch. The clock app design was like nothing Google introduced before, with an ultra-minimal aesthetic and red highlights. It seemed to be an experiment for Google. Even several versions later, this design language seemed to be confined only to this app. - -The clock's time picker was particularly well-designed. It showed a simple number pad, and it would intelligently disable numbers that would result in an invalid time. It was also impossible to set an alarm time without implicitly selecting AM or PM, forever solving the problem of accidentally setting an alarm for 9pm instead of 9am. - -![The new system UI for tablets used a stretched-out phone interface.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/tablet2.jpg) -The new system UI for tablets used a stretched-out phone interface. -Photo by Ron Amadeo - -The most controversial change in Android 4.2 was made to the tablet UI, which switched from a unified single bottom system bar to a two-bar interface with a top status bar and bottom system bar. The new design unified the phone and tablet interfaces, but critics said it was a waste of space to stretch the phone interface to a 10-inch landscape tablet. Since the navigation buttons had the whole bottom bar to themselves now, they were centered, just like the phone interface. - -![Multiple users on a tablet, and the new gesture-driven keyboard.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/2014-03-06-14.55.png) -Multiple users on a tablet, and the new gesture-driven keyboard. -Photo by Ron Amadeo - -On tablets, Android 4.2 brought support for multiple users. In the settings, a "Users" section was added, where you could manage users on a device. Setup was done from within each user account, where Android would keep separate settings, home screens, apps, and app data for each user. - -4.2 also added a new keyboard with swiping abilities. Rather than just tapping each individual letter, users could now keep a finger on the screen the whole time and just slide from letter to letter to type. - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work. - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/22/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://arstechnica.com/gadgets/2014/01/hands-on-with-samsungs-notepro-and-tabpro-new-screen-sizes-and-magazine-ui/ -[2]:http://cdn.arstechnica.net/wp-content/uploads/2013/12/device-2013-12-26-11016071.png -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo \ No newline at end of file diff --git a/sources/talk/The history of Android/23 - The history of Android.md b/sources/talk/The history of Android/23 - The history of Android.md deleted file mode 100644 index e67dff87e6..0000000000 --- a/sources/talk/The history of Android/23 - The history of Android.md +++ /dev/null @@ -1,59 +0,0 @@ -The history of Android -================================================================================ -![Another Play Store redesign! This one is very close to the current design and uses cards that make layout changes a piece of cake.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/get-em-Kirill.jpg) -Another Play Store redesign! This one is very close to the current design and uses cards that make layout changes a piece of cake. -Photo by Ron Amadeo - -### Out-of-cycle updates—who needs a new OS? ### - -In between Android 4.2 and 4.3, Google went on an out-of-cycle update tear and showed just how much Android could be improved without having to fire up the arduous OTA update process. Thanks to the [Google Play Store and Play Services][1], all of these updates were able to be delivered without updating any core system components. - -In April 2013, Google released a major redesign to the Google Play Store. Like most redesigns from here on out, the new Play Store fully adopted the Google Now aesthetic, with white cards on a gray background. The action bar changed color based on the current content section, and since the first screen featured content from all sections of the store, the action bar was a neutral gray. Buttons to navigate to the content sections were now given top billing, and below that was usually a promotional block or rows of recommended apps. - -In April 2013, Google released a major redesign to the Google Play Store. Like most redesigns from here on out, the new Play Store fully adopted the Google Now aesthetic, with white cards on a gray background. The action bar changed color based on the current content section, and since the first screen featured content from all sections of the store, the action bar was a neutral gray. Buttons to navigate to the content sections were now given top billing, and below that was usually a promotional block or rows of recommended apps. - -![The individual content sections are beautifully color-coded.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/content-rainbow.jpg) -The individual content sections are beautifully color-coded. -Photo by Ron Amadeo - -The new Play Store showed off the real power of Google’s card design language, which enabled a fully responsive layout across all screen sizes. One large card could be stuck next to several little cards, larger-screened devices could show more cards, and rather than stretch things in horizontal mode, more cards could just be added to a row. The Play Store content editors were free to play with the layout of the cards, too; a big release that needed to be highlighted could get a larger card. This design would eventually trickle down to the other Google Play content apps, finally resulting in a unified design. - -![Hangouts replaced Google Talk and is now continually developed by the Google+ team.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/talkvhangouts2.jpg) -Hangouts replaced Google Talk and is now continually developed by the Google+ team. -Photo by Ron Amadeo - -Google I/O, the company's annual developer conference, was usually where a new Android version was announced. But at the 2013 edition, Google made just as many improvements without having to update the OS. - -One of the biggest things announced at the show was an update to Google Talk, Google's instant messaging platform. For a long time, Google shipped four text communication apps for Android: Google Talk, Google+ Messenger, Messaging (the SMS app), and Google Voice. Having four apps that accomplished the same task—sending a text message to someone—was very confusing for users. At I/O, Google killed Google Talk and started their messaging product over from scratch, creating [Google Hangouts][2]. While initially it only replaced Google Talk, the plan for Hangouts was to unify all of Google's various messaging apps into a single interface. - -The layout of the Hangouts UI really wasn't drastically different from Google Talk. The main page contained your open conversations, and tapping on one opened a chat page. The design was updated, the chat page now used a card-style display for each paragraph, and the chat list was now a "drawer"-style interface, meaning you could open it with a horizontal swipe. Hangouts had read receipts and a typing status indicator, and group chat was now a primary feature. - -Google+ was the center of Hangouts now, so much so that the full name of the product was actually "Google+ Hangouts." Hangouts was completely integrated with the Google+ desktop site so that video and chats could be made from one to the other. Identity and avatars were pulled from Google+, and tapping on an avatar would open that person's Google+ profile. And much like the change from Browser to Google Chrome, core Android functionality was passed off to a separate team—the Google+ team—as opposed to being a side product of the very busy Android engineers. With the Google+ takeover, Android's main IM client now became a continually developed application. It was placed into the Play Store and received fairly regular updates. - -![The new navigation drawer interface.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/navigation_drawer_overview1.png) -The new navigation drawer interface. -Photo by [developer.android.com][3] - -Google also introduced a new design element for the action bar: the navigation drawer. This drawer was shown as a set of three lines next to the app icon in the top-right corner. By tapping on it or dragging from the edge of the screen to the right, a side-mounted menu would appear. As the name implies, this was used to navigate around the app, and it would show several top-level locations within the app. This allowed the first screen to show content, and it gave users a consistent, easy-to-access place for navigation elements. The nav drawer was basically a super-sized version of the normal menu, scrollable and docked to the right side. - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work. - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/23/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://arstechnica.com/gadgets/2013/09/balky-carriers-and-slow-oems-step-aside-google-is-defragging-android/ -[2]:http://arstechnica.com/information-technology/2013/05/hands-on-with-hangouts-googles-new-text-and-video-chat-architecture/ -[3]:https://developer.android.com/design/patterns/navigation-drawer.html -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo \ No newline at end of file diff --git a/sources/talk/The history of Android/24 - The history of Android.md b/sources/talk/The history of Android/24 - The history of Android.md deleted file mode 100644 index b95ceb29c7..0000000000 --- a/sources/talk/The history of Android/24 - The history of Android.md +++ /dev/null @@ -1,82 +0,0 @@ -The history of Android -================================================================================ -![The slick new Google Play Music app, which changed from Tron to a perfect match for the Play Store.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/Goooogleplaymusic.jpg) -The slick new Google Play Music app, which changed from Tron to a perfect match for the Play Store. -Photo by Ron Amadeo - -Another app update pushed out at I/O was a new Google Music app. The app was completely redesigned, finally doing away with the blue-on-blue design introduced in Honeycomb. Play Music's design was unified with the new Play Store released a few months earlier, with a responsive white card layout. Music was also one of the first major apps to take advantage of the new navigation drawer style. Along with the new app, Google launched Google Play Music All Access, an all-you-can-eat subscription service for $10 a month. Google Music now had a subscription plan, à la carte purchasing, and a cloud music locker. This version also introduced "Instant Mix," a mode where Google would cloud-compute a playlist of similar songs. - -![A game showing support for Google Play Games. This lineup shows the Play Store game feature descriptions, the permissions box triggered by signing into the game, a Play Games notification, and the achievements screen.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/gooooogleplaygames.jpg) -A game showing support for Google Play Games. This lineup shows the Play Store game feature descriptions, the permissions box triggered by signing into the game, a Play Games notification, and the achievements screen. -Photo by Ron Amadeo - -Google also introduced "Google Play Games," a back-end service that developers could plug into their games. The service was basically an Android version of Xbox Live or Apple's Game Center. Developers could build Play Games support into their game, which would easily let them integrate achievements, leaderboards, multiplayer, matchmaking, user accounts, and cloud saves by using Google's back-end services. - -Play Games was the start of Google's big push into gaming. Just like standalone GPS units, flip phones, and MP3 players, smartphone makers were hoping standalone gaming devices would be turned into nothing more than a smartphone feature bullet point. Why buy a Nintendo DS or PS Vita when you had a smartphone with you? An easy-to-use multiplayer service would be a big part of this, and we've still yet to see the final consequence of this move. Today, Google and Apple are both rumored to be planning living room gaming devices. - -![Google Keep, Google's first note taking service since Google Notebook.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/goooglekeep.jpg) -Google Keep, Google's first note taking service since Google Notebook. -Photo by Ron Amadeo - -It was clear some products were developed in time for presentation at Google I/O, [but the three-and-a-half hour keynote][1] was already so massive, some things were cut from being announced. Once the smoke cleared three days after Google I/O, Google introduced Google Keep, a note taking app for Android and the Web. Keep was a fairly straightforward affair, applying the responsive Google Now-style design to a note taking app. Users could change the size of the cards from a multi-column layout to a single column view. Notes could consist of plain text, checklists, voice note with automatic transcription, or pictures. Note cards could be dragged around and rearranged on the main screen, and you could even assign a color to a note. - -![Gmail 4.5, which switched to the new navigation drawer design and merged the action bars, thanks to some clever button elimination.](http://cdn.arstechnica.net/wp-content/uploads/2014/05/gmail.png) -Gmail 4.5, which switched to the new navigation drawer design and merged the action bars, thanks to some clever button elimination. -Photo by Ron Amadeo - -After I/O, not much was safe from Google's out-of-cycle updating. In June 2013, Google released a redesigned version of Gmail. The headline feature of the new design was the new navigation drawer interface that was introduced a month earlier at Google I/O. The most eye catching change was the addition of Google+ profile pictures instead of checkboxes. While the checkboxes were visibly removed, they were still there, just tap on a picture. - -![The new Google Maps, which switched to an all-white Google Now-style theme.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/newmaps11.png.) -The new Google Maps, which switched to an all-white Google Now-style theme. -Photo by Ron Amadeo - -One month later, Google released a completely overhauled version of Google Maps to the Play Store. It was the first ground-up redesign of Google Maps since Ice Cream Sandwich. The new version fully adopted the Google Now white card aesthetic, and it greatly reduced the amount of stuff on the screen. The new Google Maps seemed to have a design mandate to always show a map on the screen somewhere, as you’ll be hard pressed to find something other than the settings that fully covers the map. - -This version of Google Maps seemed to live in its own little design world. The white search bar “floated" above the map, with maps showing on the sides and top of the bar. That didn't really make it seem like the traditional Action Bar design. The navigation drawer, in the top left on every other app, was in the bottom left. There was no up button, app icon, or overflow button on the main screen. - -![The new Google Maps cut a lot of fat and displayed more information on a single screen.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/newmaps21.png) -The new Google Maps cut a lot of fat and displayed more information on a single screen. -Photo by Ron Amadeo - -The left picture shows what popped up when you tapped on the search bar (along with the keyboard, which had been closed). In the past, Google would show an empty page below a blank search bar, but in Maps, Google used that space to link to the new “Local" page. The “blank" search results displayed links to common, browsable results like restaurant listings, gas stations, and attractions. At the bottom of the results page was a list of nearby results from your search history and an option to manually cache parts of the map. - -The right set of images shows location page. The map shown in the top of the Maps 7 screenshot isn’t a thumbnail; that’s the full map view. In the new version of Google Maps, a location was displayed as a card that “floats" overtop of the main map, and the map was repositioned to center on the location. Scrolling up would move the card up and cover the map, and scrolling down would show the whole map with the result reduced to a small strip at the bottom. If the location was part of a list of search results, swiping left and right would move through the results. - -The location pages were redesigned to be much more useful at a glance. On the first page, the new version added critical information, like the location on a map, the review score, and the number of reviews. Since this is a phone, and the software will be dialing for you, the phone number was deemed pointless and was removed. The old version showed the distance to the location in miles, while the new version of Google Maps showed the distance in terms of time, based on traffic and preferred mode of transportation—a much more useful metric. The new version also put a share button front and center, which made coordination over IM or text messaging a lot easier. - -### Android 4.3, Jelly Bean—getting wearable support out early ### - -Android 4.3 would have been an incredible update if Google had done the traditional thing and not released updates between 4.3 and 4.2 through the Play Store. If the new Play Store, Gmail, Maps, Books, Music, Hangouts, Keep, and Play Games were bundled into a big brick as a new version of Android, it would have been hailed as the biggest release ever. Google didn't need to do hold back features anymore though. With very little left that required an OS update, at the end of July 2013, Google released the seemingly insignificant update called "Android 4.3." - -![Android Wear plugging into Android 4.3's Notification access screen.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/2014-03-28-12.231.jpg) -Android Wear plugging into Android 4.3's Notification access screen. -Photo by Ron Amadeo - -Google made no qualms about the low importance of 4.3, calling the newest release "Jelly Bean" (the third one in a row). Android 4.3's feature list read like a laundry list of things Google couldn't update from the Play Store or through Google Play Services, mostly consisting of low-level framework changes for developers. - -Many of the additions seemed to fit a singular purpose, though—Android 4.3 was Google's trojan horse for wearable computing support. 4.3 added support for Bluetooth Low Energy, a way to wirelessly connect Android to another device and pass data back and forth while using a very small amount of power—an integral feature to a wearable device. Android 4.3 also added a "Notification Access" API, which allowed apps to completely replicate and control the notification panel. Apps could display notification text and pictures and interact with the notification the same way users do—namely pressing action buttons and dismissing notifications. Doing this from an on-board app when you have the notification panel is useless, but on a device that is separate from your phone, replicating the information in the notification panel becomes much more useful. One of the few apps that plugged into this was "Android Wear Preview," which used the notification API to power most of the interface for Android Wear. - -The "4.3 is for wearables" theory explained the relatively low number of features in 4.3: it was pushed out the door to give OEMs time to update devices in time for the launch of [Android Wear][2]. The plan seems to have worked. Android Wear requires Android 4.3 and up, which has been out for so long now that most major flagships have updated. - -Android 4.3 was not all that exciting, but Android releases from here on out didn't need to be all that exciting. Everything became so modularized that Google could push updates out as soon as they were done through Google Play, rather than drop everything in one huge brick as an OS update. - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work. - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/24/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://live.arstechnica.com/liveblog-google-io-2013-keynote/ -[2]:http://arstechnica.com/gadgets/2014/03/in-depth-with-android-wear-googles-quantum-leap-of-a-smartwatch-os/ -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo \ No newline at end of file diff --git a/sources/talk/The history of Android/25 - The history of Android.md b/sources/talk/The history of Android/25 - The history of Android.md deleted file mode 100644 index 39eeb55768..0000000000 --- a/sources/talk/The history of Android/25 - The history of Android.md +++ /dev/null @@ -1,70 +0,0 @@ -The history of Android -================================================================================ -![The LG-made Nexus 5, the launch device for KitKat.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/nexus56.jpg) -The LG-made Nexus 5, the launch device for KitKat. - -Android 4.4, KitKat—more polish; less memory usage - -Google got really cute with the launch of Android 4.4. The company [teamed up with Nestlé][1] to name the OS "KitKat," and it launched on Halloween, October 31, 2013. Nestlé produced limited-edition Android-shaped KitKat bars, and KitKat packaging in stores promoted the new OS while offering a chance to win a Nexus 7. - -KitKat launched with a new Nexus device, the Nexus 5. The new flagship had the biggest display yet: a five-inch, 1920x1080 LCD. Despite the bigger screen size, LG—again the manufacturer for the device—was able to fit the Nexus 5 into the same dimensions as a Galaxy Nexus or Nexus 4. - -The Nexus 5 was specced comparatively to the highest-end phones at the time, with a 2.3Ghz Snapdragon 800 processor and 2GB of RAM. The phone was again sold unlocked on the Play Store, but while most phones with specs like this would go for $600-$700, Google sold the Nexus 5 for only $350. - -One of the most important improvements in KitKat was one you couldn't see: significantly lower memory usage. For KitKat, Google started a concerted effort to lower memory usage across the OS and bundled apps called "Project Svelte." After tons of optimization work and a "low memory" mode that disabled expensive graphical effects, Android could now run on as little as 340MB of RAM. Lower memory requirements were a big deal, because devices in the developing world—the biggest growth markets for smartphones—often ran on only 512MB of RAM. Ice Cream Sandwich's more advanced UI significantly raised the system requirements of Android devices, which left many low-end devices—even newly released low-end devices—stuck on Gingerbread. The lower system requirements of KitKat meant to bring these cheap devices back into the fold. With KitKat, Google hoped to finally kill Gingerbread (which, at the time of writing, is around 20 percent of the market). Just in case the lower system requirements weren't enough, there have even been reports that Google will [no longer license][2] the Google apps to Gingerbread devices. - -Besides bringing low-end phones to a modern version of the OS, Project Svelte's lower memory requirements were to be a boon to wearable computers, too. Google Glass [announced][3] it was also switching to the slimmer OS, and [Android Wear][4] ran on KitKat, too. The lower memory requirements in Android 4.4 and the notification API and Bluetooth LE support in 4.3 came together nicely to support wearable computing. - -KitKat also featured a lot of polish to the core OS interfaces that couldn't be updated via the Play Store. The System UI, Dialer, Clock, and Settings all saw updates. - -![KitKat's transparent bars on the Google Now Launcher.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/1homescreenz.png) -KitKat's transparent bars on the Google Now Launcher. -Photo by Ron Amadeo - -KitKat not only got rid of the unpopular lines to the left and right sides of the lock screen—it completely disabled lock screen widgets by default! Google obviously felt multiple lock screens and multiple home screens were a little to complicated for new users, so lock screen widgets now needed to be enabled in the settings. The lopsided time here and in the clock app was switched to a symmetrical weight, which looked a lot nicer. - -In KitKat, apps had the ability to make the system and status bars transparent, which significantly changed the look of the OS. The bars now blended into the wallpaper and any other app that chose to enable transparent bars. The bars could also be completely hidden by any app via a new feature called “immersive" mode. - -KitKat was the final nail in the “Tron" coffin, removing almost all traces of blue from the operating system. The status bar icons were changed from a blue to a neutral white. The status and system bars on the home screen weren’t completely transparent; a dark gradient was added to the top and bottom of the screen so that the white icons would still be visible on a light background. - -![Tweaks to Google Now and the folders.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/nowfolders.png) -Tweaks to Google Now and the folders. -Photo by Ron Amadeo - -The home screen that shipped with KitKat on the Nexus 5 was actually exclusive to the Nexus 5 for a few months, but it could now be on any Nexus device. The new home screen was called the "Google Now Launcher," and it was actually [the Google Search app][5]. Yes, Google Search grew from a simple search box to an entire home screen, and in KitKat, it drew the wallpaper, icons, app drawer, widgets, home screen settings, Google Now, and, of course, the search box. Thanks to Search now running the entire home screen, any time the home screen was open and the screen was on, voice commands could be activated by saying “OK Google." This was pointed out to the user with introductory “Say 'OK Google' text in the search bar, which would fade away after a few uses. - -Google Now was more integrated, too. Besides the usual swipe up from the system bar, Google Now was also the leftmost home screen. The new version brought some design tweaks as well. The Google logo was moved into the search bar, and the whole top area was compacted. A few card designs were cleaned up, and a new set of buttons at the bottom led to reminders, customization options, and an overflow button with settings, feedback, and help. Since Google Now was part of the home screen, it got transparent system and status bars, too. - -Transparency and “brightening up" certain parts of the OS were design themes in KitKat. Black was removed in the status and system bars by switching to transparent, and the black background of the folders was switched to white. - -![A screenshot showing the new, cleaner app screen layout, and a composite image of the app lineup.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/apps.png) -A screenshot showing the new, cleaner app screen layout, and a composite image of the app lineup. -Photo by Ron Amadeo - -The KitKat icon lineup changed significantly from 4.3. To be more dramatic, it was a bloodbath, with Google removing seven icons over the 4.3 loadout. Google Hangouts could handle SMS now, so the Messaging app was removed. Hangouts also took over Google+ Messenger duties, so that app shortcut was cut. Google Currents was removed as a default app, as it would soon be killed—along with Google Play Magazines—in favor of Google Play Newsstand. Google Maps was beaten back into a single icon, which meant Local and Navigation shortcuts were removed. The impossible-to-understand Movie Studio was cut, too—Google must have realized no one wants to edit movies on a phone. Thanks to the home screen “OK Google" hotword detection, the Voice Search icon was rendered redundant and removed. Depressingly, the long abandoned News & Weather app remained. - -There was a new app called “Photos"—really the Google+ app—which took over picture management duties. On the Nexus 5, the Gallery and Google+ Photos were pretty similar, but in newer builds of KitKat present on Google Play Edition devices, the Gallery was completely replaced by Google+ photos. Play Games was an interface for Google’s back-end multiplayer service—a Googly version of Xbox Live or Apple’s Game Center. Google Drive, which existed for years as a Play Store app, was finally made a default app. Google bought Quickoffice back in June 2012, now finally deeming the app acceptable for inclusion by default. While Drive opened Google Documents, Quickoffice opened Microsoft Office Documents. If keeping track, that was two document editing apps and two photo editing apps included on most KitKat loadouts. - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work. - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/25/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://arstechnica.com/gadgets/2013/09/official-the-next-edition-of-android-is-kitkat-version-4-4/ -[2]:http://www.androidpolice.com/2014/02/10/rumor-google-to-begin-forcing-oems-to-certify-android-devices-with-a-recent-os-version-if-they-want-google-apps/ -[3]:http://www.androidpolice.com/2014/03/01/glass-xe14-delayed-until-its-ready-promises-big-changes-and-a-move-to-kitkat/ -[4]:http://arstechnica.com/gadgets/2014/03/in-depth-with-android-wear-googles-quantum-leap-of-a-smartwatch-os/ -[5]:http://arstechnica.com/gadgets/2013/11/google-just-pulled-a-facebook-home-kitkats-primary-interface-is-google-search/ -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo \ No newline at end of file diff --git a/sources/talk/The history of Android/26 - The history of Android.md b/sources/talk/The history of Android/26 - The history of Android.md deleted file mode 100644 index 3f9e1427ba..0000000000 --- a/sources/talk/The history of Android/26 - The history of Android.md +++ /dev/null @@ -1,87 +0,0 @@ -The history of Android -================================================================================ -![The new "add to home screen" interface was definitely inspired by Honeycomb.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/homesetupthrowback.png) -The new "add to home screen" interface was definitely inspired by Honeycomb. -Photo by Ron Amadeo - -KitKat added a nice throwback to Honeycomb with the home screen configuration screen. On the massive 10-inch screen of a Honeycomb tablet (right picture, above), long pressing on the home screen background would present you with a zoomed-out view of all your home screens. Widgets could be dragged from the bottom widget drawer into any home screen—it was very handy. When it came time to bring the Honeycomb interface to phones, from Android 4.0 all the way to 4.3, Google skipped this design and left it to the larger screened devices, presenting only a list of options after a long press (center picture). - -For KitKat though, Google finally came up with a solution. After a long press, 4.4 presented a slightly zoomed out view—you could see the current home screen and the screens to the left and right of it. Tapping on the “widgets" button would open a full screen list of widget thumbnails, but after long-pressing on a widget, you were thrown back into the zoomed-out view and could scroll through home screen pages and place the icon where you wanted. By dragging an icon or widget all the way past the rightmost home page, you could create a new home page. - -![Contacts and the Keyboard both removed any trace of blue.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/RIP33B5E5.png) -Contacts and the Keyboard both removed any trace of blue. -Photo by Ron Amadeo - -KitKat was the end of the line for the Tron design. In most parts of the OS, any remaining blue highlights were removed in favor of gray. In the People app, blue was sucked out of the header and the letter separators in the contact list. The pictures swapped sides and the bottom bar was changed to a light gray to match the top. The Keyboard, which injected the color blue into nearly every app, was changed to gray-on-gray-on-gray. That wasn't a bad thing. Apps should be allowed to have their own color scheme—forcing a potentially clashing color on them via the keyboard wasn’t good design. - -![The first three screenshots show KitKat's dialer, and the last one is 4.3.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/phone.png) -The first three screenshots show KitKat's dialer, and the last one is 4.3. -Photo by Ron Amadeo - -Google completely revamped the dialer in KitKat, creating a wild new design that changed the way users thought about a phone. Actual numbers in the new dialer were hidden as much as possible—there wasn’t even a dial pad on the main screen. The primary interface for making a phone call was now a search bar! If you wanted to call someone in your contacts, just type their name in; if you wanted to call a business, just type the business name in and the dialer would search through Google Maps’ extensive database of phone numbers. It worked incredibly well and was something only Google could pull off. - -If searching for numbers wasn’t your thing, the app also intelligently displayed a listing for the previous phone call, your most-contacted people, and a link to all contacts. At the bottom were links to your call history, the now old school number pad, and the usual overflow button containing a settings page. - -![Office stuff: Google Drive, which was now packed in, and the printing support.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/googledrive-and-printing.png) -Office stuff: Google Drive, which was now packed in, and the printing support. -Photo by Ron Amadeo - -It was amazing it took this long, but in KitKat, Google Drive was finally included as a default app. Drive allowed users to create and edit Google Docs spreadsheets and documents, scan documents with the camera and upload them as PDFs, or view (but not edit) presentations. Drive, by this point, had a great, modern design with a slide-out navigation drawer and a Google Now-style card design. - -For even more mobile office fun, KitKat included an OS-level printing framework. At the bottom of the settings was a "Printing" screen, and any printer OEM could make a plugin for it. Google Cloud Print was, of course, one of the first supporters. Once your printer was hooked up to Cloud Print, either natively or through a computer with Chrome installed, you could print to it over the Internet. Apps needed to support the printing framework, too. Pressing the little "i" button on Google Drive would show information about the document and give you the option to print it. Just like a desktop OS, a print dialog would pop up with settings like copies, paper size, and page selection. - -![The "Photos" section of the Google+ app, which replaced the Gallery.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/that-is-one-dead-gallery.png) -The "Photos" section of the Google+ app, which replaced the Gallery. -Photo by Ron Amadeo - -Google+ Photos and the Gallery initially shipped together on the Nexus 5, but in a later build of KitKat on Google Play devices, the Gallery was axed and Google+ completely took over photo duties. The new app changed the photo app from a light theme to a dark theme, and Google+ Photos brought a modern navigation drawer design. - -Android had long included an instant upload feature, which would automatically backup all pictures on Google’s cloud storage, first on Picasa and later on Google+. The big benefit of G+ Photos over the Gallery was that it could finally manage those cloud-stored photos. Little cloud icons in the lower right of a photo indicated backup status, and it would fill from right to left to indicate an upload-in-progress. G+ photos brought its own photo editor along with support for a million of other Google+ photo features, like highlights, auto awesome, and, of course, sharing to Google+. - -![Tweaks to the Clock app, which added an alarms tab and changed the time input dialog.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/clocks.png) -Tweaks to the Clock app, which added an alarms tab and changed the time input dialog. -Photo by Ron Amadeo - -Google changed the excellent time picker that was introduced in 4.2 to this strange clock interface, which was both slower and less precise than the old interface. First you were presented with a one-handed clock which you used to choose the hour, then that clock went away and another one-handed clock allowed you to choose the minute. Having to spin the minute hand or tap a spot on the clock face made it very difficult to pick times in non-five-minute increments. Unlike the old time picker, which required you to pick a time period, this just defaulted to AM (again making it possible to accidentally be off by 12 hours). - -### Today—Android everywhere ### - -![](http://cdn.arstechnica.net/wp-content/uploads/2014/05/android-everywhere2.png) -Photo by Google/Sony/Motorola/Ron Amadeo - -What started out as a curious BlackBerry clone from a search engine company became the most popular OS in the world from one of the biggest titans in the tech industry. Android has become Google's de-facto consumer operating system, and it powers phones, tablets, Google Glass, Google TV, and more. [Parts of it][1] are even used in the Chromecast. In the future, Google will be bringing Android to watches and wearables with [Android Wear][2], and the [Open Automotive Alliance][3] will be bringing Android to cars. Google will be making a renewed commitment to the living room soon, too, with [Android TV][4]. The OS is such a core pillar of Google, that events that are supposed to cover company-wide products, like Google I/O, end up becoming Android launch parties. - -![Top row: the Google Play content stores. Bottom row: the Google Play Apps.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/2014-03-30-03.08.jpg) -Top row: the Google Play content stores. Bottom row: the Google Play Apps. -Photo by Ron Amadeo - -What was once the ugly duckling of the mobile industry has transformed so much it now [wins design awards][5] for its user interface. The design of things like Google Now have affected everything the company produces, with even the desktop sites like Search, Google+, YouTube, and Maps getting in on the card design unity. The design keeps evolving as well. Google's next plan is to [unify design][6] across not just Android, but all of its products. The goal is to take something like Gmail and make it feel the same, whether you're using it on Android, a desktop browser, or a watch. - -Google outsourced so many pieces of Android to the Play Store, that version releases are becoming less and less necessary. Google decided the best way to beat carrier and OEM update issues was to sidestep those roadblocks completely. From here on out, there isn't much left to include in an Android update other than core under-the-hood changes—but even many APIs have been pushed to Google Play Services. If you just look at version releases, it seems like Android development has slowed down from the peak 2.5-month release cycle. But the reality is Google can now continually push out improvements to the Play Store in a never-ending, somewhat subtler stream of updates. - -With 1.5 million activations per day, Android has no where to go but up. In the future, Android will be headed from phones and tablets to cars and watches, and the lower system requirements of KitKat will drive phones to even lower prices in the developing world. The bottom line? More and more people will get online. And for many of those people, Android will be not just their phone but their primary computing device. With Android leading the charge for Google in so many areas, the OS that started off as a tiny acquisition has become one of Google's most important products. - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work. - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/26/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://blog.gtvhacker.com/2013/chromecast-exploiting-the-newest-device-by-google/ -[2]:http://arstechnica.com/gadgets/2014/03/in-depth-with-android-wear-googles-quantum-leap-of-a-smartwatch-os/ -[3]:http://arstechnica.com/information-technology/2014/01/open-automotive-alliance-aims-to-bring-android-inside-the-car/ -[4]:http://arstechnica.com/gadgets/2014/04/documents-point-to-android-tv-googles-latest-bid-for-the-living-room/ -[5]:http://userexperienceawards.com/uxa2012/ -[6]:http://arstechnica.com/gadgets/2014/04/googles-next-design-challenge-unify-app-design-across-platforms/ -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo \ No newline at end of file diff --git a/sources/talk/my-open-source-story/20160301 Linux gives me all the tools I need.md b/sources/talk/my-open-source-story/20160301 Linux gives me all the tools I need.md new file mode 100644 index 0000000000..b1689f4164 --- /dev/null +++ b/sources/talk/my-open-source-story/20160301 Linux gives me all the tools I need.md @@ -0,0 +1,56 @@ +Linux gives me all the tools I need +========================================== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/OPENHERE_blue.png?itok=3eqp-7gT) + +[Linux][0] is all around us. It's [on our phones][1] in the form of Android. It's [used on the International Space Station][2]. It [provides much of the backbone of the Internet][3]. And yet many people never notice it. Discovering Linux is a rewarding endeavor. Lots of other people have [shared their Linux stories][4] on Opensource.com, and now it's my turn. + +I still remember when I first discovered Linux in 2008. The person who helped me discover Linux was my father, Socrates Ballais. He was an economics professor here in Tacloban City, Philippines. He was also a technology enthusiast. He taught me a lot about computers and technology, but only advocated using Linux as a fallback operating system in case Windows fails. + +### My earliest days + +Before we had a computer in the home, I was a Windows user. I played games, created documents, and did all the other things kids do with computers. I didn't know what Linux was or what it was used for. The Windows logo was my symbol for a computer. + +When we got our first computer, my father installed Linux ([Ubuntu][5] 8.04) on it. Being the curious kid I was, I booted into the operating system. I was astonished with the interface. It was beautiful. I found it to be very user friendly. For some time, all I did in Ubuntu was play the bundled games. I would do my school work in Windows. + +### The first install + +Four years later, I decided that I would reinstall Windows on our family computer. Without hesitation, I also decided to install Ubuntu. With that, I had fallen in love with Linux (again). Over time, I became more adept with Ubuntu and would casually advocate its use to my friends. When I got my first laptop, I installed it right away. + +### Today + +Today, Linux is my go-to operating system. When I need to do something on a computer, I do it in Linux. For documents and presentations, I use Microsoft Office via [Wine][6]. For my web needs, there's [Chrome and Firefox][7]. For email, there's [Geary][8]. You can do pretty much everything with Linux. + +Most, if not all, of my programming work is done in Linux. The lack of a standard Integrated Development Environment (IDE) like [Visual Studio][9] or [XCode][10] taught me to be flexible and learn more things as a programmer. Now a text editor and a compiler/interpreter are all I need to start coding. I only use an IDE in cases when it's the best tool for accomplishing a task at hand. I find Linux to be more developer-friendly than Windows. To generalize, Linux gives me all the tools I need to develop software. + +Today, I am the co-founder and CTO of a startup called [Creatomiv Studios][11]. I use Linux to develop code for the backend server of our latest project, Basyang. I'm also an amateur photographer, and use [GIMP][12] and [Darktable][13] to edit and manage photos. For communication with my team, I use [Telegram][14]. + +### The beauty of Linux + +Many may see Linux as an operating system only for those who love solving complicated problems and working on the command line. Others may see it as a rubbish operating system lacking the support of many companies. However, I see Linux as a thing of beauty and a tool for creation. I love Linux the way it is and hope to see it continue to grow. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/16/3/my-linux-story-sean-ballais + +作者:[Sean Francis N. Ballais][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +[a]: https://opensource.com/users/seanballais +[0]: https://opensource.com/resources/what-is-linux +[1]: http://www.howtogeek.com/189036/android-is-based-on-linux-but-what-does-that-mean/ +[2]: http://www.extremetech.com/extreme/155392-international-space-station-switches-from-windows-to-linux-for-improved-reliability +[3]: https://www.youtube.com/watch?v=JzsLkbwi1LA +[4]: https://opensource.com/tags/my-linux-story +[5]: http://ubuntu.com/ +[6]: https://www.winehq.org/ +[7]: https://www.google.com/chrome/browser/desktop/index.html +[8]: https://wiki.gnome.org/Apps/Geary +[9]: https://www.visualstudio.com/en-us/visual-studio-homepage-vs.aspx +[10]: https://developer.apple.com/xcode/ +[11]: https://www.facebook.com/CreatomivStudios/ +[12]: https://www.gimp.org/ +[13]: http://www.darktable.org/ +[14]: https://telegram.org/ diff --git a/sources/talk/my-open-source-story/20160316 Growing a career alongside Linux.md b/sources/talk/my-open-source-story/20160316 Growing a career alongside Linux.md new file mode 100644 index 0000000000..24799508c3 --- /dev/null +++ b/sources/talk/my-open-source-story/20160316 Growing a career alongside Linux.md @@ -0,0 +1,49 @@ +Growing a career alongside Linux +================================== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/OPENHERE_blue.png?itok=3eqp-7gT) + +My Linux story started in 1998 and continues today. Back then, I worked for The Gap managing thousands of desktops running [OS/2][1] (and a few years later, [Warp 3.0][2]). As an OS/2 guy, I was really happy then. The desktops hummed along and it was quite easy to support thousands of users with the tools the GAP had built. Changes were coming, though. + +In November of 1998, I received an invitation to join a brand new startup which would focus on Linux in the enterprise. This startup became quite famous as [Linuxcare][2]. + +### My time at Linuxcare + +I had played with Linux a bit, but had never considered delivering it to enterprise customers. Mere months later (which is a turn of the corner in startup time and space), I was managing a line of business that let enterprises get their hardware, software, and even books certified on a few flavors of Linux that were popular back then. + +I supported customers like IBM, Dell, and HP in ensuring their hardware ran Linux successfully. You hear a lot now about preloading Linux on hardware today, but way back then I was invited to Dell to discuss getting a laptop certified to run Linux for an upcoming trade show. Very exciting times! We also supported IBM and HP on a number of certification efforts that spanned a few years. + +Linux was changing fast, much like it always has. It gained hardware support for more key devices like sound, network, graphics. At around that time, I shifted from RPM-based systems to [Debian][3] for my personal use. + +### Using Linux through the years + +Fast forward some years and I worked at a number of companies that did Linux as hardened appliances, Linux as custom software, and Linux in the data center. By the mid 2000s, I was busy doing consulting for that rather large software company in Redmond around some analysis and verification of Linux compared to their own solutions. My personal use had not changed though—I would still run Debian testing systems on anything I could. + +I really appreciated the flexibility of a distribution that floated and was forever updated. Debian is one of the most fun and well supported distributions and has the best community I've ever been a part of. + +When I look back at my own adoption of Linux, I remember with fondness the numerous Linux Expo trade shows in San Jose, San Francisco, Boston, and New York in the early and mid 2000's. At Linuxcare we always did fun and funky booths, and walking the show floor always resulted in getting re-acquainted with old friends. Rumors of work were always traded, and the entire thing underscored the fun of using Linux in real endeavors. + +The rise of virtualization and cloud has really made the use of Linux even more interesting. When I was with Linuxcare, we partnered with a small 30-person company in Palo Alto. We would drive to their offices and get things ready for a trade show that they would attend with us. Who would have ever known that little startup would become VMware? + +I have so many stories, and there were so many people I was so fortunate to meet and work with. Linux has evolved in so many ways and has become so important. And even with its increasing importance, Linux is still fun to use. I think its openness and the ability to modify it has contributed to a legion of new users, which always astounds me. + +### Today + +I've moved away from doing mainstream Linux things over the past five years. I manage large scale infrastructure projects that include a variety of OSs (both proprietary and open), but my heart has always been with Linux. + +The constant evolution and fun of using Linux has been a driving force for me for over the past 18 years. I started with the 2.0 Linux kernel and have watched it become what it is now. It's a remarkable thing. An organic thing. A cool thing. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/16/3/my-linux-story-michael-perry + +作者:[Michael Perry][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +[a]: https://opensource.com/users/mpmilestogo +[1]: https://en.wikipedia.org/wiki/OS/2 +[2]: https://archive.org/details/IBMOS2Warp3Collection +[3]: https://en.wikipedia.org/wiki/Linuxcare +[4]: https://www.debian.org/ +[5]: diff --git a/sources/talk/my-open-source-story/20160330 After a nasty computer virus sys admin looks to Linux.md b/sources/talk/my-open-source-story/20160330 After a nasty computer virus sys admin looks to Linux.md new file mode 100644 index 0000000000..3fb63afa4f --- /dev/null +++ b/sources/talk/my-open-source-story/20160330 After a nasty computer virus sys admin looks to Linux.md @@ -0,0 +1,54 @@ +After a nasty computer virus, sys admin looks to Linux +======================================================= + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/OPENHERE_blue.png?itok=3eqp-7gT) + +My first brush with open source came while I was working for my university as a part-time system administrator in 2001. I was part of a small group that created business case studies for teaching not just in the university, but elsewhere in academia. + +As the team grew, the need for a robust LAN setup with file serving, intranet applications, domain logons, etc. emerged. Our IT infrastructure consisted mostly of bootstrapped Windows 98 computers that had become too old for the university's IT labs and were reassigned to our department. + +### Discovering Linux + +One day, as part of the university's IT procurement plan, our department received an IBM server. We planned to use it as an Internet gateway, domain controller, file and backup server, and intranet application host. + +Upon unboxing, we noticed that it came with Red Hat Linux CDs. No one on our 22-person team (including me) knew anything about Linux. After a few days of research, I met a friend of a friend who did Linux RTOS programming for a living. I asked him for some help installing it. + +It was heady stuff as I watched the friend load up the CD drive with the first of the installation CDs and boot into the Anaconda install system. In about an hour we had completed the basic installation, but still had no working internet connection. + +Another hour of tinkering got us connected to the Internet, but we still weren't anywhere near domain logons or Internet gateway functionality. After another weekend of tinkering, we were able to instruct our Windows 98 terminals to accept the IP of the the Linux PC as the proxy so that we had a working shared Internet connection. But domain logons were still some time away. + +We downloaded [Samba][1] over our awfully slow phone modem connection and hand configured it to serve as the domain controller. File services were also enabled via NFS Kernel Server and creating user directories and making the necessary adjustments and configurations on Windows 98 in Network Neighborhood. + +This setup ran flawlessly for quite some time, and we eventually decided to get started with Intranet applications for timesheet management and some other things. By this time, I was leaving the organization and had handed over most of the sys admin stuff to someone who replaced me. + +### A second Linux experience + +In 2004, I got into Linux once again. My wife ran an independent staff placement business that used data from services like Monster.com to connect clients with job seekers. + +Being the more computer literate of the two of us, it was my job to set things right with the computer or Internet when things went wrong. We also needed to experiment with a lot of tools for sifting through the mountains of resumes and CVs she had to go through on a daily basis. + +Windows [BSoDs][2] were a routine affair, but that was tolerable as long as the data we paid for was safe. I had to spend a few hours each week creating backups. + +One day, we had a virus that simply would not go away. Little did we know what was happening to the data on the slave disk. When it finally failed, we plugged in the week-old slave backup and it failed a week later. Our second backup simply refused to boot up. It was time for professional help, so we took our PC to a reputable repair shop. After two days, we learned that some malware or virus had wiped certain file types, including our paid data, clean. + +This was a body blow to my wife's business plans and meant lost contracts and delayed invoice payments. I had in the interim travelled abroad on business and purchased my first laptop computer from [Computex 2004][3] in Taiwan. It had Windows XP pre-installed, but I wanted to replace it with Linux. I had read that Linux was ready for the desktop and that [Mandrake Linux][4] was a good choice. My first attempt at installation went without a glitch. Everything worked beautifully. I used [OpenOffice][5] for my writing, presentation, and spreadsheet needs. + +We got new hard drives for our computer and installed Mandrake Linux on them. OpenOffice replaced Microsoft Office. We relied on webmail for mailing needs, and [Mozilla Firefox][6] was a welcome change in November 2004. My wife saw the benefits immediately, as there were no crashes or virus/malware infections. More importantly, we bade goodbye to the frequent crashes that plagued Windows 98 and XP. She continued to use the same distribution. + +I, on the other hand, started playing around with other distributions. I love distro-hopping and trying out new ones every once in a while. I also regularly try and test out web applications like Drupal, Joomla, and WordPress on Apache and NGINX stacks. And now our son, who was born in 2006, grew up on Linux. He's very happy with Tux Paint, Gcompris, and SMPlayer. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/16/3/my-linux-story-soumya-sarkar + +作者:[Soumya Sarkar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +[a]: https://opensource.com/users/ssarkarhyd +[1]: https://www.samba.org/ +[2]: https://en.wikipedia.org/wiki/Blue_Screen_of_Death +[3]: https://en.wikipedia.org/wiki/Computex_Taipei +[4]: https://en.wikipedia.org/wiki/Mandriva_Linux +[5]: http://www.openoffice.org/ +[6]: https://www.mozilla.org/en-US/firefox/new/ diff --git a/sources/talk/my-open-source-story/20160510 Aspiring sys admin works his way up in Linux.md b/sources/talk/my-open-source-story/20160510 Aspiring sys admin works his way up in Linux.md new file mode 100644 index 0000000000..7a2cc8d071 --- /dev/null +++ b/sources/talk/my-open-source-story/20160510 Aspiring sys admin works his way up in Linux.md @@ -0,0 +1,38 @@ +Aspiring sys admin works his way up in Linux +=============================================== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BIZ_workplay.png?itok=uQqFssrf) + +I first saw Linux in action around 2001 at my first job. I was as an account manager for an Austrian automotive industry supplier and shared an office with our IT guy. He was creating a CD burning station (one of those huge things that can burn and print several CDs simultaneously) so that we could create and send CDs of our car parts catalogue to customers. While the burning station was originally designed for Windows, he just could not get it to work. He eventually gave up on Windows and turned to Linux, and it worked flawlessly. + +For me, it was all kind of arcane. Most of the work was done on the command line, which looked like DOS but was much more powerful (even back then, I recognized this). I had been a Mac user since 1993, and a CLI (command line interface) seemed a bit old fashioned to me at the time. + +It was not until years later—I believe around 2009—that I really discovered Linux for myself. By then, I had moved to the Netherlands and found a job working for a retail supplier. It was a small company (about 20 people) where, aside from my normal job as a key account manager, I had involuntarily become the first line of IT support. Whenever something didn't work, people first came to me before calling the expensive external IT consultant. + +One of my colleagues had fallen for a phishing attack and clicked on an .exe file in an email that appeared to be from DHL. (Yes, it does happen.) His computer got completely taken over and he could not do anything. Even a complete reformat wouldn't help, as the virus kept rearing it's ugly head. I only later learned that it probably had written itself to the MBR (Master Boot Record). By this time, the contract with the external IT consultant had been terminated due to cost savings. + +I turned to Ubuntu to get my colleague to work again. And work it did—like a charm. The computer was humming along again, and I got all the important applications to work like they should. In some ways it wasn't the most elegant solution, I'll admit, yet he (and I) liked the speed and stability of the system. + +However, my colleague was so entrenched in the Windows world that he just couldn't get used to the fact that some things were done differently. He just kept complaining. (Sound familiar?) + +While my colleague couldn't bear that things were done differently, I noticed that this was much less of an issue for me as a Mac user. There were more similarities. I was intrigued. So, I installed a dual boot with Ubuntu on my work laptop and found that I got much more work done in less time and it was much easier to get the machine to do what I wanted. Ever since then I've been regularly using several Linux distros, with Ubuntu and Elementary being my personal favorites. + +At the moment, I am unemployed and hence have a lot of time to educate myself. Because I've always had an interest in IT, I am working to get into Linux systems administration. But is awfully hard to get a chance to show your knowledge nowadays because 95% of what I have learned over the years can't be shown on a paper with a stamp on it. Interviews are the place for me to have a conversation about what I know. So, I signed up for Linux certifications that I hope give me the boost I need. + +I have also been contributing to open source for some time. I started by doing translations (English to German) for the xTuple ERP and have since moved on to doing Mozilla "customer service" on Twitter, filing bug reports, etc. I evangelize for free and open software (with varying degrees of success) and financially support several FOSS advocate organizations (DuckDuckGo, bof.nl, EFF, GIMP, LibreCAD, Wikipedia, and many others) whenever I can. I am also currently working to set up a regional privacy cafe. + +Aside from that, I have started working on my first book. It's supposed to be a lighthearted field manual for normal people about computer privacy and security, which I hope to self-publish by the end of the year. (The book will be licensed under Creative Commons.) As for content, you can expect that I will explain in detail why privacy is important and what is wrong with the whole "I have nothing to hide" mentality. But the biggest part will be instructions how to get rid of pesky ad-trackers, encrypting your hard disk and mail, chat OTR, how to use TOR, etc. While it's a manual first, I aim for a tone that is casual and easy to understand spiced up with stories of personal experiences. + +I still love my Macs and will use them whenever I can afford it (mainly because of the great construction), but Linux is always there in a VM and is used for most of my daily work. Nothing fancy here, though: word processing (LibreOffice and Scribus), working on my website and blog (Wordpress and Jekyll), editing some pictures (Shotwell and Gimp), listening to music (Rhythmbox), and pretty much every other task that comes along. + +Whichever way my job hunt turns out, I know that Linux will always be my go-to system. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/16/5/my-linux-story-rene-raggl + +作者:[Rene Raggl][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +[a]: https://opensource.com/users/rraggl diff --git a/sources/talk/yearbook2015/20151208 10 tools for visual effects in Linux with Kdenlive.md b/sources/talk/yearbook2015/20151208 10 tools for visual effects in Linux with Kdenlive.md new file mode 100644 index 0000000000..c017d22de2 --- /dev/null +++ b/sources/talk/yearbook2015/20151208 10 tools for visual effects in Linux with Kdenlive.md @@ -0,0 +1,155 @@ +10 tools for visual effects in Linux with Kdenlive +================================================================================ +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life-uploads/kdenlivetoolssummary.png) +Image credits : Seth Kenlon. [CC BY-SA 4.0.][1] + +[Kdenlive][2] is one of those applications; you can use it daily for a year and wake up one morning only to realize that you still have only grazed the surface of all of its potential. That's why it's nice every once in a while to sit back and look over some of the lesser-used tricks and tools in Kdenlive. Even though something's not used as often as, say, the Spacer or Razor tools, it still may end up being just the right finishing touch on your latest masterpiece. + +Most of the tools I'll discuss here are not officially part of Kdenlive; they are plugins from the [Frei0r][3] package. These are ubiquitous parts of video processing on Linux and Unix, and they usually get installed along with Kdenlive as distributed by most Linux distributions, so they often seem like part of the application. If your install of Kdenlive does not feature some of the tools mentioned here, make sure that you have Frei0r plugins installed. + +Since many of the tools in this article affect the look of an image, here is the base image, without effects or adjustment: + +![](https://opensource.com/sites/default/files/images/life-uploads/before_0.png) + +Still image grabbed from a video by Footage Firm, Inc. [CC BY-SA 4.0.][1] + +Let's get started. + +### 1. Color effect ### + +![](https://opensource.com/sites/default/files/images/life-uploads/coloreffect.png) + +You can find the **Color Effect** filter in **Add Effect > Misc** context menu. As filters go, it's mostly just a preset; the only controls it has are which filter you want to use. + +![](https://opensource.com/sites/default/files/images/life-uploads/coloreffect_ctl_0.png) + +Normally that's the kind of filter I avoid, but I have to be honest: Sometimes a plug-and-play solution is exactly what you want. This filter has a few different settings, but the two that make it worth while (at least for me) are the Sepia and XPro effects. Admittedly, controls to adjust how sepia tone the sepia effect is would be nice, but no matter what, when you need a quick and familiar color effect, this is the filter to throw onto a clip. It's immediate, it's easy, and if your client asks for that look, this does the trick every time. + +### 2. Colorize ### + +![](https://opensource.com/sites/default/files/images/life-uploads/colorize.png) + +The simplicity of the **Colorize** filter in **Add Effect > Misc** is also its strength. In some editing applications, it takes two filters and some compositing to achieve this simple color-wash effect. It's refreshing that in Kdenlive, it's a matter of one filter with three possible controls (only one of which, strictly speaking, is necessary to achieve the look). + +![](https://opensource.com/sites/default/files/images/life-uploads/colorize_ctl.png) + +Its use is intuitive; use the **Hue** slider to set the color. Use the other controls to adjust the luma of the base image as needed. + +This is not a filter I use every day, but for ad spots, bumpers, dreamy sequences, or titles, it's the easiest and quickest path to a commonly needed look. Get a company's color, use it as the colorize effect, slap a logo over the top of the screen, and you've just created a winning corporate intro. + +### 3. Dynamic Text ### + +![](https://opensource.com/sites/default/files/images/life-uploads/dyntext.png) + +For the assistant editor, the Add Effect > Misc > Dynamic **Text** effect is worth the price of Kdenlive. With one mostly pre-set filter, you can add a running timecode burn-in to your project, which is an absolute must-have safety feature when round-tripping your footage through effects and sound. + +The controls look more complex than they actually are. + +![](https://opensource.com/sites/default/files/images/life-uploads/dyntext_ctl.png) + +The font settings are self-explanatory. Placement of the text is controlled by the Horizontal and Vertical Alignment settings; steer clear of the **Size** setting (it controls the size of the "canvas" upon which you are compositing the burn-in, not the size of the burn-in itself). + +The text itself doesn't have to be timecode. From the dropdown menu, you can choose from a list of useful text, including frame count (useful for VFX, since animators work in frames), source frame rate, source dimensions, and more. + +You are not limited to just one choice. The text field in the control panel will take whatever arbitrary text you put into it, so if you want to burn in more information than just timecode and frame rate (such as **Sc 3 - #timecode# - #meta.media.0.stream.frame_rate#**), then have at it. + +### 4. Luminance ### + +![](https://opensource.com/sites/default/files/images/life-uploads/luminance.png) + +The **Add Effect > Misc > Luminance** filter is a no-options filter. Luminance does one thing and it does it well: It drops the chroma values of all pixels in an image so that they are displayed by their luma values. In simpler terms, it's a grayscale filter. + +The nice thing about this filter is that it's quick, easy, efficient, and effective. This filter combines particularly well with other related filters (meaning that yes, I'm cheating and including three filters for one). + +![](https://opensource.com/sites/default/files/images/life-uploads/luminance_ctl.png) + +Combining, in this order, the **RGB Noise** for emulated grain, **Luminance** for grayscale, and **LumaLiftGainGamma** for levels can render a textured image that suggests the classic look and feel of [Kodax Tri-X][4] film. + +### 5. Mask0mate ### + +![](https://opensource.com/sites/default/files/images/life-uploads/mask0mate.png) +Image by Footage Firm, Inc. + +Better known as a four-point garbage mask, the **Add Effect > Alpha Manipulation > Mask0mate** tool is a quick, no-frills way to ditch parts of your frame that you don't need. There isn't much to say about it; it is what it is. + +![](https://opensource.com/sites/default/files/images/life-uploads/mask0mate_ctl.png) + +The confusing thing about the effect is that it does not imply compositing. You can pull in the edges all you want, but you won't see it unless you add the **Composite** transition to reveal what's underneath the clip (even if that's nothing). Also, use the **Invert** function for the filter to act like you think it should act (without it, the controls will probably feel backward to you). + +### 6. Pr0file ### + +![](https://opensource.com/sites/default/files/images/life-uploads/pr0file.png) + +The **Add Effect > Misc > Pr0file** filter is an analytical tool, not something you would actually leave on a clip for final export (unless, of course, you do). Pr0file consists of two components: the Marker, which dictates what area of the image is being analyzed, and the Graph, which displays information about the marked region. + +Set the marker using the **X, Y, Tilt**, and **Length** controls. The graphical readout of all the relevant color channel information is displayed as a graph, superimposed over your image. + +![](https://opensource.com/sites/default/files/images/life-uploads/pr0file_ctl.jpg) + +The readout displays a profile of the colors within the region marked. The result is a sort of hyper-specific vectorscope (or oscilloscope, as the case may be) that can help you zero in on problem areas during color correction, or compare regions while color matching. + +In other editors, the way to get the same information was simply to temporarily scale your image up to the region you want to analyze, look at your readout, and then hit undo to scale back. Both ways work, but the Pr0file filter does feel a little more elegant. + +### 7. Vectorscope ### + +![](https://opensource.com/sites/default/files/images/life-uploads/vectorscope.jpg) + +Kdenlive features an inbuilt vectorscope, available from the **View** menu in the main menu bar. A vectorscope is not a filter, it's just another view the footage in your Project Monitor, specifically a view of the color saturation in the current frame. If you are color correcting an image and you're not sure what colors you need to boost or counteract, looking at the vectorscope can be a huge help. + +There are several different views available. You can render the vectorscope in traditional green monochrome (like the hardware vectorscopes you'd find in a broadcast control room), or a chromatic view (my personal preference), or subtracted from a color-wheel background, and more. + +The vectorscope reads the entire frame, so unlike the Pr0file filter, you are not just getting a reading of one area in the frame. The result is a consolidated view of what colors are most prominent within a frame. Technically, the same sort of information can be intuited by several trial-and-error passes with color correction, or you can just leave your vectorscope open and watch the colors float along the color wheel and make adjustments accordingly. + +Aside from how you want the vectorscope to look, there are no controls for this tool. It is a readout only. + +### 8. Vertigo ### + +![](https://opensource.com/sites/default/files/images/life-uploads/vertigo.jpg) + +There's no way around it; **Add Effect > Misc > Vertigo** is a gimmicky special effect filter. So unless you're remaking [Fear and Loathing][5] or the movie adaptation of [Dead Island][6], you probably aren't going to use it that much; however, it's one of those high-quality filters that does the exact trick you want when you happen to be looking for it. + +The controls are simple. You can adjust how distorted the image becomes and the rate at which it distorts. The overall effect is probably more drunk or vision-quest than vertigo, but it's good. + +![](https://opensource.com/sites/default/files/images/life-uploads/vertigo_ctl.png) + +### 9. Vignette ### + +![](https://opensource.com/sites/default/files/images/life-uploads/vignette.jpg) + +Another beautiful effect, the **Add Effect > Misc > Vignette** darkens the outer edges of the frame to provide a sort of portrait, soft-focus nouveau look. Combined with the Color Effect or the Luminance faux Tri-X trick, this can be a powerful and emotional look. + +The softness of the border and the aspect ratio of the iris can be adjusted. The **Clear Center Size** attribute controls the size of the clear area, which has the effect of adjusting the intensity of the vignette effect. + +![](https://opensource.com/sites/default/files/images/life-uploads/vignette_ctl.png) + +### 10. Volume ### + +![](https://opensource.com/sites/default/files/images/life-uploads/vol.jpg) + +I don't believe in mixing sound within the video editing application, but I do acknowledge that sometimes it's just necessary for a quick fix or, sometimes, even for a tight production schedule. And that's when the **Audio correction > Volume (Keyframable)** effect comes in handy. + +The control panel is clunky, and no one really wants to adjust volume that way, so the effect is best when used directly in the timeline. To create a volume change, double-click the volume line over the audio clip, and then click and drag to adjust. It's that simple. + +Should you use it? Not really. Sound mixing should be done in a sound mixing application. Will you use it? Absolutely. At some point, you'll get audio that is too loud to play as you edit, or you'll be up against a deadline without a sound engineer in sight. Use it judiciously, watch your levels, and get the show finished. + +### Everything else ### + +This has been 10 (OK, 13 or 14) effects and tools that Kdenlive has quietly lying around to help your edits become great. Obviously there's a lot more to Kdenlive than just these little tricks. Some are obvious, some are cliché, some are obtuse, but they're all in your toolkit. Get to know them, explore your options, and you might be surprised what a few cheap tricks will get you. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/15/12/10-kdenlive-tools + +作者:[Seth Kenlon][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/seth +[1]:https://creativecommons.org/licenses/by-sa/4.0/ +[2]:https://kdenlive.org/ +[3]:http://frei0r.dyne.org/ +[4]:http://www.kodak.com/global/en/professional/products/films/bw/triX2.jhtml +[5]:https://en.wikipedia.org/wiki/Fear_and_Loathing_in_Las_Vegas_(film) +[6]:https://en.wikipedia.org/wiki/Dead_Island diff --git a/sources/tech/20150202 How to filter BGP routes in Quagga BGP router.md b/sources/tech/20150202 How to filter BGP routes in Quagga BGP router.md deleted file mode 100644 index f227e0c506..0000000000 --- a/sources/tech/20150202 How to filter BGP routes in Quagga BGP router.md +++ /dev/null @@ -1,202 +0,0 @@ -[bazz222] -How to filter BGP routes in Quagga BGP router -================================================================================ -In the [previous tutorial][1], we demonstrated how to turn a CentOS box into a BGP router using Quagga. We also covered basic BGP peering and prefix exchange setup. In this tutorial, we will focus on how we can control incoming and outgoing BGP prefixes by using **prefix-list** and **route-map**. - -As described in earlier tutorials, BGP routing decisions are made based on the prefixes received/advertised. To ensure error-free routing, it is recommended that you use some sort of filtering mechanism to control these incoming and outgoing prefixes. For example, if one of your BGP neighbors starts advertising prefixes which do not belong to them, and you accept such bogus prefixes by mistake, your traffic can be sent to that wrong neighbor, and end up going nowhere (so-called "getting blackholed"). To make sure that such prefixes are not received or advertised to any neighbor, you can use prefix-list and route-map. The former is a prefix-based filtering mechanism, while the latter is a more general prefix-based policy mechanism used to fine-tune actions. - -We will show you how to use prefix-list and route-map in Quagga. - -### Topology and Requirement ### - -In this tutorial, we assume the following topology. - -![](https://farm8.staticflickr.com/7394/16407625405_4f7d24d1f6_c.jpg) - -Service provider A has already established an eBGP peering with service provider B, and they are exchanging routing information between them. The AS and prefix details are as stated below. - -- **Peering block**: 192.168.1.0/24 -- **Service provider A**: AS 100, prefix 10.10.0.0/16 -- **Service provider B**: AS 200, prefix 10.20.0.0/16 - -In this scenario, service provider B wants to receive only prefixes 10.10.10.0/23, 10.10.10.0/24 and 10.10.11.0/24 from provider A. - -### Quagga Installation and BGP Peering ### - -In the [previous tutorial][1], we have already covered the method of installing Quagga and setting up BGP peering. So we will not go through the details here. Nonetheless, I am providing a summary of BGP configuration and prefix advertisements: - -![](https://farm8.staticflickr.com/7428/16219986668_97cb193b15_c.jpg) - -The above output indicates that the BGP peering is up. Router-A is advertising multiple prefixes towards router-B. Router-B, on the other hand, is advertising a single prefix 10.20.0.0/16 to router-A. Both routers are receiving the prefixes without any problems. - -### Creating Prefix-List ### - -In a router, a prefix can be blocked with either an ACL or prefix-list. Using prefix-list is often preferred to ACLs since prefix-list is less processor intensive than ACLs. Also, prefix-list is easier to create and maintain. - - ip prefix-list DEMO-PRFX permit 192.168.0.0/23 - -The above command creates prefix-list called 'DEMO-FRFX' that allows only 192.168.0.0/23. - -Another great feature of prefix-list is that we can specify a range of subnet mask(s). Take a look at the following example: - - ip prefix-list DEMO-PRFX permit 192.168.0.0/23 le 24 - -The above command creates prefix-list called 'DEMO-PRFX' that permits prefixes between 192.168.0.0/23 and /24, which are 192.168.0.0/23, 192.168.0.0/24 and 192.168.1.0/24. The 'le' operator means less than or equal to. You can also use 'ge' operator for greater than or equal to. - -A single prefix-list statement can have multiple permit/deny actions. Each statement is assigned a sequence number which can be determined automatically or specified manually. - -Multiple prefix-list statements are parsed one by one in the increasing order of sequence numbers. When configuring prefix-list, we should keep in mind that there is always an **implicit deny** at the end of all prefix-list statements. This means that anything that is not explicitly allowed will be denied. - -To allow everything, we can use the following prefix-list statement which allows any prefix starting from 0.0.0.0/0 up to anything with subnet mask /32. - - ip prefix-list DEMO-PRFX permit 0.0.0.0/0 le 32 - -Now that we know how to create prefix-list statements, we will create prefix-list called 'PRFX-LST' that will allow prefixes required in our scenario. - - router-b# conf t - router-b(config)# ip prefix-list PRFX-LST permit 10.10.10.0/23 le 24 - -### Creating Route-Map ### - -Besides prefix-list and ACLs, there is yet another mechanism called route-map, which can control prefixes in a BGP router. In fact, route-map can fine-tune possible actions more flexibly on the prefixes matched with an ACL or prefix-list. - -Similar to prefix-list, a route-map statement specifies permit or deny action, followed by a sequence number. Each route-map statement can have multiple permit/deny actions with it. For example: - - route-map DEMO-RMAP permit 10 - -The above statement creates route-map called 'DEMO-RMAP', and adds permit action with sequence 10. Now we will use match command under sequence 10. - - router-a(config-route-map)# match (press ? in the keyboard) - ----------- - - as-path Match BGP AS path list - community Match BGP community list - extcommunity Match BGP/VPN extended community list - interface match first hop interface of route - ip IP information - ipv6 IPv6 information - metric Match metric of route - origin BGP origin code - peer Match peer address - probability Match portion of routes defined by percentage value - tag Match tag of route - -As we can see, route-map can match many attributes. We will match a prefix in this tutorial. - - route-map DEMO-RMAP permit 10 - match ip address prefix-list DEMO-PRFX - -The match command will match the IP addresses permitted by the prefix-list 'DEMO-PRFX' created earlier (i.e., prefixes 192.168.0.0/23, 192.168.0.0/24 and 192.168.1.0/24). - -Next, we can modify the attributes by using the set command. The following example shows possible use cases of set. - - route-map DEMO-RMAP permit 10 - match ip address prefix-list DEMO-PRFX - set (press ? in keyboard) - ----------- - - aggregator BGP aggregator attribute - as-path Transform BGP AS-path attribute - atomic-aggregate BGP atomic aggregate attribute - comm-list set BGP community list (for deletion) - community BGP community attribute - extcommunity BGP extended community attribute - forwarding-address Forwarding Address - ip IP information - ipv6 IPv6 information - local-preference BGP local preference path attribute - metric Metric value for destination routing protocol - metric-type Type of metric - origin BGP origin code - originator-id BGP originator ID attribute - src src address for route - tag Tag value for routing protocol - vpnv4 VPNv4 information - weight BGP weight for routing table - -As we can see, the set command can be used to change many attributes. For a demonstration purpose, we will set BGP local preference. - - route-map DEMO-RMAP permit 10 - match ip address prefix-list DEMO-PRFX - set local-preference 500 - -Just like prefix-list, there is an implicit deny at the end of all route-map statements. So we will add another permit statement in sequence number 20 to permit everything. - - route-map DEMO-RMAP permit 10 - match ip address prefix-list DEMO-PRFX - set local-preference 500 - ! - route-map DEMO-RMAP permit 20 - -The sequence number 20 does not have a specific match command, so it will, by default, match everything. Since the decision is permit, everything will be permitted by this route-map statement. - -If you recall, our requirement is to only allow/deny some prefixes. So in our scenario, the set command is not necessary. We will just use one permit statement as follows. - - router-b# conf t - router-b(config)# route-map RMAP permit 10 - router-b(config-route-map)# match ip address prefix-list PRFX-LST - -This route-map statement should do the trick. - -### Applying Route-Map ### - -Keep in mind that ACLs, prefix-list and route-map are not effective unless they are applied to an interface or a BGP neighbor. Just like ACLs or prefix-list, a single route-map statement can be used with any number of interfaces or neighbors. However, any one interface or a neighbor can support only one route-map statement for inbound, and one for outbound traffic. - -We will apply the created route-map to the BGP configuration of router-B for neighbor 192.168.1.1 with incoming prefix advertisement. - - router-b# conf terminal - router-b(config)# router bgp 200 - router-b(config-router)# neighbor 192.168.1.1 route-map RMAP in - -Now, we check the routes advertised and received by using the following commands. - -For advertised routes: - - show ip bgp neighbor-IP advertised-routes - -For received routes: - - show ip bgp neighbor-IP routes - -![](https://farm8.staticflickr.com/7424/16221405429_4d86119548_c.jpg) - -You can see that while router-A is advertising four prefixes towards router-B, router-B is accepting only three prefixes. If we check the range, we can see that only the prefixes that are allowed by route-map are visible on router-B. All other prefixes are discarded. - -**Tip**: If there is no change in the received prefixes, try resetting the BGP session using the command: "clear ip bgp neighbor-IP". In our case: - - clear ip bgp 192.168.1.1 - -As we can see, the requirement has been met. We can create similar prefix-list and route-map statements in routers A and B to further control inbound and outbound prefixes. - -I am summarizing the configuration in one place so you can see it all at a glance. - - router bgp 200 - network 10.20.0.0/16 - neighbor 192.168.1.1 remote-as 100 - neighbor 192.168.1.1 route-map RMAP in - ! - ip prefix-list PRFX-LST seq 5 permit 10.10.10.0/23 le 24 - ! - route-map RMAP permit 10 - match ip address prefix-list PRFX-LST - -### Summary ### - -In this tutorial, we showed how we can filter BGP routes in Quagga by defining prefix-list and route-map. We also demonstrated how we can combine prefix-list with route-map to fine-control incoming prefixes. You can create your own prefix-list and route-map in a similar way to match your network requirements. These tools are one of the most effective ways to protect the production network from route poisoning and advertisement of bogon routes. - -Hope this helps. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/filter-bgp-routes-quagga-bgp-router.html - -作者:[Sarmed Rahman][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://xmodulo.com/author/sarmed -[1]:http://xmodulo.com/centos-bgp-router-quagga.html diff --git a/sources/tech/20150410 How to Install and Configure Multihomed ISC DHCP Server on Debian Linux.md b/sources/tech/20150410 How to Install and Configure Multihomed ISC DHCP Server on Debian Linux.md deleted file mode 100644 index 2a8bdb2fbd..0000000000 --- a/sources/tech/20150410 How to Install and Configure Multihomed ISC DHCP Server on Debian Linux.md +++ /dev/null @@ -1,159 +0,0 @@ -How to Install and Configure Multihomed ISC DHCP Server on Debian Linux -================================================================================ -Dynamic Host Control Protocol (DHCP) offers an expedited method for network administrators to provide network layer addressing to hosts on a constantly changing, or dynamic, network. One of the most common server utilities to offer DHCP functionality is ISC DHCP Server. The goal of this service is to provide hosts with the necessary network information to be able to communicate on the networks in which the host is connected. Information that is typically served by this service can include: DNS server information, network address (IP), subnet mask, default gateway information, hostname, and much more. - -This tutorial will cover ISC-DHCP-Server version 4.2.4 on a Debian 7.7 server that will manage multiple virtual local area networks (VLAN) but can very easily be applied to a single network setup as well. - -The test network that this server was setup on has traditionally relied on a Cisco router to manage the DHCP address leases. The network currently has 12 VLANs needing to be managed by one centralized server. By moving this responsibility to a dedicated server, the router can regain resources for more important tasks such as routing, access control lists, traffic inspection, and network address translation. - -The other benefit to moving DHCP to a dedicated server will, in a later guide, involve setting up Dynamic Domain Name Service (DDNS) so that new host’s host-names will be added to the DNS system when the host requests a DHCP address from the server. - -### Step 1: Installing and Configuring ISC DHCP Server ### - -1. To start the process of creating this multi-homed server, the ISC software needs to be installed via the Debian repositories using the ‘apt‘ utility. As with all tutorials, root or sudo access is assumed. Please make the appropriate modifications to the following commands. - - # apt-get install isc-dhcp-server [Installs the ISC DHCP Server software] - # dpkg --get-selections isc-dhcp-server [Confirms successful installation] - # dpkg -s isc-dhcp-server [Alternative confirmation of installation] - -![Install ISC DHCP Server in Debian](http://www.tecmint.com/wp-content/uploads/2015/04/Install-ISC-DHCP-Server.jpg) - -2. Now that the server software is confirmed installed, it is now necessary to configure the server with the network information that it will need to hand out. At the bare minimum, the administrator needs to know the following information for a basic DHCP scope: - -- The network addresses -- The subnet masks -- The range of addresses to be dynamically assigned - -Other useful information to have the server dynamically assign includes: - -- Default gateway -- DNS server IP addresses -- The Domain Name -- Host name -- Network Broadcast addresses - -These are merely a few of the many options that the ISC DHCP server can handle. To get a complete list as well as a description of each option, enter the following command after installing the package: - - # man dhcpd.conf - -3. Once the administrator has concluded all the necessary information for this server to hand out it is time to configure the DHCP server as well as the necessary pools. Before creating any pools or server configurations though, the DHCP service must be configured to listen on one of the server’s interfaces. - -On this particular server, a NIC team has been setup and DHCP will listen on the teamed interfaces which were given the name `'bond0'`. Be sure to make the appropriate changes given the server and environment in which everything is being configured. The defaults in this file are okay for this tutorial. - -![Configure ISC DHCP Network](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-ISC-DHCP-Network.jpg) - -This line will instruct the DHCP service to listen for DHCP traffic on the specified interface(s). At this point, it is time to modify the main configuration file to enable the DHCP pools on the necessary networks. The main configuration file is located at /etc/dhcp/dhcpd.conf. Open the file with a text editor to begin: - - # nano /etc/dhcp/dhcpd.conf - -This file is the configuration for the DHCP server specific options as well as all of the pools/hosts one wishes to configure. The top of the file starts of with a ‘ddns-update-style‘ clause and for this tutorial it will remain set to ‘none‘ however in a future article, Dynamic DNS will be covered and ISC-DHCP-Server will be integrated with BIND9 to enable host name to IP address updates. - -4. The next section is typically the area where and administrator can configure global network settings such as the DNS domain name, default lease time for IP addresses, subnet-masks, and much more. Again to know more about all the options be sure to read the man page for the dhcpd.conf file. - - # man dhcpd.conf - -For this server install, there were a couple of global network options that were configured at the top of the configuration file so that they wouldn’t have to be implemented in every single pool created. - -![Configure ISC DDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-ISC-DDNS.png) - -Lets take a moment to explain some of these options. While they are configured globally in this example, all of them can be configured on a per pool basis as well. - -- option domain-name “comptech.local”; – All hosts that this DHCP server hosts, will be a member of the DNS domain name “comptech.local” -- option domain-name-servers 172.27.10.6; DHCP will hand out DNS server IP of 172.27.10.6 to all of the hosts on all of the networks it is configured to host. -- option subnet-mask 255.255.255.0; – The subnet mask handed out to every network will be a 255.255.255.0 or a /24 -- default-lease-time 3600; – This is the time in seconds that a lease will automatically be valid. The host can re-request the same lease if time runs out or if the host is done with the lease, they can hand the address back early. -- max-lease-time 86400; – This is the maximum amount of time in seconds a lease can be held by a host. -- ping-check true; – This is an extra test to ensure that the address the server wants to assign out isn’t in use by another host on the network already. -- ping-timeout; – This is how long in second the server will wait for a response to a ping before assuming the address isn’t in use. -- ignore client-updates; For now this option is irrelevant since DDNS has been disabled earlier in the configuration file but when DDNS is operating, this option will ignore a hosts to request to update its host-name in DNS. - -5. The next line in this file is the authoritative DHCP server line. This line means that if this server is to be the server that hands out addresses for the networks configured in this file, then uncomment the authoritative stanza. - -This server will be the only authority on all the networks it manages so the global authoritative stanza was un-commented by removing the ‘#’ in front of the keyword authoritative. - -![Enable ISC Authoritative](http://www.tecmint.com/wp-content/uploads/2015/04/ISC-authoritative.png) -Enable ISC Authoritative - -By default the server is assumed to NOT be an authority on the network. The rationale behind this is security. If someone unknowingly configures the DHCP server improperly or on a network they shouldn’t, it could cause serious connectivity issues. This line can also be used on a per network basis. This means that if the server is not the entire network’s DHCP server, the authoritative line can instead be used on a per network basis rather than in the global configuration as seen in the above screen-shot. - -6. The next step is to configure all of the DHCP pools/networks that this server will manage. For brevities sake, this guide will only walk through one of the pools configured. The administrator will need to have gathered all of the necessary network information (ie domain name, network addresses, how many addresses can be handed out, etc). - -For this pool the following information was obtained from the network administrator: network id of 172.27.60.0, subnet mask of 255.255.255.0 or a /24, the default gateway for the subnet is 172.27.60.1, and a broadcast address of 172.27.60.255. -This information is important to building the appropriate network stanza in the dhcpd.conf file. Without further ado, let’s open the configuration file again using a text editor and then add the new network to the server. This must be done with root/sudo! - - # nano /etc/dhcp/dhcpd.conf - -![Configure DHCP Pools and Networks](http://www.tecmint.com/wp-content/uploads/2015/04/ISC-network.png) -Configure DHCP Pools and Networks - -This is the sample created to hand out IP addresses to a network that is used for the creation of VMWare virtual practice servers. The first line indicates the network as well as the subnet mask for that network. Then inside the brackets are all the options that the DHCP server should provide to hosts on this network. - -The first stanza, range 172.27.60.50 172.27.60.254;, is the range of dynamically assignable addresses that the DHCP server can hand out to hosts on this network. Notice that the first 49 addresses aren’t in the pool and can be assigned statically to hosts if needed. - -The second stanza, option routers 172.27.60.1; , hands out the default gateway address for all hosts on this network. - -The last stanza, option broadcast-address 172.27.60.255;, indicates what the network’s broadcast address. This address SHOULD NOT be a part of the range stanza as the broadcast address can’t be assigned to a host. - -Some pointers, be sure to always end the option lines with a semi-colon (;) and always make sure each network created is enclosed in curly braces { }. - -7. If there are more networks to create, continue creating them with their appropriate options and then save the text file. Once all configurations have been completed, the ISC-DHCP-Server process will need to be restarted in order to apply the new changes. This can be accomplished with the following command: - - # service isc-dhcp-server restart - -This will restart the DHCP service and then the administrator can check to see if the server is ready for DHCP requests several different ways. The easiest is to simply see if the server is listening on port 67 via the [lsof command][1]: - - # lsof -i :67 - -![Check DHCP Listening Port](http://www.tecmint.com/wp-content/uploads/2015/04/lsof.png) -Check DHCP Listening Port - -This output indicates that the DHCPD (DHCP Server daemon) is running and listening on port 67. Port 67 in this output was actually converted to ‘bootps‘ due to a port number mapping for port 67 in /etc/services file. - -This is very common on most systems. At this point, the server should be ready for network connectivity and can be confirmed by connecting a machine to the network and having it request a DHCP address from the server. - -### Step 2: Testing Client Connectivity ### - -8. Most systems now-a-days are using Network Manager to maintain network connections and as such the device should be pre-configured to pull DHCP when the interface is active. - -However on machines that aren’t using Network Manager, it may be necessary to manually attempt to pull a DHCP address. The next few steps will show how to do this as well as how to see whether the server is handing out addresses. - -The ‘[ifconfig][2]‘ utility can be used to check an interface’s configuration. The machine used to test the DHCP server only has one network adapter and it is called ‘eth0‘. - - # ifconfig eth0 - -![Check Network Interface IP Address](http://www.tecmint.com/wp-content/uploads/2015/04/No-ip.png) -Check Network Interface IP Address - -From this output, this machine currently doesn’t have an IPv4 address, great! Let’s instruct this machine to reach out to the DHCP server and request an address. This machine has the DHCP client utility known as ‘dhclient‘ installed. The DHCP client utility may very from system to system. - - # dhclient eth0 - -![Request IP Address from DHCP](http://www.tecmint.com/wp-content/uploads/2015/04/IP.png) -Request IP Address from DHCP - -Now the `'inet addr:'` field shows an IPv4 address that falls within the scope of what was configured for the 172.27.60.0 network. Also notice that the proper broadcast address was handed out as well as subnet mask for this network. - -Things are looking promising but let’s check the server to see if it was actually the place where this machine received this new IP address. To accomplish this task, the server’s system log file will be consulted. While the entire log file may contain hundreds of thousands of entries, only a few are necessary for confirming that the server is working properly. Rather than using a full text editor, this time a utility known as ‘tail‘ will be used to only show the last few lines of the log file. - - # tail /var/log/syslog - -![Check DHCP Logs](http://www.tecmint.com/wp-content/uploads/2015/04/DHCP-Log.png) -Check DHCP Logs - -Voila! The server recorded handing out an address to this host (HRTDEBXENSRV). It is a safe assumption at this point that the server is working as intended and handing out the appropriate addresses for the networks that it is an authority. At this point the DHCP server is up and running. Configure the other networks, troubleshoot, and secure as necessary. - -Enjoy the newly functioning ISC-DHCP-Server and tune in later for more Debian tutorials. In the not too distant future there will be an article on Bind9 and DDNS that will tie into this article. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/install-and-configure-multihomed-isc-dhcp-server-on-debian-linux/ - -作者:[Rob Turner][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/robturner/ -[1]:http://www.tecmint.com/10-lsof-command-examples-in-linux/ -[2]:http://www.tecmint.com/ifconfig-command-examples/ \ No newline at end of file diff --git a/sources/tech/20150806 Installation Guide for Puppet on Ubuntu 15.04.md b/sources/tech/20150806 Installation Guide for Puppet on Ubuntu 15.04.md deleted file mode 100644 index 501cb4a8dc..0000000000 --- a/sources/tech/20150806 Installation Guide for Puppet on Ubuntu 15.04.md +++ /dev/null @@ -1,430 +0,0 @@ -Translating by ZTinoZ -Installation Guide for Puppet on Ubuntu 15.04 -================================================================================ -Hi everyone, today in this article we'll learn how to install puppet to manage your server infrastructure running ubuntu 15.04. Puppet is an open source software configuration management tool which is developed and maintained by Puppet Labs that allows us to automate the provisioning, configuration and management of a server infrastructure. Whether we're managing just a few servers or thousands of physical and virtual machines to orchestration and reporting, puppet automates tasks that system administrators often do manually which frees up time and mental space so sysadmins can work on improving other aspects of your overall setup. It ensures consistency, reliability and stability of the automated jobs processed. It facilitates closer collaboration between sysadmins and developers, enabling more efficient delivery of cleaner, better-designed code. Puppet is available in two solutions configuration management and data center automation. They are **puppet open source and puppet enterprise**. Puppet open source is a flexible, customizable solution available under the Apache 2.0 license, designed to help system administrators automate the many repetitive tasks they regularly perform. Whereas puppet enterprise edition is a proven commercial solution for diverse enterprise IT environments which lets us get all the benefits of open source puppet, plus puppet apps, commercial-only enhancements, supported modules and integrations, and the assurance of a fully supported platform. Puppet uses SSL certificates to authenticate communication between master and agent nodes. - -In this tutorial, we will cover how to install open source puppet in an agent and master setup running ubuntu 15.04 linux distribution. Here, Puppet master is a server from where all the configurations will be controlled and managed and all our remaining servers will be puppet agent nodes, which is configured according to the configuration of puppet master server. Here are some easy steps to install and configure puppet to manage our server infrastructure running Ubuntu 15.04. - -### 1. Setting up Hosts ### - -In this tutorial, we'll use two machines, one as puppet master server and another as puppet node agent both running ubuntu 15.04 "Vivid Vervet" in both the machines. Here is the infrastructure of the server that we're gonna use for this tutorial. - -puppet master server with IP 44.55.88.6 and hostname : puppetmaster -puppet node agent with IP 45.55.86.39 and hostname : puppetnode - -Now we'll add the entry of the machines to /etc/hosts on both machines node agent and master server. - - # nano /etc/hosts - - 45.55.88.6 puppetmaster.example.com puppetmaster - 45.55.86.39 puppetnode.example.com puppetnode - -Please note that the Puppet Master server must be reachable on port 8140. So, we'll need to open port 8140 in it. - -### 2. Updating Time with NTP ### - -As puppet nodes needs to maintain accurate system time to avoid problems when it issues agent certificates. Certificates can appear to be expired if there is time difference, the time of the both the master and the node agent must be synced with each other. To sync the time, we'll update the time with NTP. To do so, here's the command below that we need to run on both master and node agent. - - # ntpdate pool.ntp.org - - 17 Jun 00:17:08 ntpdate[882]: adjust time server 66.175.209.17 offset -0.001938 sec - -Now, we'll update our local repository index and install ntp as follows. - - # apt-get update && sudo apt-get -y install ntp ; service ntp restart - -### 3. Puppet Master Package Installation ### - -There are many ways to install open source puppet. In this tutorial, we'll download and install a debian binary package named as **puppetlabs-release** packaged by the Puppet Labs which will add the source of the **puppetmaster-passenger** package. The puppetmaster-passenger includes the puppet master with apache web server. So, we'll now download the Puppet Labs package. - - # cd /tmp/ - # wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb - - --2015-06-17 00:19:26-- https://apt.puppetlabs.com/puppetlabs-release-trusty.deb - Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 192.155.89.90, 2600:3c03::f03c:91ff:fedb:6b1d - Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|192.155.89.90|:443... connected. - HTTP request sent, awaiting response... 200 OK - Length: 7384 (7.2K) [application/x-debian-package] - Saving to: ‘puppetlabs-release-trusty.deb’ - - puppetlabs-release-tr 100%[===========================>] 7.21K --.-KB/s in 0.06s - - 2015-06-17 00:19:26 (130 KB/s) - ‘puppetlabs-release-trusty.deb’ saved [7384/7384] - -After the download has been completed, we'll wanna install the package. - - # dpkg -i puppetlabs-release-trusty.deb - - Selecting previously unselected package puppetlabs-release. - (Reading database ... 85899 files and directories currently installed.) - Preparing to unpack puppetlabs-release-trusty.deb ... - Unpacking puppetlabs-release (1.0-11) ... - Setting up puppetlabs-release (1.0-11) ... - -Then, we'll update the local respository index with the server using apt package manager. - - # apt-get update - -Then, we'll install the puppetmaster-passenger package by running the below command. - - # apt-get install puppetmaster-passenger - -**Note**: While installing we may get an error **Warning: Setting templatedir is deprecated. See http://links.puppetlabs.com/env-settings-deprecations (at /usr/lib/ruby/vendor_ruby/puppet/settings.rb:1139:in `issue_deprecation_warning')** but we no need to worry, we'll just simply ignore this as it says that the templatedir is deprecated so, we'll simply disbale that setting in the configuration. :) - -To check whether puppetmaster has been installed successfully in our Master server not not, we'll gonna try to check its version. - - # puppet --version - - 3.8.1 - -We have successfully installed puppet master package in our puppet master box. As we are using passenger with apache, the puppet master process is controlled by apache server, that means it runs when apache is running. - -Before continuing, we'll need to stop the Puppet master by stopping the apache2 service. - - # systemctl stop apache2 - -### 4. Master version lock with Apt ### - -As We have puppet version as 3.8.1, we need to lock the puppet version update as this will mess up the configurations while updating the puppet. So, we'll use apt's locking feature for that. To do so, we'll need to create a new file **/etc/apt/preferences.d/00-puppet.pref** using our favorite text editor. - - # nano /etc/apt/preferences.d/00-puppet.pref - -Then, we'll gonna add the entries in the newly created file as: - - # /etc/apt/preferences.d/00-puppet.pref - Package: puppet puppet-common puppetmaster-passenger - Pin: version 3.8* - Pin-Priority: 501 - -Now, it will not update the puppet while running updates in the system. - -### 5. Configuring Puppet Config ### - -Puppet master acts as a certificate authority and must generate its own certificates which is used to sign agent certificate requests. First of all, we'll need to remove any existing SSL certificates that were created during the installation of package. The default location of puppet's SSL certificates is /var/lib/puppet/ssl. So, we'll remove the entire ssl directory using rm command. - - # rm -rf /var/lib/puppet/ssl - -Then, we'll configure the certificate. While creating the puppet master's certificate, we need to include every DNS name at which agent nodes can contact the master at. So, we'll edit the master's puppet.conf using our favorite text editor. - - # nano /etc/puppet/puppet.conf - -The output seems as shown below. - - [main] - logdir=/var/log/puppet - vardir=/var/lib/puppet - ssldir=/var/lib/puppet/ssl - rundir=/var/run/puppet - factpath=$vardir/lib/facter - templatedir=$confdir/templates - - [master] - # These are needed when the puppetmaster is run by passenger - # and can safely be removed if webrick is used. - ssl_client_header = SSL_CLIENT_S_DN - ssl_client_verify_header = SSL_CLIENT_VERIFY - -Here, we'll need to comment the templatedir line to disable the setting as it has been already depreciated. After that, we'll add the following line at the end of the file under [main]. - - server = puppetmaster - environment = production - runinterval = 1h - strict_variables = true - certname = puppetmaster - dns_alt_names = puppetmaster, puppetmaster.example.com - -This configuration file has many options which might be useful in order to setup own configuration. A full description of the file is available at Puppet Labs [Main Config File (puppet.conf)][1]. - -After editing the file, we'll wanna save that and exit. - -Now, we'll gonna generate a new CA certificates by running the following command. - - # puppet master --verbose --no-daemonize - - Info: Creating a new SSL key for ca - Info: Creating a new SSL certificate request for ca - Info: Certificate Request fingerprint (SHA256): F6:2F:69:89:BA:A5:5E:FF:7F:94:15:6B:A7:C4:20:CE:23:C7:E3:C9:63:53:E0:F2:76:D7:2E:E0:BF:BD:A6:78 - ... - Notice: puppetmaster has a waiting certificate request - Notice: Signed certificate request for puppetmaster - Notice: Removing file Puppet::SSL::CertificateRequest puppetmaster at '/var/lib/puppet/ssl/ca/requests/puppetmaster.pem' - Notice: Removing file Puppet::SSL::CertificateRequest puppetmaster at '/var/lib/puppet/ssl/certificate_requests/puppetmaster.pem' - Notice: Starting Puppet master version 3.8.1 - ^CNotice: Caught INT; storing stop - Notice: Processing stop - -Now, the certificate is being generated. Once we see **Notice: Starting Puppet master version 3.8.1**, the certificate setup is complete. Then we'll press CTRL-C to return to the shell. - -If we wanna look at the cert information of the certificate that was just created, we can get the list by running in the following command. - - # puppet cert list -all - - + "puppetmaster" (SHA256) 33:28:97:86:A1:C3:2F:73:10:D1:FB:42:DA:D5:42:69:71:84:F0:E2:8A:01:B9:58:38:90:E4:7D:B7:25:23:EC (alt names: "DNS:puppetmaster", "DNS:puppetmaster.example.com") - -### 6. Creating a Puppet Manifest ### - -The default location of the main manifest is /etc/puppet/manifests/site.pp. The main manifest file contains the definition of configuration that is used to execute in the puppet node agent. Now, we'll create the manifest file by running the following command. - - # nano /etc/puppet/manifests/site.pp - -Then, we'll add the following lines of configuration in the file that we just opened. - - # execute 'apt-get update' - exec { 'apt-update': # exec resource named 'apt-update' - command => '/usr/bin/apt-get update' # command this resource will run - } - - # install apache2 package - package { 'apache2': - require => Exec['apt-update'], # require 'apt-update' before installing - ensure => installed, - } - - # ensure apache2 service is running - service { 'apache2': - ensure => running, - } - -The above lines of configuration are responsible for the deployment of the installation of apache web server across the node agent. - -### 7. Starting Master Service ### - -We are now ready to start the puppet master. We can start it by running the apache2 service. - - # systemctl start apache2 - -Here, our puppet master is running, but it isn't managing any agent nodes yet. Now, we'll gonna add the puppet node agents to the master. - -**Note**: If you get an error **Job for apache2.service failed. See "systemctl status apache2.service" and "journalctl -xe" for details.** then it must be that there is some problem with the apache server. So, we can see the log what exactly has happened by running **apachectl start** under root or sudo mode. Here, while performing this tutorial, we got a misconfiguration of the certificates under **/etc/apache2/sites-enabled/puppetmaster.conf** file. We replaced **SSLCertificateFile /var/lib/puppet/ssl/certs/server.pem with SSLCertificateFile /var/lib/puppet/ssl/certs/puppetmaster.pem** and commented **SSLCertificateKeyFile** line. Then we'll need to rerun the above command to run apache server. - -### 8. Puppet Agent Package Installation ### - -Now, as we have our puppet master ready and it needs an agent to manage, we'll need to install puppet agent into the nodes. We'll need to install puppet agent in every nodes in our infrastructure we want puppet master to manage. We'll need to make sure that we have added our node agents in the DNS. Now, we'll gonna install the latest puppet agent in our agent node ie. puppetnode.example.com . - -We'll run the following command to download the Puppet Labs package in our puppet agent nodes. - - # cd /tmp/ - # wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb\ - - --2015-06-17 00:54:42-- https://apt.puppetlabs.com/puppetlabs-release-trusty.deb - Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 192.155.89.90, 2600:3c03::f03c:91ff:fedb:6b1d - Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|192.155.89.90|:443... connected. - HTTP request sent, awaiting response... 200 OK - Length: 7384 (7.2K) [application/x-debian-package] - Saving to: ‘puppetlabs-release-trusty.deb’ - - puppetlabs-release-tr 100%[===========================>] 7.21K --.-KB/s in 0.04s - - 2015-06-17 00:54:42 (162 KB/s) - ‘puppetlabs-release-trusty.deb’ saved [7384/7384] - -Then, as we're running ubuntu 15.04, we'll use debian package manager to install it. - - # dpkg -i puppetlabs-release-trusty.deb - -Now, we'll gonna update the repository index using apt-get. - - # apt-get update - -Finally, we'll gonna install the puppet agent directly from the remote repository. - - # apt-get install puppet - -Puppet agent is always disabled by default, so we'll need to enable it. To do so we'll need to edit /etc/default/puppet file using a text editor. - - # nano /etc/default/puppet - -Then, we'll need to change value of **START** to "yes" as shown below. - - START=yes - -Then, we'll need to save and exit the file. - -### 9. Agent Version Lock with Apt ### - -As We have puppet version as 3.8.1, we need to lock the puppet version update as this will mess up the configurations while updating the puppet. So, we'll use apt's locking feature for that. To do so, we'll need to create a file /etc/apt/preferences.d/00-puppet.pref using our favorite text editor. - - # nano /etc/apt/preferences.d/00-puppet.pref - -Then, we'll gonna add the entries in the newly created file as: - - # /etc/apt/preferences.d/00-puppet.pref - Package: puppet puppet-common - Pin: version 3.8* - Pin-Priority: 501 - -Now, it will not update the Puppet while running updates in the system. - -### 10. Configuring Puppet Node Agent ### - -Next, We must make a few configuration changes before running the agent. To do so, we'll need to edit the agent's puppet.conf - - # nano /etc/puppet/puppet.conf - -It will look exactly like the Puppet master's initial configuration file. - -This time also we'll comment the **templatedir** line. Then we'll gonna delete the [master] section, and all of the lines below it. - -Assuming that the puppet master is reachable at "puppet-master", the agent should be able to connect to the master. If not we'll need to use its fully qualified domain name ie. puppetmaster.example.com . - - [agent] - server = puppetmaster.example.com - certname = puppetnode.example.com - -After adding this, it will look alike this. - - [main] - logdir=/var/log/puppet - vardir=/var/lib/puppet - ssldir=/var/lib/puppet/ssl - rundir=/var/run/puppet - factpath=$vardir/lib/facter - #templatedir=$confdir/templates - - [agent] - server = puppetmaster.example.com - certname = puppetnode.example.com - -After done with that, we'll gonna save and exit it. - -Next, we'll wanna start our latest puppet agent in our Ubuntu 15.04 nodes. To start our puppet agent, we'll need to run the following command. - - # systemctl start puppet - -If everything went as expected and configured properly, we should not see any output displayed by running the above command. When we run an agent for the first time, it generates an SSL certificate and sends a request to the puppet master then if the master signs the agent's certificate, it will be able to communicate with the agent node. - -**Note**: If you are adding your first node, it is recommended that you attempt to sign the certificate on the puppet master before adding your other agents. Once you have verified that everything works properly, then you can go back and add the remaining agent nodes further. - -### 11. Signing certificate Requests on Master ### - -While puppet agent runs for the first time, it generates an SSL certificate and sends a request for signing to the master server. Before the master will be able to communicate and control the agent node, it must sign that specific agent node's certificate. - -To get the list of the certificate requests, we'll run the following command in the puppet master server. - - # puppet cert list - - "puppetnode.example.com" (SHA256) 31:A1:7E:23:6B:CD:7B:7D:83:98:33:8B:21:01:A6:C4:01:D5:53:3D:A0:0E:77:9A:77:AE:8F:05:4A:9A:50:B2 - -As we just setup our first agent node, we will see one request. It will look something like the following, with the agent node's Domain name as the hostname. - -Note that there is no + in front of it which indicates that it has not been signed yet. - -Now, we'll go for signing a certification request. In order to sign a certification request, we should simply run **puppet cert sign** with the **hostname** as shown below. - - # puppet cert sign puppetnode.example.com - - Notice: Signed certificate request for puppetnode.example.com - Notice: Removing file Puppet::SSL::CertificateRequest puppetnode.example.com at '/var/lib/puppet/ssl/ca/requests/puppetnode.example.com.pem' - -The Puppet master can now communicate and control the node that the signed certificate belongs to. - -If we want to sign all of the current requests, we can use the -all option as shown below. - - # puppet cert sign --all - -### Removing a Puppet Certificate ### - -If we wanna remove a host from it or wanna rebuild a host then add it back to it. In this case, we will want to revoke the host's certificate from the puppet master. To do this, we will want to use the clean action as follows. - - # puppet cert clean hostname - - Notice: Revoked certificate with serial 5 - Notice: Removing file Puppet::SSL::Certificate puppetnode.example.com at '/var/lib/puppet/ssl/ca/signed/puppetnode.example.com.pem' - Notice: Removing file Puppet::SSL::Certificate puppetnode.example.com at '/var/lib/puppet/ssl/certs/puppetnode.example.com.pem' - -If we want to view all of the requests signed and unsigned, run the following command: - - # puppet cert list --all - - + "puppetmaster" (SHA256) 33:28:97:86:A1:C3:2F:73:10:D1:FB:42:DA:D5:42:69:71:84:F0:E2:8A:01:B9:58:38:90:E4:7D:B7:25:23:EC (alt names: "DNS:puppetmaster", "DNS:puppetmaster.example.com") - -### 12. Deploying a Puppet Manifest ### - -After we configure and complete the puppet manifest, we'll wanna deploy the manifest to the agent nodes server. To apply and load the main manifest we can simply run the following command in the agent node. - - # puppet agent --test - - Info: Retrieving pluginfacts - Info: Retrieving plugin - Info: Caching catalog for puppetnode.example.com - Info: Applying configuration version '1434563858' - Notice: /Stage[main]/Main/Exec[apt-update]/returns: executed successfully - Notice: Finished catalog run in 10.53 seconds - -This will show us all the processes how the main manifest will affect a single server immediately. - -If we wanna run a puppet manifest that is not related to the main manifest, we can simply use puppet apply followed by the manifest file path. It only applies the manifest to the node that we run the apply from. - - # puppet apply /etc/puppet/manifest/test.pp - -### 13. Configuring Manifest for a Specific Node ### - -If we wanna deploy a manifest only to a specific node then we'll need to configure the manifest as follows. - -We'll need to edit the manifest on the master server using a text editor. - - # nano /etc/puppet/manifest/site.pp - -Now, we'll gonna add the following lines there. - - node 'puppetnode', 'puppetnode1' { - # execute 'apt-get update' - exec { 'apt-update': # exec resource named 'apt-update' - command => '/usr/bin/apt-get update' # command this resource will run - } - - # install apache2 package - package { 'apache2': - require => Exec['apt-update'], # require 'apt-update' before installing - ensure => installed, - } - - # ensure apache2 service is running - service { 'apache2': - ensure => running, - } - } - -Here, the above configuration will install and deploy the apache web server only to the two specified nodes having shortname puppetnode and puppetnode1. We can add more nodes that we need to get deployed with the manifest specifically. - -### 14. Configuring Manifest with a Module ### - -Modules are useful for grouping tasks together, they are many available in the Puppet community which anyone can contribute further. - -On the puppet master, we'll gonna install the **puppetlabs-apache** module using the puppet module command. - - # puppet module install puppetlabs-apache - -**Warning**: Please do not use this module on an existing apache setup else it will purge your apache configurations that are not managed by puppet. - -Now we'll gonna edit the main manifest ie **site.pp** using a text editor. - - # nano /etc/puppet/manifest/site.pp - -Now add the following lines to install apache under puppetnode. - - node 'puppet-node' { - class { 'apache': } # use apache module - apache::vhost { 'example.com': # define vhost resource - port => '80', - docroot => '/var/www/html' - } - } - -Then we'll wanna save and exit it. Then, we'll wanna rerun the manifest to deploy the configuration to the agents for our infrastructure. - -### Conclusion ### - -Finally we have successfully installed puppet to manage our Server Infrastructure running Ubuntu 15.04 "Vivid Vervet" linux operating system. We learned how puppet works, configure a manifest configuration, communicate with nodes and deploy the manifest on the agent nodes with secure SSL certification. Controlling, managing and configuring repeated task in several N number of nodes is very easy with puppet open source software configuration management tool. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents. Thank you ! Enjoy :-) - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-how-to/install-puppet-ubuntu-15-04/ - -作者:[Arun Pyasi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ -[1]:https://docs.puppetlabs.com/puppet/latest/reference/config_file_main.html diff --git a/sources/tech/20150817 How to Install OsTicket Ticketing System in Fedora 22 or Centos 7.md b/sources/tech/20150817 How to Install OsTicket Ticketing System in Fedora 22 or Centos 7.md deleted file mode 100644 index 515b15844a..0000000000 --- a/sources/tech/20150817 How to Install OsTicket Ticketing System in Fedora 22 or Centos 7.md +++ /dev/null @@ -1,179 +0,0 @@ -How to Install OsTicket Ticketing System in Fedora 22 / Centos 7 -================================================================================ -In this article, we'll learn how to setup help desk ticketing system with osTicket in our machine or server running Fedora 22 or CentOS 7 as operating system. osTicket is a free and open source popular customer support ticketing system developed and maintained by [Enhancesoft][1] and its contributors. osTicket is the best solution for help and support ticketing system and management for better communication and support assistance with clients and customers. It has the ability to easily integrate with inquiries created via email, phone and web based forms into a beautiful multi-user web interface. osTicket makes us easy to manage, organize and log all our support requests and responses in one single place. It is a simple, lightweight, reliable, open source, web-based and easy to setup and use help desk ticketing system. - -Here are some easy steps on how we can setup Help Desk ticketing system with osTicket in Fedora 22 or CentOS 7 operating system. - -### 1. Installing LAMP stack ### - -First of all, we'll need to install LAMP Stack to make osTicket working. LAMP stack is the combination of Apache web server, MySQL or MariaDB database system and PHP. To install a complete suit of LAMP stack that we need for the installation of osTicket, we'll need to run the following commands in a shell or a terminal. - -**On Fedora 22** - -LAMP stack is available on the official repository of Fedora 22. As the default package manager of Fedora 22 is the latest DNF package manager, we'll need to run the following command. - - $ sudo dnf install httpd mariadb mariadb-server php php-mysql php-fpm php-cli php-xml php-common php-gd php-imap php-mbstring wget - -**On CentOS 7** - -As there is LAMP stack available on the official repository of CentOS 7, we'll gonna install it using yum package manager. - - $ sudo yum install httpd mariadb mariadb-server php php-mysql php-fpm php-cli php-xml php-common php-gd php-imap php-mbstring wget - -### 2. Starting Apache Web Server and MariaDB ### - -Next, we'll gonna start MariaDB server and Apache Web Server to get started. - - $ sudo systemctl start mariadb httpd - -Then, we'll gonna enable them to start on every boot of the system. - - $ sudo systemctl enable mariadb httpd - - Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service. - Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. - -### 3. Downloading osTicket package ### - -Next, we'll gonna download the latest release of osTicket ie version 1.9.9 . We can download it from the official download page [http://osticket.com/download][2] or from the official github repository. [https://github.com/osTicket/osTicket-1.8/releases][3] . Here, in this tutorial we'll download the tarball of the latest release of osTicket from the github release page using wget command. - - $ cd /tmp/ - $ wget https://github.com/osTicket/osTicket-1.8/releases/download/v1.9.9/osTicket-v1.9.9-1-gbe2f138.zip - - --2015-07-16 09:14:23-- https://github.com/osTicket/osTicket-1.8/releases/download/v1.9.9/osTicket-v1.9.9-1-gbe2f138.zip - Resolving github.com (github.com)... 192.30.252.131 - ... - Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.244.4|:443... connected. - HTTP request sent, awaiting response... 200 OK - Length: 7150871 (6.8M) [application/octet-stream] - Saving to: ‘osTicket-v1.9.9-1-gbe2f138.zip’ - osTicket-v1.9.9-1-gb 100%[========================>] 6.82M 1.25MB/s in 12s - 2015-07-16 09:14:37 (604 KB/s) - ‘osTicket-v1.9.9-1-gbe2f138.zip’ saved [7150871/7150871] - -### 4. Extracting the osTicket ### - -After we have successfully downloaded the osTicket zipped package, we'll now gonna extract the zip. As the default root directory of Apache web server is /var/www/html/ , we'll gonna create a directory called "**support**" where we'll extract the whole directory and files of the compressed zip file. To do so, we'll need to run the following commands in a terminal or a shell. - - $ unzip osTicket-v1.9.9-1-gbe2f138.zip - -Then, we'll move the whole extracted files to it. - - $ sudo mv /tmp/upload /var/www/html/support - -### 5. Fixing Ownership and Permission ### - -Now, we'll gonna assign the ownership of the directories and files under /var/ww/html/support to apache to enable writable access to the apache process owner. To do so, we'll need to run the following command. - - $ sudo chown apache: -R /var/www/html/support - -Then, we'll also need to copy a sample configuration file to its default configuration file. To do so, we'll need to run the below command. - - $ cd /var/www/html/support/ - $ sudo cp include/ost-sampleconfig.php include/ost-config.php - $ sudo chmod 0666 include/ost-config.php - -If you have SELinux enabled on the system, run the following command. - - $ sudo chcon -R -t httpd_sys_content_t /var/www/html/vtigercrm - $ sudo chcon -R -t httpd_sys_rw_content_t /var/www/html/vtigercrm - -### 6. Configuring MariaDB ### - -As this is the first time we're going to configure MariaDB, we'll need to create a password for the root user of mariadb so that we can use it to login and create the database for our osTicket installation. To do so, we'll need to run the following command in a terminal or a shell. - - $ sudo mysql_secure_installation - - ... - Enter current password for root (enter for none): - OK, successfully used password, moving on... - - Setting the root password ensures that nobody can log into the MariaDB - root user without the proper authorisation. - - Set root password? [Y/n] y - New password: - Re-enter new password: - Password updated successfully! - Reloading privilege tables.. - Success! - ... - All done! If you've completed all of the above steps, your MariaDB - installation should now be secure. - - Thanks for using MariaDB! - -Note: Above, we are asked to enter the root password of the mariadb server but as we are setting for the first time and no password has been set yet, we'll simply hit enter while asking the current mariadb root password. Then, we'll need to enter twice the new password we wanna set. Then, we can simply hit enter in every argument in order to set default configurations. - -### 7. Creating osTicket Database ### - -As osTicket needs a database system to store its data and information, we'll be configuring MariaDB for osTicket. So, we'll need to first login into the mariadb command environment. To do so, we'll need to run the following command. - - $ sudo mysql -u root -p - -Now, we'll gonna create a new database "**osticket_db**" with user "**osticket_user**" and password "osticket_password" which will be granted access to the database. To do so, we'll need to run the following commands inside the MariaDB command environment. - - > CREATE DATABASE osticket_db; - > CREATE USER 'osticket_user'@'localhost' IDENTIFIED BY 'osticket_password'; - > GRANT ALL PRIVILEGES on osticket_db.* TO 'osticket_user'@'localhost' ; - > FLUSH PRIVILEGES; - > EXIT; - -**Note**: It is strictly recommended to replace the database name, user and password as your desire for security issue. - -### 8. Allowing Firewall ### - -If we are running a firewall program, we'll need to configure our firewall to allow port 80 so that the Apache web server's default port will be accessible externally. This will allow us to navigate our web browser to osTicket's web interface with the default http port 80. To do so, we'll need to run the following command. - - $ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent - -After done, we'll need to reload our firewall service. - - $ sudo firewall-cmd --reload - -### 9. Web based Installation ### - -Finally, is everything is done as described above, we'll now should be able to navigate osTicket's Installer by pointing our web browser to http://domain.com/support or http://ip-address/support . Now, we'll be shown if the dependencies required by osTicket are installed or not. As we've already installed all the necessary packages, we'll be welcomed with **green colored tick** to proceed forward. - -![osTicket Requirements Check](http://blog.linoxide.com/wp-content/uploads/2015/07/osticket-requirements-check1.png) - -After that, we'll be required to enter the details for our osTicket instance as shown below. We'll need to enter the database name, username, password and hostname and other important account information that we'll require while logging into the admin panel. - -![osticket configuration](http://blog.linoxide.com/wp-content/uploads/2015/07/osticket-configuration.png) - -After the installation has been completed successfully, we'll be welcomed by a Congratulations screen. There we can see two links, one for our Admin Panel and the other for the support center as the homepage of the osTicket Support Help Desk. - -![osticket installation completed](http://blog.linoxide.com/wp-content/uploads/2015/07/osticket-installation-completed.png) - -If we click on http://ip-address/support or http://domain.com/support, we'll be redirected to the osTicket support page which is as shown below. - -![osticket support homepage](http://blog.linoxide.com/wp-content/uploads/2015/07/osticket-support-homepage.png) - -Next, to login into the admin panel, we'll need to navigate our web browser to http://ip-address/support/scp or http://domain.com/support/scp . Then, we'll need to enter the login details we had just created above while configuring the database and other information in the web installer. After successful login, we'll be able to access our dashboard and other admin sections. - -![osticket admin panel](http://blog.linoxide.com/wp-content/uploads/2015/07/osticket-admin-panel.png) - -### 10. Post Installation ### - -After we have finished the web installation of osTicket, we'll now need to secure some of our configuration files. To do so, we'll need to run the following command. - - $ sudo rm -rf /var/www/html/support/setup/ - $ sudo chmod 644 /var/www/html/support/include/ost-config.php - -### Conclusion ### - -osTicket is an awesome help desk ticketing system providing several new features. It supports rich text or HTML emails, ticket filters, agent collision avoidance, auto-responder and many more features. The user interface of osTicket is very beautiful with easy to use control panel. It is a complete set of tools required for a help and support ticketing system. It is the best solution for providing customers a better way to communicate with the support team. It helps a company to make their customers happy with them regarding the support and help desk. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents. Thank you ! Enjoy :-) - ------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-how-to/install-osticket-fedora-22-centos-7/ - -作者:[Arun Pyasi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ -[1]:http://www.enhancesoft.com/ -[2]:http://osticket.com/download -[3]:https://github.com/osTicket/osTicket-1.8/releases \ No newline at end of file diff --git a/sources/tech/20150824 How to Setup Zephyr Test Management Tool on CentOS 7.x.md b/sources/tech/20150824 How to Setup Zephyr Test Management Tool on CentOS 7.x.md deleted file mode 100644 index b4014bb009..0000000000 --- a/sources/tech/20150824 How to Setup Zephyr Test Management Tool on CentOS 7.x.md +++ /dev/null @@ -1,233 +0,0 @@ -How to Setup Zephyr Test Management Tool on CentOS 7.x -================================================================================ -Test Management encompasses anything and everything that you need to do as testers. Test management tools are used to store information on how testing is to be done, plan testing activities and report the status of quality assurance activities. So in this article we will illustrate you about the setup of Zephyr test management tool that includes everything needed to manage the test process can save testers hassle of installing separate applications that are necessary for the testing process. Once you have done with its setup you will be able to track bugs, defects and allows the project tasks for collaboration with your team as you can easily share and access the data across multiple project teams for communication and collaboration throughout the testing process. - -### Requirements for Zephyr ### - -We are going to install and run Zephyr under the following set of its minimum resources. Resources can be enhanced as per your infrastructure requirements. We will be installing Zephyr on the CentOS-7 64-bit while its binary distributions are available for almost all Linux operating systems. - -注:表格 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Zephyr test management tool
Linux OSCentOS Linux 7 (Core), 64-bit
PackagesJDK 7 or above ,  Oracle JDK 6 updateNo Prior Tomcat, MySQL installed
RAM4 GBPreferred 8 GB
CPU2.0 GHZ or Higher
Hard Disk30 GB , Atleast 5GB must be free
- -You must have super user (root) access to perform the installation process for Zephyr and make sure that you have properly configured yout network with static IP address and its default set of ports must be available and allowed in the firewall where as the Port 80/443, 8005, 8009, 8010 will used by tomcat and Port 443 or 2099 will used within Zephyr by flex for the RTMP protocol. - -### Install Java JDK 7 ### - -Java JDK 7 is the basic requirement for the installation of Zephyr, if its not already installed in your operating system then do the following to install Java and setup its JAVA_HOME environment variables to be properly configured. - -Let’s issue the below commands to install Java JDK 7. - - [root@centos-007 ~]# yum install java-1.7.0-openjdk-1.7.0.79-2.5.5.2.el7_1 - ----------- - - [root@centos-007 ~]# yum install java-1.7.0-openjdk-devel-1.7.0.85-2.6.1.2.el7_1.x86_64 - -Once your java is installed including its required dependencies, run the following commands to set its JAVA_HOME environment variables. - - [root@centos-007 ~]# export JAVA_HOME=/usr/java/default - [root@centos-007 ~]# export PATH=/usr/java/default/bin:$PATH - -Now check the version of java to verify its installation with following command. - - [root@centos-007 ~]# java –version - ----------- - - java version "1.7.0_79" - OpenJDK Runtime Environment (rhel-2.5.5.2.el7_1-x86_64 u79-b14) - OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode) - -The output shows that we we have successfully installed OpenJDK Java verion 1.7.0_79. - -### Install MySQL 5.6.X ### - -If you have other MySQLs on the machine then it is recommended to remove them and -install this version on top of them or upgrade their schemas to what is specified. As this specific major/minor (5.6.X) version of MySQL is required with the root username as a prerequisite of Zephyr. - -To install MySQL 5.6 on CentOS-7.1 lets do the following steps: - -Download the rpm package, which will create a yum repo file for MySQL Server installation. - - [root@centos-007 ~]# yum install wget - [root@centos-007 ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm - -Now Install this downloaded rpm package by using rpm command. - - [root@centos-007 ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm - -After the installation of this package you will get two new yum repo related to MySQL. Then by using yum command, now we will install MySQL Server 5.6 and all dependencies will be installed itself. - - [root@centos-007 ~]# yum install mysql-server - -Once the installation process completes, run the following commands to start mysqld services and check its status whether its active or not. - - [root@centos-007 ~]# service mysqld start - [root@centos-007 ~]# service mysqld status - -On fresh installation of MySQL Server. The MySQL root user password is blank. -For good security practice, we should reset the password MySQL root user. - -Connect to MySQL using the auto-generated empty password and change the -root password. - - [root@centos-007 ~]# mysql - mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your_password'); - mysql> flush privileges; - mysql> quit; - -Now we need to configure the required database parameters in the default configuration file of MySQL. Let's open its file located in "/etc/" folder and update it as follow. - - [root@centos-007 ~]# vi /etc/my.cnf - ----------- - - [mysqld] - datadir=/var/lib/mysql - socket=/var/lib/mysql/mysql.sock - symbolic-links=0 - - sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES - max_allowed_packet=150M - max_connections=600 - default-storage-engine=INNODB - character-set-server=utf8 - collation-server=utf8_unicode_ci - - [mysqld_safe] - log-error=/var/log/mysqld.log - pid-file=/var/run/mysqld/mysqld.pid - default-storage-engine=INNODB - character-set-server=utf8 - collation-server=utf8_unicode_ci - - [mysql] - max_allowed_packet = 150M - [mysqldump] - quick - -Save the changes made in the configuration file and restart mysql services. - - [root@centos-007 ~]# service mysqld restart - -### Download Zephyr Installation Package ### - -We done with installation of required packages necessary to install Zephyr. Now we need to get the binary distributed package of Zephyr and its license key. Go to official download link of Zephyr that is http://download.yourzephyr.com/linux/download.php give your email ID and click to download. - -![Zephyr Download](http://blog.linoxide.com/wp-content/uploads/2015/08/13.png) - -Then and confirm your mentioned Email Address and you will get the Zephyr Download link and its License Key link. So click on the provided links and choose the appropriate version of your Operating system to download the binary installation package and its license file to the server. - -We have placed it in the home directory and modify its permissions to make it executable. - -![Zephyr Binary](http://blog.linoxide.com/wp-content/uploads/2015/08/22.png) - -### Start Zephyr Installation and Configuration ### - -Now we are ready to start the installation of Zephyr by executing its binary installation script as below. - - [root@centos-007 ~]# ./zephyr_4_7_9213_linux_setup.sh –c - -Once you run the above command, it will check for the Java environment variables to be properly setup and configured. If there's some mis-configuration you might the error like. - - testing JVM in /usr ... - Starting Installer ... - Error : Either JDK is not found at expected locations or JDK version is mismatched. - Zephyr requires Oracle Java Development Kit (JDK) version 1.7 or higher. - -Once you have properly configured your Java, then it will start installation of Zephyr and asks to press "o" to proceed and "c" to cancel the setup. Let's type "o" and press "Enter" key to start installation. - -![install zephyr](http://blog.linoxide.com/wp-content/uploads/2015/08/32.png) - -The next option is to review all the requirements for the Zephyr setup and Press "Enter" to move forward to next option. - -![zephyr requirements](http://blog.linoxide.com/wp-content/uploads/2015/08/42.png) - -To accept the license agreement type "1" and Press Enter. - - I accept the terms of this license agreement [1], I do not accept the terms of this license agreement [2, Enter] - -Here we need to choose the appropriate destination location where we want to install the zephyr and choose the default ports, if you want to choose other than default ports, you are free to mention here. - -![installation folder](http://blog.linoxide.com/wp-content/uploads/2015/08/52.png) - -Then customize the mysql database parameters and give the right paths to the configurations file. You might the an error at this point as shown below. - - Please update MySQL configuration. Configuration parameter max_connection should be at least 500 (max_connection = 500) and max_allowed_packet should be at least 50MB (max_allowed_packet = 50M). - -To overcome this error make sure that you have configure the "max_connection" and "max_allowed_packet" limits properly in the mysql configuration file. So confirm these settings, connect to mysql server and run the commands as shown. - -![mysql connections](http://blog.linoxide.com/wp-content/uploads/2015/08/62.png) - -Once you have configured your mysql database properly, it will extract the configuration files to complete the setup. - -![mysql customization](http://blog.linoxide.com/wp-content/uploads/2015/08/72.png) - -The installation process completes with successful installation of Zephyr 4.7 on your computer. To Launch Zephyr Desktop type "y" to finish Zephyr installation. - -![launch zephyr](http://blog.linoxide.com/wp-content/uploads/2015/08/82.png) - -### Launch Zephyr Desktop ### - -Open your web browser to launch Zephyr Desktop with your localhost IP adress and you will be direted to the Zephyr Desktop. - - http://your_server_IP/zephyr/desktop/ - -![Zephyr Desktop](http://blog.linoxide.com/wp-content/uploads/2015/08/91.png) - -From your Zephyr Dashboard click on the "Test Manager" and login with the dault user name and password that is "test.manager". - -![Test Manage Login](http://blog.linoxide.com/wp-content/uploads/2015/08/test_manager_login.png) - -Once you are loged in you will be able to configure your administrative settings as shown. So choose the settings you wish to put according to your environment. - -![Test Manage Administration](http://blog.linoxide.com/wp-content/uploads/2015/08/test_manage_admin.png) - -Save the settings after you have done with your administrative settings, similarly do the settings of resources management and project setup and start using Zephyr as a complete set of your testing management tool. You check and edit the status of your administrative settings from the Department Dashboard Management as shown. - -![zephyr dashboard](http://blog.linoxide.com/wp-content/uploads/2015/08/dashboard.png) - -### Conclusion ### - -Cheers! we have done with the complete setup of Zephyr installation setup on Centos 7.1. We hope you are now much aware of Zephyr Test management tool which offer the prospect of streamlining the testing process and allow quick access to data analysis, collaborative tools and easy communication across multiple project teams. Feel free to comment us if you find any difficulty while you are doing it in your environment. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-how-to/setup-zephyr-tool-centos-7-x/ - -作者:[Kashif Siddique][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/kashifs/ \ No newline at end of file diff --git a/sources/tech/20150831 How to switch from NetworkManager to systemd-networkd on Linux.md b/sources/tech/20150831 How to switch from NetworkManager to systemd-networkd on Linux.md deleted file mode 100644 index bc7ebee015..0000000000 --- a/sources/tech/20150831 How to switch from NetworkManager to systemd-networkd on Linux.md +++ /dev/null @@ -1,167 +0,0 @@ -Translating by Ping - -How to switch from NetworkManager to systemd-networkd on Linux -================================================================================ -In the world of Linux, adoption of [systemd][1] has been a subject of heated controversy, and the debate between its proponents and critics is still going on. As of today, most major Linux distributions have adopted systemd as a default init system. - -Billed as a "never finished, never complete, but tracking progress of technology" by its author, systemd is not just the init daemon, but is designed as a more broad system and service management platform which encompasses the growing ecosystem of core system daemons, libraries and utilities. - -One of many additions to **systemd** is **systemd-networkd**, which is responsible for network configuration within the systemd ecosystem. Using systemd-networkd, you can configure basic DHCP/static IP networking for network devices. It can also configure virtual networking features such as bridges, tunnels or VLANs. Wireless networking is not directly handled by systemd-networkd, but you can use wpa_supplicant service to configure wireless adapters, and then hook it up with **systemd-networkd**. - -On many Linux distributions, NetworkManager has been and is still used as a default network configuration manager. Compared to NetworkManager, **systemd-networkd** is still under active development, and missing features. For example, it does not have NetworkManager's intelligence to keep your computer connected across various interfaces at all times. It does not provide ifup/ifdown hooks for advanced scripting. Yet, systemd-networkd is integrated well with the rest of systemd components (e.g., **resolved** for DNS, **timesyncd** for NTP, udevd for naming), and the role of **systemd-networkd** may only grow over time in the systemd environment. - -If you are happy with the way **systemd** is evolving, one thing you can consider is to switch from NetworkManager to systemd-networkd. If you are feverishly against systemd, and perfectly happy with NetworkManager or [basic network service][2], that is totally cool. - -But for those of you who want to try out systemd-networkd, you can read on, and find out in this tutorial how to switch from NetworkManager to systemd-networkd on Linux. - -### Requirement ### - -systemd-networkd is available in systemd version 210 and higher. Thus distributions like Debian 8 "Jessie" (systemd 215), Fedora 21 (systemd 217), Ubuntu 15.04 (systemd 219) or later are compatible with systemd-networkd. - -For other distributions, check the version of your systemd before proceeding. - - $ systemctl --version - -### Switch from Network Manager to Systemd-Networkd ### - -It is relatively straightforward to switch from Network Manager to systemd-networkd (and vice versa). - -First, disable Network Manager service, and enable systemd-networkd as follows. - - $ sudo systemctl disable NetworkManager - $ sudo systemctl enable systemd-networkd - -You also need to enable **systemd-resolved** service, which is used by systemd-networkd for network name resolution. This service implements a caching DNS server. - - $ sudo systemctl enable systemd-resolved - $ sudo systemctl start systemd-resolved - -Once started, **systemd-resolved** will create its own resolv.conf somewhere under /run/systemd directory. However, it is a common practise to store DNS resolver information in /etc/resolv.conf, and many applications still rely on /etc/resolv.conf. Thus for compatibility reason, create a symlink to /etc/resolv.conf as follows. - - $ sudo rm /etc/resolv.conf - $ sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf - -### Configure Network Connections with Systemd-networkd ### - -To configure network devices with systemd-networkd, you must specify configuration information in text files with .network extension. These network configuration files are then stored and loaded from /etc/systemd/network. When there are multiple files, systemd-networkd loads and processes them one by one in lexical order. - -Let's start by creating a folder /etc/systemd/network. - - $ sudo mkdir /etc/systemd/network - -#### DHCP Networking #### - -Let's configure DHCP networking first. For this, create the following configuration file. The name of a file can be arbitrary, but remember that files are processed in lexical order. - - $ sudo vi /etc/systemd/network/20-dhcp.network - ----------- - - [Match] - Name=enp3* - - [Network] - DHCP=yes - -As you can see above, each network configuration file contains one or more "sections" with each section preceded by [XXX] heading. Each section contains one or more key/value pairs. The [Match] section determine which network device(s) are configured by this configuration file. For example, this file matches any network interface whose name starts with ens3 (e.g., enp3s0, enp3s1, enp3s2, etc). For matched interface(s), it then applies DHCP network configuration specified under [Network] section. - -### Static IP Networking ### - -If you want to assign a static IP address to a network interface, create the following configuration file. - - $ sudo vi /etc/systemd/network/10-static-enp3s0.network - ----------- - - [Match] - Name=enp3s0 - - [Network] - Address=192.168.10.50/24 - Gateway=192.168.10.1 - DNS=8.8.8.8 - -As you can guess, the interface enp3s0 will be assigned an address 192.168.10.50/24, a default gateway 192.168.10.1, and a DNS server 8.8.8.8. One subtlety here is that the name of an interface enp3s0, in facts, matches the pattern rule defined in the earlier DHCP configuration as well. However, since the file "10-static-enp3s0.network" is processed before "20-dhcp.network" according to lexical order, the static configuration takes priority over DHCP configuration in case of enp3s0 interface. - -Once you are done with creating configuration files, restart systemd-networkd service or reboot. - - $ sudo systemctl restart systemd-networkd - -Check the status of the service by running: - - $ systemctl status systemd-networkd - $ systemctl status systemd-resolved - -![](https://farm1.staticflickr.com/719/21010813392_76abe123ed_c.jpg) - -### Configure Virtual Network Devices with Systemd-networkd ### - -**systemd-networkd** also allows you to configure virtual network devices such as bridges, VLANs, tunnel, VXLAN, bonding, etc. You must configure these virtual devices in files with .netdev extension. - -Here I'll show how to configure a bridge interface. - -#### Linux Bridge #### - -If you want to create a Linux bridge (br0) and add a physical interface (eth1) to the bridge, create the following configuration. - - $ sudo vi /etc/systemd/network/bridge-br0.netdev - ----------- - - [NetDev] - Name=br0 - Kind=bridge - -Then configure the bridge interface br0 and the slave interface eth1 using .network files as follows. - - $ sudo vi /etc/systemd/network/bridge-br0-slave.network - ----------- - - [Match] - Name=eth1 - - [Network] - Bridge=br0 - ----------- - - $ sudo vi /etc/systemd/network/bridge-br0.network - ----------- - - [Match] - Name=br0 - - [Network] - Address=192.168.10.100/24 - Gateway=192.168.10.1 - DNS=8.8.8.8 - -Finally, restart systemd-networkd: - - $ sudo systemctl restart systemd-networkd - -You can use [brctl tool][3] to verify that a bridge br0 has been created. - -### Summary ### - -When systemd promises to be a system manager for Linux, it is no wonder something like systemd-networkd came into being to manage network configurations. At this stage, however, systemd-networkd seems more suitable for a server environment where network configurations are relatively stable. For desktop/laptop environments which involve various transient wired/wireless interfaces, NetworkManager may still be a preferred choice. - -For those who want to check out more on systemd-networkd, refer to the official [man page][4] for a complete list of supported sections and keys. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/switch-from-networkmanager-to-systemd-networkd.html - -作者:[Dan Nanni][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://xmodulo.com/author/nanni -[1]:http://xmodulo.com/use-systemd-system-administration-debian.html -[2]:http://xmodulo.com/disable-network-manager-linux.html -[3]:http://xmodulo.com/how-to-configure-linux-bridge-interface.html -[4]:http://www.freedesktop.org/software/systemd/man/systemd.network.html diff --git a/sources/tech/20150831 Linux workstation security checklist.md b/sources/tech/20150831 Linux workstation security checklist.md deleted file mode 100644 index 9ef46339d0..0000000000 --- a/sources/tech/20150831 Linux workstation security checklist.md +++ /dev/null @@ -1,801 +0,0 @@ -wyangsun translating -Linux workstation security checklist -================================================================================ -This is a set of recommendations used by the Linux Foundation for their systems -administrators. All of LF employees are remote workers and we use this set of -guidelines to ensure that a sysadmin's system passes core security requirements -in order to reduce the risk of it becoming an attack vector against the rest -of our infrastructure. - -Even if your systems administrators are not remote workers, chances are that -they perform a lot of their work either from a portable laptop in a work -environment, or set up their home systems to access the work infrastructure -for after-hours/emergency support. In either case, you can adapt this set of -recommendations to suit your environment. - -This, by no means, is an exhaustive "workstation hardening" document, but -rather an attempt at a set of baseline recommendations to avoid most glaring -security errors without introducing too much inconvenience. You may read this -document and think it is way too paranoid, while someone else may think this -barely scratches the surface. Security is just like driving on the highway -- -anyone going slower than you is an idiot, while anyone driving faster than you -is a crazy person. These guidelines are merely a basic set of core safety -rules that is neither exhaustive, nor a replacement for experience, vigilance, -and common sense. - -Each section is split into two areas: - -- The checklist that can be adapted to your project's needs -- Free-form list of considerations that explain what dictated these decisions - -## Severity levels - -The items in each checklist include the severity level, which we hope will help -guide your decision: - -- _(CRITICAL)_ items should definitely be high on the consideration list. - If not implemented, they will introduce high risks to your workstation - security. -- _(MODERATE)_ items will improve your security posture, but are less - important, especially if they interfere too much with your workflow. -- _(LOW)_ items may improve the overall security, but may not be worth the - convenience trade-offs. -- _(PARANOID)_ is reserved for items we feel will dramatically improve your - workstation security, but will probably require a lot of adjustment to the - way you interact with your operating system. - -Remember, these are only guidelines. If you feel these severity levels do not -reflect your project's commitment to security, you should adjust them as you -see fit. - -## Choosing the right hardware - -We do not mandate that our admins use a specific vendor or a specific model, so -this section addresses core considerations when choosing a work system. - -### Checklist - -- [ ] System supports SecureBoot _(CRITICAL)_ -- [ ] System has no firewire, thunderbolt or ExpressCard ports _(MODERATE)_ -- [ ] System has a TPM chip _(LOW)_ - -### Considerations - -#### SecureBoot - -Despite its controversial nature, SecureBoot offers prevention against many -attacks targeting workstations (Rootkits, "Evil Maid," etc), without -introducing too much extra hassle. It will not stop a truly dedicated attacker, -plus there is a pretty high degree of certainty that state security agencies -have ways to defeat it (probably by design), but having SecureBoot is better -than having nothing at all. - -Alternatively, you may set up [Anti Evil Maid][1] which offers a more -wholesome protection against the type of attacks that SecureBoot is supposed -to prevent, but it will require more effort to set up and maintain. - -#### Firewire, thunderbolt, and ExpressCard ports - -Firewire is a standard that, by design, allows any connecting device full -direct memory access to your system ([see Wikipedia][2]). Thunderbolt and -ExpressCard are guilty of the same, though some later implementations of -Thunderbolt attempt to limit the scope of memory access. It is best if the -system you are getting has none of these ports, but it is not critical, as -they usually can be turned off via UEFI or disabled in the kernel itself. - -#### TPM Chip - -Trusted Platform Module (TPM) is a crypto chip bundled with the motherboard -separately from the core processor, which can be used for additional platform -security (such as to store full-disk encryption keys), but is not normally used -for day-to-day workstation operation. At best, this is a nice-to-have, unless -you have a specific need to use TPM for your workstation security. - -## Pre-boot environment - -This is a set of recommendations for your workstation before you even start -with OS installation. - -### Checklist - -- [ ] UEFI boot mode is used (not legacy BIOS) _(CRITICAL)_ -- [ ] Password is required to enter UEFI configuration _(CRITICAL)_ -- [ ] SecureBoot is enabled _(CRITICAL)_ -- [ ] UEFI-level password is required to boot the system _(LOW)_ - -### Considerations - -#### UEFI and SecureBoot - -UEFI, with all its warts, offers a lot of goodies that legacy BIOS doesn't, -such as SecureBoot. Most modern systems come with UEFI mode on by default. - -Make sure a strong password is required to enter UEFI configuration mode. Pay -attention, as many manufacturers quietly limit the length of the password you -are allowed to use, so you may need to choose high-entropy short passwords vs. -long passphrases (see below for more on passphrases). - -Depending on the Linux distribution you decide to use, you may or may not have -to jump through additional hoops in order to import your distribution's -SecureBoot key that would allow you to boot the distro. Many distributions have -partnered with Microsoft to sign their released kernels with a key that is -already recognized by most system manufacturers, therefore saving you the -trouble of having to deal with key importing. - -As an extra measure, before someone is allowed to even get to the boot -partition and try some badness there, let's make them enter a password. This -password should be different from your UEFI management password, in order to -prevent shoulder-surfing. If you shut down and start a lot, you may choose to -not bother with this, as you will already have to enter a LUKS passphrase and -this will save you a few extra keystrokes. - -## Distro choice considerations - -Chances are you'll stick with a fairly widely-used distribution such as Fedora, -Ubuntu, Arch, Debian, or one of their close spin-offs. In any case, this is -what you should consider when picking a distribution to use. - -### Checklist - -- [ ] Has a robust MAC/RBAC implementation (SELinux/AppArmor/Grsecurity) _(CRITICAL)_ -- [ ] Publishes security bulletins _(CRITICAL)_ -- [ ] Provides timely security patches _(CRITICAL)_ -- [ ] Provides cryptographic verification of packages _(CRITICAL)_ -- [ ] Fully supports UEFI and SecureBoot _(CRITICAL)_ -- [ ] Has robust native full disk encryption support _(CRITICAL)_ - -### Considerations - -#### SELinux, AppArmor, and GrSecurity/PaX - -Mandatory Access Controls (MAC) or Role-Based Access Controls (RBAC) are an -extension of the basic user/group security mechanism used in legacy POSIX -systems. Most distributions these days either already come bundled with a -MAC/RBAC implementation (Fedora, Ubuntu), or provide a mechanism to add it via -an optional post-installation step (Gentoo, Arch, Debian). Obviously, it is -highly advised that you pick a distribution that comes pre-configured with a -MAC/RBAC system, but if you have strong feelings about a distribution that -doesn't have one enabled by default, do plan to configure it -post-installation. - -Distributions that do not provide any MAC/RBAC mechanisms should be strongly -avoided, as traditional POSIX user- and group-based security should be -considered insufficient in this day and age. If you would like to start out -with a MAC/RBAC workstation, AppArmor and PaX are generally considered easier -to learn than SELinux. Furthermore, on a workstation, where there are few or -no externally listening daemons, and where user-run applications pose the -highest risk, GrSecurity/PaX will _probably_ offer more security benefits than -SELinux. - -#### Distro security bulletins - -Most of the widely used distributions have a mechanism to deliver security -bulletins to their users, but if you are fond of something esoteric, check -whether the developers have a documented mechanism of alerting the users about -security vulnerabilities and patches. Absence of such mechanism is a major -warning sign that the distribution is not mature enough to be considered for a -primary admin workstation. - -#### Timely and trusted security updates - -Most of the widely used distributions deliver regular security updates, but is -worth checking to ensure that critical package updates are provided in a -timely fashion. Avoid using spin-offs and "community rebuilds" for this -reason, as they routinely delay security updates due to having to wait for the -upstream distribution to release it first. - -You'll be hard-pressed to find a distribution that does not use cryptographic -signatures on packages, updates metadata, or both. That being said, fairly -widely used distributions have been known to go for years before introducing -this basic security measure (Arch, I'm looking at you), so this is a thing -worth checking. - -#### Distros supporting UEFI and SecureBoot - -Check that the distribution supports UEFI and SecureBoot. Find out whether it -requires importing an extra key or whether it signs its boot kernels with a key -already trusted by systems manufacturers (e.g. via an agreement with -Microsoft). Some distributions do not support UEFI/SecureBoot but offer -alternatives to ensure tamper-proof or tamper-evident boot environments -([Qubes-OS][3] uses Anti Evil Maid, mentioned earlier). If a distribution -doesn't support SecureBoot and has no mechanisms to prevent boot-level attacks, -look elsewhere. - -#### Full disk encryption - -Full disk encryption is a requirement for securing data at rest, and is -supported by most distributions. As an alternative, systems with -self-encrypting hard drives may be used (normally implemented via the on-board -TPM chip) and offer comparable levels of security plus faster operation, but at -a considerably higher cost. - -## Distro installation guidelines - -All distributions are different, but here are general guidelines: - -### Checklist - -- [ ] Use full disk encryption (LUKS) with a robust passphrase _(CRITICAL)_ -- [ ] Make sure swap is also encrypted _(CRITICAL)_ -- [ ] Require a password to edit bootloader (can be same as LUKS) _(CRITICAL)_ -- [ ] Set up a robust root password (can be same as LUKS) _(CRITICAL)_ -- [ ] Use an unprivileged account, part of administrators group _(CRITICAL)_ -- [ ] Set up a robust user-account password, different from root _(CRITICAL)_ - -### Considerations - -#### Full disk encryption - -Unless you are using self-encrypting hard drives, it is important to configure -your installer to fully encrypt all the disks that will be used for storing -your data and your system files. It is not sufficient to simply encrypt the -user directory via auto-mounting cryptfs loop files (I'm looking at you, older -versions of Ubuntu), as this offers no protection for system binaries or swap, -which is likely to contain a slew of sensitive data. The recommended -encryption strategy is to encrypt the LVM device, so only one passphrase is -required during the boot process. - -The `/boot` partition will always remain unencrypted, as the bootloader needs -to be able to actually boot the kernel before invoking LUKS/dm-crypt. The -kernel image itself should be protected against tampering with a cryptographic -signature checked by SecureBoot. - -In other words, `/boot` should always be the only unencrypted partition on your -system. - -#### Choosing good passphrases - -Modern Linux systems have no limitation of password/passphrase length, so the -only real limitation is your level of paranoia and your stubbornness. If you -boot your system a lot, you will probably have to type at least two different -passwords: one to unlock LUKS, and another one to log in, so having long -passphrases will probably get old really fast. Pick passphrases that are 2-3 -words long, easy to type, and preferably from rich/mixed vocabularies. - -Examples of good passphrases (yes, you can use spaces): -- nature abhors roombas -- 12 in-flight Jebediahs -- perdon, tengo flatulence - -You can also stick with non-vocabulary passwords that are at least 10-12 -characters long, if you prefer that to typing passphrases. - -Unless you have concerns about physical security, it is fine to write down your -passphrases and keep them in a safe place away from your work desk. - -#### Root, user passwords and the admin group - -We recommend that you use the same passphrase for your root password as you -use for your LUKS encryption (unless you share your laptop with other trusted -people who should be able to unlock the drives, but shouldn't be able to -become root). If you are the sole user of the laptop, then having your root -password be different from your LUKS password has no meaningful security -advantages. Generally, you can use the same passphrase for your UEFI -administration, disk encryption, and root account -- knowing any of these will -give an attacker full control of your system anyway, so there is little -security benefit to have them be different on a single-user workstation. - -You should have a different, but equally strong password for your regular user -account that you will be using for day-to-day tasks. This user should be member -of the admin group (e.g. `wheel` or similar, depending on the distribution), -allowing you to perform `sudo` to elevate privileges. - -In other words, if you are the sole user on your workstation, you should have 2 -distinct, robust, equally strong passphrases you will need to remember: - -**Admin-level**, used in the following locations: - -- UEFI administration -- Bootloader (GRUB) -- Disk encryption (LUKS) -- Workstation admin (root user) - -**User-level**, used for the following: - -- User account and sudo -- Master password for the password manager - -All of them, obviously, can be different if there is a compelling reason. - -## Post-installation hardening - -Post-installation security hardening will depend greatly on your distribution -of choice, so it is futile to provide detailed instructions in a general -document such as this one. However, here are some steps you should take: - -### Checklist - -- [ ] Globally disable firewire and thunderbolt modules _(CRITICAL)_ -- [ ] Check your firewalls to ensure all incoming ports are filtered _(CRITICAL)_ -- [ ] Make sure root mail is forwarded to an account you check _(CRITICAL)_ -- [ ] Check to ensure sshd service is disabled by default _(MODERATE)_ -- [ ] Set up an automatic OS update schedule, or update reminders _(MODERATE)_ -- [ ] Configure the screensaver to auto-lock after a period of inactivity _(MODERATE)_ -- [ ] Set up logwatch _(MODERATE)_ -- [ ] Install and use rkhunter _(LOW)_ -- [ ] Install an Intrusion Detection System _(PARANOID)_ - -### Considerations - -#### Blacklisting modules - -To blacklist a firewire and thunderbolt modules, add the following lines to a -file in `/etc/modprobe.d/blacklist-dma.conf`: - - blacklist firewire-core - blacklist thunderbolt - -The modules will be blacklisted upon reboot. It doesn't hurt doing this even if -you don't have these ports (but it doesn't do anything either). - -#### Root mail - -By default, root mail is just saved on the system and tends to never be read. -Make sure you set your `/etc/aliases` to forward root mail to a mailbox that -you actually read, otherwise you may miss important system notifications and -reports: - - # Person who should get root's mail - root: bob@example.com - -Run `newaliases` after this edit and test it out to make sure that it actually -gets delivered, as some email providers will reject email coming in from -nonexistent or non-routable domain names. If that is the case, you will need to -play with your mail forwarding configuration until this actually works. - -#### Firewalls, sshd, and listening daemons - -The default firewall settings will depend on your distribution, but many of -them will allow incoming `sshd` ports. Unless you have a compelling legitimate -reason to allow incoming ssh, you should filter that out and disable the `sshd` -daemon. - - systemctl disable sshd.service - systemctl stop sshd.service - -You can always start it temporarily if you need to use it. - -In general, your system shouldn't have any listening ports apart from -responding to ping. This will help safeguard you against network-level 0-day -exploits. - -#### Automatic updates or notifications - -It is recommended to turn on automatic updates, unless you have a very good -reason not to do so, such as fear that an automatic update would render your -system unusable (it's happened in the past, so this fear is not unfounded). At -the very least, you should enable automatic notifications of available updates. -Most distributions already have this service automatically running for you, so -chances are you don't have to do anything. Consult your distribution -documentation to find out more. - -You should apply all outstanding errata as soon as possible, even if something -isn't specifically labeled as "security update" or has an associated CVE code. -All bugs have the potential of being security bugs and erring on the side of -newer, unknown bugs is _generally_ a safer strategy than sticking with old, -known ones. - -#### Watching logs - -You should have a keen interest in what happens on your system. For this -reason, you should install `logwatch` and configure it to send nightly activity -reports of everything that happens on your system. This won't prevent a -dedicated attacker, but is a good safety-net feature to have in place. - -Note, that many systemd distros will no longer automatically install a syslog -server that `logwatch` needs (due to systemd relying on its own journal), so -you will need to install and enable `rsyslog` to make sure your `/var/log` is -not empty before logwatch will be of any use. - -#### Rkhunter and IDS - -Installing `rkhunter` and an intrusion detection system (IDS) like `aide` or -`tripwire` will not be that useful unless you actually understand how they work -and take the necessary steps to set them up properly (such as, keeping the -databases on external media, running checks from a trusted environment, -remembering to refresh the hash databases after performing system updates and -configuration changes, etc). If you are not willing to take these steps and -adjust how you do things on your own workstation, these tools will introduce -hassle without any tangible security benefit. - -We do recommend that you install `rkhunter` and run it nightly. It's fairly -easy to learn and use, and though it will not deter a sophisticated attacker, -it may help you catch your own mistakes. - -## Personal workstation backups - -Workstation backups tend to be overlooked or done in a haphazard, often unsafe -manner. - -### Checklist - -- [ ] Set up encrypted workstation backups to external storage _(CRITICAL)_ -- [ ] Use zero-knowledge backup tools for cloud backups _(MODERATE)_ - -### Considerations - -#### Full encrypted backups to external storage - -It is handy to have an external hard drive where one can dump full backups -without having to worry about such things like bandwidth and upstream speeds -(in this day and age most providers still offer dramatically asymmetric -upload/download speeds). Needless to say, this hard drive needs to be in itself -encrypted (again, via LUKS), or you should use a backup tool that creates -encrypted backups, such as `duplicity` or its GUI companion, `deja-dup`. I -recommend using the latter with a good randomly generated passphrase, stored in -your password manager. If you travel with your laptop, leave this drive at home -to have something to come back to in case your laptop is lost or stolen. - -In addition to your home directory, you should also back up `/etc` and -`/var/log` for various forensic purposes. - -Above all, avoid copying your home directory onto any unencrypted storage, even -as a quick way to move your files around between systems, as you will most -certainly forget to erase it once you're done, exposing potentially private or -otherwise security sensitive data to snooping hands -- especially if you keep -that storage media in the same bag with your laptop. - -#### Selective zero-knowledge backups off-site - -Off-site backups are also extremely important and can be done either to your -employer, if they offer space for it, or to a cloud provider. You can set up a -separate duplicity/deja-dup profile to only include most important files in -order to avoid transferring huge amounts of data that you don't really care to -back up off-site (internet cache, music, downloads, etc). - -Alternatively, you can use a zero-knowledge backup tool, such as -[SpiderOak][5], which offers an excellent Linux GUI tool and has additional -useful features such as synchronizing content between multiple systems and -platforms. - -## Best practices - -What follows is a curated list of best practices that we think you should -adopt. It is most certainly non-exhaustive, but rather attempts to offer -practical advice that strikes a workable balance between security and overall -usability. - -### Browsing - -There is no question that the web browser will be the piece of software with -the largest and the most exposed attack surface on your system. It is a tool -written specifically to download and execute untrusted, frequently hostile -code. It attempts to shield you from this danger by employing multiple -mechanisms such as sandboxes and code sanitization, but they have all been -previously defeated on multiple occasions. You should learn to approach -browsing websites as the most insecure activity you'll engage in on any given -day. - -There are several ways you can reduce the impact of a compromised browser, but -the truly effective ways will require significant changes in the way you -operate your workstation. - -#### 1: Use two different browsers - -This is the easiest to do, but only offers minor security benefits. Not all -browser compromises give an attacker full unfettered access to your system -- -sometimes they are limited to allowing one to read local browser storage, -steal active sessions from other tabs, capture input entered into the browser, -etc. Using two different browsers, one for work/high security sites, and -another for everything else will help prevent minor compromises from giving -attackers access to the whole cookie jar. The main inconvenience will be the -amount of memory consumed by two different browser processes. - -Here's what we recommend: - -##### Firefox for work and high security sites - -Use Firefox to access work-related sites, where extra care should be taken to -ensure that data like cookies, sessions, login information, keystrokes, etc, -should most definitely not fall into attackers' hands. You should NOT use -this browser for accessing any other sites except select few. - -You should install the following Firefox add-ons: - -- [ ] NoScript _(CRITICAL)_ - - NoScript prevents active content from loading, except from user - whitelisted domains. It is a great hassle to use with your default browser - (though offers really good security benefits), so we recommend only - enabling it on the browser you use to access work-related sites. - -- [ ] Privacy Badger _(CRITICAL)_ - - EFF's Privacy Badger will prevent most external trackers and ad platforms - from being loaded, which will help avoid compromises on these tracking - sites from affecting your browser (trackers and ad sites are very commonly - targeted by attackers, as they allow rapid infection of thousands of - systems worldwide). - -- [ ] HTTPS Everywhere _(CRITICAL)_ - - This EFF-developed Add-on will ensure that most of your sites are accessed - over a secure connection, even if a link you click is using http:// (great - to avoid a number of attacks, such as [SSL-strip][7]). - -- [ ] Certificate Patrol _(MODERATE)_ - - This tool will alert you if the site you're accessing has recently changed - their TLS certificates -- especially if it wasn't nearing expiration dates - or if it is now using a different certification authority. It helps - alert you if someone is trying to man-in-the-middle your connection, - but generates a lot of benign false-positives. - -You should leave Firefox as your default browser for opening links, as -NoScript will prevent most active content from loading or executing. - -##### Chrome/Chromium for everything else - -Chromium developers are ahead of Firefox in adding a lot of nice security -features (at least [on Linux][6]), such as seccomp sandboxes, kernel user -namespaces, etc, which act as an added layer of isolation between the sites -you visit and the rest of your system. Chromium is the upstream open-source -project, and Chrome is Google's proprietary binary build based on it (insert -the usual paranoid caution about not using it for anything you don't want -Google to know about). - -It is recommended that you install **Privacy Badger** and **HTTPS Everywhere** -extensions in Chrome as well and give it a distinct theme from Firefox to -indicate that this is your "untrusted sites" browser. - -#### 2: Use two different browsers, one inside a dedicated VM - -This is a similar recommendation to the above, except you will add an extra -step of running Chrome inside a dedicated VM that you access via a fast -protocol, allowing you to share clipboards and forward sound events (e.g. -Spice or RDP). This will add an excellent layer of isolation between the -untrusted browser and the rest of your work environment, ensuring that -attackers who manage to fully compromise your browser will then have to -additionally break out of the VM isolation layer in order to get to the rest -of your system. - -This is a surprisingly workable configuration, but requires a lot of RAM and -fast processors that can handle the increased load. It will also require an -important amount of dedication on the part of the admin who will need to -adjust their work practices accordingly. - -#### 3: Fully separate your work and play environments via virtualization - -See [Qubes-OS project][3], which strives to provide a high-security -workstation environment via compartmentalizing your applications into separate -fully isolated VMs. - -### Password managers - -#### Checklist - -- [ ] Use a password manager _(CRITICAL_) -- [ ] Use unique passwords on unrelated sites _(CRITICAL)_ -- [ ] Use a password manager that supports team sharing _(MODERATE)_ -- [ ] Use a separate password manager for non-website accounts _(PARANOID)_ - -#### Considerations - -Using good, unique passwords should be a critical requirement for every member -of your team. Credential theft is happening all the time -- either via -compromised computers, stolen database dumps, remote site exploits, or any -number of other means. No credentials should ever be reused across sites, -especially for critical applications. - -##### In-browser password manager - -Every browser has a mechanism for saving passwords that is fairly secure and -can sync with vendor-maintained cloud storage while keeping the data encrypted -with a user-provided passphrase. However, this mechanism has important -disadvantages: - -1. It does not work across browsers -2. It does not offer any way of sharing credentials with team members - -There are several well-supported, free-or-cheap password managers that are -well-integrated into multiple browsers, work across platforms, and offer -group sharing (usually as a paid service). Solutions can be easily found via -search engines. - -##### Standalone password manager - -One of the major drawbacks of any password manager that comes integrated with -the browser is the fact that it's part of the application that is most likely -to be attacked by intruders. If this makes you uncomfortable (and it should), -you may choose to have two different password managers -- one for websites -that is integrated into your browser, and one that runs as a standalone -application. The latter can be used to store high-risk credentials such as -root passwords, database passwords, other shell account credentials, etc. - -It may be particularly useful to have such tool for sharing superuser account -credentials with other members of your team (server root passwords, ILO -passwords, database admin passwords, bootloader passwords, etc). - -A few tools can help you: - -- [KeePassX][8], which improves team sharing in version 2 -- [Pass][9], which uses text files and PGP and integrates with git -- [Django-Pstore][10], which uses GPG to share credentials between admins -- [Hiera-Eyaml][11], which, if you are already using Puppet for your - infrastructure, may be a handy way to track your server/service credentials - as part of your encrypted Hiera data store - -### Securing SSH and PGP private keys - -Personal encryption keys, including SSH and PGP private keys, are going to be -the most prized items on your workstation -- something the attackers will be -most interested in obtaining, as that would allow them to further attack your -infrastructure or impersonate you to other admins. You should take extra steps -to ensure that your private keys are well protected against theft. - -#### Checklist - -- [ ] Strong passphrases are used to protect private keys _(CRITICAL)_ -- [ ] PGP Master key is stored on removable storage _(MODERATE)_ -- [ ] Auth, Sign and Encrypt Subkeys are stored on a smartcard device _(MODERATE)_ -- [ ] SSH is configured to use PGP Auth key as ssh private key _(MODERATE)_ - -#### Considerations - -The best way to prevent private key theft is to use a smartcard to store your -encryption private keys and never copy them onto the workstation. There are -several manufacturers that offer OpenPGP capable devices: - -- [Kernel Concepts][12], where you can purchase both the OpenPGP compatible - smartcards and the USB readers, should you need one. -- [Yubikey NEO][13], which offers OpenPGP smartcard functionality in addition - to many other cool features (U2F, PIV, HOTP, etc). - -It is also important to make sure that the master PGP key is not stored on the -main workstation, and only subkeys are used. The master key will only be -needed when signing someone else's keys or creating new subkeys -- operations -which do not happen very frequently. You may follow [the Debian's subkeys][14] -guide to learn how to move your master key to removable storage and how to -create subkeys. - -You should then configure your gnupg agent to act as ssh agent and use the -smartcard-based PGP Auth key to act as your ssh private key. We publish a -[detailed guide][15] on how to do that using either a smartcard reader or a -Yubikey NEO. - -If you are not willing to go that far, at least make sure you have a strong -passphrase on both your PGP private key and your SSH private key, which will -make it harder for attackers to steal and use them. - -### SELinux on the workstation - -If you are using a distribution that comes bundled with SELinux (such as -Fedora), here are some recommendation of how to make the best use of it to -maximize your workstation security. - -#### Checklist - -- [ ] Make sure SELinux is enforcing on your workstation _(CRITICAL)_ -- [ ] Never blindly run `audit2allow -M`, always check _(CRITICAL)_ -- [ ] Never `setenforce 0` _(MODERATE)_ -- [ ] Switch your account to SELinux user `staff_u` _(MODERATE)_ - -#### Considerations - -SELinux is a Mandatory Access Controls (MAC) extension to core POSIX -permissions functionality. It is mature, robust, and has come a long way since -its initial roll-out. Regardless, many sysadmins to this day repeat the -outdated mantra of "just turn it off." - -That being said, SELinux will have limited security benefits on the -workstation, as most applications you will be running as a user are going to -be running unconfined. It does provide enough net benefit to warrant leaving -it on, as it will likely help prevent an attacker from escalating privileges -to gain root-level access via a vulnerable daemon service. - -Our recommendation is to leave it on and enforcing. - -##### Never `setenforce 0` - -It's tempting to use `setenforce 0` to flip SELinux into permissive mode -on a temporary basis, but you should avoid doing that. This essentially turns -off SELinux for the entire system, while what you really want is to -troubleshoot a particular application or daemon. - -Instead of `setenforce 0` you should be using `semanage permissive -a -[somedomain_t]` to put only that domain into permissive mode. First, find out -which domain is causing troubles by running `ausearch`: - - ausearch -ts recent -m avc - -and then look for `scontext=` (source SELinux context) line, like so: - - scontext=staff_u:staff_r:gpg_pinentry_t:s0-s0:c0.c1023 - ^^^^^^^^^^^^^^ - -This tells you that the domain being denied is `gpg_pinentry_t`, so if you -want to troubleshoot the application, you should add it to permissive domains: - - semange permissive -a gpg_pinentry_t - -This will allow you to use the application and collect the rest of the AVCs, -which you can then use in conjunction with `audit2allow` to write a local -policy. Once that is done and you see no new AVC denials, you can remove that -domain from permissive by running: - - semanage permissive -d gpg_pinentry_t - -##### Use your workstation as SELinux role staff_r - -SELinux comes with a native implementation of roles that prohibit or grant -certain privileges based on the role associated with the user account. As an -administrator, you should be using the `staff_r` role, which will restrict -access to many configuration and other security-sensitive files, unless you -first perform `sudo`. - -By default, accounts are created as `unconfined_r` and most applications you -execute will run unconfined, without any (or with only very few) SELinux -constraints. To switch your account to the `staff_r` role, run the following -command: - - usermod -Z staff_u [username] - -You should log out and log back in to enable the new role, at which point if -you run `id -Z`, you'll see: - - staff_u:staff_r:staff_t:s0-s0:c0.c1023 - -When performing `sudo`, you should remember to add an extra flag to tell -SELinux to transition to the "sysadmin" role. The command you want is: - - sudo -i -r sysadm_r - -At which point `id -Z` will show: - - staff_u:sysadm_r:sysadm_t:s0-s0:c0.c1023 - -**WARNING**: you should be comfortable using `ausearch` and `audit2allow` -before you make this switch, as it's possible some of your applications will -no longer work when you're running as role `staff_r`. At the time of writing, -the following popular applications are known to not work under `staff_r` -without policy tweaks: - -- Chrome/Chromium -- Skype -- VirtualBox - -To switch back to `unconfined_r`, run the following command: - - usermod -Z unconfined_u [username] - -and then log out and back in to get back into the comfort zone. - -## Further reading - -The world of IT security is a rabbit hole with no bottom. If you would like to -go deeper, or find out more about security features on your particular -distribution, please check out the following links: - -- [Fedora Security Guide](https://docs.fedoraproject.org/en-US/Fedora/19/html/Security_Guide/index.html) -- [CESG Ubuntu Security Guide](https://www.gov.uk/government/publications/end-user-devices-security-guidance-ubuntu-1404-lts) -- [Debian Security Manual](https://www.debian.org/doc/manuals/securing-debian-howto/index.en.html) -- [Arch Linux Security Wiki](https://wiki.archlinux.org/index.php/Security) -- [Mac OSX Security](https://www.apple.com/support/security/guides/) - -## License -This work is licensed under a -[Creative Commons Attribution-ShareAlike 4.0 International License][0]. - --------------------------------------------------------------------------------- - -via: https://github.com/lfit/itpol/blob/master/linux-workstation-security.md#linux-workstation-security-checklist - -作者:[mricon][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://github.com/mricon -[0]: http://creativecommons.org/licenses/by-sa/4.0/ -[1]: https://github.com/QubesOS/qubes-antievilmaid -[2]: https://en.wikipedia.org/wiki/IEEE_1394#Security_issues -[3]: https://qubes-os.org/ -[4]: https://xkcd.com/936/ -[5]: https://spideroak.com/ -[6]: https://code.google.com/p/chromium/wiki/LinuxSandboxing -[7]: http://www.thoughtcrime.org/software/sslstrip/ -[8]: https://keepassx.org/ -[9]: http://www.passwordstore.org/ -[10]: https://pypi.python.org/pypi/django-pstore -[11]: https://github.com/TomPoulton/hiera-eyaml -[12]: http://shop.kernelconcepts.de/ -[13]: https://www.yubico.com/products/yubikey-hardware/yubikey-neo/ -[14]: https://wiki.debian.org/Subkeys -[15]: https://github.com/lfit/ssh-gpg-smartcard-config diff --git a/sources/tech/20150906 Do Simple Math In Ubuntu And elementary OS With NaSC.md b/sources/tech/20150906 Do Simple Math In Ubuntu And elementary OS With NaSC.md deleted file mode 100644 index 512c0669f9..0000000000 --- a/sources/tech/20150906 Do Simple Math In Ubuntu And elementary OS With NaSC.md +++ /dev/null @@ -1,54 +0,0 @@ -ictlyh Translating -Do Simple Math In Ubuntu And elementary OS With NaSC -================================================================================ -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Make-Math-Simpler-with-NaSC.jpg) - -[NaSC][1], abbreviation Not a Soulver Clone, is a third party app developed for elementary OS. Whatever the name suggests, NaSC is heavily inspired by [Soulver][2], an OS X app for doing maths like a normal person. - -elementary OS itself draws from OS X and it is not a surprise that a number of the third party apps it has got, are also inspired by OS X apps. - -Coming back to NaSC, what exactly it means by “maths like a normal person “? Well, it means to write like how you think in your mind. As per the description of the app: - -> “Its an app where you do maths like a normal person. It lets you type whatever you want and smartly figures out what is math and spits out an answer on the right pane. Then you can plug those answers in to future equations and if that answer changes, so does the equations its used in.” - -Still not convinced? Here, take a look at this screenshot. - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/NaSC.png) - -Now, you see what is ‘math for normal person’? Honestly, I am not a fan of such apps but it might be useful for some of you perhaps. Let’s see how can you install NaSC in elementary OS, Ubuntu and Linux Mint. - -### Install NaSC in Ubuntu, elementary OS and Mint ### - -There is a PPA available for installing NaSC. The PPA says ‘daily’ which could mean daily build (i.e. unstable) but in my quick test, it worked just fine. - -Open a terminal and use the following commands: - - sudo apt-add-repository ppa:nasc-team/daily - sudo apt-get update - sudo apt-get install nasc - -Here is a screenshot of NaSC in Ubuntu 15.04: - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/NaSC-Ubuntu.png) - -If you want to remove it, you can use the following commands: - - sudo apt-get remove nasc - sudo apt-add-repository --remove ppa:nasc-team/daily - -If you try it, do share your experience with it. In addition to this, you can also try [Vocal podcast app for Linux][3] from third party elementary OS apps. - --------------------------------------------------------------------------------- - -via: http://itsfoss.com/math-ubuntu-nasc/ - -作者:[Abhishek][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://itsfoss.com/author/abhishek/ -[1]:http://parnold-x.github.io/nasc/ -[2]:http://www.acqualia.com/soulver/ -[3]:http://itsfoss.com/podcast-app-vocal-linux/ \ No newline at end of file diff --git a/sources/tech/20150906 How To Manage Log Files With Logrotate On Ubuntu 12.10.md b/sources/tech/20150906 How To Manage Log Files With Logrotate On Ubuntu 12.10.md deleted file mode 100644 index 0c7ae1a7e3..0000000000 --- a/sources/tech/20150906 How To Manage Log Files With Logrotate On Ubuntu 12.10.md +++ /dev/null @@ -1,117 +0,0 @@ -ictlyh Translating -How To Manage Log Files With Logrotate On Ubuntu 12.10 -================================================================================ -#### About Logrotate #### - -Logrotate is a utility/tool that manages activities like automatic rotation, removal and compression of log files in a system. This is an excellent tool to manage your logs conserve precious disk space. By having a simple yet powerful configuration file, different parameters of logrotation can be controlled. This gives complete control over the way logs can be automatically managed and need not necessitate manual intervention. - -### Prerequisites ### - -As a prerequisite, we are assuming that you have gone through the article on how to set up your droplet or VPS. If not, you can find the article [here][1]. This tutorial requires you to have a VPS up and running and have you log into it. - -#### Setup Logrotate #### - -### Step 1—Update System and System Packages ### - -Run the following command to update the package lists from apt-get and get the information on the newest versions of packages and their dependencies. - - sudo apt-get update - -### Step 2—Install Logrotate ### - -If logrotate is not already on your VPS, install it now through apt-get. - - sudo apt-get install logrotate - -### Step 3 — Confirmation ### - -To verify that logrotate was successfully installed, run this in the command prompt. - - logrotate - -Since the logrotate utility is based on configuration files, the above command will not rotate any files and will show you a brief overview of the usage and the switch options available. - -### Step 4—Configure Logrotate ### - -Configurations and default options for the logrotate utility are present in: - - /etc/logrotate.conf - -Some of the important configuration settings are : rotation-interval, log-file-size, rotation-count and compression. - -Application-specific log file information (to override the defaults) are kept at: - - /etc/logrotate.d/ - -We will have a look at a few examples to understand the concept better. - -### Step 5—Example ### - -An example application configuration setting would be the dpkg (Debian package management system), that is stored in /etc/logrotate.d/dpkg. One of the entries in this file would be: - - /var/log/dpkg.log { - monthly - rotate 12 - compress - delaycompress - missingok - notifempty - create 644 root root - } - -What this means is that: - -- the logrotation for dpkg monitors the /var/log/dpkg.log file and does this on a monthly basis this is the rotation interval. -- 'rotate 12' signifies that 12 days worth of logs would be kept. -- logfiles can be compressed using the gzip format by specifying 'compress' and 'delaycompress' delays the compression process till the next log rotation. 'delaycompress' will work only if 'compress' option is specified. -- 'missingok' avoids halting on any error and carries on with the next log file. -- 'notifempty' avoid log rotation if the logfile is empty. -- 'create ' creates a new empty file with the specified properties after log-rotation. - -Though missing in the above example, 'size' is also an important setting if you want to control the sizing of the logs growing in the system. - -A configuration setting of around 100MB would look like: - - size 100M - -Note that If both size and rotation interval are set, then size is taken as a higher priority. That is, if a configuration file has the following settings: - - monthly - size 100M - -then the logs are rotated once the file size reaches 100M and this need not wait for the monthly cycle. - -### Step 6—Cron Job ### - -You can also set the logrotation as a cron so that the manual process can be avoided and this is taken care of automatically. By specifying an entry in /etc/cron.daily/logrotate , the rotation is triggered daily. - -### Step 7—Status Check and Verification ### - -To verify if a particular log is indeed rotating or not and to check the last date and time of its rotation, check the /var/lib/logrotate/status file. This is a neatly formatted file that contains the log file name and the date on which it was last rotated. - - cat /var/lib/logrotate/status - -A few entries from this file, for example: - - "/var/log/lpr.log" 2013-4-11 - "/var/log/dpkg.log" 2013-4-11 - "/var/log/pm-suspend.log" 2013-4-11 - "/var/log/syslog" 2013-4-11 - "/var/log/mail.info" 2013-4-11 - "/var/log/daemon.log" 2013-4-11 - "/var/log/apport.log" 2013-4-11 - -Congratulations! You have logrotate installed in your system. Now, change the configuration settings as per your requirements. - -Try 'man logrotate' or 'logrotate -?' for more details. - --------------------------------------------------------------------------------- - -via: https://www.digitalocean.com/community/tutorials/how-to-manage-log-files-with-logrotate-on-ubuntu-12-10 - -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[1]:https://www.digitalocean.com/community/articles/initial-server-setup-with-ubuntu-12-04 \ No newline at end of file diff --git a/sources/tech/20150906 How to Configure OpenNMS on CentOS 7.x.md b/sources/tech/20150906 How to Configure OpenNMS on CentOS 7.x.md deleted file mode 100644 index c7810d06ef..0000000000 --- a/sources/tech/20150906 How to Configure OpenNMS on CentOS 7.x.md +++ /dev/null @@ -1,219 +0,0 @@ -How to Configure OpenNMS on CentOS 7.x -================================================================================ -Systems management and monitoring services are very important that provides information to view important systems management information that allow us to to make decisions based on this information. To make sure the network is running at its best and to minimize the network downtime we need to improve application performance. So, in this article we will make you understand the step by step procedure to setup OpenNMS in your IT infrastructure. OpenNMS is a free open source enterprise level network monitoring and management platform that provides information to allow us to make decisions in regards to future network and capacity planning. - -OpenNMS designed to manage tens of thousands of devices from a single server as well as manage unlimited devices using a cluster of servers. It includes a discovery engine to automatically configure and manage network devices without operator intervention. It is written in Java and is published under the GNU General Public License. OpenNMS is known for its scalability with its main functional areas in services monitoring, data collection using SNMP and event management and notifications. - -### Installing OpenNMS RPM Repository ### - -We will start from the installation of OpenNMS RPM for our CentOs 7.1 operating system as its available for most of the RPM-based distributions through Yum at their official link http://yum.opennms.org/ . - -![OpenNMS RPM](http://blog.linoxide.com/wp-content/uploads/2015/08/18.png) - -Then open your command line interface of CentOS 7.1 and login with root credentials to run the below command with “wget” to get the required RPM. - - [root@open-nms ~]# wget http://yum.opennms.org/repofiles/opennms-repo-stable-rhel7.noarch.rpm - -![Download RPM](http://blog.linoxide.com/wp-content/uploads/2015/08/26.png) - -Now we need to install this repository so that the OpenNMS package information could be available through yum for installation. Let’s run the command below with same root level credentials to do so. - - [root@open-nms ~]# rpm -Uvh opennms-repo-stable-rhel7.noarch.rpm - -![Installing RPM](http://blog.linoxide.com/wp-content/uploads/2015/08/36.png) - -### Installing Prerequisite Packages for OpenNMS ### - -Now before we start installation of OpenNMS, let’s make sure you’ve done the following prerequisites. - -**Install JDK 7** - -Its recommended that you install the latest stable Java 7 JDK from Oracle for the best performance to integrate JDK in our YUM repository as a fallback. Let’s go to the Oracle Java 7 SE JDK download page, accept the license if you agree, choose the platform and architecture. Once it has finished downloading, execute it from the command-line and then install the resulting JDK rpm. - -Else run the below command to install using the Yum from the the available system repositories. - - [root@open-nms ~]# yum install java-1.7.0-openjdk-1.7.0.85-2.6.1.2.el7_1 - -Once you have installed the Java you can confirm its installation using below command and check its installed version. - - [root@open-nms ~]# java -version - -![Java version](http://blog.linoxide.com/wp-content/uploads/2015/08/46.png) - -**Install PostgreSQL** - -Now we will install the PostgreSQL that is a must requirement to setup the database for OpenNMS. PostgreSQL is included in all of the major YUM-based distributions. To install, simply run the below command. - - [root@open-nms ~]# yum install postgresql postgresql-server - -![Installing Postgresql](http://blog.linoxide.com/wp-content/uploads/2015/08/55.png) - -### Prepare the Database for OpenNMS ### - -Once you have installed PostgreSQL, now you'll need to make sure that PostgreSQL is up and active. Let’s run the below command to first initialize the database and then start its services. - - [root@open-nms ~]# /sbin/service postgresql initdb - [root@open-nms ~]# /sbin/service postgresql start - -![start DB](http://blog.linoxide.com/wp-content/uploads/2015/08/64.png) - -Now to confirm the status of your PostgreSQL database you can run the below command. - - [root@open-nms ~]# service postgresql status - -![PostgreSQL status](http://blog.linoxide.com/wp-content/uploads/2015/08/74.png) - -To ensure that PostgreSQL will start after a reboot, use the “systemctl”command to enable start on bootup using below command. - - [root@open-nms ~]# systemctl enable postgresql - ln -s '/usr/lib/systemd/system/postgresql.service' '/etc/systemd/system/multi-user.target.wants/postgresql.service' - -### Configure PostgreSQL ### - -Locate the Postgres “data” directory. Often this is located in /var/lib/pgsql/data directory and Open the postgresql.conf file in text editor and configure the following parameters as shown. - - [root@open-nms ~]# vim /var/lib/pgsql/data/postgresql.conf - ----------- - - #------------------------------------------------------------------------------ - # CONNECTIONS AND AUTHENTICATION - #------------------------------------------------------------------------------ - - listen_addresses = 'localhost' - max_connections = 256 - - #------------------------------------------------------------------------------ - # RESOURCE USAGE (except WAL) - #------------------------------------------------------------------------------ - - shared_buffers = 1024MB - -**User Access to the Database** - -PostgreSQL only allows you to connect if you are logged in to the local account name that matches the PostgreSQL user. Since OpenNMS runs as root, it cannot connect as a "postgres" or "opennms" user by default, so we have to change the configuration to allow user access to the database by opening the below configuration file. - - [root@open-nms ~]# vim /var/lib/pgsql/data/pg_hba.conf - -Update the configuration file as shown below and change the METHOD settings from "ident" to "trust" - -![user access to db](http://blog.linoxide.com/wp-content/uploads/2015/08/84.png) - -Write and quit the file to make saved changes and then restart PostgreSQL services. - - [root@open-nms ~]# service postgresql restart - -### Starting OpenNMS Installation ### - -Now we are ready go with installation of OpenNMS as we have almost don with its prerequisites. Using the YUM packaging system will download and install all of the required components and their dependencies, if they are not already installed on your system. -So let's riun th belwo command to start OpenNMS installation that will pull everything you need to have a working OpenNMS, including the OpenNMS core, web UI, and a set of common plugins. - - [root@open-nms ~]# yum -y install opennms - -![OpenNMS Installation](http://blog.linoxide.com/wp-content/uploads/2015/08/93.png) - -The above command will ends up with successful installation of OpenNMS and its derivative packages. - -### Configure JAVA for OpenNMS ### - -In order to integrate the default version of Java with OpenNMS we will run the below command. - - [root@open-nms ~]# /opt/opennms/bin/runjava -s - -![java integration](http://blog.linoxide.com/wp-content/uploads/2015/08/102.png) - -### Run the OpenNMS installer ### - -Now it's time to start the OpenNMS installer that will create and configure the OpenNMS database, while the same command will be used in case we want to update it to the latest version. To do so, we will run the following command. - - [root@open-nms ~]# /opt/opennms/bin/install -dis - -The above install command will take many options with following mechanism. - --d - to update the database --i - to insert any default data that belongs in the database --s - to create or update the stored procedures OpenNMS uses for certain kinds of data access - - ============================================================================== - OpenNMS Installer - ============================================================================== - - Configures PostgreSQL tables, users, and other miscellaneous settings. - - DEBUG: Platform is IPv6 ready: true - - searching for libjicmp.so: - - trying to load /usr/lib64/libjicmp.so: OK - - searching for libjicmp6.so: - - trying to load /usr/lib64/libjicmp6.so: OK - - searching for libjrrd.so: - - trying to load /usr/lib64/libjrrd.so: OK - - using SQL directory... /opt/opennms/etc - - using create.sql... /opt/opennms/etc/create.sql - 17:27:51.178 [Main] INFO org.opennms.core.schema.Migrator - PL/PgSQL call handler exists - 17:27:51.180 [Main] INFO org.opennms.core.schema.Migrator - PL/PgSQL language exists - - checking if database "opennms" is unicode... ALREADY UNICODE - - Creating imports directory (/opt/opennms/etc/imports... OK - - Checking for old import files in /opt/opennms/etc... DONE - INFO 16/08/15 17:27:liquibase: Reading from databasechangelog - Installer completed successfully! - - ============================================================================== - OpenNMS Upgrader - ============================================================================== - - OpenNMS is currently stopped - Found upgrade task SnmpInterfaceRrdMigratorOnline - Found upgrade task KscReportsMigrator - Found upgrade task JettyConfigMigratorOffline - Found upgrade task DataCollectionConfigMigratorOffline - Processing RequisitionsMigratorOffline: Remove non-ip-snmp-primary and non-ip-interfaces from requisitions: NMS-5630, NMS-5571 - - Running pre-execution phase - Backing up: /opt/opennms/etc/imports - - Running post-execution phase - Removing backup /opt/opennms/etc/datacollection.zip - - Finished in 0 seconds - - Upgrade completed successfully! - -### Firewall configurations to Allow OpenNMS ### - -Here we have to allow OpenNMS management interface port 8980 through firewall or router to access the management web interface from the remote systems. So use the following commands to do so. - - [root@open-nms etc]# firewall-cmd --permanent --add-port=8980/tcp - [root@open-nms etc]# firewall-cmd --reload - -### Start OpenNMS and Login to Web Interface ### - -Let's start OpenNMS service and enable to it start at each bootup by using the below command. - - [root@open-nms ~]#systemctl start opennms - [root@open-nms ~]#systemctl enable opennms - -Once the services are up are ready to go with its web management interface. Open your web browser and access it with your server's IP address and 8980 port. - -http://servers_ip:8980/ - -Give the username and password where as the default username and password is admin/admin. - -![opennms login](http://blog.linoxide.com/wp-content/uploads/2015/08/opennms-login.png) - -After successful authentication with your provided username and password you will be directed towards the the Home page of OpenNMS where you can configure the new monitoring devices/nodes/services etc. - -![opennms home](http://blog.linoxide.com/wp-content/uploads/2015/08/opennms-home.png) - -### Conclusion ### - -Congratulations! we have successfully setup OpenNMS on CentOS 7.1. So, at the end of this tutorial, you are now able to install and configure OpenNMS with its prerequisites that included PostgreSQL and JAVA setup. So let's enjoy with the great network monitoring system with open source roots using OpenNMS that provide a bevy of features at no cost than their high-end competitors, and can scale to monitor large numbers of network nodes. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/monitoring-2/install-configure-opennms-centos-7-x/ - -作者:[Kashif Siddique][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/kashifs/ \ No newline at end of file diff --git a/sources/tech/20150906 How to Install DNSCrypt and Unbound in Arch Linux.md b/sources/tech/20150906 How to Install DNSCrypt and Unbound in Arch Linux.md deleted file mode 100644 index 98cb0e9b55..0000000000 --- a/sources/tech/20150906 How to Install DNSCrypt and Unbound in Arch Linux.md +++ /dev/null @@ -1,174 +0,0 @@ -How to Install DNSCrypt and Unbound in Arch Linux -================================================================================ -**DNSCrypt** is a protocol that encrypt and authenticate communications between a DNS client and a DNS resolver. Prevent from DNS spoofing or man in the middle-attack. DNSCrypt are available for most operating system, including Linux, Windows, MacOSX android and iOS. And in this tutorial I'm using archlinux with kernel 4.1. - -Unbound is a DNS cache server used to resolve any DNS query received. If the user requests a new query, then unbound will store it as a cache, and when the user requests the same query for the second time, then unbound would take from the cache that have been saved. This will be faster than the first request query. - -And now I will try to install "DNSCrypt" to secure the dns communication, and make it faster with dns cache "Unbound". - -### Step 1 - Install yaourt ### - -Yaourt is one of AUR(Arch User Repository) helper that make archlinux users easy to install a program from AUR. Yaourt use same syntax as pacman, so you can install the program with yaourt. and this is easy way to install yaourt : - -1. Edit the arch repository configuration file with nano or vi, stored in a file "/etc/pacman.conf". - - $ nano /etc/pacman.conf - -2. Add at the bottom line yaourt repository, just paste script below : - - [archlinuxfr] - SigLevel = Never - Server = http://repo.archlinux.fr/$arch - -3. Save it with press "Ctrl + x" and then "Y". - -4. Now update the repository database and install yaourt with pacman command : - - $ sudo pacman -Sy yaourt - -### Step 2 - Install DNSCrypt and Unbound ### - -DNSCrypt and unbound available on archlinux repository, then you can install it with pacman command : - - $ sudo pacman -S dnscrypt-proxy unbound - -wait it and press "Y" for proceed with installation. - -### Step 3 - Install dnscrypt-autoinstall ### - -Dnscrypt-autoinstall is A script for installing and automatically configuring DNSCrypt on Linux-based systems. Dnscrypt-autoinstall available in AUR(Arch User Repository), and you must use "yaourt" command to install it : - - $ yaourt -S dnscrypt-autoinstall - -Note : - --S = it is same as pacman -S to install a software/program. - -### Step 4 - Run dnscrypt-autoinstall ### - -run the command "dnscrypt-autoinstall" with root privileges to configure DNSCrypt automatically : - - $ sudo dnscrypt-autoinstall - -Press "Enter" for the next configuration, and then type "y" and choose the DNS provider you want to use, I'm here use DNSCrypt.eu featured with no logs and DNSSEC. - -![DNSCrypt autoinstall](http://blog.linoxide.com/wp-content/uploads/2015/08/DNSCrypt-autoinstall.png) - -### Step 5 - Configure DNSCrypt and Unbound ### - -1. Open the dnscrypt configuration file "/etc/conf.d/dnscrypt-config" and make sure the configuration of "DNSCRYPT_LOCALIP" point to **localhost IP**, and for port configuration "DNSCRYPT_LOCALPORT" it's up to you, I`m here use port **40**. - - $ nano /etc/conf.d/dnscrypt-config - - DNSCRYPT_LOCALIP=127.0.0.1 - DNSCRYPT_LOCALIP2=127.0.0.2 - DNSCRYPT_LOCALPORT=40 - -![DNSCrypt Configuration](http://blog.linoxide.com/wp-content/uploads/2015/08/DNSCryptConfiguration.png) - -Save and exit. - -2. Now you can edit unbound configuration in "/etc/unbound/". edit the file configuration with nano editor : - - $ nano /etc/unbound/unbound.conf - -3. Add the following script in the end of line : - - do-not-query-localhost: no - forward-zone: - name: "." - forward-addr: 127.0.0.1@40 - -Make sure the "**forward-addr**" port is same with "**DNSCRYPT_LOCALPORT**" configuration in DNSCrypt. You can see the I`m use port **40**. - -![Unbound Configuration](http://blog.linoxide.com/wp-content/uploads/2015/08/UnboundConfiguration.png) - -and then save and exit. - -### Step 6 - Run DNSCrypt and Unbound, then Add to startup/Boot ### - -Please run DNSCrypt and unbound with root privileges, you can run with systemctl command : - - $ sudo systemctl start dnscrypt-proxy unbound - -Add the service at the boot time/startup. You can do it by running "systemctl enable" : - - $ sudo systemctl enable dnscrypt-proxy unbound - -the command will create the symlink of the service to "/usr/lib/systemd/system/" directory. - -### Step 7 - Configure resolv.conf and restart all services ### - -Resolv.conf is a file used by linux to configure Domain Name Server(DNS) resolver. it is just plain-text created by administrator, so you must edit by root privileges and make it immutable/no one can edit it. - -Edit it with nano editor : - - $ nano /etc/resolv.conf - -and add the localhost IP "**127.0.0.1**". and now make it immutable with "chattr" command : - - $ chattr +i /etc/resolv.conf - -Note : - -If you want to edit it again, make it writable with command "chattr -i /etc/resolv.conf". - -Now yo need to restart the DNSCrypt, unbound and the network : - - $ sudo systemctl restart dnscrypt-proxy unbound netctl - -If you see the error, check your configuration file. - -### Testing ### - -1. Test DNSCrypt - -You can be sure that DNSCrypt had acted correctly by visiting https://dnsleaktest.com/, then click on "Standard Test" or "Extended Test" and wait the process running. - -And now you can see that DNSCrypt is working with DNSCrypt.eu as your DNS provider. - -![Testing DNSCrypt](http://blog.linoxide.com/wp-content/uploads/2015/08/TestingDNSCrypt.png) - -And now you can see that DNSCrypt is working with DNSCrypt.eu as your DNS provider. - -2. Test Unbound - -Now you should ensure that the unbound is working correctly with "dig" or "drill" command. - -This is the results for dig command : - - $ dig linoxide.com - -Now see in the results, the "Query time" is "533 msec" : - - ;; Query time: 533 msec - ;; SERVER: 127.0.0.1#53(127.0.0.1) - ;; WHEN: Sun Aug 30 14:48:19 WIB 2015 - ;; MSG SIZE rcvd: 188 - -and try again with the same command. And you will see the "Query time" is "0 msec". - - ;; Query time: 0 msec - ;; SERVER: 127.0.0.1#53(127.0.0.1) - ;; WHEN: Sun Aug 30 14:51:05 WIB 2015 - ;; MSG SIZE rcvd: 188 - -![Unbound Test](http://blog.linoxide.com/wp-content/uploads/2015/08/UnboundTest.png) - -And in the end DNSCrypt secure communications between the DNS clients and DNS resolver is working perfectly, and then Unbound make it faster if there is the same request in another time by taking the cache that have been saved. - -### Conclusion ### - -DNSCrypt is a protocol that can encrypt data flow between the DNS client and DNS resolver. DNSCrypt can run on various operating systems, either mobile or desktop. Choose DNS provider also includes something important, choose which provide a DNSSEC and no logs. Unbound can be used as a DNS cache, thus speeding up the resolve process resolv, because Unbound will store a request as the cache, then when a client request same query in the next time, then unbound would take from the cache that have been saved. DNSCrypt and Unbound is a powerful combination for the safety and speed. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/tools/install-dnscrypt-unbound-archlinux/ - -作者:[Arul][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arulm/ \ No newline at end of file diff --git a/sources/tech/20150906 How to install Suricata intrusion detection system on Linux.md b/sources/tech/20150906 How to install Suricata intrusion detection system on Linux.md deleted file mode 100644 index fe4a784d5a..0000000000 --- a/sources/tech/20150906 How to install Suricata intrusion detection system on Linux.md +++ /dev/null @@ -1,197 +0,0 @@ -How to install Suricata intrusion detection system on Linux -================================================================================ -With incessant security threats, intrusion detection system (IDS) has become one of the most critical requirements in today's data center environments. However, as more and more servers upgrade their NICs to 10GB/40GB Ethernet, it is increasingly difficult to implement compute-intensive intrusion detection on commodity hardware at line rates. One approach to scaling IDS performance is **multi-threaded IDS**, where CPU-intensive deep packet inspection workload is parallelized into multiple concurrent tasks. Such parallelized inspection can exploit multi-core hardware to scale up IDS throughput easily. Two well-known open-source efforts in this area are [Suricata][1] and [Bro][2]. - -In this tutorial, I am going to demonstrate **how to install and configure Suricata IDS on Linux server**. - -### Install Suricata IDS on Linux ### - -Let's build Suricata from the source. You first need to install several required dependencies as follows. - -#### Install Dependencies on Debian, Ubuntu or Linux Mint #### - - $ sudo apt-get install wget build-essential libpcre3-dev libpcre3-dbg automake autoconf libtool libpcap-dev libnet1-dev libyaml-dev zlib1g-dev libcap-ng-dev libjansson-dev - -#### Install Dependencies on CentOS, Fedora or RHEL #### - - $ sudo yum install wget libpcap-devel libnet-devel pcre-devel gcc-c++ automake autoconf libtool make libyaml-devel zlib-devel file-devel jansson-devel nss-devel - -Once you install all required packages, go ahead and install Suricata as follows. - -First, download the latest Suricata source code from [http://suricata-ids.org/download/][3], and build it. As of this writing, the latest version is 2.0.8. - - $ wget http://www.openinfosecfoundation.org/download/suricata-2.0.8.tar.gz - $ tar -xvf suricata-2.0.8.tar.gz - $ cd suricata-2.0.8 - $ ./configure --sysconfdir=/etc --localstatedir=/var - -Here is the example output of configuration. - - Suricata Configuration: - AF_PACKET support: yes - PF_RING support: no - NFQueue support: no - NFLOG support: no - IPFW support: no - DAG enabled: no - Napatech enabled: no - Unix socket enabled: yes - Detection enabled: yes - - libnss support: yes - libnspr support: yes - libjansson support: yes - Prelude support: no - PCRE jit: yes - LUA support: no - libluajit: no - libgeoip: no - Non-bundled htp: no - Old barnyard2 support: no - CUDA enabled: no - -Now compile and install it. - - $ make - $ sudo make install - -Suricata source code comes with default configuration files. Let's install these default configuration files as follows. - - $ sudo make install-conf - -As you know, Suricata is useless without IDS rule sets. Conveniently, the Makefile comes with IDS rule installation option. To install IDS rules, run the following command. - - $ sudo make install-rules - -The above rule installation command will download the current snapshot of community rulesets available from [EmergingThreats.net][4], and store them under /etc/suricata/rules. - -![](https://farm1.staticflickr.com/691/20482669553_8b67632277_c.jpg) - -### Configure Suricata IDS the First Time ### - -Now it's time to configure Suricata. The configuration file is located at **/etc/suricata/suricata.yaml**. Open the file with a text editor for editing. - - $ sudo vi /etc/suricata/suricata.yaml - -Here are some basic setup for you to get started. - -The "default-log-dir" keyword should point to the location of Suricata log files. - - default-log-dir: /var/log/suricata/ - -Under "vars" section, you will find several important variables used by Suricata. "HOME_NET" should point to the local network to be inspected by Suricata. "!$HOME_NET" (assigned to EXTERNAL_NET) refers to any other networks than the local network. "XXX_PORTS" indicates the port number(s) use by different services. Note that Suricata can automatically detect HTTP traffic regardless of the port it uses. So it is not critical to specify the HTTP_PORTS variable correctly. - - vars: - HOME_NET: "[192.168.122.0/24]" - EXTERNAL_NET: "!$HOME_NET" - HTTP_PORTS: "80" - SHELLCODE_PORTS: "!80" - SSH_PORTS: 22 - -The "host-os-policy" section is used to defend against some well-known attacks which exploit the behavior of an operating system's network stack (e.g., TCP reassembly) to evade detection. As a counter measure, modern IDS came up with so-called "target-based" inspection, where inspection engine fine-tunes its detection algorithm based on a target operating system of the traffic. Thus, if you know what OS individual local hosts are running, you can feed that information to Suricata to potentially enhance its detection rate. This is when "host-os-policy" section is used. In this example, the default IDS policy is Linux; if no OS information is known for a particular IP address, Suricata will apply Linux-based inspection. When traffic for 192.168.122.0/28 and 192.168.122.155 is captured, Suricata will apply Windows-based inspection policy. - - host-os-policy: - # These are Windows machines. - windows: [192.168.122.0/28, 192.168.122.155] - bsd: [] - bsd-right: [] - old-linux: [] - # Make the default policy Linux. - linux: [0.0.0.0/0] - old-solaris: [] - solaris: ["::1"] - hpux10: [] - hpux11: [] - irix: [] - macos: [] - vista: [] - windows2k3: [] - -Under "threading" section, you can specify CPU affinity for different Suricata threads. By default, [CPU affinity][5] is disabled ("set-cpu-affinity: no"), meaning that Suricata threads will be scheduled on any available CPU cores. By default, Suricata will create one "detect" thread for each CPU core. You can adjust this behavior by specifying "detect-thread-ratio: N". This will create N*M detect threads, where M is the total number of CPU cores on the host. - - threading: - set-cpu-affinity: no - detect-thread-ratio: 1.5 - -With the above threading settings, Suricata will create 1.5*M detection threads, where M is the total number of CPU cores on the system. - -For more information about Suricata configuration, you can read the default configuration file itself, which is heavily commented for clarity. - -### Perform Intrusion Detection with Suricata ### - -Now it's time to test-run Suricata. Before launching it, there's one more step to do. - -When you are using pcap capture mode, it is highly recommended to turn off any packet offloead features (e.g., LRO/GRO) on the NIC which Suricata is listening on, as those features may interfere with live packet capture. - -Here is how to turn off LRO/GRO on the network interface eth0: - - $ sudo ethtool -K eth0 gro off lro off - -Note that depending on your NIC, you may see the following warning, which you can ignore. It simply means that your NIC does not support LRO. - - Cannot change large-receive-offload - -Suricata supports a number of running modes. A runmode determines how different threads are used for IDS. The following command lists all [available runmodes][6]. - - $ sudo /usr/local/bin/suricata --list-runmodes - -![](https://farm6.staticflickr.com/5730/20481140934_25080d04d7_c.jpg) - -The default runmode used by Suricata is autofp (which stands for "auto flow pinned load balancing"). In this mode, packets from each distinct flow are assigned to a single detect thread. Flows are assigned to threads with the lowest number of unprocessed packets. - -Finally, let's start Suricata, and see it in action. - - $ sudo /usr/local/bin/suricata -c /etc/suricata/suricata.yaml -i eth0 --init-errors-fatal - -![](https://farm1.staticflickr.com/701/21077552366_c577746e36_c.jpg) - -In this example, we are monitoring a network interface eth0 on a 8-core system. As shown above, Suricata creates 13 packet processing threads and 3 management threads. The packet processing threads consist of one PCAP packet capture thread, and 12 detect threads (equal to 8*1.5). This means that the packets captured by one capture thread are load-balanced to 12 detect threads for IDS. The management threads are one flow manager and two counter/stats related threads. - -Here is a thread-view of Suricata process (plotted by [htop][7]). - -![](https://farm6.staticflickr.com/5775/20482669593_174f8f41cb_c.jpg) - -Suricata detection logs are stored in /var/log/suricata directory. - - $ tail -f /var/log/suricata/fast.log - ----------- - - 04/01/2015-15:47:12.559075 [**] [1:2200074:1] SURICATA TCPv4 invalid checksum [**] [Classification: (null)] [Priority: 3] {TCP} 172.16.253.158:22 -> 172.16.253.1:46997 - 04/01/2015-15:49:06.565901 [**] [1:2200074:1] SURICATA TCPv4 invalid checksum [**] [Classification: (null)] [Priority: 3] {TCP} 172.16.253.158:22 -> 172.16.253.1:46317 - 04/01/2015-15:49:06.566759 [**] [1:2200074:1] SURICATA TCPv4 invalid checksum [**] [Classification: (null)] [Priority: 3] {TCP} 172.16.253.158:22 -> 172.16.253.1:46317 - -For ease of import, the log is also available in JSON format: - - $ tail -f /var/log/suricata/eve.json - ----------- - {"timestamp":"2015-04-01T15:49:06.565901","event_type":"alert","src_ip":"172.16.253.158","src_port":22,"dest_ip":"172.16.253.1","dest_port":46317,"proto":"TCP","alert":{"action":"allowed","gid":1,"signature_id":2200074,"rev":1,"signature":"SURICATA TCPv4 invalid checksum","category":"","severity":3}} - {"timestamp":"2015-04-01T15:49:06.566759","event_type":"alert","src_ip":"172.16.253.158","src_port":22,"dest_ip":"172.16.253.1","dest_port":46317,"proto":"TCP","alert":{"action":"allowed","gid":1,"signature_id":2200074,"rev":1,"signature":"SURICATA TCPv4 invalid checksum","category":"","severity":3}} - -### Conclusion ### - -In this tutorial, I demonstrated how you can set up Suricata IDS on a multi-core Linux server. Unlike single-threaded [Snort IDS][8], Suricata can easily benefit from multi-core/many-core hardware with multi-threading. There is great deal of customization in Suricata to maximize its performance and detection coverage. Suricata folks maintain [online Wiki][9] quite well, so I strongly recommend you check it out if you want to deploy Suricata in your environment. - -Are you currently using Suricata? If so, feel free to share your experience. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/install-suricata-intrusion-detection-system-linux.html - -作者:[Dan Nanni][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://xmodulo.com/author/nanni -[1]:http://suricata-ids.org/ -[2]:https://www.bro.org/ -[3]:http://suricata-ids.org/download/ -[4]:http://rules.emergingthreats.net/ -[5]:http://xmodulo.com/run-program-process-specific-cpu-cores-linux.html -[6]:https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Runmodes -[7]:http://ask.xmodulo.com/view-threads-process-linux.html -[8]:http://xmodulo.com/how-to-compile-and-install-snort-from-source-code-on-ubuntu.html -[9]:https://redmine.openinfosecfoundation.org/projects/suricata/wiki \ No newline at end of file diff --git a/sources/tech/20150906 Install Qmmp 0.9.0 Winamp-like Audio Player in Ubuntu.md b/sources/tech/20150906 Install Qmmp 0.9.0 Winamp-like Audio Player in Ubuntu.md deleted file mode 100644 index 36e4c70d2c..0000000000 --- a/sources/tech/20150906 Install Qmmp 0.9.0 Winamp-like Audio Player in Ubuntu.md +++ /dev/null @@ -1,73 +0,0 @@ -translation by strugglingyouth -Install Qmmp 0.9.0 Winamp-like Audio Player in Ubuntu -================================================================================ -![](http://ubuntuhandbook.org/wp-content/uploads/2015/01/qmmp-icon-simple.png) - -Qmmp, Qt-based audio player with winamp or xmms like user interface, now is at 0.9.0 release. PPA updated for Ubuntu 15.10, Ubuntu 15.04, Ubuntu 14.04, Ubuntu 12.04 and derivatives. - -Qmmp 0.9.0 is a big release with many new features, improvements and some translation updates. It added: - -- audio-channel sequence converter; -- 9 channels support to equalizer; -- album artist tag support; -- asynchronous sorting; -- sorting by file modification date; -- sorting by album artist; -- multiple column support; -- feature to hide track length; -- feature to disable plugins without qmmp.pri modification (qmake only) -- feature to remember playlist scroll position; -- feature to exclude cue data files; -- feature to change user agent; -- feature to change window title; -- feature to reset fonts; -- feature to restore default shortcuts; -- default hotkey for the “Rename List” action; -- feature to disable fadeout in the gme plugin; -- Simple User Interface (QSUI) with the following changes: - - added multiple column support; - - added sorting by album artist; - - added sorting by file modification date; - - added feature to hide song length; - - added default hotkey for the “Rename List” action; - - added “Save List” action to the tab menu; - - added feature to reset fonts; - - added feature to reset shortcuts; - - improved status bar; - -It also improved playlist changes notification, playlist container, sample rate converter, cmake build scripts, title formatter, ape tags support in the mpeg plugin, fileops plugin, reduced cpu usage, changed default skin (to Glare) and playlist separator. - -![qmmp-090](http://ubuntuhandbook.org/wp-content/uploads/2015/09/qmmp-090.jpg) - -### Install Qmmp 0.9.0 in Ubuntu: ### - -New release has been made into PPA, available for all current Ubuntu releases and derivatives. - -1. To add the [Qmmp PPA][1]. - -Open terminal from the Dash, App Launcher, or via Ctrl+Alt+T shortcut keys. When it opens, run command: - - sudo add-apt-repository ppa:forkotov02/ppa - -![qmmp-ppa](http://ubuntuhandbook.org/wp-content/uploads/2015/09/qmmp-ppa.jpg) - -2. After adding the PPA, upgrade Qmmp player through Software Updater. Or refresh system cache and install the software via below commands: - - sudo apt-get update - - sudo apt-get install qmmp qmmp-plugin-pack - -That’s it. Enjoy! - --------------------------------------------------------------------------------- - -via: http://ubuntuhandbook.org/index.php/2015/09/qmmp-0-9-0-in-ubuntu/ - -作者:[Ji m][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://ubuntuhandbook.org/index.php/about/ -[1]:https://launchpad.net/~forkotov02/+archive/ubuntu/ppa diff --git a/sources/tech/20150906 Installing NGINX and NGINX Plus With Ansible.md b/sources/tech/20150906 Installing NGINX and NGINX Plus With Ansible.md deleted file mode 100644 index 3fa66fe6b1..0000000000 --- a/sources/tech/20150906 Installing NGINX and NGINX Plus With Ansible.md +++ /dev/null @@ -1,451 +0,0 @@ -translation by strugglingyouth -nstalling NGINX and NGINX Plus With Ansible -================================================================================ -Coming from a production operations background, I have learned to love all things related to automation. Why do something by hand if a computer can do it for you? But creating and implementing automation can be a difficult task given an ever-changing infrastructure and the various technologies surrounding your environments. This is why I love [Ansible][1]. Ansible is an open source tool for IT configuration management, deployment, and orchestration that is extremely easy to use. - -One of my favorite features of Ansible is that it is completely clientless. To manage a system, a connection is made over SSH, using either [Paramiko][2] (a Python library) or native [OpenSSH][3]. Another attractive feature of Ansible is its extensive selection of modules. These modules can be used to perform some of the common tasks of a system administrator. In particular, they make Ansible a powerful tool for installing and configuring any application across multiple servers, environments, and operating systems, all from one central location. - -In this tutorial I will walk you through the steps for using Ansible to install and deploy the open source [NGINX][4] software and [NGINX Plus][5], our commercial product. I’m showing deployment onto a [CentOS][6] server, but I have included details about deploying on Ubuntu servers in [Creating an Ansible Playbook for Installing NGINX and NGINX Plus on Ubuntu][7] below. - -For this tutorial I will be using Ansible version 1.9.2 and performing the deployment from a server running CentOS 7.1. - - $ ansible --version - ansible 1.9.2 - - $ cat /etc/redhat-release - CentOS Linux release 7.1.1503 (Core) - -If you don’t already have Ansible, you can get instructions for installing it [at the Ansible site][8]. - -If you are using CentOS, installing Ansible is easy as typing the following command. If you want to compile from source or for other distributions, see the instructions at the Ansible link provided just above. - - $ sudo yum install -y epel-release && sudo yum install -y ansible - -Depending on your environment, some of the commands in this tutorial might require sudo privileges. The path to the files, usernames, and destination servers are all values that will be specific to your environment. - -### Creating an Ansible Playbook for Installing NGINX (CentOS) ### - -First we create a working directory for our NGINX deployment, along with subdirectories and deployment configuration files. I usually recommend creating the directory in your home directory and show that in all examples in this tutorial. - - $ cd $HOME - $ mkdir -p ansible-nginx/tasks/ - $ touch ansible-nginx/deploy.yml - $ touch ansible-nginx/tasks/install_nginx.yml - -The directory structure now looks like this. You can check by using the tree command. - - $ tree $HOME/ansible-nginx/ - /home/kjones/ansible-nginx/ - ├── deploy.yml - └── tasks - └── install_nginx.yml - - 1 directory, 2 files - -If you do not have tree installed, you can do so using the following command. - - $ sudo yum install -y tree - -#### Creating the Main Deployment File #### - -Next we open **deploy.yml** in a text editor. I prefer vim for editing configuration files on the command line, and will use it throughout the tutorial. - - $ vim $HOME/ansible-nginx/deploy.yml - -The **deploy.yml** file is our main Ansible deployment file, which we’ll reference when we run the ansible‑playbook command in [Running Ansible to Deploy NGINX][9]. Within this file we specify the inventory for Ansible to use along with any other configuration files to include at runtime. - -In my example I use the [include][10] module to specify a configuration file that has the steps for installing NGINX. While it is possible to create a playbook in one very large file, I recommend that you separate the steps into smaller included files to keep things organized. Sample use cases for an include are copying static content, copying configuration files, or assigning variables for a more advanced deployment with configuration logic. - -Type the following lines into the file. I include the filename at the top in a comment for reference. - - # ./ansible-nginx/deploy.yml - - - hosts: nginx - tasks: - - include: 'tasks/install_nginx.yml' - -The hosts statement tells Ansible to deploy to all servers in the **nginx** group, which is defined in **/etc/ansible/hosts**. We’ll edit this file in [Creating the List of NGINX Servers below][11]. - -The include statement tells Ansible to read in and execute the contents of the **install_nginx.yml** file from the **tasks** directory during deployment. The file includes the steps for downloading, installing, and starting NGINX. We’ll create this file in the next section. - -#### Creating the Deployment File for NGINX #### - -Now let’s save our work to **deploy.yml** and open up **install_nginx.yml** in the editor. - - $ vim $HOME/ansible-nginx/tasks/install_nginx.yml - -The file is going to contain the instructions – written in [YAML][12] format – for Ansible to follow when installing and configuring our NGINX deployment. Each section (step in the process) starts with a name statement (preceded by hyphen) that describes the step. The string following name: is written to stdout during the Ansible deployment and can be changed as you wish. The next line of a section in the YAML file is the module that will be used during that deployment step. In the configuration below, both the [yum][13] and [service][14] modules are used. The yum module is used to install packages on CentOS. The service module is used to manage UNIX services. The final line or lines in a section specify any parameters for the module (in the example, these lines start with name and state). - -Type the following lines into the file. As with **deploy.yml**, the first line in our file is a comment that names the file for reference. The first section tells Ansible to install the **.rpm** file for CentOS 7 from the NGINX repository. This directs the package manager to install the most recent stable version of NGINX directly from NGINX. Modify the pathname as necessary for your CentOS version. A list of available packages can be found on the [open source NGINX website][15]. The next two sections tell Ansible to install the latest NGINX version using the yum module and then start NGINX using the service module. - -**Note:** In the first section, the pathname to the CentOS package appears on two lines only for space reasons. Type the entire path on a single line. - - # ./ansible-nginx/tasks/install_nginx.yml - - - name: NGINX | Installing NGINX repo rpm - yum: - name: http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm - - - name: NGINX | Installing NGINX - yum: - name: nginx - state: latest - - - name: NGINX | Starting NGINX - service: - name: nginx - state: started - -#### Creating the List of NGINX Servers #### - -Now that we have our Ansible deployment configuration files all set up, we need to tell Ansible exactly which servers to deploy to. We specify this in the Ansible **hosts** file I mentioned earlier. Let’s make a backup of the existing file and create a new one just for our deployment. - - $ sudo mv /etc/ansible/hosts /etc/ansible/hosts.backup - $ sudo vim /etc/ansible/hosts - -Type (or edit) the following lines in the file to create a group called **nginx** and list the servers to install NGINX on. You can designate servers by hostname, IP address, or in an array such as **server[1-3].domain.com**. Here I designate one server by its IP address. - - # /etc/ansible/hosts - - [nginx] - 172.16.239.140 - -#### Setting Up Security #### - -We are almost all set, but before deployment we need to ensure that Ansible has authorization to access our destination server over SSH. - -The preferred and most secure method is to add the Ansible deployment server’s RSA SSH key to the destination server’s **authorized_keys** file, which gives Ansible unrestricted SSH permissions on the destination server. To learn more about this configuration, see [Securing OpenSSH][16] on wiki.centos.org. This way you can automate your deployments without user interaction. - -Alternatively, you can request the password interactively during deployment. I strongly recommend that you use this method during testing only, because it is insecure and there is no way to track changes to a destination host’s fingerprint. If you want to do this, change the value of StrictHostKeyChecking from the default yes to no in the **/etc/ssh/ssh_config** file on each of your destination hosts. Then add the --ask-pass flag on the ansible-playbook command to have Ansible prompt for the SSH password. - -Here I illustrate how to edit the **ssh_config** file to disable strict host key checking on the destination server. We manually SSH into the server to which we’ll deploy NGINX and change the value of StrictHostKeyChecking to no. - - $ ssh kjones@172.16.239.140 - kjones@172.16.239.140's password:*********** - - [kjones@nginx ]$ sudo vim /etc/ssh/ssh_config - -After you make the change, save **ssh_config**, and connect to your Ansible server via SSH. The setting should look as below before you save your work. - - # /etc/ssh/ssh_config - - StrictHostKeyChecking no - -#### Running Ansible to Deploy NGINX #### - -If you have followed the steps in this tutorial, you can run the following command to have Ansible deploy NGINX. (Again, if you have set up RSA SSH key authentication, then the --ask-pass flag is not needed.) Run the command on the Ansible server with the configuration files we created above. - - $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx/deploy.yml - -Ansible prompts for the SSH password and produces output like the following. A recap that reports failed=0 like this one indicates that deployment succeeded. - - $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx/deploy.yml - SSH password: - - PLAY [all] ******************************************************************** - - GATHERING FACTS *************************************************************** - ok: [172.16.239.140] - - TASK: [NGINX | Installing NGINX repo rpm] ************************************* - changed: [172.16.239.140] - - TASK: [NGINX | Installing NGINX] ********************************************** - changed: [172.16.239.140] - - TASK: [NGINX | Starting NGINX] ************************************************ - changed: [172.16.239.140] - - PLAY RECAP ******************************************************************** - 172.16.239.140 : ok=4 changed=3 unreachable=0 failed=0 - -If you didn’t get a successful play recap, you can try running the ansible-playbook command again with the -vvvv flag (verbose with connection debugging) to troubleshoot the deployment process. - -When deployment succeeds (as it did for us on the first try), you can verify that NGINX is running on the remote server by running the following basic [cURL][17] command. Here it returns 200 OK. Success! We have successfully installed NGINX using Ansible. - - $ curl -Is 172.16.239.140 | grep HTTP - HTTP/1.1 200 OK - -### Creating an Ansible Playbook for Installing NGINX Plus (CentOS) ### - -Now that I’ve shown you how to install the open source version of NGINX, I’ll walk you through the steps for installing NGINX Plus. This requires some additional changes to the deployment configuration and showcases some of Ansible’s other features. - -#### Copying the NGINX Plus Certificate and Key to the Ansible Server #### - -To install and configure NGINX Plus with Ansible, we first need to copy the key and certificate for our NGINX Plus subscription from the [NGINX Plus Customer Portal][18] to the standard location on the Ansible deployment server. - -Access to the NGINX Plus Customer Portal is available for customers who have purchased NGINX Plus or are evaluating it. If you are interested in evaluating NGINX Plus, you can request a 30-day free trial [here][19]. You will receive a link to your trial certificate and key shortly after you sign up. - -On a Mac or Linux host, use the [scp][20] utility as I show here. On a Microsoft Windows host, you can use [WinSCP][21]. For this tutorial, I downloaded the files to my Mac laptop, then used scp to copy them to the Ansible server. These commands place both the key and certificate in my home directory. - - $ cd /path/to/nginx-repo-files/ - $ scp nginx-repo.* user@destination-server:. - -Next we SSH to the Ansible server, make sure the SSL directory for NGINX Plus exists, and move the files there. - - $ ssh user@destination-server - $ sudo mkdir -p /etc/ssl/nginx/ - $ sudo mv nginx-repo.* /etc/ssl/nginx/ - -Verify that your **/etc/ssl/nginx** directory contains both the certificate (**.crt**) and key (**.key**) files. You can check by using the tree command. - - $ tree /etc/ssl/nginx - /etc/ssl/nginx - ├── nginx-repo.crt - └── nginx-repo.key - - 0 directories, 2 files - -If you do not have tree installed, you can do so using the following command. - - $ sudo yum install -y tree - -#### Creating the Ansible Directory Structure #### - -The remaining steps are very similar to the ones for open source NGINX that we performed in [Creating an Ansible Playbook for Installing NGINX (CentOS)][22]. First we set up a working directory for our NGINX Plus deployment. Again I prefer creating it as a subdirectory of my home directory. - - $ cd $HOME - $ mkdir -p ansible-nginx-plus/tasks/ - $ touch ansible-nginx-plus/deploy.yml - $ touch ansible-nginx-plus/tasks/install_nginx_plus.yml - -The directory structure now looks like this. - - $ tree $HOME/ansible-nginx-plus/ - /home/kjones/ansible-nginx-plus/ - ├── deploy.yml - └── tasks - └── install_nginx_plus.yml - - 1 directory, 2 files - -#### Creating the Main Deployment File #### - -Next we use vim to create the **deploy.yml** file as for open source NGINX. - - $ vim ansible-nginx-plus/deploy.yml - -The only difference from the open source NGINX deployment is that we change the name of the included file to **install_nginx_plus.yml**. As a reminder, the file tells Ansible to deploy NGINX Plus on all servers in the **nginx** group (which is defined in **/etc/ansible/hosts**), and to read in and execute the contents of the **install_nginx_plus.yml** file from the **tasks** directory during deployment. - - # ./ansible-nginx-plus/deploy.yml - - - hosts: nginx - tasks: - - include: 'tasks/install_nginx_plus.yml' - -If you have not done so already, you also need to create the hosts file as detailed in [Creating the List of NGINX Servers][23] above. - -#### Creating the Deployment File for NGINX Plus #### - -Open **install_nginx_plus.yml** in a text editor. The file is going to contain the instructions for Ansible to follow when installing and configuring your NGINX Plus deployment. The commands and modules are specific to CentOS and some are unique to NGINX Plus. - - $ vim ansible-nginx-plus/tasks/install_nginx_plus.yml - -The first section uses the [file][24] module, telling Ansible to create the SSL directory for NGINX Plus as specified by the path and state arguments, set the ownership to root, and change the mode to 0700. - - # ./ansible-nginx-plus/tasks/install_nginx_plus.yml - - - name: NGINX Plus | Creating NGINX Plus ssl cert repo directory - file: path=/etc/ssl/nginx state=directory group=root mode=0700 - -The next two sections use the [copy][25] module to copy the NGINX Plus certificate and key from the Ansible deployment server to the NGINX Plus server during the deployment, again setting ownership to root and the mode to 0700. - - - name: NGINX Plus | Copying NGINX Plus repository certificate - copy: src=/etc/ssl/nginx/nginx-repo.crt dest=/etc/ssl/nginx/nginx-repo.crt owner=root group=root mode=0700 - - - name: NGINX Plus | Copying NGINX Plus repository key - copy: src=/etc/ssl/nginx/nginx-repo.key dest=/etc/ssl/nginx/nginx-repo.key owner=root group=root mode=0700 - -Next we tell Ansible to use the [get_url][26] module to download the CA certificate from the NGINX Plus repository at the remote location specified by the url argument, put it in the directory specified by the dest argument, and set the mode to 0700. - - - name: NGINX Plus | Downloading NGINX Plus CA certificate - get_url: url=https://cs.nginx.com/static/files/CA.crt dest=/etc/ssl/nginx/CA.crt mode=0700 - -Similarly, we tell Ansible to download the NGINX Plus repo file using the get_url module and copy it to the **/etc/yum.repos.d** directory on the NGINX Plus server. - - - name: NGINX Plus | Downloading yum NGINX Plus repository - get_url: url=https://cs.nginx.com/static/files/nginx-plus-7.repo dest=/etc/yum.repos.d/nginx-plus-7.repo mode=0700 - -The final two name sections tell Ansible to install and start NGINX Plus using the yum and service modules. - - - name: NGINX Plus | Installing NGINX Plus - yum: - name: nginx-plus - state: latest - - - name: NGINX Plus | Starting NGINX Plus - service: - name: nginx - state: started - -#### Running Ansible to Deploy NGINX Plus #### - -After saving the **install_nginx_plus.yml** file, we run the ansible-playbook command to deploy NGINX Plus. Again here we include the --ask-pass flag to have Ansible prompt for the SSH password and pass it to each NGINX Plus server, and specify the path to the main Ansible **deploy.yml** file. - - $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx-plus/deploy.yml - - PLAY [nginx] ****************************************************************** - - GATHERING FACTS *************************************************************** - ok: [172.16.239.140] - - TASK: [NGINX Plus | Creating NGINX Plus ssl cert repo directory] ************** - changed: [172.16.239.140] - - TASK: [NGINX Plus | Copying NGINX Plus repository certificate] **************** - changed: [172.16.239.140] - - TASK: [NGINX Plus | Copying NGINX Plus repository key] ************************ - changed: [172.16.239.140] - - TASK: [NGINX Plus | Downloading NGINX Plus CA certificate] ******************** - changed: [172.16.239.140] - - TASK: [NGINX Plus | Downloading yum NGINX Plus repository] ******************** - changed: [172.16.239.140] - - TASK: [NGINX Plus | Installing NGINX Plus] ************************************ - changed: [172.16.239.140] - - TASK: [NGINX Plus | Starting NGINX Plus] ************************************** - changed: [172.16.239.140] - - PLAY RECAP ******************************************************************** - 172.16.239.140 : ok=8 changed=7 unreachable=0 failed=0 - -The playbook recap was successful. Now we can run a quick curl command to verify that NGINX Plus is running. Great, we get 200 OK! Success! We have successfully installed NGINX Plus with Ansible. - - $ curl -Is http://172.16.239.140 | grep HTTP - HTTP/1.1 200 OK - -### Creating an Ansible Playbook for Installing NGINX and NGINX Plus on Ubuntu ### - -The process for deploying NGINX and NGINX Plus on [Ubuntu servers][27] is pretty similar to the process on CentOS, so instead of providing step-by-step instructions I’ll show the complete deployment files and and point out the slight differences from CentOS. - -First create the Ansible directory structure and the main Ansible deployment file, as for CentOS. Also create the **/etc/ansible/hosts** file as described in [Creating the List of NGINX Servers][28]. For NGINX Plus, you need to copy over the key and certificate as described in [Copying the NGINX Plus Certificate and Key to the Ansible Server][29]. - -Here’s the **install_nginx.yml** deployment file for open source NGINX. In the first section, we use the [apt_key][30] module to import the NGINX signing key. The next two sections use the [lineinfile][31] module to add the package URLs for Ubuntu 14.04 to the **sources.list** file. Lastly we use the [apt][32] module to update the cache and install NGINX (apt replaces the yum module we used for deploying to CentOS). - - # ./ansible-nginx/tasks/install_nginx.yml - - - name: NGINX | Adding NGINX signing key - apt_key: url=http://nginx.org/keys/nginx_signing.key state=present - - - name: NGINX | Adding sources.list deb url for NGINX - lineinfile: dest=/etc/apt/sources.list line="deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx" - - - name: NGINX Plus | Adding sources.list deb-src url for NGINX - lineinfile: dest=/etc/apt/sources.list line="deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx" - - - name: NGINX | Updating apt cache - apt: - update_cache: yes - - - name: NGINX | Installing NGINX - apt: - pkg: nginx - state: latest - - - name: NGINX | Starting NGINX - service: - name: nginx - state: started - -Here’s the **install_nginx.yml** deployment file for NGINX Plus. The first four sections set up the NGINX Plus key and certificate. Then we use the apt_key module to import the signing key as for open source NGINX, and the get_url module to download the apt configuration file for NGINX Plus. The [shell][33] module evokes a printf command that writes its output to the **nginx-plus.list** file in the **sources.list.d** directory. The final name modules are the same as for open source NGINX. - - # ./ansible-nginx-plus/tasks/install_nginx_plus.yml - - - name: NGINX Plus | Creating NGINX Plus ssl cert repo directory - file: path=/etc/ssl/nginx state=directory group=root mode=0700 - - - name: NGINX Plus | Copying NGINX Plus repository certificate - copy: src=/etc/ssl/nginx/nginx-repo.crt dest=/etc/ssl/nginx/nginx-repo.crt owner=root group=root mode=0700 - - - name: NGINX Plus | Copying NGINX Plus repository key - copy: src=/etc/ssl/nginx/nginx-repo.key dest=/etc/ssl/nginx/nginx-repo.key owner=root group=root mode=0700 - - - name: NGINX Plus | Downloading NGINX Plus CA certificate - get_url: url=https://cs.nginx.com/static/files/CA.crt dest=/etc/ssl/nginx/CA.crt mode=0700 - - - name: NGINX Plus | Adding NGINX Plus signing key - apt_key: url=http://nginx.org/keys/nginx_signing.key state=present - - - name: NGINX Plus | Downloading Apt-Get NGINX Plus repository - get_url: url=https://cs.nginx.com/static/files/90nginx dest=/etc/apt/apt.conf.d/90nginx mode=0700 - - - name: NGINX Plus | Adding sources.list url for NGINX Plus - shell: printf "deb https://plus-pkgs.nginx.com/ubuntu `lsb_release -cs` nginx-plus\n" >/etc/apt/sources.list.d/nginx-plus.list - - - name: NGINX Plus | Running apt-get update - apt: - update_cache: yes - - - name: NGINX Plus | Installing NGINX Plus via apt-get - apt: - pkg: nginx-plus - state: latest - - - name: NGINX Plus | Start NGINX Plus - service: - name: nginx - state: started - -We’re now ready to run the ansible-playbook command: - - $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx-plus/deploy.yml - -You should get a successful play recap. If you did not get a success, you can use the verbose flag to help troubleshoot your deployment as described in [Running Ansible to Deploy NGINX][34]. - -### Summary ### - -What I demonstrated in this tutorial is just the beginning of what Ansible can do to help automate your NGINX or NGINX Plus deployment. There are many useful modules ranging from user account management to custom configuration templates. If you are interested in learning more about these, please visit the extensive [Ansible documentation][35 site. - -To learn more about Ansible, come hear my talk on deploying NGINX Plus with Ansible at [NGINX.conf 2015][36], September 22–24 in San Francisco. - --------------------------------------------------------------------------------- - -via: https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/ - -作者:[Kevin Jones][a] -译者:[struggling](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.nginx.com/blog/author/kjones/ -[1]:http://www.ansible.com/ -[2]:http://www.paramiko.org/ -[3]:http://www.openssh.com/ -[4]:http://nginx.org/en/ -[5]:https://www.nginx.com/products/ -[6]:http://www.centos.org/ -[7]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#ubuntu -[8]:http://docs.ansible.com/ansible/intro_installation.html#installing-the-control-machine -[9]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#deploy-nginx -[10]:http://docs.ansible.com/ansible/playbooks_roles.html#task-include-files-and-encouraging-reuse -[11]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#list-nginx -[12]:http://docs.ansible.com/ansible/YAMLSyntax.html -[13]:http://docs.ansible.com/ansible/yum_module.html -[14]:http://docs.ansible.com/ansible/service_module.html -[15]:http://nginx.org/en/linux_packages.html -[16]:http://wiki.centos.org/HowTos/Network/SecuringSSH -[17]:http://curl.haxx.se/ -[18]:https://cs.nginx.com/ -[19]:https://www.nginx.com/#free-trial -[20]:http://linux.die.net/man/1/scp -[21]:https://winscp.net/eng/download.php -[22]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#playbook-nginx -[23]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#list-nginx -[24]:http://docs.ansible.com/ansible/file_module.html -[25]:http://docs.ansible.com/ansible/copy_module.html -[26]:http://docs.ansible.com/ansible/get_url_module.html -[27]:http://www.ubuntu.com/ -[28]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#list-nginx -[29]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#copy-cert-key -[30]:http://docs.ansible.com/ansible/apt_key_module.html -[31]:http://docs.ansible.com/ansible/lineinfile_module.html -[32]:http://docs.ansible.com/ansible/apt_module.html -[33]:http://docs.ansible.com/ansible/shell_module.html -[34]:https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/#deploy-nginx -[35]:http://docs.ansible.com/ -[36]:https://www.nginx.com/nginxconf/ diff --git a/sources/tech/20150906 Make Math Simple in Ubuntu or Elementary OS via NaSC.md b/sources/tech/20150906 Make Math Simple in Ubuntu or Elementary OS via NaSC.md deleted file mode 100644 index 2ddb2a072c..0000000000 --- a/sources/tech/20150906 Make Math Simple in Ubuntu or Elementary OS via NaSC.md +++ /dev/null @@ -1,63 +0,0 @@ -ictlyh Translating -Make Math Simple in Ubuntu / Elementary OS via NaSC -================================================================================ -![](http://ubuntuhandbook.org/wp-content/uploads/2015/09/nasc-icon.png) - -NaSC (Not a Soulver Clone) is an open source software designed for Elementary OS to do arithmetics. It’s kinda similar to the Mac app [Soulver][1]. - -> Its an app where you do maths like a normal person. It lets you type whatever you want and smartly figures out what is math and spits out an answer on the right pane. Then you can plug those answers in to future equations and if that answer changes, so does the equations its used in. - -With NaSC you can for example: - -- Perform calculations with strangers you can define yourself -- Change the units and values ​​(in m cm, dollar euro …) -- Knowing the surface area of ​​a planet -- Solve of second-degree polynomial -- and more … - -![nasc-eos](http://ubuntuhandbook.org/wp-content/uploads/2015/09/nasc-eos.jpg) - -At the first launch, NaSC offers a tutorial that details possible features. You can later click the help icon on headerbar to get more. - -![nasc-help](http://ubuntuhandbook.org/wp-content/uploads/2015/09/nasc-help.jpg) - -In addition, the software allows to save your file in order to continue the work. It can be also shared on Pastebin with a defined time. - -### Install NaSC in Ubuntu / Elementary OS Freya: ### - -For Ubuntu 15.04, Ubuntu 15.10, Elementary OS Freya, open terminal from the Dash, App Launcher and run below commands one by one: - -1. Add the [NaSC PPA][2] via command: - - sudo apt-add-repository ppa:nasc-team/daily - -![nasc-ppa](http://ubuntuhandbook.org/wp-content/uploads/2015/09/nasc-ppa.jpg) - -2. If you’ve installed Synaptic Package Manager, search for and install `nasc` via it after clicking Reload button. - -Or run below commands to update system cache and install the software: - - sudo apt-get update - - sudo apt-get install nasc - -3. **(Optional)** To remove the software as well as NaSC, run: - - sudo apt-get remove nasc && sudo add-apt-repository -r ppa:nasc-team/daily - -For those who don’t want to add PPA, grab the .deb package directly from [this page][3]. - --------------------------------------------------------------------------------- - -via: http://ubuntuhandbook.org/index.php/2015/09/make-math-simple-in-ubuntu-elementary-os-via-nasc/ - -作者:[Ji m][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://ubuntuhandbook.org/index.php/about/ -[1]:http://www.acqualia.com/soulver/ -[2]:https://launchpad.net/~nasc-team/+archive/ubuntu/daily/ -[3]:http://ppa.launchpad.net/nasc-team/daily/ubuntu/pool/main/n/nasc/ \ No newline at end of file diff --git a/sources/tech/20151104 How to Setup Pfsense Firewall and Basic Configuration.md b/sources/tech/20151104 How to Setup Pfsense Firewall and Basic Configuration.md new file mode 100644 index 0000000000..821937390a --- /dev/null +++ b/sources/tech/20151104 How to Setup Pfsense Firewall and Basic Configuration.md @@ -0,0 +1,266 @@ +How to Setup Pfsense Firewall and Basic Configuration +================================================================================ +In this article our focus is Pfsense setup, basic configuration and overview of features available in the security distribution of FreeBSD. In this tutorial we will run network wizard for basic setting of firewall and detailed overview of services. After the [installation process][1] following snapshot shows the IP addresses of WAN/LAN and different options for the management of Pfsense firewall. + +![options](http://blog.linoxide.com/wp-content/uploads/2015/08/options.png) + +After setup , following window appear which shows the url for configuration of Pfsense. + +![URL for gui](http://blog.linoxide.com/wp-content/uploads/2015/08/login_pfsense.png) + +Open above given URL in the browser and login with username **admin** and password **pfsense** + +![login_username_password](http://blog.linoxide.com/wp-content/uploads/2015/08/login_username_password.png) + +After successful login, following wizard appears for the basic setting of Pfsense firewall. However setup wizard option can be bypassed and user can run it from the **System** menu from the web interface. + +Click on the **Next** button to start basic configuration process on Pfsense firewall. + +![wizard_start](http://blog.linoxide.com/wp-content/uploads/2015/08/wizard_start.png) + +Setting hostname, domain and DNS addresses is shown in the following figure. + +![basic_setting_wizard](http://blog.linoxide.com/wp-content/uploads/2015/08/basic_setting_wizard.png) + +Setting time zone is shown in the below given snapshot. + +![time_setting](http://blog.linoxide.com/wp-content/uploads/2015/08/time_setting.png) + +Next window shows setting for the WAN interface. By defaults Pfsense firewall block bogus and private networks. + +![wan setting](http://blog.linoxide.com/wp-content/uploads/2015/08/wan-setting.png) + +Setting LAN IP address which is used to access the Pfsense web interface for further configuration. + +![lan setting](http://blog.linoxide.com/wp-content/uploads/2015/08/lan-setting.png) + +By default password for web interface is "pfsense". Enter new password for admin user on the following window to access the web interface for further configuration. + +![password](http://blog.linoxide.com/wp-content/uploads/2015/08/password.png) + +Click on the "reload" button which is shown below. It applies the setting and redirect firewall user to main dashboard of Pfsense. + +![)reload](http://blog.linoxide.com/wp-content/uploads/2015/08/reload.png + +As shown in the following snapshot, Pfsense dashboard shows system information (such as cpu details, os version, dns detail, memory consumption) and status of ethernet/wireless interfaces etc. + +![dashboard](http://blog.linoxide.com/wp-content/uploads/2015/08/dashboard1.png) + +### Menu detail ### + +PFsense consist of System, interfaces, firewall,services,vpn,status,diagnostics and help menus. + +![all menu](http://blog.linoxide.com/wp-content/uploads/2015/10/all-menu.png) + +### System Menu ### + +Sub menus of **System** is given below. + +![system menu](http://blog.linoxide.com/wp-content/uploads/2015/08/system-menu.png) + +In the **Advanced** sub menu user can perform following operations. + +1. Configuration of web interface +1. Firewall/Nat setting +1. Networking setting +1. System tuneables setting +1. Notification setting + +![advanced-systemmenu](http://blog.linoxide.com/wp-content/uploads/2015/10/advanced-systemmenu.png) + +In the **Cert manager** sub menu, firewall administrator generates certificates for CA and users. + +![cert-manager-systemmenu](http://blog.linoxide.com/wp-content/uploads/2015/10/cert-manager-systemmenu.png) + +In the **Firmware** sub menu, user can update Pfsense firmware manually/automatically. User can take full backup of Pfsense configurations. + +![firmware-systemmenu](http://blog.linoxide.com/wp-content/uploads/2015/10/firmware-systemmenu.png) + +In the **General Setup** sub menu, user can change basic setting such as hostname and domain etc. + +![general setup-systemmenu](http://blog.linoxide.com/wp-content/uploads/2015/10/general-setup-systemmenu.png) + +As menu title indicates, user can enable/disable high availability feature from this sub menu. + +![highavail-systemmenu](http://blog.linoxide.com/wp-content/uploads/2015/10/highavail-systemmenu.png) + +Packages sub menu provides package manager facility in the web interface for Pfsense . + +![packages-system menu](http://blog.linoxide.com/wp-content/uploads/2015/10/packages-systemmenu.png) + +User can perform gateway and route management using **Routing** sub menu. + +![routing-system menu](http://blog.linoxide.com/wp-content/uploads/2015/10/routing-systemmenu.png) + +**Setup Wizard** sub menu opens following window which start basic configuration of Pfsense. + +![wizard_start](http://blog.linoxide.com/wp-content/uploads/2015/10/wizard_start.png) + +Management of user can be done from the **User manager** sub menu. + +![usermanager-system](http://blog.linoxide.com/wp-content/uploads/2015/10/usermanager-system.png) + +### Interfaces Menu ### + +This menu is used for the assignment of interfaces (LAN/WAN), VLAN setting,wireless and GRE configuration etc. + +![Interfaces setting](http://blog.linoxide.com/wp-content/uploads/2015/10/interfaces-setting.png) + +### Firewall Menu ### + +Firewall is the main and core part of Pfsense distribution and it provides following features. + +![firewall-menu](http://blog.linoxide.com/wp-content/uploads/2015/10/firewall-systemmenu.png) + +**Aliases** + +Aliases are defined for real hosts, networks or ports and they can be used to minimize the number of changes. + +![firewall-aliases](http://blog.linoxide.com/wp-content/uploads/2015/10/firewall-aliases.png) + +**NAT (Network Address Translation)** + +NAT binds a specific internal address to a specific external address. Incoming traffic from the Internet to the specified IP will be directed toward the associated internal IP. + +![firewall-nat](http://blog.linoxide.com/wp-content/uploads/2015/10/firewall-nat.png) + +**Firewall Rules** + +Firewall rules control what traffic is allowed to enter an interface on the firewall. After traffic is passed on the interface, it enters an entry in the state table is created. + +![firewall-rules](http://blog.linoxide.com/wp-content/uploads/2015/10/firewall-rules.png) + +**Schedules** + +Firewall rules can be scheduled so that they are only active at certain times of day or on certain specific days or days of the week. + +![firewall-schedules](http://blog.linoxide.com/wp-content/uploads/2015/10/firewall-schedules.png) + +**Traffic Shaper** + +Traffic shaping is the control of computer network traffic in order to optimize performance and lower latency. + +![firewall-traffic shapper](http://blog.linoxide.com/wp-content/uploads/2015/10/firewall-traffic-shapper.png) + +**Virtual IPs** + +Virtual IPs add knowledge of additional IP addresses to the firewall that are different from the firewall's real interface addresses. + +![firewall-virtualipaddresses](http://blog.linoxide.com/wp-content/uploads/2015/10/services-menu.png) + +### Services Menu ### + +Services menu shows services which are provided by the Pfsense distribution along firewall. + +![services-menu](http://blog.linoxide.com/wp-content/uploads/2015/10/services-menu.png) + +New program/software installed for some specific service is also shown in this menu such as snort. By default following services are listed in services menu. + +**Captive portal** + +The captive portal functionality in Pfsense allows securing a network by requiring a username and password entered on a portal page. + +![services-captive portal](http://blog.linoxide.com/wp-content/uploads/2015/10/services-captive-portal.png) + +**DHCP Relay** + +The DHCP Relay daemon will relay DHCP requests between broadcast domains for IPv4 DHCP. + +![services-dhcp relay](http://blog.linoxide.com/wp-content/uploads/2015/10/services-dhcp-relay.png) + +**DHCP Server** + +User can run DHCP service on the firewall for the network devices. + +![services-dhcp server](http://blog.linoxide.com/wp-content/uploads/2015/10/services-dhcp-server.png) + +**DNS Forwarder/Resolver/Dynamic DNS** + +DNS different services can be configured on the Pfsense firewall. + +![services-dynamic dns client](http://blog.linoxide.com/wp-content/uploads/2015/10/services-dynamic-dns-client.png) + +![services-dns resolver](http://blog.linoxide.com/wp-content/uploads/2015/10/services-dns-resolver.png) + +![services-dns forwarder](http://blog.linoxide.com/wp-content/uploads/2015/10/services-dns-forwarder.png) + +**IGMP Proxy** + +User can configure IGMP on the Pfsense firewall from services menu. + +![services igmp](http://blog.linoxide.com/wp-content/uploads/2015/10/services-igmp.png) + +**Load Balancer** + +Load Balancing is one of the important feature which is also supported by the Pfsense firewall. + +![services load balancer](http://blog.linoxide.com/wp-content/uploads/2015/10/services-load-balancer.png) + +**SNMP (Simple Network Management Protocol)** + +Pfsense supports all versions of snmp for remote management of firewall. + +![services snmp](http://blog.linoxide.com/wp-content/uploads/2015/10/services-snmp.png) + +**Wake on Lan** + +Using this feature packet sent to a workstation on a locally connected network which will power on a workstation. + +![services-wake on lan](http://blog.linoxide.com/wp-content/uploads/2015/10/services-wake-on-lan.png) + +### VPN Menu ### + +It is one of the most important feature of Pfsense. Its supports following types of vpn configuration. + +**VPN IPsec** + +IPsec is a standard for providing security to IP protocols via encryption and/or authentication. + +![vpn-ipsec](http://blog.linoxide.com/wp-content/uploads/2015/10/vpn-ipsec.png) + +**L2TP IPsec** + +L2TP/IPsec is a common VPN type that wraps L2TP, an insecure tunneling protocol, inside a secure channel built using transport mode IPsec. + +![vpn- l2tp](http://blog.linoxide.com/wp-content/uploads/2015/10/vpn-l2tp.png) + +**OpenVPN** + +OpenVPN is an Open Source VPN server and client that is supported on pfSense. + +![vpn openvpn](http://blog.linoxide.com/wp-content/uploads/2015/10/vpn-openvpn.png) + +**Status Menu** + +It shows the status of services provided by Pfsense such as dhcp server, ipsec and load balancer etc. + +![status-menu](http://blog.linoxide.com/wp-content/uploads/2015/10/status-menu.png) + +**Diagnostic Menu** + +This menu helps administrator/user for the rectification of Pfsense issues or problems. + +![diagnosics menu](http://blog.linoxide.com/wp-content/uploads/2015/10/diagnosics-menu.png) + +**Help Menu** + +This menu provides links for different useful resources such as FreeBSD handbook,developer wiki, paid support and pfsense book. + +![help menu](http://blog.linoxide.com/wp-content/uploads/2015/10/help-menu.png) + +### Conclusion ### + +In this article our focus was on the basic configuration and features set of Pfsense distribution. It is based on FreeBSD distribution and widely used due to security and stability features. In our future articles on Pfsense, our focus will be on the basic firewall rules setting, snort (IDS/IPS) and IPSEC VPN configuration. + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/firewall/pfsense-setup-basic-configuration/ + +作者:[nido][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/naveeda/ +[1]:http://linoxide.com/firewall/install-pfsense-firewall/ \ No newline at end of file diff --git a/sources/tech/20151215 Securi-Pi--Using the Raspberry Pi as a Secure Landing Point.md b/sources/tech/20151215 Securi-Pi--Using the Raspberry Pi as a Secure Landing Point.md new file mode 100644 index 0000000000..36c28d25d6 --- /dev/null +++ b/sources/tech/20151215 Securi-Pi--Using the Raspberry Pi as a Secure Landing Point.md @@ -0,0 +1,497 @@ +Securi-Pi: Using the Raspberry Pi as a Secure Landing Point +================================================================================ + +Like many LJ readers these days, I've been leading a bit of a techno-nomadic lifestyle as of the past few years—jumping from network to network, access point to access point, as I bounce around the real world while maintaining my connection to the Internet and other networks I use on a daily basis. As of late, I've found that more and more networks are starting to block outbound ports like SMTP (port 25), SSH (port 22) and others. It becomes really frustrating when you drop into a local coffee house expecting to be able to fire up your SSH client and get a few things done, and you can't, because the network's blocking you. + +However, I have yet to run across a network that blocks HTTPS outbound (port 443). After a bit of fiddling with a Raspberry Pi 2 I have at home, I was able to get a nice clean solution that lets me hit various services on the Raspberry Pi via port 443—allowing me to walk around blocked ports and hobbled networks so I can do the things I need to do. In a nutshell, I have set up this Raspberry Pi to act as an OpenVPN endpoint, SSH endpoint and Apache server—with all these services listening on port 443 so networks with restrictive policies aren't an issue. + +### Notes +This solution will work on most networks, but firewalls that do deep packet inspection on outbound traffic still can block traffic that's tunneled using this method. However, I haven't been on a network that does that...yet. Also, while I use a lot of cryptography-based solutions here (OpenVPN, HTTPS, SSH), I haven't done a strict security audit of this setup. DNS may leak information, for example, and there may be other things I haven't thought of. I'm not recommending this as a way to hide all your traffic—I just use this so that I can connect to the Internet in an unfettered way when I'm out and about. + +### Getting Started +Let's start off with what you need to put this solution together. I'm using this on a Raspberry Pi 2 at home, running the latest Raspbian, but this should work just fine on a Raspberry Pi Model B, as well. It fits within the 512MB of RAM footprint quite easily, although performance may be a bit slower, because the Raspberry Pi Model B has a single-core CPU as opposed to the Pi 2's quad-core. My Raspberry Pi 2 is behind my home's router/firewall, so I get the added benefit of being able to access my machines at home. This also means that any traffic I send to the Internet appears to come from my home router's IP address, so this isn't a solution designed to protect anonymity. If you don't have a Raspberry Pi, or don't want this running out of your home, it's entirely possible to run this out of a small cloud server too. Just make sure that the server's running Debian or Ubuntu, as these instructions are targeted at Debian-based distributions. + +![](http://www.linuxjournal.com/files/linuxjournal.com/ufiles/imagecache/large-550px-centered/u1002061/11913f1.jpg) + +Figure 1. The Raspberry Pi, about to become an encrypted network endpoint. + +### Installing and Configuring BIND +Once you have your platform up and running—whether it's a Raspberry Pi or otherwise—next you're going to install BIND, the nameserver that powers a lot of the Internet. You're going to install BIND as a caching nameserver only, and not have it service incoming requests from the Internet. Installing BIND will give you a DNS server to point your OpenVPN clients at, once you get to the OpenVPN step. Installing BIND is easy; it's just a simple `apt-get `command to install it: + +``` +root@test:~# apt-get install bind9 +Reading package lists... Done +Building dependency tree +Reading state information... Done +The following extra packages will be installed: + bind9utils +Suggested packages: + bind9-doc resolvconf ufw +The following NEW packages will be installed: + bind9 bind9utils +0 upgraded, 2 newly installed, 0 to remove and + ↪0 not upgraded. +Need to get 490 kB of archives. +After this operation, 1,128 kB of additional disk + ↪space will be used. +Do you want to continue [Y/n]? y +``` + +There are a couple minor configuration changes that need to be made to one of the config files of BIND before it can operate as a caching nameserver. Both changes are in `/etc/bind/named.conf.options`. First, you're going to uncomment the "forwarders" section of this file, and you're going to add a nameserver on the Internet to which to forward requests. In this case, I'm going to add Google's DNS (8.8.8.8). The "forwarders" section of the file should look like this: + +``` +forwarders { + 8.8.8.8; +}; +``` + +The second change you're going to make allows queries from your internal network and localhost. Simply add this line to the bottom of the configuration file, right before the `}`; that ends the file: + +``` +allow-query { 192.168.1.0/24; 127.0.0.0/16; }; +``` + +That line above allows this DNS server to be queried from the network it's on (in this case, my network behind my firewall) and localhost. Next, you just need to restart BIND: + +``` +root@test:~# /etc/init.d/bind9 restart +[....] Stopping domain name service...: bind9waiting + ↪for pid 13209 to die +. ok +[ ok ] Starting domain name service...: bind9. +``` + +Now you can test `nslookup` to make sure your server works: + +``` +root@test:~# nslookup +> server localhost +Default server: localhost +Address: 127.0.0.1#53 +> www.google.com +Server: localhost +Address: 127.0.0.1#53 + +Non-authoritative answer: +Name: www.google.com +Address: 173.194.33.176 +Name: www.google.com +Address: 173.194.33.177 +Name: www.google.com +Address: 173.194.33.178 +Name: www.google.com +Address: 173.194.33.179 +Name: www.google.com +Address: 173.194.33.180 +``` + +That's it! You've got a working nameserver on this machine. Next, let's move on to OpenVPN. + +### Installing and Configuring OpenVPN + +OpenVPN is an open-source VPN solution that relies on SSL/TLS for its key exchange. It's also easy to install and get working under Linux. Configuration of OpenVPN can be a bit daunting, but you're not going to deviate from the default configuration by much. To start, you're going to run an apt-get command and install OpenVPN: + +``` +root@test:~# apt-get install openvpn +Reading package lists... Done +Building dependency tree +Reading state information... Done +The following extra packages will be installed: + liblzo2-2 libpkcs11-helper1 +Suggested packages: + resolvconf +The following NEW packages will be installed: + liblzo2-2 libpkcs11-helper1 openvpn +0 upgraded, 3 newly installed, 0 to remove and + ↪0 not upgraded. +Need to get 621 kB of archives. +After this operation, 1,489 kB of additional disk + ↪space will be used. +Do you want to continue [Y/n]? y +``` + +Now that OpenVPN is installed, you're going to configure it. OpenVPN is SSL-based, and it relies on both server and client certificates to work. To generate these certificates, you need to configure a Certificate Authority (CA) on the machine. Luckily, OpenVPN ships with some wrapper scripts known as "easy-rsa" that help to bootstrap this process. You'll start by making a directory on the filesystem for the easy-rsa scripts to reside in and by copying the scripts from the template directory there: + +``` +root@test:~# mkdir /etc/openvpn/easy-rsa +root@test:~# cp -rpv + ↪/usr/share/doc/openvpn/examples/easy-rsa/2.0/* + ↪/etc/openvpn/easy-rsa/ + ``` + +Next, copy the vars file to a backup copy: + +``` +root@test:/etc/openvpn/easy-rsa# cp vars vars.bak +``` + +Now, edit vars so it's got information pertinent to your installation. I'm going specify only the lines that need to be edited, with sample data, below: + +``` +KEY_SIZE=4096 +KEY_COUNTRY="US" +KEY_PROVINCE="CA" +KEY_CITY="Silicon Valley" +KEY_ORG="Linux Journal" +KEY_EMAIL="bill.childers@linuxjournal.com" +``` + +The next step is to source the vars file, so that the environment variables in the file are in your current environment: + +``` +root@test:/etc/openvpn/easy-rsa# source ./vars +NOTE: If you run ./clean-all, I will be doing a + ↪rm -rf on /etc/openvpn/easy-rsa/keys + ``` + +### Building the Certificate Authority + +You're now going to run clean-all to ensure a clean working environment, and then you're going to build the CA. Note that I'm changing changeme prompts to something that's appropriate for this installation: + +``` +root@test:/etc/openvpn/easy-rsa# ./clean-all +root@test:/etc/openvpn/easy-rsa# ./build-ca +Generating a 4096 bit RSA private key +...................................................++ +...................................................++ +writing new private key to 'ca.key' +----- +You are about to be asked to enter information that +will be incorporated into your certificate request. +What you are about to enter is what is called a +Distinguished Name or a DN. +There are quite a few fields but you can leave some +blank. For some fields there will be a default value, +If you enter '.', the field will be left blank. +----- +Country Name (2 letter code) [US]: +State or Province Name (full name) [CA]: +Locality Name (eg, city) [Silicon Valley]: +Organization Name (eg, company) [Linux Journal]: +Organizational Unit Name (eg, section) + ↪[changeme]:SecTeam +Common Name (eg, your name or your server's hostname) + ↪[changeme]:test.linuxjournal.com +Name [changeme]:test.linuxjournal.com +Email Address [bill.childers@linuxjournal.com]: +``` + +### Building the Server Certificate + +Once the CA is created, you need to build the OpenVPN server certificate: + +```root@test:/etc/openvpn/easy-rsa# + ↪./build-key-server test.linuxjournal.com +Generating a 4096 bit RSA private key +...................................................++ +writing new private key to 'test.linuxjournal.com.key' +----- +You are about to be asked to enter information that +will be incorporated into your certificate request. +What you are about to enter is what is called a +Distinguished Name or a DN. +There are quite a few fields but you can leave some +blank. For some fields there will be a default value, +If you enter '.', the field will be left blank. +----- +Country Name (2 letter code) [US]: +State or Province Name (full name) [CA]: +Locality Name (eg, city) [Silicon Valley]: +Organization Name (eg, company) [Linux Journal]: +Organizational Unit Name (eg, section) + ↪[changeme]:SecTeam +Common Name (eg, your name or your server's hostname) + ↪[test.linuxjournal.com]: +Name [changeme]:test.linuxjournal.com +Email Address [bill.childers@linuxjournal.com]: + +Please enter the following 'extra' attributes +to be sent with your certificate request +A challenge password []: +An optional company name []: +Using configuration from + ↪/etc/openvpn/easy-rsa/openssl-1.0.0.cnf +Check that the request matches the signature +Signature ok +The Subject's Distinguished Name is as follows +countryName :PRINTABLE:'US' +stateOrProvinceName :PRINTABLE:'CA' +localityName :PRINTABLE:'Silicon Valley' +organizationName :PRINTABLE:'Linux Journal' +organizationalUnitName:PRINTABLE:'SecTeam' +commonName :PRINTABLE:'test.linuxjournal.com' +name :PRINTABLE:'test.linuxjournal.com' +emailAddress + ↪:IA5STRING:'bill.childers@linuxjournal.com' +Certificate is to be certified until Sep 1 + ↪06:23:59 2025 GMT (3650 days) +Sign the certificate? [y/n]:y + +1 out of 1 certificate requests certified, commit? [y/n]y +Write out database with 1 new entries +Data Base Updated +``` + +The next step may take a while—building the Diffie-Hellman key for the OpenVPN server. This takes several minutes on a conventional desktop-grade CPU, but on the ARM processor of the Raspberry Pi, it can take much, much longer. Have patience, as long as the dots in the terminal are proceeding, the system is building its Diffie-Hellman key (note that many dots are snipped in these examples): + +``` +root@test:/etc/openvpn/easy-rsa# ./build-dh +Generating DH parameters, 4096 bit long safe prime, + ↪generator 2 +This is going to take a long time +....................................................+ + +``` + +### Building the Client Certificate + +Now you're going to generate a client key for your client to use when logging in to the OpenVPN server. OpenVPN is typically configured for certificate-based auth, where the client presents a certificate that was issued by an approved Certificate Authority: + +``` +root@test:/etc/openvpn/easy-rsa# ./build-key + ↪bills-computer +Generating a 4096 bit RSA private key +...................................................++ +...................................................++ +writing new private key to 'bills-computer.key' +----- +You are about to be asked to enter information that +will be incorporated into your certificate request. +What you are about to enter is what is called a +Distinguished Name or a DN. There are quite a few +fields but you can leave some blank. +For some fields there will be a default value, +If you enter '.', the field will be left blank. +----- +Country Name (2 letter code) [US]: +State or Province Name (full name) [CA]: +Locality Name (eg, city) [Silicon Valley]: +Organization Name (eg, company) [Linux Journal]: +Organizational Unit Name (eg, section) + ↪[changeme]:SecTeam +Common Name (eg, your name or your server's hostname) + ↪[bills-computer]: +Name [changeme]:bills-computer +Email Address [bill.childers@linuxjournal.com]: + +Please enter the following 'extra' attributes +to be sent with your certificate request +A challenge password []: +An optional company name []: +Using configuration from + ↪/etc/openvpn/easy-rsa/openssl-1.0.0.cnf +Check that the request matches the signature +Signature ok +The Subject's Distinguished Name is as follows +countryName :PRINTABLE:'US' +stateOrProvinceName :PRINTABLE:'CA' +localityName :PRINTABLE:'Silicon Valley' +organizationName :PRINTABLE:'Linux Journal' +organizationalUnitName:PRINTABLE:'SecTeam' +commonName :PRINTABLE:'bills-computer' +name :PRINTABLE:'bills-computer' +emailAddress + ↪:IA5STRING:'bill.childers@linuxjournal.com' +Certificate is to be certified until + ↪Sep 1 07:35:07 2025 GMT (3650 days) +Sign the certificate? [y/n]:y + +1 out of 1 certificate requests certified, + ↪commit? [y/n]y +Write out database with 1 new entries +Data Base Updated +root@test:/etc/openvpn/easy-rsa# +``` + +Now you're going to generate an HMAC code as a shared key to increase the security of the system further: + +``` +root@test:~# openvpn --genkey --secret + ↪/etc/openvpn/easy-rsa/keys/ta.key +``` + +### Configuration of the Server + +Finally, you're going to get to the meat of configuring the OpenVPN server. You're going to create a new file, /etc/openvpn/server.conf, and you're going to stick to a default configuration for the most part. The main change you're going to do is to set up OpenVPN to use TCP rather than UDP. This is needed for the next major step to work—without OpenVPN using TCP for its network communication, you can't get things working on port 443. So, create a new file called /etc/openvpn/server.conf, and put the following configuration in it: Garrick, shrink below. + +``` +port 1194 +proto tcp +dev tun +ca easy-rsa/keys/ca.crt +cert easy-rsa/keys/test.linuxjournal.com.crt ## or whatever + ↪your hostname was +key easy-rsa/keys/test.linuxjournal.com.key ## Hostname key + ↪- This file should be kept secret +management localhost 7505 +dh easy-rsa/keys/dh4096.pem +tls-auth /etc/openvpn/certs/ta.key 0 +server 10.8.0.0 255.255.255.0 # The server will use this + ↪subnet for clients connecting to it +ifconfig-pool-persist ipp.txt +push "redirect-gateway def1 bypass-dhcp" # Forces clients + ↪to redirect all traffic through the VPN +push "dhcp-option DNS 192.168.1.1" # Tells the client to + ↪use the DNS server at 192.168.1.1 for DNS - + ↪replace with the IP address of the OpenVPN + ↪machine and clients will use the BIND + ↪server setup earlier +keepalive 30 240 +comp-lzo # Enable compression +persist-key +persist-tun +status openvpn-status.log +verb 3 +``` + +And last, you're going to enable IP forwarding on the server, configure OpenVPN to start on boot and start the OpenVPN service: + +``` +root@test:/etc/openvpn/easy-rsa/keys# echo + ↪"net.ipv4.ip_forward = 1" >> /etc/sysctl.conf +root@test:/etc/openvpn/easy-rsa/keys# sysctl -p + ↪/etc/sysctl.conf +net.core.wmem_max = 12582912 +net.core.rmem_max = 12582912 +net.ipv4.tcp_rmem = 10240 87380 12582912 +net.ipv4.tcp_wmem = 10240 87380 12582912 +net.core.wmem_max = 12582912 +net.core.rmem_max = 12582912 +net.ipv4.tcp_rmem = 10240 87380 12582912 +net.ipv4.tcp_wmem = 10240 87380 12582912 +net.core.wmem_max = 12582912 +net.core.rmem_max = 12582912 +net.ipv4.tcp_rmem = 10240 87380 12582912 +net.ipv4.tcp_wmem = 10240 87380 12582912 +net.ipv4.ip_forward = 0 +net.ipv4.ip_forward = 1 + +root@test:/etc/openvpn/easy-rsa/keys# update-rc.d + ↪openvpn defaults +update-rc.d: using dependency based boot sequencing + +root@test:/etc/openvpn/easy-rsa/keys# + ↪/etc/init.d/openvpn start +[ ok ] Starting virtual private network daemon:. +``` + +### Setting Up OpenVPN Clients + +Your client installation depends on the host OS of your client, but you'll need to copy your client certs and keys created above to your client, and you'll need to import those certificates and create a configuration for that client. Each client and client OS does it slightly differently and documenting each one is beyond the scope of this article, so you'll need to refer to the documentation for that client to get it running. Refer to the Resources section for OpenVPN clients for each major OS. + +### Installing SSLH—the "Magic" Protocol Multiplexer + +The really interesting piece of this solution is SSLH. SSLH is a protocol multiplexer—it listens on port 443 for traffic, and then it can analyze whether the incoming packet is an SSH packet, HTTPS or OpenVPN, and it can forward that packet onto the proper service. This is what enables this solution to bypass most port blocks—you use the HTTPS port for all of this traffic, since HTTPS is rarely blocked. + +To start, `apt-get` install SSLH: + +``` +root@test:/etc/openvpn/easy-rsa/keys# apt-get + ↪install sslh +Reading package lists... Done +Building dependency tree +Reading state information... Done +The following extra packages will be installed: + apache2 apache2-mpm-worker apache2-utils + ↪apache2.2-bin apache2.2-common + libapr1 libaprutil1 libaprutil1-dbd-sqlite3 + ↪libaprutil1-ldap libconfig9 +Suggested packages: + apache2-doc apache2-suexec apache2-suexec-custom + ↪openbsd-inetd inet-superserver +The following NEW packages will be installed: + apache2 apache2-mpm-worker apache2-utils + ↪apache2.2-bin apache2.2-common + libapr1 libaprutil1 libaprutil1-dbd-sqlite3 + ↪libaprutil1-ldap libconfig9 sslh +0 upgraded, 11 newly installed, 0 to remove + ↪and 0 not upgraded. +Need to get 1,568 kB of archives. +After this operation, 5,822 kB of additional + ↪disk space will be used. +Do you want to continue [Y/n]? y +``` + +After SSLH is installed, the package installer will ask you if you want to run it in inetd or standalone mode. Select standalone mode, because you want SSLH to run as its own process. If you don't have Apache installed, the Debian/Raspbian package of SSLH will pull it in automatically, although it's not strictly required. If you already have Apache running and configured, you'll want to make sure it only listens on localhost's interface and not all interfaces (otherwise, SSLH can't start because it can't bind to port 443). After installation, you'll receive an error that looks like this: + +``` +[....] Starting ssl/ssh multiplexer: sslhsslh disabled, + ↪please adjust the configuration to your needs +[FAIL] and then set RUN to 'yes' in /etc/default/sslh + ↪to enable it. ... failed! +failed! +``` + +This isn't an error, exactly—it's just SSLH telling you that it's not configured and can't start. Configuring SSLH is pretty simple. Its configuration is stored in `/etc/default/sslh`, and you just need to configure the `RUN` and `DAEMON_OPTS` variables. My SSLH configuration looks like this: + +``` +# Default options for sslh initscript +# sourced by /etc/init.d/sslh + +# Disabled by default, to force yourself +# to read the configuration: +# - /usr/share/doc/sslh/README.Debian (quick start) +# - /usr/share/doc/sslh/README, at "Configuration" section +# - sslh(8) via "man sslh" for more configuration details. +# Once configuration ready, you *must* set RUN to yes here +# and try to start sslh (standalone mode only) + +RUN=yes + +# binary to use: forked (sslh) or single-thread + ↪(sslh-select) version +DAEMON=/usr/sbin/sslh + +DAEMON_OPTS="--user sslh --listen 0.0.0.0:443 --ssh + ↪127.0.0.1:22 --ssl 127.0.0.1:443 --openvpn + ↪127.0.0.1:1194 --pidfile /var/run/sslh/sslh.pid" + ``` + + Save the file and start SSLH: + +``` + root@test:/etc/openvpn/easy-rsa/keys# + ↪/etc/init.d/sslh start +[ ok ] Starting ssl/ssh multiplexer: sslh. +``` + +Now, you should be able to ssh to port 443 on your Raspberry Pi, and have it forward via SSLH: + +``` +$ ssh -p 443 root@test.linuxjournal.com +root@test:~# +``` + +SSLH is now listening on port 443 and can direct traffic to SSH, Apache or OpenVPN based on the type of packet that hits it. You should be ready to go! + +### Conclusion + +Now you can fire up OpenVPN and set your OpenVPN client configuration to port 443, and SSLH will route it to the OpenVPN server on port 1194. But because you're talking to your server on port 443, your VPN traffic won't get blocked. Now you can land at a strange coffee shop, in a strange town, and know that your Internet will just work when you fire up your OpenVPN and point it at your Raspberry Pi. You'll also gain some encryption on your link, which will improve the privacy of your connection. Enjoy surfing the Net via your new landing point! + +Resources + +Installing and Configuring OpenVPN: [https://wiki.debian.org/OpenVPN](https://wiki.debian.org/OpenVPN) and [http://cryptotap.com/articles/openvpn](http://cryptotap.com/articles/openvpn) + +OpenVPN client downloads: [https://openvpn.net/index.php/open-source/downloads.html](https://openvpn.net/index.php/open-source/downloads.html) + +OpenVPN Client for iOS: [https://itunes.apple.com/us/app/openvpn-connect/id590379981?mt=8](https://itunes.apple.com/us/app/openvpn-connect/id590379981?mt=8) + +OpenVPN Client for Android: [https://play.google.com/store/apps/details?id=net.openvpn.openvpn&hl=en](https://play.google.com/store/apps/details?id=net.openvpn.openvpn&hl=en) + +Tunnelblick for Mac OS X (OpenVPN client): [https://tunnelblick.net](https://tunnelblick.net) + +SSLH—Protocol Multiplexer: [http://www.rutschle.net/tech/sslh.shtml](http://www.rutschle.net/tech/sslh.shtml) and [https://github.com/yrutschle/sslh](https://github.com/yrutschle/sslh) + + +---------- +via: http://www.linuxjournal.com/content/securi-pi-using-raspberry-pi-secure-landing-point?page=0,0 + +作者:[Bill Childers][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxjournal.com/users/bill-childers + + diff --git a/sources/tech/20160104 What is good stock portfolio management software on Linux.md b/sources/tech/20160104 What is good stock portfolio management software on Linux.md new file mode 100644 index 0000000000..258cf104fc --- /dev/null +++ b/sources/tech/20160104 What is good stock portfolio management software on Linux.md @@ -0,0 +1,109 @@ +What is good stock portfolio management software on Linux +================================================================================ +If you are investing in the stock market, you probably understand the importance of a sound portfolio management plan. The goal of portfolio management is to come up with the best investment plan tailored for you, considering your risk tolerance, time horizon and financial goals. Given its importance, no wonder there are no shortage of commercial portfolio management apps and stock market monitoring software, each touting various sophisticated portfolio performance tracking and reporting capabilities. + +For those of you Linux aficionados who are looking for a **good open-source portfolio management tool** to manage and track your stock portfolio on Linux, I would highly recommend a Java-based portfolio manager called [JStock][1]. If you are not a big Java fan, you might be turned off by the fact that JStock runs on a heavyweight JVM. At the same time I am sure many people will appreciate the fact that JStock is instantly accessible on every Linux platform with JRE installed. No hoops to jump through to make it work on your Linux environment. + +The day is gone when "open-source" means "cheap" or "subpar". Considering that JStock is just a one-man job, JStock is impressively packed with many useful features as a portfolio management tool, and all that credit goes to Yan Cheng Cheok! For example, JStock supports price monitoring via watchlists, multiple portfolios, custom/built-in stock indicators and scanners, support for 27 different stock markets and cross-platform cloud backup/restore. JStock is available on multiple platforms (Linux, OS X, Android and Windows), and you can save and restore your JStock portfolios seamlessly across different platforms via cloud backup/restore. + +Sounds pretty neat, huh? Now I am going to show you how to install and use JStock in more detail. + +### Install JStock on Linux ### + +Since JStock is written in Java, you must [install JRE][2] to run it. Note that JStock requires JRE 1.7 or higher. If your JRE version does not meet this requirement, JStock will fail with the following error. + + Exception in thread "main" java.lang.UnsupportedClassVersionError: org/yccheok/jstock/gui/JStock : Unsupported major.minor version 51.0 + +Once you install JRE on your Linux, download the latest JStock release from the official website, and launch it as follows. + + $ wget https://github.com/yccheok/jstock/releases/download/release_1-0-7-13/jstock-1.0.7.13-bin.zip + $ unzip jstock-1.0.7.13-bin.zip + $ cd jstock + $ chmod +x jstock.sh + $ ./jstock.sh + +In the rest of the tutorial, let me demonstrate several useful features of JStock. + +### Monitor Stock Price Movements via Watchlist ### + +On JStock you can monitor stock price movement and automatically get notified by creating one or more watchlists. In each watchlist, you can add multiple stocks you are interested in. Then add your alert thresholds under "Fall Below" and "Rise Above" columns, which correspond to minimum and maximum stock prices you want to set, respectively. + +![](https://c2.staticflickr.com/2/1588/23795349969_37f4b0f23c_c.jpg) + +For example, if you set minimum/maximum prices of AAPL stock to $102 and $115.50, you will be alerted via desktop notifications if the stock price goes below $102 or moves higher than $115.50 at any time. + +You can also enable email alert option, so that you will instead receive email notifications for such price events. To enable email alerts, go to "Options" menu. Under "Alert" tab, turn on "Send message to email(s)" box, and enter your Gmail account. Once you go through Gmail authorization steps, JStock will start sending email alerts to that Gmail account (and optionally CC to any third-party email address). + +![](https://c2.staticflickr.com/2/1644/24080560491_3aef056e8d_b.jpg) + +### Manage Multiple Portfolios ### + +JStock allows you to manage multiple portfolios. This feature is useful if you are using multiple stock brokers. You can create a separate portfolio for each broker and manage your buy/sell/dividend transactions on a per-broker basis. You can switch different portfolios by choosing a particular portfolio under "Portfolio" menu. The following screenshot shows a hypothetical portfolio. + +![](https://c2.staticflickr.com/2/1646/23536385433_df6c036c9a_c.jpg) + +Optionally you can enable broker fee option, so that you can enter any broker fees, stamp duty and clearing fees for each buy/sell transaction. If you are lazy, you can enable fee auto-calculation and enter fee schedules for each brokering firm from the option menu beforehand. Then JStock will automatically calculate and enter fees when you add transactions to your portfolio. + +![](https://c2.staticflickr.com/2/1653/24055085262_0e315c3691_b.jpg) + +### Screen Stocks with Built-in/Custom Indicators ### + +If you are doing any technical analysis on stocks, you may want to screen stocks based on various criteria (so-called "stock indicators"). For stock screening, JStock offers several [pre-built technical indicators][3] that capture upward/downward/reversal trends of individual stocks. The following is a list of available indicators. + +- Moving Average Convergence Divergence (MACD) +- Relative Strength Index (RSI) +- Money Flow Index (MFI) +- Commodity Channel Index (CCI) +- Doji +- Golden Cross, Death Cross +- Top Gainers/Losers + +To install any pre-built indicator, go to "Stock Indicator Editor" tab on JStock. Then click on "Install" button in the right-side panel. Choose "Install from JStock server" option, and then install any indicator(s) you want. + +![](https://c2.staticflickr.com/2/1476/23867534660_b6a9c95a06_c.jpg) + +Once one or more indicators are installed, you can scan stocks using them. Go to "Stock Indicator Scanner" tab, click on "Scan" button at the bottom, and choose any indicator. + +![](https://c2.staticflickr.com/2/1653/24137054996_e8fcd10393_c.jpg) + +Once you select the stocks to scan (e.g., NYSE, NASDAQ), JStock will perform scan, and show a list of stocks captured by the indicator. + +![](https://c2.staticflickr.com/2/1446/23795349889_0f1aeef608_c.jpg) + +Besides pre-built indicators, you can also define custom indicator(s) on your own with a GUI-based indicator editor. The following example screens for stocks whose current price is less than or equal to its 60-day average price. + +![](https://c2.staticflickr.com/2/1605/24080560431_3d26eac6b5_c.jpg) + +### Cloud Backup and Restore between Linux and Android JStock ### + +Another nice feature of JStock is cloud backup and restore. JStock allows you to save and restore your portfolios/watchlists via Google Drive, and this features works seamlessly across different platforms (e.g., Linux and Android). For example, if you saved your JStock portfolios to Google Drive on Android, you can restore them on Linux version of JStock. + +![](https://c2.staticflickr.com/2/1537/24163165565_bb47e04d6c_c.jpg) + +![](https://c2.staticflickr.com/2/1556/23536385333_9ed1a75d72_c.jpg) + +If you don't see your portfolios/watchlists after restoring from Google Drive, make sure that your country is correctly set under "Country" menu. + +JStock Android free version is available from [Google Play store][4]. You will need to upgrade to premium version for one-time payment if you want to use its full features (e.g., cloud backup, alerts, charts). I think the premium version is definitely worth it. + +![](https://c2.staticflickr.com/2/1687/23867534720_18b917028c_c.jpg) + +As a final note, I should mention that its creator, Yan Cheng Cheok, is pretty active in JStock development, and quite responsive in addressing any bugs. Kudos to him! + +What do you think of JStock as portfolio tracking software? + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/stock-portfolio-management-software-linux.html + +作者:[Dan Nanni][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://jstock.org/ +[2]:http://ask.xmodulo.com/install-java-runtime-linux.html +[3]:http://jstock.org/ma_indicator.html +[4]:https://play.google.com/store/apps/details?id=org.yccheok.jstock.gui diff --git a/sources/tech/20160218 How to Best Manage Encryption Keys on Linux.md b/sources/tech/20160218 How to Best Manage Encryption Keys on Linux.md new file mode 100644 index 0000000000..19aab96541 --- /dev/null +++ b/sources/tech/20160218 How to Best Manage Encryption Keys on Linux.md @@ -0,0 +1,111 @@ +How to Best Manage Encryption Keys on Linux +============================================= + +![](http://www.linux.com/images/stories/41373/key-management-diagram.png) + +Storing SSH encryption **keys** and memorizing passwords can be a headache. But unfortunately in today's world of malicious hackers and exploits, basic security precautions are an essential practice. For a lot of general users, this amounts to simply memorizing passwords and perhaps finding a good program to store the passwords, as we remind such users not to use the same password for every site. But for those of us in various IT fields, we need to take this up a level. We have to deal with encryption keys such as SSH keys, not just passwords. + +Here's a scenario: I have a server running on a cloud that I use for my main git repository. I have multiple computers I work from. All of those computers need to log into that central server to push to and pull from. I have git set up to use SSH. When git uses SSH, git essentially logs into the server in the same way you would if you were to launch a command line into the server with the SSH command. In order to configure everything, I created a config file in my .ssh directory that contains a Host entry providing a name for the server, the host name, the user to log in as, and the path to a key file. I can then test this configuration out by simply typing the command + +>ssh gitserver + +And soon I'm presented with the server's bash shell. Now I can configure git to use this same entry to log in with the stored key. Easy enough, except for one problem: For each computer I use to log into that server, I need to have a key file. That means more than one key file floating around. I have several such keys on this computer, and several such keys on my other computers. In the same way everyday users have a gazillion passwords, it's easy for us IT folks to end up with a gazillion key files. What to do? + +## Cleaning Up + +Before starting out with a program to help you manage your keys, you have to lay some groundwork on how your keys should be handled, and whether the questions we're asking even make sense. And that requires first and foremost that you understand where your public keys go and where your private keys go. I'm going to assume you know: + +1. The difference between a public key and private key + +2. Why you can't generate a private key from a public key but you can do the reverse + +3. The purpose of the authorized_keys file and what goes in it + +4. How you use private keys to log into a server that has the corresponding public key in its authorized_keys file. + +Here's an example. When you create a cloud server on Amazon Web Services, you have to provide an SSH key that you'll use for connecting to your server. Each key has a public part and a private part. Because you want your server to stay secure, at first glance it might seem you put the private key onto that server, and that you take the public key with you. After all, you don't want that server to be publicly accessible, right? But that's actually backwards. + +You put the public key on the AWS server, and you hold onto your private key for logging into the server. You guard that private key and keep it by your side, not on some remote server, as shown in the figure above. + +Here's why: If the public key were to become known to others, they wouldn't be able to log into the server since they don't have the private key. Further, if somebody did manage to break into your server, all they would find is a public key. You can't generate a private key from a public key. And so if you're using that same key on other servers, they wouldn't be able to use it to log into those other computers. + +And that's why you put your public key on your servers for logging into them through SSH. The private keys stay with you. You don't let those private keys out of your hands. + +But there's still trouble. Consider the case of my git server. I had some decisions to make. Sometimes I'm logged into a development server that's hosted elsewhere. While on that dev box, I need to connect to my git server. How can the dev box connect to the git server? By using the private key. And therein lies trouble. This scenario requires I put a private key on a server that is hosted elsewhere, which is potentially dangerous. + +Now a further scenario: What if I were to use a single key to log into multiple servers? If an intruder got hold of this one private key, he or she would have that private key and gain access to the full virtual network of servers, ready to do some serious damage. Not good at all. + +And that, of course, brings up the other question: Should I really use the same key for those other servers? That's could be dangerous because of what I just described. + +In the end, this sounds messy, but there are some simple solutions. Let's get organized. + +(Note that there are many places you need to use keys besides just logging into servers, but I'm presenting this as one scenario to show you what you're faced with when dealing with keys.) + +## Regarding Passphrases + +When you create your keys, you have the option to include a passphrase that is required when using the private key. With this passphrase, the private key file itself is encrypted using the passphrase. For example, if you have a public key stored on a server and you use the private key to log into that server, you'll be prompted to enter a passphrase. Without the passphrase, the key cannot be used. Alternatively, you can configure your key without a passphrase to begin with. Then all you need is the key file to log into the server. + +Generally going without a passphrase is easier on the users, but one reason I strongly recommend using the passphrase in many situations is this: If the private key file gets stolen, the person who steals it still can't use it until he or she is able to find out the passphrase. In theory, this will save you time as you remove the public key from the server before the attacker can discover the passphrase, thus protecting your system. There are other reasons to use a passphrase, but this one alone makes it worth it to me in many situations. (As an example, I have VNC software on an Android tablet. The tablet holds my private key. If my tablet gets stolen, I'll immediately revoke the public key from the server it logs into, rendering its private key useless, with or without the passphrase.) But in some cases I don't use it, because the server I'm logging into might not have much valuable data on it. It depends on the situation. + +## Server Infrastructure + +How you design your infrastructure of servers will impact how you manage your keys. For example, if you have multiple users logging in, you'll need to decide whether each user gets a separate key. (Generally speaking, they should; you don't want users sharing private keys. That way if one user leaves the organization or loses trust, you can revoke that user's key without having to generate new keys for everyone else. And similarly, by sharing keys they could log in as each other, which is also bad.) But another issue is how you're allocating your servers. Do you allocate a lot of servers using tools such as Puppet, for example? And do you create multiple servers based on your own images? When you replicate your servers, do you need to have the same key for each? Different cloud server software allows you to configure this how you choose; you can have the servers get the same key, or have a new one generated for each. + +If you're dealing with replicated servers, it can get confusing if the users need to use different keys to log into two different servers that are otherwise similar. But on the other hand, there could be security risks by having the servers share the same keys. Or, on the third hand, if your keys are needed for something other than logging in (such as mounting an encrypted drive), then you would need the same key in multiple places. As you can see, whether you need to use the same keys across different servers is not a decision I can make for you; there are trade offs, and you need to decide for yourself what's best. + +In the end, you're likely to have: + +- Multiple servers that need to be logged into + +- Multiple users logging into different servers, each with their own key + +- Multiple keys for each user as they log into different servers. + +(If you're using keys in other situations, as you likely are, the same general concepts will apply regarding how keys are used, how many keys are needed, whether they're shared, and how you handle private and public parts of keys.) + +## Method of safety + +Knowing your infrastructure and unique situation, you need to put together a key management plan that will help guide you on how you distribute and store your keys. For example, earlier I mentioned that if my tablet gets stolen, I will revoke the public key from my server, hopefully before the tablet can be used to access the server. As such, I can allow for the following in my overall plan: + +1. Private keys are okay on mobile devices, but they must include a passphrase + +2. There must exist a way to quickly revoke public keys from a server. + +In your situation, you might decide you just don't want to use passphrases for a system you log into regularly; for example, the system might be a test machine that the developers log into many times a day. That's fine, but then you'll need to adjust your rules a bit. You might include a rule that that machine is not to be logged into from mobile devices. In other words, you need to build your protocols based on your own situation, and not assume one size fits all. + +## Software + +On to software. Surprisingly, there aren't a lot of good, solid software solutions for storing and managing your private keys. But should there be? Consider this: If you have a program storing all your keys for all your servers, and that program is locked down by a quick password, are your keys really secure? Or, similarly, if your private keys are sitting on your hard drive for quick access by the SSH program, is a key management software really providing any protection? + +But for overall infrastructure and creating and managing public keys, there are some solutions. I already mentioned Puppet. In the Puppet world, you create modules to manage your servers in different ways. The idea is that servers are dynamic and not necessarily exact duplicates of each other. [Here's one clever approach](http://manuel.kiessling.net/2014/03/26/building-manageable-server-infrastructures-with-puppet-part-4/) that uses the same keys on different servers, but uses a different Puppet module for each user. This solution may or may not apply to you. + +Or, another option is to shift gears altogether. In the world of Docker, you can take a different approach, as described in [this blog regarding SSH and Docker](http://blog.docker.com/2014/06/why-you-dont-need-to-run-sshd-in-docker/). + +But what about managing the private keys? If you search, you're not going to find many software options, for the reasons I mentioned earlier; the private keys are sitting on your hard drive, and a management program might not provide much additional security. But I do manage my keys using this method: + +First, I have multiple Host entries in my .ssh/config file. I have an entry for hosts that I log into, but sometimes I have more than one entry for a single host. That happens if I have multiple logins. I have two different logins for the server hosting my git repository; one is strictly for git, and the other is for general-purpose bash access. The one for git has greatly restricted rights on that machine. Remember what I said earlier about my git keys living on remote development machines? There we go. Although those keys can log into one of my servers, the accounts used are severely limited. + + Second, most of these private keys include a passphrase. (For dealing with having to type the passphrase multiple times, considering using [ssh-agent](http://blog.docker.com/2014/06/why-you-dont-need-to-run-sshd-in-docker/).) + +Third, I do have some servers that I want to guard a bit more carefully, and I don't have an entry into my Host file. This is more a social engineering aspect, because the key files are still present, but it might take an intruder a bit longer to locate the key file and figure out which machine they go with. In those cases, I just type out the long ssh command manually. (It's really not that bad.) + +And you can see that I'm not using any special software to manage these private keys. + +## One Size Doesn't Fit All + +We occasionally get questions at linux.com for advice on good software for managing keys. But let's take a step back. The question actually needs to be re-framed, because there isn't a one-size-fits-all solution. The questions you ask should be based on your own situation. Are you simply trying to find a place to store your key files? Are you looking for a way to manage multiple users each with their own public key that needs to be inserted into the authorized_keys file? + +Throughout this article, I've covered the basics of how all this fits together, and hopefully at this point you'll see that how you manage your keys, and whatever software you look for (if you even need additional software at all), should happen only after you ask the right questions. + + +------------------------------------------------------------------------------ + +via: http://www.linux.com/learn/tutorials/838235-how-to-best-manage-encryption-keys-on-linux + +作者:[Jeff Cogswell][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linux.com/community/forums/person/62256 diff --git a/sources/tech/20160218 How to Set Nginx as Reverse Proxy on Centos7 CPanel.md b/sources/tech/20160218 How to Set Nginx as Reverse Proxy on Centos7 CPanel.md new file mode 100644 index 0000000000..dc21bc0b23 --- /dev/null +++ b/sources/tech/20160218 How to Set Nginx as Reverse Proxy on Centos7 CPanel.md @@ -0,0 +1,203 @@ +zky001开始翻译 + +How to Set Nginx as Reverse Proxy on Centos7 CPanel +================================================================================ + +Nginx is one of the fastest and most powerful web-server. It is known for its high performance and low resource utilization. It can be installed as both a standalone and a Reverse Proxy Web-server. In this article, I'm discussing about the installation of Nginx as a reverse proxy along with Apache on a CPanel server with latest CentOS 7 installed. + +Nginx as a reverse proxy will work as a frontend webserver serving static contents along with Apache serving the dynamic files in backend. This setup will boost up the overall server performance. + +Let's walk through the installation steps for Nginx as reverse proxy in CentOS7 x86_64 bit server with cPanel 11.52 installed. + +First of all, we need to install the EPEL repo to start-up with the process. + +### Step 1: Install the EPEL repo. ### + + root@server1 [/usr]# yum -y install epel-release + Loaded plugins: fastestmirror, tsflags, universal-hooks + Loading mirror speeds from cached hostfile + * EA4: 66.23.237.210 + * base: mirrors.linode.com + * extras: mirrors.linode.com + * updates: mirrors.linode.com + Resolving Dependencies + --> Running transaction check + ---> Package epel-release.noarch 0:7-5 will be installed + --> Finished Dependency Resolution + + Dependencies Resolved + + =============================================================================================================================================== + Package Arch Version Repository Size + =============================================================================================================================================== + Installing: + epel-release noarch 7-5 extras 14 k + +### Step 2: After installing the repo, we can start with the installation of the nDeploy RPM repo for CentOS to install our required nDeploy Webstack and Nginx plugin. ### + + root@server1 [/usr]# yum -y install http://rpm.piserve.com/nDeploy-release-centos-1.0-1.noarch.rpm + Loaded plugins: fastestmirror, tsflags, universal-hooks + nDeploy-release-centos-1.0-1.noarch.rpm | 1.7 kB 00:00:00 + Examining /var/tmp/yum-root-ei5tWJ/nDeploy-release-centos-1.0-1.noarch.rpm: nDeploy-release-centos-1.0-1.noarch + Marking /var/tmp/yum-root-ei5tWJ/nDeploy-release-centos-1.0-1.noarch.rpm to be installed + Resolving Dependencies + --> Running transaction check + ---> Package nDeploy-release-centos.noarch 0:1.0-1 will be installed + --> Finished Dependency Resolution + + Dependencies Resolved + + =============================================================================================================================================== + Package Arch Version Repository Size + =============================================================================================================================================== + Installing: + nDeploy-release-centos noarch 1.0-1 /nDeploy-release-centos-1.0-1.noarch 110 + +### Step 3: Install the nDeploy and Nginx nDeploy plugins. ### + + root@server1 [/usr]# yum --enablerepo=ndeploy install nginx-nDeploy nDeploy + Loaded plugins: fastestmirror, tsflags, universal-hooks + epel/x86_64/metalink | 9.9 kB 00:00:00 + epel | 4.3 kB 00:00:00 + ndeploy | 2.9 kB 00:00:00 + (1/4): ndeploy/7/x86_64/primary_db | 14 kB 00:00:00 + (2/4): epel/x86_64/group_gz | 169 kB 00:00:00 + (3/4): epel/x86_64/primary_db | 3.7 MB 00:00:02 + + Dependencies Resolved + + =============================================================================================================================================== + Package Arch Version Repository Size + =============================================================================================================================================== + Installing: + nDeploy noarch 2.0-11.el7 ndeploy 80 k + nginx-nDeploy x86_64 1.8.0-34.el7 ndeploy 36 M + Installing for dependencies: + PyYAML x86_64 3.10-11.el7 base 153 k + libevent x86_64 2.0.21-4.el7 base 214 k + memcached x86_64 1.4.15-9.el7 base 84 k + python-inotify noarch 0.9.4-4.el7 base 49 k + python-lxml x86_64 3.2.1-4.el7 base 758 k + + Transaction Summary + =============================================================================================================================================== + Install 2 Packages (+5 Dependent packages) + +With these steps, we've completed with the installation of Nginx plugin in our server. Now we need to configure Nginx as reverse proxy and create the virtualhost for the existing cPanel user accounts. For that we can run the following script. + +### Step 4: To enable Nginx as a front end Web Server and create the default configuration files. ### + + root@server1 [/usr]# /opt/nDeploy/scripts/cpanel-nDeploy-setup.sh enable + Modifying apache http and https port in cpanel + + httpd restarted successfully. + Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service. + Created symlink from /etc/systemd/system/multi-user.target.wants/ndeploy_watcher.service to /usr/lib/systemd/system/ndeploy_watcher.service. + Created symlink from /etc/systemd/system/multi-user.target.wants/ndeploy_backends.service to /usr/lib/systemd/system/ndeploy_backends.service. + ConfGen:: saheetha + ConfGen:: satest + +As you can see these script will modify the Apache port from 80 to another port to make Nginx run as a front end web server and create the virtual host configuration files for the existing cPanel accounts. Once it is done, confirm the status of both Apache and Nginx. + +### Apache Status: ### + + root@server1 [/var/run/httpd]# systemctl status httpd + ● httpd.service - Apache Web Server + Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) + Active: active (running) since Mon 2016-01-18 06:34:23 UTC; 12s ago + Process: 25606 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) + Main PID: 24760 (httpd) + CGroup: /system.slice/httpd.service + ‣ 24760 /usr/local/apache/bin/httpd -k start + + Jan 18 06:34:23 server1.centos7-test.com systemd[1]: Starting Apache Web Server... + Jan 18 06:34:23 server1.centos7-test.com apachectl[25606]: httpd (pid 24760) already running + Jan 18 06:34:23 server1.centos7-test.com systemd[1]: Started Apache Web Server. + +### Nginx Status: ### + + root@server1 [~]# systemctl status nginx + ● nginx.service - nginx-nDeploy - high performance web server + Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) + Active: active (running) since Sun 2016-01-17 17:18:29 UTC; 13h ago + Docs: http://nginx.org/en/docs/ + Main PID: 3833 (nginx) + CGroup: /system.slice/nginx.service + ├─ 3833 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf + ├─25473 nginx: worker process + ├─25474 nginx: worker process + └─25475 nginx: cache manager process + + Jan 17 17:18:29 server1.centos7-test.com systemd[1]: Starting nginx-nDeploy - high performance web server... + Jan 17 17:18:29 server1.centos7-test.com nginx[3804]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok + Jan 17 17:18:29 server1.centos7-test.com nginx[3804]: nginx: configuration file /etc/nginx/nginx.conf test is successful + Jan 17 17:18:29 server1.centos7-test.com systemd[1]: Started nginx-nDeploy - high performance web server. + +Nginx act as a frontend webserver running on port 80 and Apache configuration is modified to listen on http port 9999 and https port 4430. Please see their status below: + + root@server1 [/usr/local/src]# netstat -plan | grep httpd + tcp 0 0 0.0.0.0:4430 0.0.0.0:* LISTEN 17270/httpd + tcp 0 0 0.0.0.0:9999 0.0.0.0:* LISTEN 17270/httpd + tcp6 0 0 :::4430 :::* LISTEN 17270/httpd + tcp6 0 0 :::9999 :::* LISTEN 17270/httpd + +![apacheport](http://blog.linoxide.com/wp-content/uploads/2016/01/apacheport.png) + + root@server1 [/usr/local/src]# netstat -plan | grep nginx + tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 17802/nginx: master + tcp 0 0 45.79.183.73:80 0.0.0.0:* LISTEN 17802/nginx: master + +The virtualhost entries created for the existing users as located in the folder "**/etc/nginx/sites-enabled**". This file path is included in the Nginx main configuration file. + + root@server1 [/etc/nginx/sites-enabled]# ll | grep .conf + -rw-r--r-- 1 root root 311 Jan 17 09:02 saheetha.com.conf + -rw-r--r-- 1 root root 336 Jan 17 09:02 saheethastest.com.conf + +### Sample Vhost for a domain: ### + + server { + + listen 45.79.183.73:80; + #CPIPVSIX:80; + + # ServerNames + server_name saheetha.com www.saheetha.com; + access_log /usr/local/apache/domlogs/saheetha.com main; + access_log /usr/local/apache/domlogs/saheetha.com-bytes_log bytes_log; + + include /etc/nginx/sites-enabled/saheetha.com.include; + + } + +We can confirm the working of the web server status by calling a website in the browser. Please see the web server information on my server after the installation. + + root@server1 [/home]# ip a | grep -i eth0 + 3: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 + inet 45.79.183.73/24 brd 45.79.183.255 scope global dynamic eth0 + root@server1 [/home]# nginx -v + nginx version: nginx/1.8.0 + +![webserver-status](http://blog.linoxide.com/wp-content/uploads/2016/01/webserver.png) + +Nginx will create the virtual host automatically for any newly created accounts in cPanel. With these simple steps we can configure Nginx as reverse proxy on a CentOS 7/CPanel server. + +### Advantages of Nginx as Reverse Proxy: ### + + 1. Easy to install and configure + 2. Performance and efficiency + 3. Prevent DDOS attacks + 4. Allows .htaccess PHP rewrite rules + +I hope this article is useful for you guys. Thank you for referring to this. I would appreciate your valuable comments and suggestions on this for further improvements. + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/set-nginx-reverse-proxy-centos-7-cpanel/ + +作者:[Saheetha Shameer][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/saheethas/ diff --git a/sources/tech/20160218 Linux Systems Patched for Critical glibc Flaw.md b/sources/tech/20160218 Linux Systems Patched for Critical glibc Flaw.md new file mode 100644 index 0000000000..19c654e27e --- /dev/null +++ b/sources/tech/20160218 Linux Systems Patched for Critical glibc Flaw.md @@ -0,0 +1,50 @@ +Linux Systems Patched for Critical glibc Flaw +================================================= + +**Google exposed a critical flaw affecting major Linux distributions. The glibc flaw could have potentially led to remote code execution.** + +Linux users today are scrambling to patch a critical flaw in the core glibc open-source library that could be exposing systems to a remote code execution risk. The glibc vulnerability is identified as CVE-2015-7547 and is titled, "getaddrinfo stack-based buffer overflow." + +The glibc, or GNU C Library, is an open-source implementation of the C and C++ programming language libraries and is part of every major Linux distribution. Google engineers came across the CVE-2015-7547 issue when they were attempting to connect into a certain host system and a segmentation fault (segfault) occurred, causing the connection to crash. Further investigation revealed that glibc was at fault and the crash could potentially achieve an arbitrary remote code execution condition. + +"The glibc DNS client side resolver is vulnerable to a stack-based buffer overflow when the getaddrinfo() library function is used," Google wrote in a blog post. "Software using this function may be exploited with attacker-controlled domain names, attacker-controlled DNS [Domain Name System] servers, or through a man-in-the-middle attack." + +Actually exploiting the CVE-2015-7547 issue is not trivial, but it is possible. To prove that the issue can be exploited, Google has published proof-of-concept (PoC) code on GitHub that demonstrates if an end user or system is vulnerable. + +"The server code triggers the vulnerability and therefore will crash the client code," the GitHub PoC page states. + +Mark Loveless, senior security researcher at Duo Security, explained that the main risk of CVE-2015-7547 is to Linux client-based applications that rely on DNS responses. + +"There are some specific conditions, so not every single application will be impacted, but it appears that several command-line utilities, including the popular SSH [Secure Shell] client could trigger the flaw," Loveless told eWEEK. "We deem this serious mainly because of the existing risks to Linux systems, but also because of the potential for other issues." + +Other issues could potentially include a risk of an email-based attack that triggers the vulnerable glibc getaddrinfo() library call. Also of note is the fact that the vulnerability was in the code for years before it was discovered. + +Google's engineers were not the first or only group to discover the security risk in glibc. The issue was first reported to a glibc bug [tracker](https://sourceware.org/bugzilla/show_bug.cgi?id=1866) on July 13, 2015. The roots of the flaw go back even further with the actual code commit that introduced the flaw first in glibc 2.9, which was released in May 2008. + +Linux vendor Red Hat also independently was looking at the bug in glibc and on Jan. 6, 2016, Google and Red Hat developers confirmed that they had been independently working on the same vulnerability as part of the initial private discussion with upstream glibc maintainers. + +"Once it was confirmed that both teams were working on the same vulnerability, we collaborated on potential fixes, mitigations and regression testing," Florian Weimer, principal software engineer for product security at Red Hat, told eWEEK. "We also worked together to make the test coverage as wide as possible to catch any related problems in the code to help prevent future issues." + +It took years to discover that there was a security issue with the glibc code because that flaw isn't obvious or immediately apparent. + +"To diagnose bugs in a networking component, like a DNS resolver, it is common to look at packet traces which were captured while the issue was encountered," Weimer said. "Such packet captures were not available in this case, so some experimentation was needed to reproduce the exact scenario that triggered the bug." + +Weimer added that once the packet captures were available, considerable effort went into validating the fix, leading to a series of refinements culminating in the regression test suite that was contributed upstream to the glibc project. + +In many cases in Linux, the Security Enhanced Linux (SELinux) mandatory access security controls can mitigate the risk of potential vulnerabilities, but that's not the case with the new glibc issue. + +"The risk is a compromise of important system functionality due to the execution of arbitrary code supplied by an attacker," Weimer said. "A suitable SELinux policy can contain some of the damage an attacker might do and constrain their access to the system, but DNS is used by many applications and system components, so SELinux policies offer only limited containment for this issue." + +Alongside the vulnerability disclosure today, there is now a patch available to mitigate the potential risk of CVE-2015-7547. + +------------------------------------------------------------------------------ + +via: http://www.eweek.com/security/linux-systems-patched-for-critical-glibc-flaw.html + +作者:[Michael Kerner][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://twitter.com/TechJournalist diff --git a/sources/tech/20160218 What do Linux developers think of Git and GitHub.md b/sources/tech/20160218 What do Linux developers think of Git and GitHub.md new file mode 100644 index 0000000000..b444b0958c --- /dev/null +++ b/sources/tech/20160218 What do Linux developers think of Git and GitHub.md @@ -0,0 +1,95 @@ +@4357 翻译中 + +What do Linux developers think of Git and GitHub? +===================================================== + +**Also in today’s open source roundup: DistroWatch reviews XStream Desktop 153, and Street Fighter V is coming to Linux and SteamOS in the spring** + +## What do Linux developers think of Git and GitHub? + +The popularity of Git and GitHub among Linux developers is well established. But what do developers think of them? And should GitHub really be synonymous with Git itself? A Linux redditor recently asked about this and got some very interesting answers. + +Dontwakemeup46 asked his question: + +>I am learning Git and Github. What I am interested in is how these two are viewed by the community. That git and github are used extensively, is something I know. But are there serious issues with either Git or Github? Something that the community would love to change? + +[More at Reddit](http://api.viglink.com/api/click?format=go&jsonp=vglnk_145580413015211&key=0a7039c08493c7c51b759e3d13019dbe&libId=iksc5hc8010113at000DL3yrsuvp7&loc=http%3A%2F%2Fwww.infoworld.com%2Farticle%2F3033059%2Flinux%2Fwhat-do-linux-developers-think-of-git-and-github.html&v=1&out=https%3A%2F%2Fwww.reddit.com%2Fr%2Flinux%2Fcomments%2F45jy59%2Fthe_popularity_of_git_and_github%2F&ref=http%3A%2F%2Fwww.linux.com%2Fnews%2Fsoftware%2Fapplications%2F886008-what-do-linux-developers-think-of-git-and-github&title=What%20do%20Linux%20developers%20think%20of%20Git%20and%20GitHub%3F%20%7C%20InfoWorld&txt=More%20at%20Reddit) + +His fellow Linux redditors responded with their thoughts about Git and GitHub: + +>Derenir: ”Github is not affliated with Git. + +>Git is made by Linus Torvalds. + +>Github hardly supports Linux. + +>Github is a corporate bordelo that tries to make money from Git. + +>[https://desktop.github.com/](http://api.viglink.com/api/click?format=go&jsonp=vglnk_145580415025712&key=0a7039c08493c7c51b759e3d13019dbe&libId=iksc5hc8010113at000DL3yrsuvp7&loc=http%3A%2F%2Fwww.infoworld.com%2Farticle%2F3033059%2Flinux%2Fwhat-do-linux-developers-think-of-git-and-github.html&v=1&type=U&out=https%3A%2F%2Fdesktop.github.com%2F&ref=http%3A%2F%2Fwww.linux.com%2Fnews%2Fsoftware%2Fapplications%2F886008-what-do-linux-developers-think-of-git-and-github&title=What%20do%20Linux%20developers%20think%20of%20Git%20and%20GitHub%3F%20%7C%20InfoWorld&txt=https%3A%2F%2Fdesktop.github.com%2F) see here no Linux Support.” + +>**Bilog78**: ”A minor update: git hasn't been “made by Linus Torvalds” for a while. The maintainer is Junio C Hamano and the main contributors after him are Jeff King and Shawn O. Pearce.” + +>**Fearthefuture**: ”I like git but can't understand why people even use github anymore. From my point of view the only thing it does better than bitbucket are user statistics and the larger userbase. Bitbucket has unlimited free private repos, much better UI and very good integration with other services such as Jenkins.” + +>**Thunger**: ”Gitlab.com is also nice, especially since you can host your own instance on your own servers.” + +>**Takluyver**: ”Lots of people are familiar with the UI of Github and associated services like Travis, and lots of people already have Github accounts, so it's a good place for projects to be. People also use their Github profile as a kind of portfolio, so they're motivated to put more projects on there. Github is a de facto standard for hosting open source projects.” + +>**Tdammers**: ”Serious issue with git would be the UI, which is kind of counterintuitive, to the point that many users just stick with a handful of memorized incantations. + +Github: most serious issue here is that it's a proprietary hosted solution; you buy convenience, and the price is that your code is on someone else's server and not under your control anymore. Another common criticism of github is that its workflow isn't in line with the spirit of git itself, particularly the way pull requests work. And finally, github is monopolizing the code hosting landscape, and that's bad for diversity, which in turn is crucial for a thriving free software community.” + +>**Dies**: ”How is that the case? More importantly, if that is the case, then what's done is done and I guess we're stuck with Github since they control so many projects.” + +>**Tdammers**: ”The code is hosted on someone else's server, "someone else" in this case being github. Which, for an open-source project, is not typically a huge problem, but still, you don't control it. If you have a private project on github, then the only assurance you have that it will remain private is github's word for it. If you decide to delete things, then you can never be sure whether it's been deleted, or just hidden. + +Github doesn't control the projects themselves (you can always take your code and host it elsewhere, declaring the new location the "official" one), it just has deeper access to the code than the developers themselves.” + +>**Drelos**: ”I have read a lot of praises and bad stuff about Github ([here's an example](http://api.viglink.com/api/click?format=go&jsonp=vglnk_145580428524613&key=0a7039c08493c7c51b759e3d13019dbe&libId=iksc5hc8010113at000DL3yrsuvp7&loc=http%3A%2F%2Fwww.infoworld.com%2Farticle%2F3033059%2Flinux%2Fwhat-do-linux-developers-think-of-git-and-github.html&v=1&out=http%3A%2F%2Fwww.wired.com%2F2015%2F06%2Fproblem-putting-worlds-code-github%2F&ref=http%3A%2F%2Fwww.linux.com%2Fnews%2Fsoftware%2Fapplications%2F886008-what-do-linux-developers-think-of-git-and-github&title=What%20do%20Linux%20developers%20think%20of%20Git%20and%20GitHub%3F%20%7C%20InfoWorld&txt=here%27s%20an%20example)) but my simple noob question is why aren't efforts towards a free and open "version" ?” + +>**Twizmwazin**: ”GitLab is sorta pushing there.” + +[More at Reddit](http://api.viglink.com/api/click?format=go&jsonp=vglnk_145580429720714&key=0a7039c08493c7c51b759e3d13019dbe&libId=iksc5hc8010113at000DL3yrsuvp7&loc=http%3A%2F%2Fwww.infoworld.com%2Farticle%2F3033059%2Flinux%2Fwhat-do-linux-developers-think-of-git-and-github.html&v=1&out=https%3A%2F%2Fwww.reddit.com%2Fr%2Flinux%2Fcomments%2F45jy59%2Fthe_popularity_of_git_and_github%2F&ref=http%3A%2F%2Fwww.linux.com%2Fnews%2Fsoftware%2Fapplications%2F886008-what-do-linux-developers-think-of-git-and-github&title=What%20do%20Linux%20developers%20think%20of%20Git%20and%20GitHub%3F%20%7C%20InfoWorld&txt=More%20at%20Reddit) + +## DistroWatch reviews XStream Desktop 153 + +XStreamOS is a version of Solaris created by Sonicle. XStream Desktop brings the power of Solaris to desktop users, and distrohoppers might be interested in checking it out. DistroWatch did a full review of XStream Desktop 153 and found that it performed fairly well. + +Jesse Smith reports for DistroWatch: + +>I think XStream Desktop does a lot of things well. Admittedly, my trial got off to a rocky start when the operating system would not boot on my hardware and I could not get the desktop to use my display's full screen resolution when running in VirtualBox. However, after that, XStream performed fairly well. The installer works well, the operating system automatically sets up and uses boot environments, insuring we can recover the system if something goes wrong. The package management tools work well and XStream ships with a useful collection of software. + +>I did run into a few problems playing media, specifically getting audio to work. I am not sure if that is another hardware compatibility issue or a problem with the media software that ships with the operating system. On the other hand, tools such as the web browser, e-mail, productivity suite and configuration tools all worked well. + +>What I appreciate about XStream the most is that the operating system is a branch of the OpenSolaris family that is being kept up to date. Other derivatives of OpenSolaris tend to lag behind, at least with desktop software, but XStream is still shipping recent versions of Firefox and LibreOffice. + +>For me personally, XStream is missing a few components, like a printer manager, multimedia support and drivers for my specific hardware. Other aspects of the operating system are quite attractive. I like the way the developers have set up LXDE, I like the default collection of software and I especially like the way file system snapshots and boot environments are enabled out of the box. Most Linux distributions, openSUSE aside, have not caught on to the usefulness of boot environments yet and I hope it is a technology that is picked up by more projects. + +[More at DistroWatch](http://api.viglink.com/api/click?format=go&jsonp=vglnk_145580434172315&key=0a7039c08493c7c51b759e3d13019dbe&libId=iksc5hc8010113at000DL3yrsuvp7&loc=http%3A%2F%2Fwww.infoworld.com%2Farticle%2F3033059%2Flinux%2Fwhat-do-linux-developers-think-of-git-and-github.html&v=1&out=http%3A%2F%2Fdistrowatch.com%2Fweekly.php%3Fissue%3D20160215%23xstreamos&ref=http%3A%2F%2Fwww.linux.com%2Fnews%2Fsoftware%2Fapplications%2F886008-what-do-linux-developers-think-of-git-and-github&title=What%20do%20Linux%20developers%20think%20of%20Git%20and%20GitHub%3F%20%7C%20InfoWorld&txt=More%20at%20DistroWatch) + +## Street Fighter V and SteamOS + +Street Fighter is one of the most well known game franchises of all time, and now [Capcom has announced](http://api.viglink.com/api/click?format=go&jsonp=vglnk_145580435418216&key=0a7039c08493c7c51b759e3d13019dbe&libId=iksc5hc8010113at000DL3yrsuvp7&loc=http%3A%2F%2Fwww.infoworld.com%2Farticle%2F3033059%2Flinux%2Fwhat-do-linux-developers-think-of-git-and-github.html&v=1&out=http%3A%2F%2Fsteamcommunity.com%2Fgames%2F310950%2Fannouncements%2Fdetail%2F857177755595160250&ref=http%3A%2F%2Fwww.linux.com%2Fnews%2Fsoftware%2Fapplications%2F886008-what-do-linux-developers-think-of-git-and-github&title=What%20do%20Linux%20developers%20think%20of%20Git%20and%20GitHub%3F%20%7C%20InfoWorld&txt=Capcom%20has%20announced) that Street Fighter V will be coming to Linux and SteamOS in the spring. This is great news for Linux gamers. + +Joe Parlock reports for Destructoid: + +>Are you one of the less than one percent of Steam users who play on a Linux-based system? Are you part of the even smaller percentage of people who play on Linux and are excited for Street Fighter V? Well, I’ve got some good news for you. + +>Capcom has announced via Steam that Street Fighter V will be coming to SteamOS and other Linux operating systems sometime this spring. It’ll come at no extra cost, so those who already own the PC build of the game will just be able to install it on Linux and be good to go. + +[More at Destructoid](http://api.viglink.com/api/click?format=go&jsonp=vglnk_145580435418216&key=0a7039c08493c7c51b759e3d13019dbe&libId=iksc5hc8010113at000DL3yrsuvp7&loc=http%3A%2F%2Fwww.infoworld.com%2Farticle%2F3033059%2Flinux%2Fwhat-do-linux-developers-think-of-git-and-github.html&v=1&out=http%3A%2F%2Fsteamcommunity.com%2Fgames%2F310950%2Fannouncements%2Fdetail%2F857177755595160250&ref=http%3A%2F%2Fwww.linux.com%2Fnews%2Fsoftware%2Fapplications%2F886008-what-do-linux-developers-think-of-git-and-github&title=What%20do%20Linux%20developers%20think%20of%20Git%20and%20GitHub%3F%20%7C%20InfoWorld&txt=Capcom%20has%20announced) + +Did you miss a roundup? Check the [Eye On Open home page](http://www.infoworld.com/blog/eye-on-open/) to get caught up with the latest news about open source and Linux. + +------------------------------------------------------------------------------ + +via: http://www.infoworld.com/article/3033059/linux/what-do-linux-developers-think-of-git-and-github.html + +作者:[Jim Lynch][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.infoworld.com/author/Jim-Lynch/ + diff --git a/sources/tech/20160222 Achieving Enterprise-Ready Container Tools With Wercker’s Open Source CLI.md b/sources/tech/20160222 Achieving Enterprise-Ready Container Tools With Wercker’s Open Source CLI.md new file mode 100644 index 0000000000..81f7467719 --- /dev/null +++ b/sources/tech/20160222 Achieving Enterprise-Ready Container Tools With Wercker’s Open Source CLI.md @@ -0,0 +1,80 @@ +Achieving Enterprise-Ready Container Tools With Wercker’s Open Source CLI +=========================================== + +For enterprises, containers offer more efficient build environments, cloud-native applications and migration from legacy systems to the cloud. But enterprise adoption of the technology -- Docker specifically -- has been hampered by, among other issues, [a lack of mature developer tools][1]. + +Amsterdam-based [Wercker][2] is one of many early-stage companies looking to meet the need for better tools with its cloud platform for automating microservices and application development, based on Docker. + +The company [announced a $4.5 million Series A][3] funding round this month, which will help it ramp up development on an upcoming on-premise enterprise product. Key to its success, however, will be building a community around its newly [open-sourced CLI][4] tool. Wercker must quickly integrate with myriad other container technologies -- open source Kubernetes and Mesos among them -- to remain competitive in the evolving container space. + +“By open sourcing our CLI technology, we hope to get to dev-prod parity faster and turn “build once, ship anywhere” into an automated reality,” said Wercker CEO and founder Micha Hernández van Leuffen. + +I reached out to van Leuffen to learn more about the company, its CLI tool, and how it’s planning to help grow the pool of enterprise customers actually using containers in production. Below is an edited version of the interview. + +### Linux.com: Can you briefly tell us about Wercker? + +van Leuffen: Wercker is a container-centric platform for automating the development of microservices and applications. + +With Wercker’s Docker-based infrastructure, teams can increase developer velocity with custom automation pipelines using steps that produce containers as artifacts. Once the build passes, users can continue to deploy the steps as specified in the wercker.yml. Continuously repeating these steps allows teams to work in small increments, making it easy to debug and ship faster. + +![](https://www.linux.com/images/stories/66866/wercker-cli.png) + +### Linux.com: How does it help developers? + +van Leuffen: The Wercker CLI helps developers attain greater dev-prod parity. They’re able to release faster and more often because they are developing, building and testing in an environment very similar to that in production. We’ve open sourced the exact same program that we execute in the Wercker cloud platform to run your pipelines. + +### Linux.com: Can you point out some of the features and advantages of your tool as compared to competitors? + +van Leuffen: Unlike some of our competitors, we’re not just offering Docker support. With Wercker, the Docker container is the unit of work. All jobs run inside containers, and each build artifact can be a Docker container. + +Wercker’s Docker container pipeline is completely customizable. A ‘pipeline’ refers to any automated workflow, for instance, a build or deploy pipeline. In those workflows, you want to execute tasks: install dependencies, test your code, push your container, or create a slack notification when something fails, for example. We call these tasks ‘steps,’ and there is no limit to the types of steps created. In fact, we have a marketplace of steps built by the Wercker community. So if you’ve built a step that fits my workflow, I can use that in my pipeline. + +Our Docker container pipelines adapt to any developer workflow. Users can use any Docker container out there — not just those made by or for Wercker. Whether the container is on Docker Hub or a private registry such as CoreOS’s Quay, it works with Wercker. + +Our competitors range from the classic CI/CD tools to larger-scale DevOps solutions like CloudBees. + +### Linux.com: How does it integrate with other cloud technologies? + +van Leuffen: Wercker is vendor-agnostic and can automate development with any cloud platform or service. We work closely with ecosystem partners like Mesosphere, Kubernetes and CoreOS to make integrations as seamless as possible. We also recently partnered with Atlassian to integrate the Wercker platform with Bitbucket. More than 3 million Bitbucket users can install the Wercker Pipeline Viewer and view build status directly from their dashboard. + +### Linux.com: Why did you open source the Wercker CLI tool? + +van Leuffen: Open sourcing the Wercker CLI will help us stay ahead of the curve and strengthen the developer community. The market landscape is changing fast; developers are expected to release more frequently, using infrastructure of increasing complexity. While Docker has solved a lot of infrastructure problems, developer teams are still looking for the perfect tools to test, build and deploy rapidly. + +The Wercker community is already experimenting with these new tools: Kubernetes, Mesosphere, CoreOS. It makes sense to tap that community to create integrations that work with our technology – and make that process as frictionless as possible. By open sourcing our CLI technology, we hope to get to dev-prod parity faster and turn “build once, ship anywhere” into an automated reality. + +### Linux.com: You recently raised over $4.5 million, so how is this fund being used for product development? + +van Leuffen: We’re focused on building out our commercial team and bringing an enterprise product to market. We’ve had a lot of inbound interest from the enterprise looking for VPC and on-premise solutions. While the enterprise is still largely in the discovery stage, we can see the market shifting toward containers. Enterprise software devs need to release often, just like the small, agile teams with whom they are increasingly competing. We need to prove containers can scale, and that Wercker has the organizational permissions and the automation suite to make that process as efficient as possible. + +In addition to continuing to invest in our product, we’ll be focusing our resources on market education and developer evangelism. Developer teams are still looking for the right mix of tools to test, build and deploy rapidly (including Kubernetes, Mesosphere, CoreOS, etc.). As an ecosystem, we need to do more to educate and provide the tutorials and resources to help developers succeed in this changing landscape. + +### Linux.com: What products do you offer and who is your target audience? + +van Leuffen: We currently offer one service level of our product Wercker; however, we’re developing an enterprise offering. Current organizations using Wercker range from startups, such as Open Listings, to larger companies and big agencies, like Pivotal Labs. + + +### Linux.com: What does this recently open-sourced CLI do? + +van Leuffen: Using the Wercker Command Line Interface (CLI), developers can spin up Docker containers on their desktop, automate their build and deploy processes and then deploy them to various cloud providers, like AWS, and scheduler and orchestration platforms, such as Mesosphere and Kubernetes. + +The Wercker Command Line Interface is available as an open source project on GitHub and runs on both OSX and Linux machines. + + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/enterprise/systems-management/887177-achieving-enterprise-ready-container-tools-with-werckers-open-source-cli + +作者:[Swapnil Bhartiya][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/community/forums/person/61003 +[1]:http://thenewstack.io/adopting-containers-enterprise/ +[2]:http://wercker.com/ +[3]:http://venturebeat.com/2016/01/28/wercker-raises-4-5-million-open-sources-its-command-line-tool/ +[4]:https://github.com/wercker/wercker + + diff --git a/sources/tech/20160301 Viper, the Python IoT Development Suite, is now Zerynth.md b/sources/tech/20160301 Viper, the Python IoT Development Suite, is now Zerynth.md new file mode 100644 index 0000000000..f732382bc6 --- /dev/null +++ b/sources/tech/20160301 Viper, the Python IoT Development Suite, is now Zerynth.md @@ -0,0 +1,35 @@ +(翻译中 by runningwater) +Viper, the Python IoT Development Suite, is now Zerynth +============================================================ + + +![](http://www.open-electronics.org/wp-content/uploads/2016/02/Logo_Zerynth-636x144.png) + + +The startup that launched the tools to develop embedded solutions in Python language announced the brand change along with the first official release. + +>Exactly one year after the Kickstarter launch of the suite for developing Internet of Things solutions in Python language, **Viper becomes Zerynth**. It is definitely a big day for the startup that created a radically new way to approach the world of microcontrollers and connected devices, making professionals and makers able to design interactive solutions with reduced efforts and shorter time. + +>“We really believe in the uniqueness of our tools, this is why they deserve an adequate recognition. Viper was a great name for a product, but other notable companies had the same feeling many decades ago, with the result that this term was shared with too many other actors out there. We are grown now, and ready to take off fast and light, like the design processes that our tools are enabling”, says the Viper (now Zerynth), co-founders. + +>**Thousands of users** developed amazing connected solutions in just 9 months of life in Beta version. Built to be cross-platform, Zerynth’s tools are meant for high-level design of Internet/cloud-connected devices, interactive objects, artistic installations. They are: **Zerynth Studio**, a browser-based IDE for programming embedded devices in Python with cloud sync and board management features; **Zerynth Virtual Machine**: a multithreaded real-time OS that provides real hardware independence allowing code reuse on the entire ARM architecture; **Zerynth App**, a general purpose interface that turns any mobile into the controller and display for smart objects and IoT systems. + +>This modular set of tools, adaptable to different hardware and cloud infrastructures, can dramatically reduce the time to market and the overall development costs for makers, professionals and companies. + +>Now Zerynth celebrates its new name launching the **first official release** of the toolkit. Check it here [www.zerynth.com][1] + +![](http://www.open-electronics.org/wp-content/uploads/2016/02/Zerynth-Press-Release_Studio-Img-768x432.png) + +-------------------------------------------------------------------------------- + +via: http://www.open-electronics.org/viper-the-python-iot-development-suite-is-now-zerynth/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+OpenElectronics+%28Open+Electronics%29 + +作者:[Staff ][a] +译者:[runningwater](https://github.com/runningwater) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.open-electronics.org/author/staff/ +[1]: http://www.zerynth.com/ + diff --git a/sources/tech/20160303 Top 5 open source command shells for Linux.md b/sources/tech/20160303 Top 5 open source command shells for Linux.md new file mode 100644 index 0000000000..8705ad2981 --- /dev/null +++ b/sources/tech/20160303 Top 5 open source command shells for Linux.md @@ -0,0 +1,90 @@ +翻译中;by ping +Top 5 open source command shells for Linux +=============================================== + +keyword: shell , Linux , bash , zsh , fish , ksh , tcsh , license + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/terminal_blue_smoke_command_line_0.jpg?itok=u2mRRqOa) + +There are two kinds of Linux users: the cautious and the adventurous. + +On one side is the user who almost reflexively tries out ever new option which hits the scene. They’ve tried handfuls of window managers, dozens of distributions, and every new desktop widget they can find. + +On the other side is the user who finds something they like and sticks with it. They tend to like their distribution’s defaults. If they’re passionate about a text editor, it’s whichever one they mastered first. + +As a Linux user, both on the server and the desktop, for going on fifteen years now, I am definitely more in the second category than the first. I have a tendency to use what’s presented to me, and I like the fact that this means more often than not I can find thorough documentation and examples of most any use case I can dream up. If I used something non-standard, the switch was carefully researched and often predicated by a strong pitch from someone I trust. + +But that doesn’t mean I don’t like to sometimes try and see what I’m missing. So recently, after years of using the bash shell without even giving it a thought, I decided to try out four alternative shells: ksh, tcsh, zsh, and fish. All four were easy installs from my default repositories in Fedora, and they’re likely already packaged for your distribution of choice as well. + +Here’s a little bit on each option and why you might choose it to be your next Linux command-line interpreter. + +### bash + +First, let’s take a look back at the familiar. [GNU Bash][1], the Bourne Again Shell, has been the default in pretty much every Linux distribution I’ve used through the years. Originally released in 1989, bash has grown to easily become the most used shell across the Linux world, and it is commonly found in other unix-like operating systems as well. + +Bash is a perfectly respectable shell, and as you look for documentation of how to do various things across the Internet, almost invariably you’ll find instructions which assume you are using a bash shell. But bash has some shortcomings, as anyone who has ever written a bash script that’s more than a few lines can attest to. It’s not that you can’t do something, it’s that it’s not always particularly intuitive (or at least elegant) to read and write. For some examples, see this list of [common bash pitfalls][2]. + +That said, bash is probably here to stay for at least the near future, with its enormous install base and legions of both casual and professional system administrators who are already attuned to its usage, and quirks. The bash project is available under a [GPLv3][3] license. + +### ksh + +[KornShell][4], also known by its command invocation, ksh, is an alternative shell that grew out of Bell Labs in the 1980s, written by David Korn. While originally proprietary software, later versions were released under the [Eclipse Public License][5]. + +Proponents of ksh list a number of ways in which they feel it is superior, including having a better loop syntax, cleaner exit codes from pipes, an easier way to repeat commands, and associative arrays. It's also capable of emulating many of the behaviors of vi or emacs, so if you are very partial to a text editor, it may be worth giving a try. Overall, I found it to be very similar to bash for basic input, although for advanced scripting it would surely be a different experience. + +### tcsh + +[Tcsh][6] is a derivative of csh, the Berkely Unix C shell, and sports a very long lineage back to the early days of Unix and computing itself. + +The big selling point for tcsh is its scripting language, which should look very familiar to anyone who has programmed in C. Tcsh's scripting is loved by some and hated by others. But it has other features as well, including adding arguments to aliases, and various defaults that might appeal to your preferences, including the way autocompletion with tab and history tab completion work. + +You can find tcsh under a [BSD license][7]. + +### zsh + +[Zsh][8] is another shell which has similarities to bash and ksh. Originating in the early 90s, zsh sports a number of useful features, including spelling correction, theming, namable directory shortcuts, sharing your command history across multiple terminals, and various other slight tweaks from the original Bourne shell. + +The code and binaries for zsh can be distributed under an MIT-like license, though portions are under the GPL; check the [actual license][9] for details. + +### fish + +I knew I was going to like the Friendly Interactive Shell, [fish][10], when I visited the website and found it described tongue-in-cheek with "Finally, a command line shell for the 90s"—fish was written in 2005. + +The authors of fish offer a number of reasons to make the switch, all invoking a bit of humor and poking a bit of fun at shells that don't quite live up. Features include autosuggestions ("Watch out, Netscape Navigator 4.0"), support of the "astonishing" 256 color palette of VGA, but some actually quite helpful features as well including command completion based on the man pages on your machine, clean scripting, and a web-based configuration. + +Fish is licensed primarily unde the GPL version 2 but with portions under other licenses; check the repository for [complete information][11]. + +*** + +Looking for a more detailed rundown on the precise differences between each option? [This site][12] ought to help you out. + +So where did I land? Well, ultimately, I’m probably going back to bash, because the differences were subtle enough that someone who mostly used the command line interactively as opposed to writing advanced scripts really wouldn't benefit much from the switch, and I'm already pretty comfortable in bash. + +But I’m glad I decided to come out of my shell (ha!) and try some new options. And I know there are many, many others out there. Which shells have you tried, and which one do you prefer? Let us know in the comments! + + + + +via: https://opensource.com/business/16/3/top-linux-shells + +作者:[Jason Baker][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/jason-baker + +[1]: https://www.gnu.org/software/bash/ +[2]: http://mywiki.wooledge.org/BashPitfalls +[3]: http://www.gnu.org/licenses/gpl.html +[4]: http://www.kornshell.org/ +[5]: https://www.eclipse.org/legal/epl-v10.html +[6]: http://www.tcsh.org/Welcome +[7]: https://en.wikipedia.org/wiki/BSD_licenses +[8]: http://www.zsh.org/ +[9]: https://sourceforge.net/p/zsh/code/ci/master/tree/LICENCE +[10]: https://fishshell.com/ +[11]: https://github.com/fish-shell/fish-shell/blob/master/COPYING +[12]: http://hyperpolyglot.org/unix-shells + diff --git a/sources/tech/20160314 15 podcasts for FOSS fans.md b/sources/tech/20160314 15 podcasts for FOSS fans.md new file mode 100644 index 0000000000..eae53102ad --- /dev/null +++ b/sources/tech/20160314 15 podcasts for FOSS fans.md @@ -0,0 +1,80 @@ +zpl1025 +15 podcasts for FOSS fans +============================= + +keyword : FOSS , podcast + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/oss_podcasts.png?itok=3KwxsunX) + +I listen to a lot of podcasts. A lot. On my phone's podcatcher, I am subscribed to around 60 podcasts... and I think that only eight of those have podfaded (died). Unsurprisingly, a fairly sizeable proportion of those remaining alive-and-well subscriptions are shows with a specific interest or relevance to open source software. As I seek to resurrect my own comatose podcast from the nebulous realm of podfadery, I thought it would be great for us as a community to share what we're listening to. + +>Quick digression: I understand that there are a lot of "pod"-prefixed words in that first paragraph. Furthermore, I also know that the term itself is related to a proprietary device that, by most accounts, isn't even used for listening to these web-based audio broadcasts. However, the term 'webcast' died in the nineties and 'oggcast' never gathered a substantial foothold among the listening public. As such, in order to ensure that the most people actually know what I'm referring to, I'm essentially forced to use the web-anachronistic, but publicly recognized term, podcast. + +I should also mention that a number of these shows involve grown-ups using grown-up language (i.e. swearing). I've tried to indicate which shows these are by putting a red E next to their names, but please do your own due diligence if you're concerned about listening to these shows at work or with children around. + +The following lists are podcasts that I keep in heavy rotation (each sublist is listed in alphabetical order). In the first list are the ones I think of as my "general coverage" shows. They tend to either discuss general topics related to free and open source software, or they give a survey of multiple open source projects from one episode to the next. + +- [Bad Voltage][1] E — Regular contributor and community moderator here on Opensource.com, Jono Bacon, shares hosting dutes on this podcast with Jeremy Garcia, Stuart Langridge, and Bryan Lunduke, four friends with a variety of digressing and intersecting opinions. That's the most interesting part of the show for me. Of course, they also do product reviews and cover timely news relevant to free and open source software, but it's the banter that I stick around for. + +- [FLOSS Weekly][2] — The Twit network of podcasts is a long-time standby in technology broadcasts. Hosted by Randal Schwartz, FLOSS Weekly focuses on covering one open source project each week, typically by interviewing someone relevant in the development of that project. It's a really good show for getting exposed to new open source tools... or learning more about the programs you're already familiar with. + +- [Free as in Freedom][3] — Hosted by Bradley Kuhn and Karen Sandler, this show has a specific focus on legal and policy matters as it relates to both specific free and open source projects, as well as open culture in general. The show seems to have gone on a bit of a hiatus since its last episode in November of 2015, but I for one am immensely hopeful that Free as in Freedom emerges victoriously from its battle with being podfaded and returns to its regular bi-weekly schedule. + +- [GNU World Order][4] — I think that this show can be best descrbed as a free and open source variety show. Solo host, Klaatu, spends the majority of each show going in-depth at nearly tutorial level with a whole range of specific software tools and workflows. It's a really friendly way to get an open source neophyte up to speed with everything from understanding SSH to playing with digital painting and video. And there's a video component to the show, too, which certainly helps make some of these topics easier to follow. + +- [Hacker Public Radio][5] — This is just a well-executed version of a fantastic concept. Hacker Public Radio (HPR) is a community-run daily (well, working-week daily) podcast with a focus on "anything of interest to hackers." Sure there are wide swings in audio quality from show to show, but it's an open platform where anyone can share what they know (or what they think) in that topic space. Show topics include 3D printing, hardware hacking, conference interviews, and more. There are even long-running tutorial series and an audio book club. The monthly recap episodes are particularly useful if you're having trouble picking a place to start. And best of all, you can record your own episode and add it to the schedule. In fact, they actively encourage it. + +My next list of open source podcasts are a bit more specific to particular topics or software packages in the free and open source ecosystem. + +- [Blender Podcast][6] — Although this podcast is very specific to one particular application—Blender, in case you couldn't guess—many of the topics are relevant to issues faced by users and developers of open source other softrware programs. Hosts Thomas Dinges and Campbell Barton—both on the core development team for Blender—discuss the latest happenings in the Blender community, sometimes with a guest. The release schedule is a bit sporadic, but one of the things I really like about this particular show is the fact that they talk about both user issues and developer issues... and the various intersections of the two. It's a great way for each part of the community to gain insight from the other. + +- [Sunday Morning Linux Review][7] — As it's name indicates, SMLR offers a weekly review of topics relevant to Linux. Since around the end of last year, the show has seen a bit of a restructuring. However, that has not detracted from its quality. Tony Bemus, Mary Tomich, and Tom Lawrence deliver a lot of good information, and you can catch them recording their shows live through their website (if you happen to have free time on your Sundays). + +- [LinuxLUGcast][8] — The LinuxLUGcast is a community podcast that's really a recording of an online Linux Users Group (LUG) that meets on the first and third Friday of each month. The group meets (and records) via Mumble and discussions range from home builds with single-board computers like the Raspberry Pi to getting help with trying out a new distro. The LUG is open to everyone, but there is a rotating cast of regulars who've made themselves (and their IRC handles) recognizable fixtures on the show. (Full disclosure: I'm a regular on this one) + +- [The Open EdTech Podcast][9] — Thaj Sara's Open EdTech Podcast is a fairly new show that so far only has three episodes. However, since there's a really sizeable community of open source users in the field of education (both in teaching and in IT), this show serves an important and underserved segment of our community. I've spoken with Thaj via email and he assures me that new episodes are in the pipe. He just needs to set aside the time to edit them. + +- [The Linux Action Show][10] — It would be remiss of me to make a list of open source podcasts and not mention one of the stallwart fixtures in the space: The Linux Action Show. Chris Fisher and Noah Chelliah discuss current news as it pertains to Linux and open source topics while at the same time giving feature attention to specific projects or their own experiences using various open source tools. + +This next section is what I'm going to term my "honorable mention" section. These shows are either new or have a more tangential focus on open source software and culture. In any case, I still think readers of Opensource.com would enjoy listening to these shows. + +- [Blender Institute Podcast][11] — The Blender Institute—the more commercial creative production spin-off from the Blender Foundation—started hosting their own weekly podcast a few months ago. In the show, artists (and now a developer!) working at the Institute discuss the open content projects they're working on, answer questions about using Blender, and give great insight into how things go (or occasionally don't go) in their day-to-day work. + +- [Geek News Radio][12] E — There was a tangible sense of loss about a year ago when the hosts of Linux Outlaws hung up their mics. Well good news! A new show has sprung from its ashes. In episodes of Geek News Radio, Fab Scherschel and Dave Nicholas have a wider focus than Linux Outlaws did. Rather than being an actual news podcast, it's more akin to an informal discussion among friends about video games, movies, technology, and open source (of course). + +- [Geekrant][13] — Formerly known as the Everyday Linux Podcast, this show was rebranded at the start of the year to reflect kind of content that the hosts Mark Cockrell, Seth Anderson, and Chris Neves were already discussing. They do discuss open source software and culture, but they also give their own spin and opinions on topics of interest in general geek culture. Topics have a range that includes everything from popular media to network security. (P.S. Opensource.com content manager Jen Wike Huger was a guest on Episode 164.) + +- [Open Source Creative][14] E — In case you haven't read my little bio blurb, I also have my own podcast. In this show, I talk about news and topics that are [hopefully] of interest to artists and creatives who use free and open source tools. I record it during my work commute so episode length varies with traffic, and I haven't quite figured out a good way to do interviews safely, but if you listen while you're on your way to work, it'll be like we're carpooling. The show has been on a bit of hiatus for almost a year, but I've commited to making sure it comes back... and soon. + +- [Still Untitled][15] E — As you may have noticed from most of the selections on this list, I tend to lean toward the indie side of the spectrum, preferring to listen to shows by people with less of a "name." That said, this show really hits a good place for me. Hosts Adam Savage, Norman Chan, and Will Smith talk about all manner of interesting and geeky things. From Adam's adventures with Mythbusters to maker builds and book reviews, there's rarely ever a show that hasn't been fun for me to listen to. + +So there you go! I'm always looking for more interesting shows to listen to on my commute (as I'm sure many others are). What suggestions or recommendations do you have? + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/16/3/open-source-podcasts + +作者:[Jason van Gumster][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/jason-van-gumster +[1]: http://badvoltage.org/ +[2]: https://twit.tv/shows/floss-weekly +[3]: http://faif.us/ +[4]: http://gnuworldorder.info/ +[5]: http://hackerpublicradio.org/ +[6]: https://blender-podcast.org/ +[7]: http://smlr.us/ +[8]: http://linuxlugcast.com/ +[9]: http://openedtechpodcast.com/ +[10]: http://www.jupiterbroadcasting.com/tag/linux-action-show/ +[11]: http://podcast.blender.institute/ +[12]: http://sixgun.org/geeknewsradio +[13]: http://elementopie.com/geekrant-episodes +[14]: http://monsterjavaguns.com/podcast +[15]: http://www.tested.com/still-untitled-the-adam-savage-project/ diff --git a/sources/tech/20160314 Healthy Open Source.md b/sources/tech/20160314 Healthy Open Source.md new file mode 100644 index 0000000000..57dd559284 --- /dev/null +++ b/sources/tech/20160314 Healthy Open Source.md @@ -0,0 +1,213 @@ +Translating by yuba0604 +Healthy Open Source +============================ + +keyword: Node.js , opensource , project management , software + +*A walkthrough of the Node.js Foundation’s base contribution policy*. + +A lot has changed since io.js and Node.js merged under the Node.js Foundation. The most impressive change, and probably the change that is most relevant to the rest of the community and to open source in general, is the growth in contributors and committers to the project. + +A few years ago, Node.js had just a few committers (contributors with write access to the repository in order to merge code and triage bugs). The maintenance overhead for the few committers on Node.js Core was overwhelming and the project began to see a decline in both committers and outside contribution. This resulted in a corresponding decline in releases. + +Today, the Node.js project is divided into many components with a full org size of well over 400 members. Node.js Core now has over 50 committers and over 100 contributors per month. + +Through this growth we’ve found many tools that help scale the human infrastructure around an Open Source project. We also identified a few core values we believe are fundamental to modern Open Source: transparency, participation, and efficacy. As we continue to scale the way we do Open Source we try to find a balance of these values and adapt the practices we find help to fit the needs of each component of the Node.js project. + +Now that Node.js is in a good place, the foundation is looking to promote this kind of sustainability in the ecosystem. Part of this is a new umbrella for additional projects to enter the foundation, of which [Express was recently admitted][1], and the creation of this new contribution policy. + +This contribution policy is not universal. It’s meant as a starting point. Additions and alterations to this policy are encouraged so that the process used by each project fits its needs and can continue to change shape as the project grows and faces new challenges. + +The [current version][2] is hosted in the Node.js Foundation. We expect to iterate on this over time and encourage people to [log issues][3] with questions and feedback regarding the policy for future iterations. + +This document describes a very simple process suitable for most projects in the Node.js ecosystem. Projects are encouraged to adopt this whether they are hosted in the Node.js Foundation or not. + +The Node.js project is organized into over a hundred repositories and a few dozen Working Groups. There are large variations in contribution policy between many of these components because each one has different constraints. This document is a minimalist version of the processes and philosophy we’ve found works best everywhere. + +We believe that contributors should own their projects, and that includes contribution policies like this. While new foundation projects start with this policy we expect many of them to alter it or possibly diverge from it entirely to suite their own specific needs. + +The goal of this document is to create a contribution process that: + +* Encourages new contributions. + +* Encourages contributors to remain involved. + +* Avoids unnecessary processes and bureaucracy whenever possible. + +* Creates a transparent decision making process which makes it clear how contributors can be involved in decision making. + +Most contribution processes are created by maintainers who feel overwhelmed by outside contributions. These documents have traditionally been about processes that make life easier for a small group of maintainers, often at the cost of attracting new contributors. + +We’ve gone the opposite direction. The purpose of this policy is to gain contributors, to retain them as much as possible, and to use a much larger and growing contributor base to manage the corresponding influx of contributions. + +As projects mature, there’s a tendency to become top heavy and overly hierarchical as a means of quality control and this is enforced through process. We use process to add transparency that encourages participation which grows the code review pool which leads to better quality control. + +This document is based on much prior art in the Node.js community, io.js, and the Node.js project. + +This document is based on what we’ve learned growing the Node.js project. Not just the core project, which has been a massive undertaking, but also much smaller sub-projects like the website which have very different needs and, as a result, very different processes. + +When we began these reforms in the Node.js project, we were taking a lot of inspiration from the broader Node.js ecosystem. In particular, Rod Vagg’s [OPEN Open Source policy][4]. Rod’s work in levelup and nan is the basis for what we now call “liberal contribution policies.” + +### Vocabulary + +* A **Contributor** is any individual creating or commenting on an issue or pull request. + +* A **Committer** is a subset of contributors who have been given write access to the repository. + +* A **TC (Technical Committee)** is a group of committers representing the required technical expertise to resolve rare disputes. + +Every person who shows up to comment on an issue or submit code is a member of a project’s community. Just being able to see them means that they have crossed the line from being a user to being a contributor. + +Typically open source projects have had a single distinction for those that have write access to the repository and those empowered with decision making. We’ve found this to be inadequate and have separated this into two distinctions which we’ll dive into more a bit later. + +![](https://www.linux.com/images/stories/66866/healthy_1.png) + +healthy 1Looking at the community in and around a project as a bunch of concentric circles helps to visualize this. + +In the outermost circle are users, a subset of those users are contributors, a subset of contributors become committers who can merge code and triage issues. Finally, a smaller group of trusted experts who only get pulled in to the hard problems and can act as a tie-breaker in disputes. + +This is what a healthy project should look like. As the demands on the project from increased users rise, so do the contributors, and as contributors increase more are converted into committers. As the committer base grows, more of them rise to the level of expertise where they should be involved in higher level decision making. + +![](https://www.linux.com/images/stories/66866/healthy-2.png) + +If these groups don’t grow in proportion to each other they can’t carry the load imposed on them by outward growth. A project’s ability to convert people from each of these groups is the only way it can stay healthy if its user base is growing. + +This is what unhealthy projects look like in their earliest stages of dysfunction, but imagine that the committers bubble is so small you can’t actually read the word “committers” in it, and imagine this is a logarithmic scale. + +healthy-2A massive user base is pushing a lot of contributions onto a very small number of maintainers. + +This is when maintainers build processes and barriers to new contributions as a means to manage the workload. Often the problems the project is facing will be attributed to the tools the project is using, especially GitHub. + +In Node.js we had all the same problems, resolved them without a change in tooling, and today manage a growing workload much larger than most projects, and GitHub has not been a bottleneck. + +We know what happens to unhealthy projects over a long enough time period, more maintainers leave, contributions eventually fall, and **if we’re lucky** users leave it. When we aren’t so lucky adoption continues and years later we’re plagued with security and stability issues in widely adopt software that can’t be effectively maintained. + +The number of users a project has is a poor indicator of the health of the project, often it is the most used software that suffers the biggest contribution crisis. + +### Logging + +Log an issue for any question or problem you might have. When in doubt, log an issue, any additional policies about what to include will be provided in the responses. The only exception is security disclosures which should be sent privately. + +The first sentence is surprisingly controversial. A lot of maintainers complain that there isn’t a more heavy handed way of forcing people to read a document before they log an issue on GitHub. We have documents all over projects in the Node.js Foundation about writing good bug reports but, first and foremost, we encourage people to log something and try to avoid putting barriers in the way of that. + +Sure, we get bad bugs, but we have a ton of contributors who can immediately work with people who log them to educate them on better practices and treat it as an opportunity to educate. This is why we have documentation on writing good bugs, in order to educate contributors, not as a barrier to entry. + +Creating barriers to entry just reduces the number of people there’s a chance to identify, educate and potentially grow into greater contributors. + +Of course, never log a public issue about a security disclosure, ever. This is a bit vague about the best private venue because we can’t determine that for every project that adopts this policy, but we’re working on a responsible disclosure mechanism for the broader community (stay tuned). + +Committers may direct you to another repository, ask for additional clarifications, and add appropriate metadata before the issue is addressed. + +For smaller projects this isn’t a big deal but in Node.js we’ve had to continually break off work into other, more specific, repositories just to keep the volume on a single repo manageable. But all anyone has to do when someone puts something in the wrong place is direct them to the right one. + +Another benefit of growing the committer base is that there’s more people to deal with little things, like redirecting issues to other repos, or adding metadata to issues and PRs. This allows developers who are more specialized to focus on just a narrow subset of work rather than triaging issues. + +Please be courteous, respectful, and every participant is expected to follow the project’s Code of Conduct. + +One thing that can burn out a project is when people show up with a lot of hostility and entitlement. Most of the time this sentiment comes from a feeling that their input isn’t valued. No matter what, a few people will show up who are used to more hostile environments and it’s good to have these kinds of expectations explicit and written down. + +And each project should have a Code of Conduct, which is an extension of these expectations that makes people feel safe and respected. + +### Contributions + +Any change to resources in this repository must be through pull requests. This applies to all changes to documentation, code, binary files, etc. Even long term committers and TC members must use pull requests. + +No pull request can be merged without being reviewed. + +Every change needs to be a pull request. + +A Pull Request captures the entire discussion and review of a change. Allowing some subset of committers to slip things in without a Pull Request gives the impression to potential contributors that they they can’t be involved in the project because they don’t have access to a behind the scenes process or culture. + +This isn’t just a good practice, it’s a necessity in order to be transparent enough to attract new contributors. + +For non-trivial contributions, pull requests should sit for at least 36 hours to ensure that contributors in other timezones have time to review. Consideration should also be given to weekends and other holiday periods to ensure active committers all have reasonable time to become involved in the discussion and review process if they wish. + +Part of being open and inviting to more contributors is making the process accessible to people in timezones all over the world. We don’t want to add an artificial delay in small doc changes but for any change that needs a bit of consideration needs to give people in different parts of the world time to consider it. + +In Node.js we actually have an even longer timeline than this, 48 hours on weekdays and 72 on weekends. That might be too much for smaller projects so it is shorter in this base policy but as a project grows it may want to increase this as well. + +The default for each contribution is that it is accepted once no committer has an objection. During review committers may also request that a specific contributor who is most versed in a particular area gives a “LGTM” before the PR can be merged. There is no additional “sign off” process for contributions to land. Once all issues brought by committers are addressed it can be landed by any committer. + +A key part of the liberal contribution policies we’ve been building is an inversion of the typical code review process. Rather than the default mode for a change to be rejected until enough people sign off, we make the default for every change to land. This puts the onus on reviewers to note exactly what adjustments need to be made in order for it to land. + +For new contributors it’s a big leap just to get that initial code up and sent. Viewing the code review process as a series of small adjustments and education, rather than a quality control hierarchy, does a lot to encourage and retain these new contributors. + +It’s important not to build processes that encourage a project to be too top heavy, with a few people needing to sign off on every change. Instead, we just mention any committer than we think should weigh in on a specific review. In Node.js we have people who are the experts on OpenSSL, any change to crypto is going to need a LGTM from them. This kind of expertise forms naturally as a project grows and this is a good way to work with it without burning people out. + +In the case of an objection being raised in a pull request by another committer, all involved committers should seek to arrive at a consensus by way of addressing concerns being expressed by discussion, compromise on the proposed change, or withdrawal of the proposed change. + +This is what we call a lazy consensus seeking process. Most review comments and adjustments are uncontroversial and the process should optimize for getting them in without unnecessary process. When there is disagreement, try to reach an easy consensus among the committers. More than 90% of the time this is simple, easy and obvious. + +If a contribution is controversial and committers cannot agree about how to get it to land or if it should land then it should be escalated to the TC. TC members should regularly discuss pending contributions in order to find a resolution. It is expected that only a small minority of issues be brought to the TC for resolution and that discussion and compromise among committers be the default resolution mechanism. + +For the minority of changes that are controversial and don’t reach an easy consensus we escalate that to the TC. These are rare but when they do happen it’s good to reach a resolution quickly rather than letting things fester. Contentious issues tend to get a lot of attention, especially by those more casually involved in the project or even entirely outside of it, but they account for a relatively small amount of what the project does every day. + +### Becoming a Committer + +All contributors who land a non-trivial contribution should be on-boarded in a timely manner, and added as a committer, and be given write access to the repository. + +This is where we diverge sharply from open source tradition. + +Projects have historically guarded commit rights to their version control system. This made a lot of sense when we were using version control systems like subversion. A single contributor can inadvertently mess up a project pretty badly in older version control systems, but not so much in git. In git, there isn’t a lot that can’t be fixed and so most of the quality controls we put on guarding access are no longer necessary. + +Not every committer has the rights to release or make high level decisions, so we can be much more liberal about giving out commit rights. That increases the committer base for code review and bug triage. As a wider range of expertise in the committer pool smaller changes are reviewed and adjusted without the intervention of the more technical contributors, who can spend their time on reviews only they can do. + +This is they key to scaling contribution growth: committer growth. + +Committers are expected to follow this policy and continue to send pull requests, go through proper review, and have other committers merge their pull requests. + +This part is entirely redundant, but on purpose. Just a reminder even once someone is a committer their changes still flow through the same process they followed before. + +### TC Process + +The TC uses a “consensus seeking” process for issues that are escalated to the TC. The group tries to find a resolution that has no open objections among TC members. If a consensus cannot be reached that has no objections then a majority wins vote is called. It is also expected that the majority of decisions made by the TC are via a consensus seeking process and that voting is only used as a last-resort. + +The best solution tends to be the one everyone can agree to so you would think that consensus systems would be the norm. However, **pure consensus** systems incentivize obstructionism which we need to avoid. + +In pure consensus everyone essentially has a veto. So, if I don’t want something to happen I’m in a strong position of power over everyone that wants something to happen. They have to convince me, and I don’t have to convince anyone else of anything. + +To avoid this we use a system called “consensus seeking” which has a long history outside of open source. It’s quite simple, just attempt to reach a consensus, if a consensus can’t be reached then call for a majority wins vote. + +Just the fact that a vote **is a possibility** means that people can’t be obstructionists, whether someone favor a change or not, they have to convince their peers and if they aren’t willing to put in the work to convince their peers then they probably don’t involve themselves in that decision at all. + +The way these incentives play out is pretty impressive. We started using this process in io.js and adopted it in Node.js when we merged into the foundation. In that entire time we’ve never actually had to call for a vote, just the fact that we could is enough to keep everyone working together to find a solution and move forward. + +Resolution may involve returning the issue to committers with suggestions on how to move forward towards a consensus. It is not expected that a meeting of the TC will resolve all issues on its agenda during that meeting and may prefer to continue the discussion happening among the committers. + +A TC tries to resolve things in a timely manner so that people can make progress but often it’s better to provide some additional guidance that pushes the greater contributorship towards resolution without being heavy handed. + +Avoid creating big decision hierarchies. Instead, invest in a broad, growing and empowered contributorship that can make progress without intervention. We need to view a constant need for intervention by a few people to make any and every tough decision as the biggest obstacle to healthy Open Source. + +Members can be added to the TC at any time. Any committer can nominate another committer to the TC and the TC uses its standard consensus seeking process to evaluate whether or not to add this new member. Members who do not participate consistently at the level of a majority of the other members are expected to resign. + +The TC just uses the same consensus seeking process for adding new members as it uses for everything else. + +It’s a good idea to encourage committers to nominate people to the TC and not just wait around for TC members to notice the impact some people are having. Listening to the broader committers about who they see as having a big impact keeps the TC’s perspective inline with the rest of the project. + +As a project grows it’s important to add people from a variety of skill sets. If people are doing a lot of docs work, or test work, treat the investment they are making as equally valuable as the hard technical stuff. + +Projects should have the same ladder, user -> contributor -> commiters -> TC member, for every skill set they want to build into the project to keep it healthy. + +I often see long time maintainers worry about adding people who don’t understand every part of the project, as if they have to be involved in every decision. The reality is that people do know their limitations and want to defer hard decisions to people they know have more experience. + +Thanks to Greg [Wallace][5] and ashley [williams][6]. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/biz-os/governance/892141-healthy-open-source + +作者:[Mikeal Rogers][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/community/forums/person/66928 + + +[1]: https://medium.com/@nodejs/node-js-foundation-to-add-express-as-an-incubator-project-225fa3008f70#.mc30mvj4m +[2]: https://github.com/nodejs/TSC/blob/master/BasePolicies/CONTRIBUTING.md +[3]: https://github.com/nodejs/TSC/issues +[4]: https://github.com/Level/community/blob/master/CONTRIBUTING.md +[5]: https://medium.com/@gtewallaceLF +[6]: https://medium.com/@ag_dubs diff --git a/sources/tech/20160416 A newcomer's guide to navigating OpenStack Infrastructure.md b/sources/tech/20160416 A newcomer's guide to navigating OpenStack Infrastructure.md new file mode 100644 index 0000000000..4fa50b0a45 --- /dev/null +++ b/sources/tech/20160416 A newcomer's guide to navigating OpenStack Infrastructure.md @@ -0,0 +1,87 @@ +A newcomer's guide to navigating OpenStack Infrastructure +=========================================================== + +New contributors to OpenStack are welcome, but having a road map for navigating within this maturing, fast-paced open source community doesn't hurt. At OpenStack Summit in Austin, [Paul Belanger][1] (Red Hat, Inc.), [Elizabeth K. Joseph][2] (HPE), and [Christopher Aedo][3] (IBM) will lead a session on [OpenStack Infrastructure for Beginners][4]. In this interview, they offer tips and resources to help onboard new OpenStack contributors. + +![](https://opensource.com/sites/default/files/images/life/Interview%20banner%20Q%26A.png) + +**Your talk description says you'll be "diving into the heart of infrastructure and explain everything you need to know about the systems that keep OpenStack working." That's a tall order for a 40-minute time slot. What are the top things beginners should know about OpenStack infrastructure?** + +**Elizabeth K. Joseph (EKJ)**: We don't use GitHub for OpenStack patches. This is something that trips up a lot of new contributors because we do maintain mirrors of all our repositories on GitHub for historical reasons. Instead we use a fully open source code review and continuous integration (CI) system maintained by the OpenStack Infrastructure team. Relatedly, since we run a CI system, every change proposed to OpenStack is tested before merging. + +**Paul Belanger (PB)**: A lot of passionate people in the project, so don't get discouraged if your patch gets a -1. + +**Christopher Aedo (CA)**: The community wants to help you succeed, don't be afraid to ask questions or ask for pointers to more information to improve your understanding. + +### Which online resources would you recommend for beginners to fill in the holes for what you can't cover in your talk? + +**PB**: Definitely our [OpenStack Project Infrastructure documentation][5]. At lot of effort has been taken to keep it up to date as much as possible. Every system used in running OpenStack as a project has a dedicated page, even the OpenStack cloud the Infrastructure teams is bringing online. + +**EKJ**: I'll echo what Paul said about the Infrastructure documentation, and add that we love seeing patches from folks who are learning. We often don't realize what we're missing in terms of documentation until someone asks. So read, learn, and then help us fill in the gaps. You can ask questions on the [openstack-infra mailing list][6] or in our IRC channel at #openstack-infra on Freenode. + +**CA**: I love [this detailed post][7] about building images, by Ian Wienand. + +### Which "gotchas" should new OpenStack contributors look out for? + +**EKJ**: Contributing is not just about submitting new code and new features; the OpenStack community places a very high value on doing code reviews. If you want people to look at a patch you submitted, consider reviewing some of the work of others and providing clear and constructive feedback. The more your fellow contributors know about your work and see you doing reviews, the more likely you'll get your code reviewed in a timely manner. + +**CA**: I see a lot of newcomers getting tripped up with [Gerrit][8]. Read through the [developer workflow][9] in the Developers Guide, and then maybe read through it one more time. If you're not used to Gerrit, it can seem confusing and overwhelming at first, but walking through a few code reviews usually makes it all come together. Also, I'm a big fan of IRC. It can be a great place to get help, but it's best if you can maintain a persistent presence so people can answer your questions even if you're not "there" at that particular moment. (Read [IRC, the secret to success in open source][10].) You don't need to be "always on," but the ability to easily scroll back in a channel and catch up on a conversation can be invaluable. + +**PB**: I agree with both Elizabeth and Chris—Gerrit is what to look out for. It is going to be the hub of your development effort. Not only will you be submitting code for people to review, but you'll also be reviewing other contributors' code. Watch out for the Gerrit UI; it can be confusing at times. I'd recommend trying out [Gertty][11], which is a console-based interface to the Gerrit Code Review system, which happens to be a project driven by OpenStack Infrastructure. + +### What resources do you recommend for beginners to help them network with other OpenStack contributors? + +**PB**: For me, it was using IRC and joining the #openstack-infra channel on Freenode ([IRC logs][12]). There is a lot of fantastic information and people in that channel. You get to see the day-to-day operations of the OpenStack project, and once you know how the project works, you'll have a better understanding on how to contribute to its future. + +**CA**: I want to second that note for IRC; staying on IRC throughout the day made a huge difference for me in terms of feeling informed and connected. It's also such a great way to get help when you're stuck with someone on one of the projects—the ones with active IRC channels always have someone around willing to get your issues sorted out. + +**EKJ**: The [openstack-dev mailing list][13] is quite important for staying up to date with news about projects you're working on inside of OpenStack, so I recommend subscribing to that. The mailing list uses subject tags to separate projects, so you can instruct your email client to use those and focus on threads that impact projects you care about. Beyond online resources, many OpenStack groups have popped up all over the world that serve the needs of both users and contributors to OpenStack, and many of them routinely have talks and events with key OpenStack contributors. You can search on Meetup.com in your area, or search on [groups.openstack.org][14] to see if there is an OpenStack group in your area. Finally, there are the [OpenStack Summits][15], which happen every six months, and where we'll be giving our Infrastructure talk. In their current format, the summits consist of both a user conference and a developer conference in one space to talk about everything related to OpenStack, past, present, and future. + +### In which areas does OpenStack need to improve to become more beginner-friendly? + +**PB**: I think our [account-setup][16] process could be made easier for new contributors, especially how many steps are needed to submit your first patch. There is a large cost to enroll into OpenStack development model, which maybe be too much for contributors; however, once enrolled, the model works fantastic for developers. + +**CA**: We have a very pro-developer community, but the focus is on developing OpenStack itself, with less consideration given to the users of OpenStack clouds. We need to bring in application developers and encourage more people to develop things that run beautifully on OpenStack clouds, and encourage them to share those apps in the [Community App Catalog][17]. We can do this by continuing to improve our API standards and by ensuring different libraries (like libcloud, phpopencloud, and others) continue to work reliably for developers. Oh, also by sponsoring more OpenStack hackathons! All these things can ease entry for newcomers, which will lead to them sticking around. + +**EKJ**: I've worked on open source software for many years, but for a large number of OpenStack developers, this is the first open source project they've every worked on. I've found that their proprietary software background doesn't prepare them for the open source ideals, methodologies, and collaboration techniques used in an open source project. I'd love to see us do a better job of welcoming people who have this proprietary software background and working with them so they can truly understand the value of what they're working on in the open source software community. + +### I think 2016 is shaping up to be the Year of the Open Source Haiku. Explain OpenStack to beginners via Haiku. + +**PB**: OpenStack runs clouds If you enjoy free software Submit your first patch + +**CA**: In the near future OpenStack will rule the world Help make it happen! + +**EKJ**: OpenStack is free Deploy on your own servers And run your own cloud! + +*Paul, Elizabeth*, and Christopher will be [speaking at OpenStack Summit][18] in Austin on Monday, April 25, starting at 11:15am. + + +------------------------------------------------------------------------------ + +via: https://opensource.com/business/16/4/interview-openstack-infrastructure-beginners + +作者:[linux.com][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://rikkiendsley.com/ +[1]: https://twitter.com/pabelanger +[2]: https://twitter.com/pleia2 +[3]: https://twitter.com/docaedo +[4]: https://www.openstack.org/summit/austin-2016/summit-schedule/events/7337 +[5]: http://docs.openstack.org/infra/system-config/ +[6]: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra +[7]: https://www.technovelty.org/openstack/image-building-in-openstack-ci.html +[8]: https://code.google.com/p/gerrit/ +[9]: http://docs.openstack.org/infra/manual/developers.html#development-workflow +[10]: https://developer.ibm.com/opentech/2015/12/20/irc-the-secret-to-success-in-open-source/ +[11]: https://pypi.python.org/pypi/gertty +[12]: http://eavesdrop.openstack.org/irclogs/%23openstack-infra/ +[13]: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev +[14]: https://groups.openstack.org/ +[15]: https://www.openstack.org/summit/ +[16]: http://docs.openstack.org/infra/manual/developers.html#account-setup +[17]: https://apps.openstack.org/ +[18]: https://www.openstack.org/summit/austin-2016/summit-schedule/events/7337 diff --git a/sources/tech/20160426 IS UBUNTU’S SNAP PACKAGING REALLY SECURE.md b/sources/tech/20160426 IS UBUNTU’S SNAP PACKAGING REALLY SECURE.md new file mode 100644 index 0000000000..2752b5855f --- /dev/null +++ b/sources/tech/20160426 IS UBUNTU’S SNAP PACKAGING REALLY SECURE.md @@ -0,0 +1,54 @@ +IS UBUNTU’S SNAP PACKAGING REALLY SECURE +========================================== + + +The recent release of [Ubuntu 16.04 LTS has brought a number of new features][1], one of which we covered was the [inclusion of ZFS][2]. Another feature that many people have been talking about is the Snap package format. But according to one of the developers of [CoreOS][3], the Snap packages are not as safe as the claim. + +### WHAT ARE SNAP PACKAGES? + +Snap packages are inspired by containers. This new package format allows [developers to issue updates for applications running on Ubuntu Long-Term-Support (LTS) releases][4]. This gives users the option to run a stable operating system, but keep their applications updated. This is accomplished by including all of the application’s dependencies in the same package. This prevents the program from breaking when a dependency updates. + +Another advantage of Snap packages is that the applications are isolated from the rest of the system. This means that if you change something with a Snap package, it will not affect the rest of the system. It also prevents other applications from accessing your private information, which makes it harder for hackers to get your data. + +### BUT WAIT… + +According to [Matthew Garrett][5], Snap can’t quite deliver on the last promise. Garret works as a Linux kernel developer and security developer at CoreOS, so he should know what he’s talking about. + +[According to Garret][6], “Any Snap package you install is completely capable of copying all your private data to wherever it wants with very little difficulty.” + +[ZDnet][7] reported: + +>*“To prove his point, he built a proof-of-concept attack package in Snap, which first shows an “adorable” teddy bear and then logs keystrokes from Firefox and could be used to steal private SSH keys. The PoC actually injects a harmless command, but could be tweaked to include a cURL session to steal SSH keys.”* + +### BUT WAIT A LITTLE MORE… + +Is it really that Snap has security flaws? Apparently not so. + +Garret himself said that this problem was caused by the X11 window system and did not affect mobile devices that use Mir. So, it is the flaw in X11 that does it. It’s not Snap itself. + +>how X11 trusts applications is a well-known security risk. Snap doesn’t change X11’s trust model, so the fact that applications can see what other applications are doing isn’t a weakness in the new package format, but rather X11’s. + +Garrett is just actually trying to show that when Canonical is all praises for Snap and its security; Snap applications are not fully sandboxed. They are as risky as any other binaries. + +Keeping the fact in mind that Ubuntu 16.04 still uses X11 display, and not Mir, downloading and installing Snap packages from unknown sources might be harmful. But that’s the case with any other packaging, isn’t it? + +In related articles, you should check out [how to use Snap packages in Ubuntu 16.04][8]. And do let us know of your views on Snap and its security. + +---------- +via: http://itsfoss.com/snap-package-securrity-issue/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ItsFoss+%28Its+FOSS%21+An+Open+Source+Blog%29 + +作者:[ John Paul][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://itsfoss.com/author/john/ +[1]: http://itsfoss.com/features-ubuntu-1604/ +[2]: http://itsfoss.com/oracle-canonical-lawsuit/ +[3]: https://en.wikipedia.org/wiki/CoreOS +[4]: https://insights.ubuntu.com/2016/04/13/snaps-for-classic-ubuntu/ +[5]: https://mjg59.dreamwidth.org/l +[6]: https://mjg59.dreamwidth.org/42320.html +[7]: http://www.zdnet.com/article/linux-expert-matthew-garrett-ubuntu-16-04s-new-snap-format-is-a-security-risk/ +[8]: http://itsfoss.com/use-snap-packages-ubuntu-16-04/ diff --git a/sources/tech/20160511 4 Container Networking Tools to Know.md b/sources/tech/20160511 4 Container Networking Tools to Know.md new file mode 100644 index 0000000000..5b80791c6f --- /dev/null +++ b/sources/tech/20160511 4 Container Networking Tools to Know.md @@ -0,0 +1,63 @@ +4 Container Networking Tools to Know +======================================= + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/network-crop.jpeg?itok=Na1tb9aR) +>[Creative Commons Zero][1] + +With so many new cloud computing technologies, tools, and techniques to keep track of, it can be hard to know where to start learning new skills. This series on [next-gen cloud technologies][2] aims to help you get up to speed on the important projects and products in emerging and rapidly changing areas such as software-defined networking (SDN) , containers, and the space where they coincide: container networking. + +The relationship between containers and networks remains challenging for enterprise container deployment. Containers need networking functionality to connect distributed applications. Part of the challenge, according to a recent [Enterprise Networking Planet][3] article, is “to deploy containers in a way that provides the isolation they need to function as their own self-contained data environments while still maintaining effective connectivity.” + +[Docker][4], the popular container platform, uses software-defined virtual networks to connect containers with the local network. Additionally, it uses Linux bridging features and virtual extensible LAN (VXLAN) technology so containers can communicate with each other in the same Swarm, or cluster. Docker’s plug-in architecture also allows other network management tools, such as those listed below, to control containers. + +Innovation in container networking has enabled containers to connect with other containers across hosts. This enables developers to start an application in a container on a host in a development environment and transition it across testing and then into a production environment enabling continuous integration, agility, and rapid deployment. + +Container networking tools help accomplish container networking scalability, mainly by: + +1) enabling complex, multi-host systems to be distributed across multiple container hosts. + +2) enabling orchestration for container systems spanning a tremendous number of hosts across multiple public and private cloud platforms. + +![](https://www.linux.com/sites/lcom/files/styles/floated_images/public/john-willis_k.jpg?itok=lTsH9eqI) +>John Willis speaking at Open Networking Summit 2016. + +For more information, check out the [Docker Networking Tutorial][5] video, which was presented by Brent Salisbury and John Willis at the recent [Open Networking Summit (ONS)][6]. This and many other ONS keynotes and presentations can be found [here][7]. + +Container networking tools and projects you should know about include: + +[Calico][8] -- The Calico project (from [Metaswitch][9]) leverages Border Gateway Protocol (BGP) and integrates with cloud orchestration systems for secure IP communication between virtual machines and containers. + +[Flannel][10] -- Flannel (previously called rudder) from [CoreOS][11] provides an overlay network that can be used as an alternative to existing SDN solutions. + +[Weaveworks][12] -- The Weaveworks projects for managing containers include [Weave Net][13], Weave Scope, and Weave Flux. Weave Net is a tool for building and deploying Docker container networks. + +[Canal][14] -- Just this week, CoreOS and Tigera announced the formation of a new open source project called Canal. According to the announcement, the Canal project aims to combine aspects of Calico and Flannel, "weaving security policy into both the network fabric and the cloud orchestrator." + +You can learn more about container management, software-defined networking, and other next-gen cloud technologies through The Linux Foundation’s free “Cloud Infrastructure Technologies” course -- a massively open online course being offered through edX. [Registration for this course is open now][15], and course content will be available in June. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/4-container-networking-tools-know + +作者:[AMBER ANKERHOLZ][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/aankerholz +[1]: https://www.linux.com/licenses/category/creative-commons-zero +[2]: https://www.linux.com/news/5-next-gen-cloud-technologies-you-should-know +[3]: http://www.enterprisenetworkingplanet.com/datacenter/datacenter-blog/container-networking-challenges-for-the-enterprise.html +[4]: https://docs.docker.com/engine/userguide/networking/dockernetworks/ +[5]: https://youtu.be/Le0bEg4taak +[6]: http://events.linuxfoundation.org/events/open-networking-summit +[7]: https://www.linux.com/watch-videos-from-ons2016 +[8]: https://www.projectcalico.org/ +[9]: http://www.metaswitch.com/cloud-network-virtualization +[10]: https://coreos.com/blog/introducing-rudder/ +[11]: https://coreos.com/ +[12]: https://www.weave.works/ +[13]: https://www.weave.works/products/weave-net/ +[14]: https://github.com/tigera/canal +[15]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-cloud-infrastructure-technologies?utm_source=linuxcom&utm_medium=article&utm_campaign=cloud%20mooc%20article%201 diff --git a/sources/tech/20160511 An introduction to data processing with Cassandra and Spark.md b/sources/tech/20160511 An introduction to data processing with Cassandra and Spark.md new file mode 100644 index 0000000000..46331a9ae5 --- /dev/null +++ b/sources/tech/20160511 An introduction to data processing with Cassandra and Spark.md @@ -0,0 +1,51 @@ +Translating KevinSJ +An introduction to data processing with Cassandra and Spark +============================================================== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/osdc_520x292_opendata_0613mm.png?itok=mzC0Tb28) + + +There's been a huge surge of interest around the Apache Cassandra database due to the increasing uptime and performance demands of modern cloud applications. + +So, what is Apache Cassandra? A distributed OLTP database built for high availability and linear scalability. When people ask what Cassandra is used for, think about the type of system you want close to the customer. This is ultimately the system that our users interact with. Applications that must always be available: product catalogs, IoT, medical systems, and mobile applications. In these categories downtime can mean loss of revenue or even more dire outcomes depending on your specific use case. Netflix was one of the earliest adopters of this project, which was open sourced in 2008, and their contributions, along with successes, put it on the radar of the masses. + +Cassandra became a top level Apache Software Foundation project in 2010 and has been riding the wave in popularity since then. Now even knowledge in Cassandra gets you serious returns in the job market. It's both crazy and awesome to consider a NoSQL and open source technology could perform this sort of disruption next to the giants of enterprise SQL. This begs the question, what makes it so popular? + +Cassandra has the ability to be always on in spite of massive hardware and network failures by utilizing a design first widely discussed in [the Dynamo paper from Amazon][1]. By using a peer to peer model, with no single point of failure, we can survive rack failure and even complete network partitions. We can deal with an entire data center failure without impacting our customer's experience. A distributed system that plans for failure is a properly planned distributed system, because frankly, failures are just going to happen. With Cassandra, we accept that cruel fact of life, and bake it into the database's architecture and functionality. + +We know what you’re thinking, "But, I’m coming from a relational background, isn't this going to be a daunting transition?" The answer is somewhat yes and no. Data modeling with Cassandra will feel familiar to developers coming from the relational world. We use tables to model our data, and CQL, the Cassandra Query Language, to query the database. However, unlike SQL, Cassandra supports more complex data structures such as nested and user defined types. For instance, instead of creating a dedicated table to store likes on a cat photo, we can store that data in a collection with the photo itself enabling faster, sequential lookups. That's expressed very naturally in CQL. In our photo table we may want to track the name, URL, and the people that liked the photo. + +![](https://opensource.com/sites/default/files/resize/screen_shot_2016-05-06_at_7.17.33_am-350x198.png) + +In a high performance system milliseconds matter for both user experience and for customer retention. Expensive JOIN operations limit our ability to scale out by adding unpredictable network calls. By denormalizing our data so it can be fetched in as few requests as possible, we profit from the trend of decreasing costs in disk space and in return get predictable, high performance applications. We embrace the concept of denormalization with Cassandra because it offers a pretty appealing tradeoff. + +We're obviously not just limited to storing likes on cat photos. Cassandra is a optimized for high write throughput. This makes it the perfect solution for big data applications where we’re constantly ingesting data. Time series and IoT use cases are growing at a steady rate in both demand and appearance in the market, and we're continuously finding ways to utilize the data we collect to improve our technological application. + +This brings us to the next step, we've talked about storing our data in a modern, cost-effective fashion, but how do we get even more horsepower? Meaning, once we've collected all that data, what do we do with it? How can we analyze hundreds of terabytes efficiently? How can we react to information we're receiving in real-time, making decisions in seconds rather than hours? Enter Apache Spark. + +Spark is the next step in the evolution of big data processing. Hadoop and MapReduce were revolutionary projects, giving the big data world an opportunity to crunch all the data we've collected. Spark takes our big data analysis to the next level by drastically improving performance and massively decreasing code complexity. Through Spark, we can perform massive batch processing calculations, react quickly to stream processing, make smart decisions through machine learning, and understand complex, recursive relationships through graph traversals. It’s not just about offering your customers a fast and reliable connection to their application (which is what Cassandra offers), it's also about being able to leverage insights from the data Cassandra stores to make more intelligent business decisions and better cater to customer needs. + +You can check out the [Spark-Cassandra Connector][2] (open source) and give it a shot. To learn more about both technologies, we highly recommend the free self-paced courses on [DataStax Academy][3]. + +Have fun digging in and learning some killer new technology! If you want to learn more, check out our [OSCON tutorial][4], with a hands on exploration into the worlds of both Cassandra and Spark. + +We also love taking questions on Twitter, so give us a shout and we’ll try to help: [Dani][5] and [Jon][6]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/16/5/basics-cassandra-and-spark-data-processing + +作者:[Jon Haddad][a],[Dani Traphagen][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twitter.com/rustyrazorblade +[b]: https://opensource.com/users/dtrapezoid +[1]: http://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf +[2]: https://github.com/datastax/spark-cassandra-connector +[3]: https://academy.datastax.com/ +[4]: http://conferences.oreilly.com/oscon/open-source-us/public/schedule/detail/49162 +[5]: https://twitter.com/dtrapezoid +[6]: https://twitter.com/rustyrazorblade diff --git a/sources/tech/20160512 Rapid prototyping with docker-compose.md b/sources/tech/20160512 Rapid prototyping with docker-compose.md new file mode 100644 index 0000000000..0c67223697 --- /dev/null +++ b/sources/tech/20160512 Rapid prototyping with docker-compose.md @@ -0,0 +1,142 @@ + +Rapid prototyping with docker-compose +======================================== + +In this write-up we'll look at a Node.js prototype for **finding stock of the Raspberry PI Zero** from three major outlets in the UK. + +I wrote the code and deployed it to an Ubuntu VM in Azure within a single evening of hacking. Docker and the docker-compose tool made the deployment and update process extremely quick. + +### Remember linking? + +If you've already been through the [Hands-On Docker tutorial][1] then you will have experience linking Docker containers on the command line. Linking a Node hit counter to a Redis server on the command line may look like this: + +``` +$ docker run -d -P --name redis1 +$ docker run -d hit_counter -p 3000:3000 --link redis1:redis +``` + +Now imagine your application has three tiers + +- Web front-end +- Batch tier for processing long running tasks +- Redis or mongo database + +Explicit linking through `--link` is just about manageable with a couple of containers, but can get out of hand as we add more tiers or containers to the application. + +### Enter docker-compose + +![](http://blog.alexellis.io/content/images/2016/05/docker-compose-logo-01.png) +>Docker Compose logo + +The docker-compose tool is part of the standard Docker Toolbox and can also be downloaded separately. It provides a rich set of features to configure all of an application's parts through a plain-text YAML file. + +The above example would look like this: + +``` +version: "2.0" +services: + redis1: + image: redis + hit_counter: + build: ./hit_counter + ports: + - 3000:3000 +``` + +From Docker 1.10 onwards we can take advantage of network overlays to help us scale out across multiple hosts. Prior to this linking only worked across a single host. The `docker-compose scale` command can be used to bring on more computing power as the need arises. + +>View the [docker-compose][2] reference on docker.com + +### Real-world example: Raspberry PI Stock Alert + +![](http://blog.alexellis.io/content/images/2016/05/Raspberry_Pi_Zero_ver_1-3_1_of_3_large.JPG) +>The new Raspberry PI Zero v1.3 image courtesy of Pimoroni + +There is a huge buzz around the Raspberry PI Zero - a tiny microcomputer with a 1GHz CPU and 512MB RAM capable of running full Linux, Docker, Node.js, Ruby and many other popular open-source tools. One of the best things about the PI Zero is that costs only 5 USD. That also means that stock gets snapped up really quickly. + +*If you want to try Docker or Swarm on the PI check out the tutorial below.* + +>[Docker Swarm on the PI Zero][3] + +### Original site: whereismypizero.com + +I found a webpage which used screen scraping to find whether 4-5 of the most popular outlets had stock. + +- The site contained a static HTML page +- Issued one XMLHttpRequest per outlet accessing /public/api/ +- The server issued the HTTP request to each shop and performed the scraping + +Every call to /public/api/ took 3 seconds to execute and using Apache Bench (ab) I was only able to get through 0.25 requests per second. + +### Reinventing the wheel + +The retailers didn't seem to mind whereismypizero.com scraping their sites for stock, so I set about writing a similar tool from the ground up. I had the intention of handing a much higher amount of requests per second through caching and de-coupling the scrape from the web tier. Redis was the perfect tool for the job. It allowed me to set an automatically expiring key/value pair (i.e. a simple cache) and also to transmit messages between Node processes through pub/sub. + +>Fork or star the code on Github: [alexellis/pi_zero_stock][4] + +If you've worked with Node.js before then you will know it is single-threaded and that any CPU intensive tasks such as parsing HTML or JSON could lead to a slow-down. One way to mitigate that is to use a second worker process and a Redis messaging channel as connective tissue between this and the web tier. + +- Web tier + -Gives 200 for cache hit (Redis key exists for store) + -Gives 202 for cache miss (Redis key doesn't exist, so issues message) + -Since we are only ever reading a Redis key the response time is very quick. +- Stock Fetcher + -Performs HTTP request + -Scrapes for different types of web stores + -Updates a Redis key with a cache expire of 60 seconds + -Also locks a Redis key to prevent too many in-flight HTTP requests to the web stores. +``` +version: "2.0" +services: + web: + build: ./web/ + ports: + - "3000:3000" + stock_fetch: + build: ./stock_fetch/ + redis: + image: redis +``` + +*The docker-compose.yml file from the example.* + +Once I had this working locally deploying to an Ubuntu 16.04 image in the cloud (Azure) took less than 5 minutes. I logged in, cloned the repository and typed in `docker compose up -d`. That was all it took - rapid prototyping a whole system doesn't get much better. Anyone (including the owner of whereismypizero.com) can deploy the new solution with just two lines: + +``` +$ git clone https://github.com/alexellis/pi_zero_stock +$ docker-compose up -d +``` + +Updating the site is easy and just involves a `git pull` followed by a `docker-compose up -d` with the `--build` argument passed along. + +If you are still linking your Docker containers manually, try Docker Compose for yourself or my code below: + +>Fork or star the code on Github: [alexellis/pi_zero_stock][5] + +### Check out the test site + +The test site is currently deployed now using docker-compose. + +>[stockalert.alexellis.io][6] + +![](http://blog.alexellis.io/content/images/2016/05/Screen-Shot-2016-05-16-at-22-34-26-1.png) + +Preview as of 16th of May 2016 + +---------- +via: http://blog.alexellis.io/rapid-prototype-docker-compose/ + +作者:[Alex Ellis][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://blog.alexellis.io/author/alex/ +[1]: http://blog.alexellis.io/handsondocker +[2]: https://docs.docker.com/compose/compose-file/ +[3]: http://blog.alexellis.io/dockerswarm-pizero/ +[4]: https://github.com/alexellis/pi_zero_stock +[5]: https://github.com/alexellis/pi_zero_stock +[6]: http://stockalert.alexellis.io/ + diff --git a/sources/tech/20160512 Bitmap in Linux Kernel.md b/sources/tech/20160512 Bitmap in Linux Kernel.md new file mode 100644 index 0000000000..06297fa204 --- /dev/null +++ b/sources/tech/20160512 Bitmap in Linux Kernel.md @@ -0,0 +1,398 @@ +[Translating By cposture 20160520] +Data Structures in the Linux Kernel +================================================================================ + +Bit arrays and bit operations in the Linux kernel +-------------------------------------------------------------------------------- + +Besides different [linked](https://en.wikipedia.org/wiki/Linked_data_structure) and [tree](https://en.wikipedia.org/wiki/Tree_%28data_structure%29) based data structures, the Linux kernel provides [API](https://en.wikipedia.org/wiki/Application_programming_interface) for [bit arrays](https://en.wikipedia.org/wiki/Bit_array) or `bitmap`. Bit arrays are heavily used in the Linux kernel and following source code files contain common `API` for work with such structures: + +* [lib/bitmap.c](https://github.com/torvalds/linux/blob/master/lib/bitmap.c) +* [include/linux/bitmap.h](https://github.com/torvalds/linux/blob/master/include/linux/bitmap.h) + +Besides these two files, there is also architecture-specific header file which provides optimized bit operations for certain architecture. We consider [x86_64](https://en.wikipedia.org/wiki/X86-64) architecture, so in our case it will be: + +* [arch/x86/include/asm/bitops.h](https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/bitops.h) + +header file. As I just wrote above, the `bitmap` is heavily used in the Linux kernel. For example a `bit array` is used to store set of online/offline processors for systems which support [hot-plug](https://www.kernel.org/doc/Documentation/cpu-hotplug.txt) cpu (more about this you can read in the [cpumasks](https://0xax.gitbooks.io/linux-insides/content/Concepts/cpumask.html) part), a `bit array` stores set of allocated [irqs](https://en.wikipedia.org/wiki/Interrupt_request_%28PC_architecture%29) during initialization of the Linux kernel and etc. + +So, the main goal of this part is to see how `bit arrays` are implemented in the Linux kernel. Let's start. + +Declaration of bit array +================================================================================ + +Before we will look on `API` for bitmaps manipulation, we must know how to declare it in the Linux kernel. There are two common method to declare own bit array. The first simple way to declare a bit array is to array of `unsigned long`. For example: + +```C +unsigned long my_bitmap[8] +``` + +The second way is to use the `DECLARE_BITMAP` macro which is defined in the [include/linux/types.h](https://github.com/torvalds/linux/blob/master/include/linux/types.h) header file: + +```C +#define DECLARE_BITMAP(name,bits) \ + unsigned long name[BITS_TO_LONGS(bits)] +``` + +We can see that `DECLARE_BITMAP` macro takes two parameters: + +* `name` - name of bitmap; +* `bits` - amount of bits in bitmap; + +and just expands to the definition of `unsigned long` array with `BITS_TO_LONGS(bits)` elements, where the `BITS_TO_LONGS` macro converts a given number of bits to number of `longs` or in other words it calculates how many `8` byte elements in `bits`: + +```C +#define BITS_PER_BYTE 8 +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) +#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) +``` + +So, for example `DECLARE_BITMAP(my_bitmap, 64)` will produce: + +```python +>>> (((64) + (64) - 1) / (64)) +1 +``` + +and: + +```C +unsigned long my_bitmap[1]; +``` + +After we are able to declare a bit array, we can start to use it. + +Architecture-specific bit operations +================================================================================ + +We already saw above a couple of source code and header files which provide [API](https://en.wikipedia.org/wiki/Application_programming_interface) for manipulation of bit arrays. The most important and widely used API of bit arrays is architecture-specific and located as we already know in the [arch/x86/include/asm/bitops.h](https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/bitops.h) header file. + +First of all let's look at the two most important functions: + +* `set_bit`; +* `clear_bit`. + +I think that there is no need to explain what these function do. This is already must be clear from their name. Let's look on their implementation. If you will look into the [arch/x86/include/asm/bitops.h](https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/bitops.h) header file, you will note that each of these functions represented by two variants: [atomic](https://en.wikipedia.org/wiki/Linearizability) and not. Before we will start to dive into implementations of these functions, first of all we must to know a little about `atomic` operations. + +In simple words atomic operations guarantees that two or more operations will not be performed on the same data concurrently. The `x86` architecture provides a set of atomic instructions, for example [xchg](http://x86.renejeschke.de/html/file_module_x86_id_328.html) instruction, [cmpxchg](http://x86.renejeschke.de/html/file_module_x86_id_41.html) instruction and etc. Besides atomic instructions, some of non-atomic instructions can be made atomic with the help of the [lock](http://x86.renejeschke.de/html/file_module_x86_id_159.html) instruction. It is enough to know about atomic operations for now, so we can begin to consider implementation of `set_bit` and `clear_bit` functions. + +First of all, let's start to consider `non-atomic` variants of this function. Names of non-atomic `set_bit` and `clear_bit` starts from double underscore. As we already know, all of these functions are defined in the [arch/x86/include/asm/bitops.h](https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/bitops.h) header file and the first function is `__set_bit`: + +```C +static inline void __set_bit(long nr, volatile unsigned long *addr) +{ + asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory"); +} +``` + +As we can see it takes two arguments: + +* `nr` - number of bit in a bit array. +* `addr` - address of a bit array where we need to set bit. + +Note that the `addr` parameter is defined with `volatile` keyword which tells to compiler that value maybe changed by the given address. The implementation of the `__set_bit` is pretty easy. As we can see, it just contains one line of [inline assembler](https://en.wikipedia.org/wiki/Inline_assembler) code. In our case we are using the [bts](http://x86.renejeschke.de/html/file_module_x86_id_25.html) instruction which selects a bit which is specified with the first operand (`nr` in our case) from the bit array, stores the value of the selected bit in the [CF](https://en.wikipedia.org/wiki/FLAGS_register) flags register and set this bit. + +Note that we can see usage of the `nr`, but there is `addr` here. You already might guess that the secret is in `ADDR`. The `ADDR` is the macro which is defined in the same header code file and expands to the string which contains value of the given address and `+m` constraint: + +```C +#define ADDR BITOP_ADDR(addr) +#define BITOP_ADDR(x) "+m" (*(volatile long *) (x)) +``` + +Besides the `+m`, we can see other constraints in the `__set_bit` function. Let's look on they and try to understand what do they mean: + +* `+m` - represents memory operand where `+` tells that the given operand will be input and output operand; +* `I` - represents integer constant; +* `r` - represents register operand + +Besides these constraint, we also can see - the `memory` keyword which tells compiler that this code will change value in memory. That's all. Now let's look at the same function but at `atomic` variant. It looks more complex that its `non-atomic` variant: + +```C +static __always_inline void +set_bit(long nr, volatile unsigned long *addr) +{ + if (IS_IMMEDIATE(nr)) { + asm volatile(LOCK_PREFIX "orb %1,%0" + : CONST_MASK_ADDR(nr, addr) + : "iq" ((u8)CONST_MASK(nr)) + : "memory"); + } else { + asm volatile(LOCK_PREFIX "bts %1,%0" + : BITOP_ADDR(addr) : "Ir" (nr) : "memory"); + } +} +``` + +First of all note that this function takes the same set of parameters that `__set_bit`, but additionally marked with the `__always_inline` attribute. The `__always_inline` is macro which defined in the [include/linux/compiler-gcc.h](https://github.com/torvalds/linux/blob/master/include/linux/compiler-gcc.h) and just expands to the `always_inline` attribute: + +```C +#define __always_inline inline __attribute__((always_inline)) +``` + +which means that this function will be always inlined to reduce size of the Linux kernel image. Now let's try to understand implementation of the `set_bit` function. First of all we check a given number of bit at the beginning of the `set_bit` function. The `IS_IMMEDIATE` macro defined in the same [header](https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/bitops.h) file and expands to the call of the builtin [gcc](https://en.wikipedia.org/wiki/GNU_Compiler_Collection) function: + +```C +#define IS_IMMEDIATE(nr) (__builtin_constant_p(nr)) +``` + +The `__builtin_constant_p` builtin function returns `1` if the given parameter is known to be constant at compile-time and returns `0` in other case. We no need to use slow `bts` instruction to set bit if the given number of bit is known in compile time constant. We can just apply [bitwise or](https://en.wikipedia.org/wiki/Bitwise_operation#OR) for byte from the give address which contains given bit and masked number of bits where high bit is `1` and other is zero. In other case if the given number of bit is not known constant at compile-time, we do the same as we did in the `__set_bit` function. The `CONST_MASK_ADDR` macro: + +```C +#define CONST_MASK_ADDR(nr, addr) BITOP_ADDR((void *)(addr) + ((nr)>>3)) +``` + +expands to the give address with offset to the byte which contains a given bit. For example we have address `0x1000` and the number of bit is `0x9`. So, as `0x9` is `one byte + one bit` our address with be `addr + 1`: + +```python +>>> hex(0x1000 + (0x9 >> 3)) +'0x1001' +``` + +The `CONST_MASK` macro represents our given number of bit as byte where high bit is `1` and other bits are `0`: + +```C +#define CONST_MASK(nr) (1 << ((nr) & 7)) +``` + +```python +>>> bin(1 << (0x9 & 7)) +'0b10' +``` + +In the end we just apply bitwise `or` for these values. So, for example if our address will be `0x4097` and we need to set `0x9` bit: + +```python +>>> bin(0x4097) +'0b100000010010111' +>>> bin((0x4097 >> 0x9) | (1 << (0x9 & 7))) +'0b100010' +``` + +the `ninth` bit will be set. + +Note that all of these operations are marked with `LOCK_PREFIX` which is expands to the [lock](http://x86.renejeschke.de/html/file_module_x86_id_159.html) instruction which guarantees atomicity of this operation. + +As we already know, besides the `set_bit` and `__set_bit` operations, the Linux kernel provides two inverse functions to clear bit in atomic and non-atomic context. They are `clear_bit` and `__clear_bit`. Both of these functions are defined in the same [header file](https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/bitops.h) and takes the same set of arguments. But not only arguments are similar. Generally these functions are very similar on the `set_bit` and `__set_bit`. Let's look on the implementation of the non-atomic `__clear_bit` function: + +```C +static inline void __clear_bit(long nr, volatile unsigned long *addr) +{ + asm volatile("btr %1,%0" : ADDR : "Ir" (nr)); +} +``` + +Yes. As we see, it takes the same set of arguments and contains very similar block of inline assembler. It just uses the [btr](http://x86.renejeschke.de/html/file_module_x86_id_24.html) instruction instead of `bts`. As we can understand form the function's name, it clears a given bit by the given address. The `btr` instruction acts like `btr`. This instruction also selects a given bit which is specified in the first operand, stores its value in the `CF` flag register and clears this bit in the given bit array which is specifed with second operand. + +The atomic variant of the `__clear_bit` is `clear_bit`: + +```C +static __always_inline void +clear_bit(long nr, volatile unsigned long *addr) +{ + if (IS_IMMEDIATE(nr)) { + asm volatile(LOCK_PREFIX "andb %1,%0" + : CONST_MASK_ADDR(nr, addr) + : "iq" ((u8)~CONST_MASK(nr))); + } else { + asm volatile(LOCK_PREFIX "btr %1,%0" + : BITOP_ADDR(addr) + : "Ir" (nr)); + } +} +``` + +and as we can see it is very similar on `set_bit` and just contains two differences. The first difference it uses `btr` instruction to clear bit when the `set_bit` uses `bts` instruction to set bit. The second difference it uses negated mask and `and` instruction to clear bit in the given byte when the `set_bit` uses `or` instruction. + +That's all. Now we can set and clear bit in any bit array and and we can go to other operations on bitmasks. + +Most widely used operations on a bit arrays are set and clear bit in a bit array in the Linux kernel. But besides this operations it is useful to do additional operations on a bit array. Yet another widely used operation in the Linux kernel - is to know is a given bit set or not in a bit array. We can achieve this with the help of the `test_bit` macro. This macro is defined in the [arch/x86/include/asm/bitops.h](https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/bitops.h) header file and expands to the call of the `constant_test_bit` or `variable_test_bit` depends on bit number: + +```C +#define test_bit(nr, addr) \ + (__builtin_constant_p((nr)) \ + ? constant_test_bit((nr), (addr)) \ + : variable_test_bit((nr), (addr))) +``` + +So, if the `nr` is known in compile time constant, the `test_bit` will be expanded to the call of the `constant_test_bit` function or `variable_test_bit` in other case. Now let's look at implementations of these functions. Let's start from the `variable_test_bit`: + +```C +static inline int variable_test_bit(long nr, volatile const unsigned long *addr) +{ + int oldbit; + + asm volatile("bt %2,%1\n\t" + "sbb %0,%0" + : "=r" (oldbit) + : "m" (*(unsigned long *)addr), "Ir" (nr)); + + return oldbit; +} +``` + +The `variable_test_bit` function takes similar set of arguments as `set_bit` and other function take. We also may see inline assembly code here which executes [bt](http://x86.renejeschke.de/html/file_module_x86_id_22.html) and [sbb](http://x86.renejeschke.de/html/file_module_x86_id_286.html) instruction. The `bt` or `bit test` instruction selects a given bit which is specified with first operand from the bit array which is specified with the second operand and stores its value in the [CF](https://en.wikipedia.org/wiki/FLAGS_register) bit of flags register. The second `sbb` instruction substracts first operand from second and subscrtact value of the `CF`. So, here write a value of a given bit number from a given bit array to the `CF` bit of flags register and execute `sbb` instruction which calculates: `00000000 - CF` and writes the result to the `oldbit`. + +The `constant_test_bit` function does the same as we saw in the `set_bit`: + +```C +static __always_inline int constant_test_bit(long nr, const volatile unsigned long *addr) +{ + return ((1UL << (nr & (BITS_PER_LONG-1))) & + (addr[nr >> _BITOPS_LONG_SHIFT])) != 0; +} +``` + +It generates a byte where high bit is `1` and other bits are `0` (as we saw in `CONST_MASK`) and applies bitwise [and](https://en.wikipedia.org/wiki/Bitwise_operation#AND) to the byte which contains a given bit number. + +The next widely used bit array related operation is to change bit in a bit array. The Linux kernel provides two helper for this: + +* `__change_bit`; +* `change_bit`. + +As you already can guess, these two variants are atomic and non-atomic as for example `set_bit` and `__set_bit`. For the start, let's look at the implementation of the `__change_bit` function: + +```C +static inline void __change_bit(long nr, volatile unsigned long *addr) +{ + asm volatile("btc %1,%0" : ADDR : "Ir" (nr)); +} +``` + +Pretty easy, is not it? The implementation of the `__change_bit` is the same as `__set_bit`, but instead of `bts` instruction, we are using [btc](http://x86.renejeschke.de/html/file_module_x86_id_23.html). This instruction selects a given bit from a given bit array, stores its value in the `CF` and changes its value by the applying of complement operation. So, a bit with value `1` will be `0` and vice versa: + +```python +>>> int(not 1) +0 +>>> int(not 0) +1 +``` + +The atomic version of the `__change_bit` is the `change_bit` function: + +```C +static inline void change_bit(long nr, volatile unsigned long *addr) +{ + if (IS_IMMEDIATE(nr)) { + asm volatile(LOCK_PREFIX "xorb %1,%0" + : CONST_MASK_ADDR(nr, addr) + : "iq" ((u8)CONST_MASK(nr))); + } else { + asm volatile(LOCK_PREFIX "btc %1,%0" + : BITOP_ADDR(addr) + : "Ir" (nr)); + } +} +``` + +It is similar on `set_bit` function, but also has two differences. The first difference is `xor` operation instead of `or` and the second is `bts` instead of `bts`. + +For this moment we know the most important architecture-specific operations with bit arrays. Time to look at generic bitmap API. + +Common bit operations +================================================================================ + +Besides the architecture-specific API from the [arch/x86/include/asm/bitops.h](https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/bitops.h) header file, the Linux kernel provides common API for manipulation of bit arrays. As we know from the beginning of this part, we can find it in the [include/linux/bitmap.h](https://github.com/torvalds/linux/blob/master/include/linux/bitmap.h) header file and additionally in the * [lib/bitmap.c](https://github.com/torvalds/linux/blob/master/lib/bitmap.c) source code file. But before these source code files let's look into the [include/linux/bitops.h](https://github.com/torvalds/linux/blob/master/include/linux/bitops.h) header file which provides a set of useful macro. Let's look on some of they. + +First of all let's look at following four macros: + +* `for_each_set_bit` +* `for_each_set_bit_from` +* `for_each_clear_bit` +* `for_each_clear_bit_from` + +All of these macros provide iterator over certain set of bits in a bit array. The first macro iterates over bits which are set, the second does the same, but starts from a certain bits. The last two macros do the same, but iterates over clear bits. Let's look on implementation of the `for_each_set_bit` macro: + +```C +#define for_each_set_bit(bit, addr, size) \ + for ((bit) = find_first_bit((addr), (size)); \ + (bit) < (size); \ + (bit) = find_next_bit((addr), (size), (bit) + 1)) +``` + +As we may see it takes three arguments and expands to the loop from first set bit which is returned as result of the `find_first_bit` function and to the last bit number while it is less than given size. + +Besides these four macros, the [arch/x86/include/asm/bitops.h](https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/bitops.h) provides API for rotation of `64-bit` or `32-bit` values and etc. + +The next [header](https://github.com/torvalds/linux/blob/master/include/linux/bitmap.h) file which provides API for manipulation with a bit arrays. For example it provdes two functions: + +* `bitmap_zero`; +* `bitmap_fill`. + +To clear a bit array and fill it with `1`. Let's look on the implementation of the `bitmap_zero` function: + +```C +static inline void bitmap_zero(unsigned long *dst, unsigned int nbits) +{ + if (small_const_nbits(nbits)) + *dst = 0UL; + else { + unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); + memset(dst, 0, len); + } +} +``` + +First of all we can see the check for `nbits`. The `small_const_nbits` is macro which defined in the same header [file](https://github.com/torvalds/linux/blob/master/include/linux/bitmap.h) and looks: + +```C +#define small_const_nbits(nbits) \ + (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) +``` + +As we may see it checks that `nbits` is known constant in compile time and `nbits` value does not overflow `BITS_PER_LONG` or `64`. If bits number does not overflow amount of bits in a `long` value we can just set to zero. In other case we need to calculate how many `long` values do we need to fill our bit array and fill it with [memset](http://man7.org/linux/man-pages/man3/memset.3.html). + +The implementation of the `bitmap_fill` function is similar on implementation of the `biramp_zero` function, except we fill a given bit array with `0xff` values or `0b11111111`: + +```C +static inline void bitmap_fill(unsigned long *dst, unsigned int nbits) +{ + unsigned int nlongs = BITS_TO_LONGS(nbits); + if (!small_const_nbits(nbits)) { + unsigned int len = (nlongs - 1) * sizeof(unsigned long); + memset(dst, 0xff, len); + } + dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits); +} +``` + +Besides the `bitmap_fill` and `bitmap_zero` functions, the [include/linux/bitmap.h](https://github.com/torvalds/linux/blob/master/include/linux/bitmap.h) header file provides `bitmap_copy` which is similar on the `bitmap_zero`, but just uses [memcpy](http://man7.org/linux/man-pages/man3/memcpy.3.html) instead of [memset](http://man7.org/linux/man-pages/man3/memset.3.html). Also it provides bitwise operations for bit array like `bitmap_and`, `bitmap_or`, `bitamp_xor` and etc. We will not consider implementation of these functions because it is easy to understand implementations of these functions if you understood all from this part. Anyway if you are interested how did these function implemented, you may open [include/linux/bitmap.h](https://github.com/torvalds/linux/blob/master/include/linux/bitmap.h) header file and start to research. + +That's all. + +Links +================================================================================ + +* [bitmap](https://en.wikipedia.org/wiki/Bit_array) +* [linked data structures](https://en.wikipedia.org/wiki/Linked_data_structure) +* [tree data structures](https://en.wikipedia.org/wiki/Tree_%28data_structure%29) +* [hot-plug](https://www.kernel.org/doc/Documentation/cpu-hotplug.txt) +* [cpumasks](https://0xax.gitbooks.io/linux-insides/content/Concepts/cpumask.html) +* [IRQs](https://en.wikipedia.org/wiki/Interrupt_request_%28PC_architecture%29) +* [API](https://en.wikipedia.org/wiki/Application_programming_interface) +* [atomic operations](https://en.wikipedia.org/wiki/Linearizability) +* [xchg instruction](http://x86.renejeschke.de/html/file_module_x86_id_328.html) +* [cmpxchg instruction](http://x86.renejeschke.de/html/file_module_x86_id_41.html) +* [lock instruction](http://x86.renejeschke.de/html/file_module_x86_id_159.html) +* [bts instruction](http://x86.renejeschke.de/html/file_module_x86_id_25.html) +* [btr instruction](http://x86.renejeschke.de/html/file_module_x86_id_24.html) +* [bt instruction](http://x86.renejeschke.de/html/file_module_x86_id_22.html) +* [sbb instruction](http://x86.renejeschke.de/html/file_module_x86_id_286.html) +* [btc instruction](http://x86.renejeschke.de/html/file_module_x86_id_23.html) +* [man memcpy](http://man7.org/linux/man-pages/man3/memcpy.3.html) +* [man memset](http://man7.org/linux/man-pages/man3/memset.3.html) +* [CF](https://en.wikipedia.org/wiki/FLAGS_register) +* [inline assembler](https://en.wikipedia.org/wiki/Inline_assembler) +* [gcc](https://en.wikipedia.org/wiki/GNU_Compiler_Collection) + + +------------------------------------------------------------------------------ + +via: https://github.com/0xAX/linux-insides/blob/master/DataStructures/bitmap.md + +作者:[0xAX][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twitter.com/0xAX diff --git a/sources/tech/20160516 4 BEST MODERN OPEN SOURCE CODE EDITORS FOR LINUX.md b/sources/tech/20160516 4 BEST MODERN OPEN SOURCE CODE EDITORS FOR LINUX.md new file mode 100644 index 0000000000..93bf396c4a --- /dev/null +++ b/sources/tech/20160516 4 BEST MODERN OPEN SOURCE CODE EDITORS FOR LINUX.md @@ -0,0 +1,88 @@ +alim0x translating + +4 BEST MODERN OPEN SOURCE CODE EDITORS FOR LINUX +================================================== + +![](http://itsfoss.com/wp-content/uploads/2015/01/Best_Open_Source_Editors.jpeg) + +Looking for **best programming editors in Linux**? If you ask the old school Linux users, their answer would be Vi, Vim, Emacs, Nano etc. But I am not talking about them. I am going to talk about new age, cutting edge, great looking, sleek and yet powerful, feature rich **best open source code editors for Linux** that would enhance your programming experience. + +### BEST MODERN OPEN SOURCE EDITORS FOR LINUX + +I use Ubuntu as my main desktop and hence I have provided installation instructions for Ubuntu based distributions. But this doesn’t make this list as **best text editors for Ubuntu** because the list is apt for any Linux distribution. Just to add, the list is not in any particular priority order. + +### BRACKETS + +![](http://itsfoss.com/wp-content/uploads/2015/01/brackets_UI.jpeg) + +[Brackets][1] is an open source code editor from [Adobe][2]. Brackets focuses exclusively on the needs of web designers with built in support for HTML, CSS and Java Script. It’s light weight and yet powerful. It provides you with inline editing and live preview. There are plenty of plugins available to further enhance your experience with Brackets. + +To [install Brackets in Ubuntu][3] and Ubuntu based distributions such as Linux Mint, you can use this unofficial PPA: + +``` +sudo add-apt-repository ppa:webupd8team/brackets +sudo apt-get update +sudo apt-get install brackets +``` + +For other Linux distributions, you can get the source code as well as binaries for Linux, OS X and Windows on its website. + +[Download Brackets Source Code and Binaries](https://github.com/adobe/brackets/releases) + +### ATOM + +![](http://itsfoss.com/wp-content/uploads/2014/08/Atom_Editor.jpeg) + +[Atom][4] is another modern and sleek looking open source editor for programmers. Atom is developed by Github and promoted as a “hackable text editor for the 21st century”. The looks of Atom resembles a lot like Sublime Text editor, a hugely popular but closed source text editors among programmers. + +Atom has recently released .deb and .rpm packages so that one can easily install Atom in Debian and Fedora based Linux distributions. Of course, its source code is available as well. + + +[Download Atom .deb](https://atom.io/download/deb) + +[Download Atom .rpm](https://atom.io/download/rpm) + +[Get Atom source code](https://github.com/atom/atom/blob/master/docs/build-instructions/linux.md) + +### LIME TEXT + +![](http://itsfoss.com/wp-content/uploads/2014/08/LimeTextEditor.jpeg) + +So you like Sublime Text editor but you are not comfortable with the fact that it is not open source. No worries. We have an [open source clone of Sublime Text][5], called [Lime Text][6]. It is built on Go, HTML and QT. The reason behind cloning of Sublime Text is that there are numerous bugs in Sublime Text 2 and Sublime Text 3 is in beta since forever. There are no transparency in its development, on whether the bugs are being fixed or not. + +So open source lovers, rejoice and get the source code of Lime Text from the link below: + +[Get Lime Text Source Code](https://github.com/limetext/lime) + +### LIGHT TABLE + +![](http://itsfoss.com/wp-content/uploads/2015/01/Light_Table.jpeg) + +Flaunted as “the next generation code editor”, [Light Table][7] is another modern looking, feature rich open source editor which is more of an IDE than a mere text editor. There are numerous extensions available to enhance its capabilities. Inline evaluation is what you would love in it. You have to use it to believe how useful Light Table actually is. + +[Install Light Table in Ubuntu Linux](http://itsfoss.com/install-lighttable-ubuntu/) + +### WHAT’S YOUR PICK? + +No, we are not limited to just four code editors in Linux. The list was about modern editors for programmers. Of course, you have plenty of other options such as [Notepad++ alternative Notepadqq][8] or [SciTE][9] and many more. So, among these four, which one is your favorite code editor for Linux? + + +---------- +via: http://itsfoss.com/best-modern-open-source-code-editors-for-linux/?utm_source=newsletter&utm_medium=email&utm_campaign=offline_and_portable_linux_apps_and_other_linux_stories + +作者:[Abhishek Prakash][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://itsfoss.com/author/abhishek/ +[1]: http://brackets.io/ +[2]: http://www.adobe.com/ +[3]: http://itsfoss.com/install-brackets-ubuntu/ +[4]: https://atom.io/ +[5]: http://itsfoss.com/lime-text-open-source-alternative/ +[6]: http://limetext.org/ +[7]: http://lighttable.com/ +[8]: http://itsfoss.com/notepadqq-notepad-for-linux/ +[9]: http://itsfoss.com/scite-the-notepad-for-linux/ diff --git a/sources/tech/20160516 Scaling Collaboration in DevOps.md b/sources/tech/20160516 Scaling Collaboration in DevOps.md new file mode 100644 index 0000000000..ea1e193b96 --- /dev/null +++ b/sources/tech/20160516 Scaling Collaboration in DevOps.md @@ -0,0 +1,67 @@ +Scaling Collaboration in DevOps +================================= + +![](http://devops.com/wp-content/uploads/2016/05/ScalingCollaboration.jpg) + +Those familiar with DevOps generally agree that it is equally as much about culture as it is about technology. There are certainly tools and practices involved in the effective implementation of DevOps, but the foundation of DevOps success is how well [teams and individuals collaborate][1] across the enterprise to get things done more rapidly, efficiently and effectively. + +Most DevOps platforms and tools are designed with scalability in mind. DevOps environments often run in the cloud and tend to be volatile. It’s important for the software that supports DevOps to be able to scale in real time to address spikes and lulls in demand. The same thing is true for the human element as well, but scaling collaboration is a whole different story. + +Collaboration across the enterprise is critical for DevOps success. Great code and development needs to make it over the finish line to production to benefit customers. The challenge organizations face is how to do that seamlessly and with as much speed and automation as possible without sacrificing quality or performance. How can businesses streamline code development and deployment, while maintaining visibility, governance and compliance? + +### Emerging Trends + +First, I want to provide some background and share some data gathered by 451 Research on DevOps and DevOps adoption in general. Cloud, agile and DevOps capabilities are important for organizations today—both in perception and reality. 451 sees enterprise adoption of these things, as well as container technologies, growing—including increased usage in production environments. + +There are a number of advantages to embracing these technologies and methodologies, such as increased flexibility and speed, reduction of costs, improvements in resilience and reliability, and fitness for new or emerging applications. According to 451 Research, organizations also face some barriers including a lack of familiarity and required skills internally, the immaturity of these emerging technologies, and cost and security concerns. + +In the “[Voice of the Enterprise: SDI Q4 2015 survey][2],” 451 Research found that more than half of the respondents (51.7 percent) consider themselves to be late adopters, or even the last adopters of new technology. The flip side of that is that almost half (48.3 percent) label themselves as first or early adopters. + +Those general sentiments are reflected in the survey responses to other questions. When asked about implementation of containers, 50.3 percent stated it is not in their plans at all, while the remaining 49.7 percent are in some state of planning, pilot or active use of container technologies. Nearly two-thirds (65.1 percent) indicated that they use agile development methodologies for application development, but only 39.6 percent responded that they’ve embraced DevOps approaches. Nevertheless, while agile software development has been in the industry for years, 451 notes the impressive adoption of containers and DevOps, given they are emergent trends. + +When asked what the top three IT pain points are, the leading responses were cost or budget, insufficient staff and legacy software issues. As organizations move to cloud, DevOps, and containers issues such as these will need to be addressed, along with how to scale both technologies and collaboration effectively. + +### The Current State + +The industry—driven in large part by the DevOps revolution—is in the midst of a sea change, where software development is becoming more highly integrated across the entire business. The creation of software is less segregated and is more and more a function of collaboration and socialization. + +Concepts and methodologies that were novel or niche just a few years ago have matured quickly to become the mainstream technologies and frameworks that are driving value today. Businesses rely on concepts such as agile, lean, virtualization, cloud, automation and microservices to streamline development and enable them to work more effectively and efficiently at the same time. + +To adapt and evolve, enterprises need to accomplish a number of key tasks. The challenge companies face today is how to accelerate development while reducing costs. Organizations need to eliminate the barriers that exist between IT and the rest of the business, and work cooperatively toward a strategy that provides more effectiveness in a technology-driven, competitive environment. + +Agile, cloud, DevOps and containers all play a role in that process, but the one thing that binds it all is effective collaboration. Each of these technologies and methodologies provides unique benefits, but the real value comes from the organization as a whole—and the tools and platforms used by the organization—being able to collaborate at scale. Successful DevOps implementations also require participation from other stakeholders beyond development and IT operations teams, including security, database, storage and line-of-business teams. + +### Collaboration-as-a-Platform + +There are services and platforms online—such as GitHub—that facilitate and streamline collaboration. The online platform functions as a code repository, but the value extends beyond just providing a place to store code. + +Such a [collaboration platform][4] helps developers and teams collaborate more effectively because it provides a community where the code and process can be shared and discussed. Managers can monitor progress and track what code is shipping next. Developers can experiment with new ideas in a safe environment before taking those experiments to a live production environment, and new ideas and experiments can be effectively communicated to the appropriate teams. + +One of the keys to more agile development and DevOps is to allow developers to test things and gather relevant feedback quickly. The goal is to produce quality code and features faster, not to waste time setting up and managing infrastructure or scheduling more meetings to talk about it. The GitHub platform, for example, enables more effective and scalable collaboration because code review can occur when it is most convenient for the participants. There is no need to try and coordinate and schedule code review meetings, so the developers can continue to work uninterrupted, resulting in greater productivity and job satisfaction. + +Steven Anderson of Sendachi noted that GitHub is a collaboration platform, but it’s also a place for your tools to work with you, too. This means it can help not only with collaboration and continuous integration, but also with code quality. + +One of the benefits of a collaboration platform is that large teams of developers can be broken down into smaller teams that can focus more efficiently on specific components. It also allows things such as document sharing alongside code development to blur the lines between technical and non-technical contributions and enable increased collaboration and visibility. + +### Collaboration is Key + +The importance of collaboration can’t be stressed enough. It is a key tenet of DevOps culture, and it’s vital to agile development and maintaining a competitive edge in today’s world. Executive or management support and internal evangelism are important. Organizations also need to embrace the culture shift—blending skills across functional areas toward a common goal. + +With that culture established, though, effective collaboration is crucial. A collaboration platform is an essential element of collaborating at scale because it streamlines productivity and reduces redundancy and effort, and yields higher quality results at the same time. + + +-------------------------------------------------------------------------------- + +via: http://devops.com/2016/05/16/scaling-collaboration-devops/ + +作者:[TONY BRADLEY][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://devops.com/author/tonybsg/ +[1]: http://devops.com/2014/12/15/four-strategies-supporting-devops-collaboration/ +[2]: https://451research.com/ +[3]: https://451research.com/customer-insight-voice-of-the-enterprise-overview +[4]: http://devops.com/events/analytics-of-collaboration-on-github/ diff --git a/sources/tech/20160518 Python 3: An Intro to Encryption.md b/sources/tech/20160518 Python 3: An Intro to Encryption.md new file mode 100644 index 0000000000..43c042d5c1 --- /dev/null +++ b/sources/tech/20160518 Python 3: An Intro to Encryption.md @@ -0,0 +1,278 @@ +Python 3: An Intro to Encryption +=================================== + +Python 3 doesn’t have very much in its standard library that deals with encryption. Instead, you get hashing libraries. We’ll take a brief look at those in the chapter, but the primary focus will be on the following 3rd party packages: PyCrypto and cryptography. We will learn how to encrypt and decrypt strings with both of these libraries. + +--- + +### Hashing + +If you need secure hashes or message digest algorithms, then Python’s standard library has you covered in the **hashlib** module. It includes the FIPS secure hash algorithms SHA1, SHA224, SHA256, SHA384, and SHA512 as well as RSA’s MD5 algorithm. Python also supports the adler32 and crc32 hash functions, but those are in the **zlib** module. + +One of the most popular uses of hashes is storing the hash of a password instead of the password itself. Of course, the hash has to be a good one or it can be decrypted. Another popular use case for hashes is to hash a file and then send the file and its hash separately. Then the person receiving the file can run a hash on the file to see if it matches the hash that was sent. If it does, then that means no one has changed the file in transit. + + +Let’s try creating an md5 hash: + +``` +>>> import hashlib +>>> md5 = hashlib.md5() +>>> md5.update('Python rocks!') +Traceback (most recent call last): + File "", line 1, in + md5.update('Python rocks!') +TypeError: Unicode-objects must be encoded before hashing +>>> md5.update(b'Python rocks!') +>>> md5.digest() +b'\x14\x82\xec\x1b#d\xf6N}\x16*+[\x16\xf4w' +``` + +Let’s take a moment to break this down a bit. First off, we import **hashlib** and then we create an instance of an md5 HASH object. Next we add some text to the hash object and we get a traceback. It turns out that to use the md5 hash, you have to pass it a byte string instead of a regular string. So we try that and then call it’s **digest** method to get our hash. If you prefer the hex digest, we can do that too: + +``` +>>> md5.hexdigest() +'1482ec1b2364f64e7d162a2b5b16f477' +``` + +There’s actually a shortcut method of creating a hash, so we’ll look at that next when we create our sha512 hash: + +``` +>>> sha = hashlib.sha1(b'Hello Python').hexdigest() +>>> sha +'422fbfbc67fe17c86642c5eaaa48f8b670cbed1b' +``` + +As you can see, we can create our hash instance and call its digest method at the same time. Then we print out the hash to see what it is. I chose to use the sha1 hash as it has a nice short hash that will fit the page better. But it’s also less secure, so feel free to try one of the others. + +--- + +### Key Derivation + +Python has pretty limited support for key derivation built into the standard library. In fact, the only method that hashlib provides is the **pbkdf2_hmac** method, which is the PKCS#5 password-based key derivation function 2. It uses HMAC as its psuedorandom function. You might use something like this for hashing your password as it supports a salt and iterations. For example, if you were to use SHA-256 you would need a salt of at least 16 bytes and a minimum of 100,000 iterations. + +As a quick aside, a salt is just random data that you use as additional input into your hash to make it harder to “unhash” your password. Basically it protects your password from dictionary attacks and pre-computed rainbow tables. + +Let’s look at a simple example: + +``` +>>> import binascii +>>> dk = hashlib.pbkdf2_hmac(hash_name='sha256', + password=b'bad_password34', + salt=b'bad_salt', + iterations=100000) +>>> binascii.hexlify(dk) +b'6e97bad21f6200f9087036a71e7ca9fa01a59e1d697f7e0284cd7f9b897d7c02' +``` + +Here we create a SHA256 hash on a password using a lousy salt but with 100,000 iterations. Of course, SHA is not actually recommended for creating keys of passwords. Instead you should use something like **scrypt** instead. Another good option would be the 3rd party package, bcrypt. It is designed specifically with password hashing in mind. + +--- + +### PyCryptodome + +The PyCrypto package is probably the most well known 3rd party cryptography package for Python. Sadly PyCrypto’s development stopping in 2012. Others have continued to release the latest version of PyCryto so you can still get it for Python 3.5 if you don’t mind using a 3rd party’s binary. For example, I found some binary Python 3.5 wheels for PyCrypto on Github (https://github.com/sfbahr/PyCrypto-Wheels). + +Fortunately there is a fork of the project called PyCrytodome that is a drop-in replacement for PyCrypto. To install it for Linux, you can use the following pip command: + + +``` +pip install pycryptodome +``` + +Windows is a bit different: + +``` +pip install pycryptodomex +``` + +If you run into issues, it’s probably because you don’t have the right dependencies installed or you need a compiler for Windows. Check out the PyCryptodome [website][1] for additional installation help or to contact support. + +Also worth noting is that PyCryptodome has many enhancements over the last version of PyCrypto. It is well worth your time to visit their home page and see what new features exist. + +### Encrypting a String + +Once you’re done checking their website out, we can move on to some examples. For our first trick, we’ll use DES to encrypt a string: + +``` +>>> from Crypto.Cipher import DES +>>> key = 'abcdefgh' +>>> def pad(text): + while len(text) % 8 != 0: + text += ' ' + return text +>>> des = DES.new(key, DES.MODE_ECB) +>>> text = 'Python rocks!' +>>> padded_text = pad(text) +>>> encrypted_text = des.encrypt(text) +Traceback (most recent call last): + File "", line 1, in + encrypted_text = des.encrypt(text) + File "C:\Programs\Python\Python35-32\lib\site-packages\Crypto\Cipher\blockalgo.py", line 244, in encrypt + return self._cipher.encrypt(plaintext) +ValueError: Input strings must be a multiple of 8 in length +>>> encrypted_text = des.encrypt(padded_text) +>>> encrypted_text +b'>\xfc\x1f\x16x\x87\xb2\x93\x0e\xfcH\x02\xd59VQ' +``` + +This code is a little confusing, so let’s spend some time breaking it down. First off, it should be noted that the key size for DES encryption is 8 bytes, which is why we set our key variable to a size letter string. The string that we will be encrypting must be a multiple of 8 in length, so we create a function called **pad** that can pad any string out with spaces until it’s a multiple of 8. Next we create an instance of DES and some text that we want to encrypt. We also create a padded version of the text. Just for fun, we attempt to encrypt the original unpadded variant of the string which raises a **ValueError**. Here we learn that we need that padded string after all, so we pass that one in instead. As you can see, we now have an encrypted string! + +Of course the example wouldn’t be complete if we didn’t know how to decrypt our string: + +``` +>>> des.decrypt(encrypted_text) +b'Python rocks! ' +``` + +Fortunately, that is very easy to accomplish as all we need to do is call the **decrypt** method on our des object to get our decrypted byte string back. Our next task is to learn how to encrypt and decrypt a file with PyCrypto using RSA. But first we need to create some RSA keys! + +### Create an RSA Key + +If you want to encrypt your data with RSA, then you’ll need to either have access to a public / private RSA key pair or you will need to generate your own. For this example, we will just generate our own. Since it’s fairly easy to do, we will do it in Python’s interpreter: + +``` +>>> from Crypto.PublicKey import RSA +>>> code = 'nooneknows' +>>> key = RSA.generate(2048) +>>> encrypted_key = key.exportKey(passphrase=code, pkcs=8, + protection="scryptAndAES128-CBC") +>>> with open('/path_to_private_key/my_private_rsa_key.bin', 'wb') as f: + f.write(encrypted_key) +>>> with open('/path_to_public_key/my_rsa_public.pem', 'wb') as f: + f.write(key.publickey().exportKey()) +``` + +First we import **RSA** from **Crypto.PublicKey**. Then we create a silly passcode. Next we generate an RSA key of 2048 bits. Now we get to the good stuff. To generate a private key, we need to call our RSA key instance’s **exportKey** method and give it our passcode, which PKCS standard to use and which encryption scheme to use to protect our private key. Then we write the file out to disk. + +Next we create our public key via our RSA key instance’s **publickey** method. We used a shortcut in this piece of code by just chaining the call to exportKey with the publickey method call to write it to disk as well. + +### Encrypting a File + +Now that we have both a private and a public key, we can encrypt some data and write it to a file. Here’s a pretty standard example: + +``` +from Crypto.PublicKey import RSA +from Crypto.Random import get_random_bytes +from Crypto.Cipher import AES, PKCS1_OAEP + +with open('/path/to/encrypted_data.bin', 'wb') as out_file: + recipient_key = RSA.import_key( + open('/path_to_public_key/my_rsa_public.pem').read()) + session_key = get_random_bytes(16) + + cipher_rsa = PKCS1_OAEP.new(recipient_key) + out_file.write(cipher_rsa.encrypt(session_key)) + + cipher_aes = AES.new(session_key, AES.MODE_EAX) + data = b'blah blah blah Python blah blah' + ciphertext, tag = cipher_aes.encrypt_and_digest(data) + + out_file.write(cipher_aes.nonce) + out_file.write(tag) + out_file.write(ciphertext) +``` + +The first three lines cover our imports from PyCryptodome. Next we open up a file to write to. Then we import our public key into a variable and create a 16-byte session key. For this example we are going to be using a hybrid encryption method, so we use PKCS#1 OAEP, which is Optimal asymmetric encryption padding. This allows us to write a data of an arbitrary length to the file. Then we create our AES cipher, create some data and encrypt the data. This will return the encrypted text and the MAC. Finally we write out the nonce, MAC (or tag) and the encrypted text. + +As an aside, a nonce is an arbitrary number that is only used for crytographic communication. They are usually random or pseudorandom numbers. For AES, it must be at least 16 bytes in length. Feel free to try opening the encrypted file in your favorite text editor. You should just see gibberish. + +Now let’s learn how to decrypt our data: + +``` +from Crypto.PublicKey import RSA +from Crypto.Cipher import AES, PKCS1_OAEP + +code = 'nooneknows' + +with open('/path/to/encrypted_data.bin', 'rb') as fobj: + private_key = RSA.import_key( + open('/path_to_private_key/my_rsa_key.pem').read(), + passphrase=code) + + enc_session_key, nonce, tag, ciphertext = [ fobj.read(x) + for x in (private_key.size_in_bytes(), + 16, 16, -1) ] + + cipher_rsa = PKCS1_OAEP.new(private_key) + session_key = cipher_rsa.decrypt(enc_session_key) + + cipher_aes = AES.new(session_key, AES.MODE_EAX, nonce) + data = cipher_aes.decrypt_and_verify(ciphertext, tag) + +print(data) +``` + +If you followed the previous example, this code should be pretty easy to parse. In this case, we are opening our encrypted file for reading in binary mode. Then we import our private key. Note that when you import the private key, you must give it your passcode. Otherwise you will get an error. Next we read in our file. You will note that we read in the private key first, then the next 16 bytes for the nonce, which is followed by the next 16 bytes which is the tag and finally the rest of the file, which is our data. + +Then we need to decrypt our session key, recreate our AES key and decrypt the data. + +You can use PyCryptodome to do much, much more. However we need to move on and see what else we can use for our cryptographic needs in Python. + +--- + +### The cryptography package + +The **cryptography** package aims to be “cryptography for humans” much like the **requests** library is “HTTP for Humans”. The idea is that you will be able to create simple cryptographic recipes that are safe and easy-to-use. If you need to, you can drop down to low=level cryptographic primitives, which require you to know what you’re doing or you might end up creating something that’s not very secure. + +If you are using Python 3.5, you can install it with pip, like so: + +``` +pip install cryptography +``` + +You will see that cryptography installs a few dependencies along with itself. Assuming that they all completed successfully, we can try encrypting some text. Let’s give the **Fernet** symmetric encryption algorithm. The Fernet algorithm guarantees that any message you encrypt with it cannot be manipulated or read without the key you define. Fernet also support key rotation via **MultiFernet**. Let’s take a look at a simple example: + +``` +>>> from cryptography.fernet import Fernet +>>> cipher_key = Fernet.generate_key() +>>> cipher_key +b'APM1JDVgT8WDGOWBgQv6EIhvxl4vDYvUnVdg-Vjdt0o=' +>>> cipher = Fernet(cipher_key) +>>> text = b'My super secret message' +>>> encrypted_text = cipher.encrypt(text) +>>> encrypted_text +(b'gAAAAABXOnV86aeUGADA6mTe9xEL92y_m0_TlC9vcqaF6NzHqRKkjEqh4d21PInEP3C9HuiUkS9f' + b'6bdHsSlRiCNWbSkPuRd_62zfEv3eaZjJvLAm3omnya8=') +>>> decrypted_text = cipher.decrypt(encrypted_text) +>>> decrypted_text +b'My super secret message' +``` + +First off we need to import Fernet. Next we generate a key. We print out the key to see what it looks like. As you can see, it’s a random byte string. If you want, you can try running the **generate_key** method a few times. The result will always be different. Next we create our Fernet cipher instance using our key. + +Now we have a cipher we can use to encrypt and decrypt our message. The next step is to create a message worth encrypting and then encrypt it using the **encrypt** method. I went ahead and printed our the encrypted text so you can see that you can no longer read the text. To **decrypt** our super secret message, we just call decrypt on our cipher and pass it the encrypted text. The result is we get a plain text byte string of our message. + +--- + +### Wrapping Up + +This chapter barely scratched the surface of what you can do with PyCryptodome and the cryptography packages. However it does give you a decent overview of what can be done with Python in regards to encrypting and decrypting strings and files. Be sure to read the documentation and start experimenting to see what else you can do! + +--- + +### Related Reading + +PyCrypto Wheels for Python 3 on [github][2] + +PyCryptodome [documentation][3] + +Python’s Cryptographic [Services][4] + +The cryptography package’s [website][5] + +------------------------------------------------------------------------------ + +via: http://www.blog.pythonlibrary.org/2016/05/18/python-3-an-intro-to-encryption/ + +作者:[Mike][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.blog.pythonlibrary.org/author/mld/ +[1]: http://pycryptodome.readthedocs.io/en/latest/ +[2]: https://github.com/sfbahr/PyCrypto-Wheels +[3]: http://pycryptodome.readthedocs.io/en/latest/src/introduction.html +[4]: https://docs.python.org/3/library/crypto.html +[5]: https://cryptography.io/en/latest/ diff --git a/sources/tech/20160519 The future of sharing: integrating Pydio and ownCloud.md b/sources/tech/20160519 The future of sharing: integrating Pydio and ownCloud.md new file mode 100644 index 0000000000..0461fda34d --- /dev/null +++ b/sources/tech/20160519 The future of sharing: integrating Pydio and ownCloud.md @@ -0,0 +1,65 @@ +The future of sharing: integrating Pydio and ownCloud +========================================================= + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BIZ_darwincloud_520x292_0311LL.png?itok=5yWIaEDe) +>Image by : +opensource.com + +The open source file sharing ecosystem accommodates a large variety of projects, each supplying their own solution, and each with a different approach. There are a lot of reasons to choose an open source solution rather than commercial solutions like Dropbox, Google Drive, iCloud, or OneDrive. These solutions offer to take away worries about managing your data but come with certain limitations, including a lack of control and integration into existing infrastructure. + +There are quite a few file sharing and sync alternatives available to users, including ownCloud and Pydio. + +### Pydio + +The Pydio (Put your data in orbit) project was founded by musician Charles du Jeu, who needed a way to share large audio files with his bandmates. [Pydio][1] is a file sharing and sync solution, with multiple storage backends, designed with developers and system administrators in mind. It has over one million downloads worldwide and has been translated into 27 languages. + +Open source from the very start, the project grew organically on [SourceForge][2] and now finds its home on [GitHub][3]. + +The user interface is based on Google's [Material Design][4]. Users can use an existing legacy file infrastructure or set up Pydio with an on-premise approach, and use web, desktop, and mobile applications to manage their assets everywhere. For administrators, the fine-grained access rights are a powerful tool for configuring access to assets.​ + +On the [Pydio community page][5], you will find several resources to get you up to speed quickly. The Pydio website gives some clear guidelines on [how to contribute][6] to the Pydio repositories on GitHub. The [forum][7] includes sections for developers and community. + +### ownCloud + +[ownCloud][8] has over 8 million users worldwide and is an open source, self-hosted file sync and sharing technology. There are sync clients for all major platforms as well as WebDAV through a web interface. ownCloud has an easy to use interface, powerful administrator tools, and extensive sharing and collaboration features—designed to give users control over their data. + +ownCloud's open architecture is extensible via an API and offers a platform for apps. Over 300 applications have been written, featuring capabilities like handling calendar, contacts, mail, music, passwords, notes, and many other types of data. ownCloud provides security, scales from a Raspberry Pi to a cluster with petabytes of storage and millions of users, and is developed by an international community of hundreds of contributors. + +### Federated sharing + +File sharing is starting to shift toward teamwork, and standardization provides a solid basis for such collaboration. + +Federated sharing, a new open standard supported by the [OpenCloudMesh][9] project, is a step in that direction. Among other things, it allows for the sharing of files and folders between servers that support this, like Pydio and ownCloud instances. + +First introduced in ownCloud 7, this server-to-server sharing allows you to mount file shares from remote servers, in effect creating your own cloud of clouds. You can create direct share links with users on other servers that support federated cloud sharing. + +Implementing this new API allows for deeper integration between storage solutions while maintaining the security, control, and attributes of the original platforms. + +"Exchanging and sharing files is something that is essential today and tomorrow," ownCloud founder Frank Karlitschek said. "Because of that, it is important to do this in a federated and distributed way without centralized data silos. The number one design goal [of federated sharing] is to enable sharing in the most seamless and easiest way while protecting the security and privacy of the users." + +### What's next? + +An initiative like OpenCloudMesh will extend this new open standard of file sharing through cooperation of institutions and companies like Pydio and ownCloud. ownCloud 9 has already introduced the ability for federated servers to exchange user lists, enabling the same seamless auto-complete experience you have with users on your own server. In the future, the idea of having a (federated!) set of central address book servers that can be used to search for others' federated cloud IDs might bring inter-cloud collaboration to an even higher level. + +The initiative will undoubtedly contribute to already growing open technical community within which members can easily discuss, develop, and contribute to the "OCM sharing API" as a vendor-neutral protocol. All leading partners of the OCM project are fully committed to the open API design principle and welcome other open source file share and sync communities to participate and join the connected cloud. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/business/16/5/sharing-files-pydio-owncloud + +作者:[ben van 't ende][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/benvantende +[1]: https://pydio.com/ +[2]: https://sourceforge.net/projects/ajaxplorer/ +[3]: https://github.com/pydio/ +[4]: https://www.google.com/design/spec/material-design/introduction.html +[5]: https://pydio.com/en/community +[6]: https://pydio.com/en/community/contribute +[7]: https://pydio.com/forum/f +[8]: https://owncloud.org/ +[9]: https://wiki.geant.org/display/OCM/Open+Cloud+Mesh diff --git a/sources/tech/20160520 ORB: NEW GENERATION OF LINUX APPS ARE HERE.md b/sources/tech/20160520 ORB: NEW GENERATION OF LINUX APPS ARE HERE.md new file mode 100644 index 0000000000..8ea5e6b803 --- /dev/null +++ b/sources/tech/20160520 ORB: NEW GENERATION OF LINUX APPS ARE HERE.md @@ -0,0 +1,142 @@ +ORB: NEW GENERATION OF LINUX APPS ARE HERE +============================================= + +![](http://itsfoss.com/wp-content/uploads/2016/05/ORB-Apps.jpeg) + +We have talked about [installing applications offline in Ubuntu][1] before. And we are going to talk about it once again. + +[Orbital Apps][2] has brought us a new type of application package, **ORB**, with portable applications, interactive installer support and offline usage ability. + +Portable applications are always handy. Mostly because they can run on-the-fly without needing any administrator privileges, and also it can be carried around on small USB sticks along with all their settings and data. And these interactive installers will be able to allow us to install applications with ease. + +### OPEN RUNNABLE BUNDLE (ORB) + +ORB is a free & open-source package format and it’s different from the others in numerous ways. Some of the specifications of ORB is followings: + +- **Compression**: All the packages are compressed with squashfs making them up-to 60% smaller. +- **Portable Mode**: If a portable ORB application is run from a removable drive, it’ll store its settings and data on that drive. +- **Security**: All ORB packages are signed with PGP/RSA and distributed via TLS 1.2. +- **Offline**: All the dependencies are bundled with the package, so no downloading dependencies anymore. +- **Open package**: ORB packages can be mounted as ISO images. + +### VARIETY + +ORB applications are now available in two varieties: + +- Portable Applications +- SuperDEB + +#### 1. PORTABLE ORB APPLICATIONS + +Portable ORB Applications is capable of running right away without needing any installation beforehand. That means it’ll need no administrator privileges and no dependencies! You can just download them from the Orbital Apps website and get to work. + +And as it supports Portable Mode, you can copy it on a USB stick and carry it around. All its settings and data will be stored with it on that USB stick. Just connect the USB stick with any system running on Ubuntu 16.04 and you’ll be ready to go. + +##### AVAILABLE PORTABLE APPLICATIONS + +Currently, more than 35 applications are available as portable packages, including some very popular applications like: [Deluge][3], [Firefox][4], [GIMP][5], [Libreoffice][6], [uGet][7] & [VLC][8]. + +For a full list of available packages, check the [Portable ORB Apps list][9]. + +##### USING PORTABLE APPLICATION + +Follow the steps for using Portable ORB Applications: + +- Download your desired package from the Orbital Apps site. +- Move it wherever you want (local drive / USB stick). +- Open the directory where you’ve stored the ORB package. + +![](http://itsfoss.com/wp-content/uploads/2016/05/using-portable-orb-app-1-1024x576.jpg) + +- Open Properties of the ORB package. + +![](http://itsfoss.com/wp-content/uploads/2016/05/using-portable-orb-app-2.jpg) +>Add Execute permission to ORB package + +- Add Execute permission from Permissions tab. +- Double-click on it. + +Wait for a few seconds as it prepares itself for running. And you’re good to go. + +#### 2. SUPERDEB + +Another variety of ORB Applications is SuperDEB. SuperDEBs are easy and interactive installers that make the software installation process a lot smoother. If you don’t like to install software from terminal or software centers, SuperDEB is exactly for you. + +And the most interesting part is that you won’t need an active internet connection for installing as all the dependencies are bundled with the installer. + +##### AVAILABLE SUPERDEBS + +More than 60 applications are currently available as SuperDEB. Some of the popular software among them are: [Chromium][10], [Deluge][3], [Firefox][4], [GIMP][5], [Libreoffice][6], [uGet][7] & [VLC][8]. + +For a full list of available SuperDEBs, check the [SuperDEB list][11]. + +##### USING SUPERDEB INSTALLER + +- Download your desired SuperDEB from Orbital Apps site. +- Add **Execute permission** to it just like before ( Properties > Permissions ). +- Double-click on the SuperDEB installer and follow the interactive instructions: + +![](http://itsfoss.com/wp-content/uploads/2016/05/Using-SuperDEB-Installer-1.png) +>Click OK + +![](http://itsfoss.com/wp-content/uploads/2016/05/Using-SuperDEB-Installer-2.png) +>Enter your password and proceed + +![](http://itsfoss.com/wp-content/uploads/2016/05/Using-SuperDEB-Installer-3.png) +>It’ll start Installing… + +![](http://itsfoss.com/wp-content/uploads/2016/05/Using-SuperDEB-Installer-4.png) +>And soon it’ll be done… + +- After finishing the installation, you’re good to use it normally. + +### ORB APPS COMPATIBILITY + +According to Orbital Apps, they are fully compatible with Ubuntu 16.04 [64 bit]. + +>Reading suggestion: [How To Know If You Have 32 Bit or 64 Bit Computer in Ubuntu][12]. + +As for other distros compatibility is not guaranteed. But we can say that, it’ll work on any Ubuntu 16.04 flavors (UbuntuMATE, UbuntuGNOME, Lubuntu, Xubuntu etc.) and Ubuntu 16.04 based distros (like upcoming Linux Mint 18). We currently have no information if Orbital Apps is planning on expanding its support for other Ubuntu versions/Linux Distros or not. + +If you’re going to use Portable ORB applications often on your system, you can consider installing ORB Launcher. It’s not necessary but is recommended installing to get an improved experience. The shortest method of installing ORB Launcher is opening the terminal and enter the following command: + +``` +wget -O - https://www.orbital-apps.com/orb.sh | bash +``` + +You can find the detailed instructions at [official documentation][13]. + +### WHAT IF I NEED AN APP THAT’S NOT LISTED? + +If you need an application as ORB package that is not available right now, you can [contact][14] Orbital Apps. And the good news is, Orbital Apps is working hard and planning on releasing a tool for creating ORB packages. So, hopefully, soon we’ll be able to make ORB packages ourselves! + +Just to add, this was about installing apps offline. If you are interested, you should read [how to update or upgrade Ubuntu offline][15]. + +So, what do you think about Orbital Apps’ Portable Applications and SuperDEB installers? Will you try them? + + +---------------------------------- +via: http://itsfoss.com/orb-linux-apps/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ItsFoss+%28Its+FOSS%21+An+Open+Source+Blog%29 + +作者:[Munif Tanjim][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/munif/ +[1]: http://itsfoss.com/cube-lets-install-linux-applications-offline/ +[2]: https://www.orbital-apps.com/ +[3]: https://www.orbital-apps.com/download/portable_apps_linux/deluge +[4]: https://www.orbital-apps.com/download/portable_apps_linux/firefox +[5]: https://www.orbital-apps.com/download/portable_apps_linux/gimp +[6]: https://www.orbital-apps.com/download/portable_apps_linux/libreoffice +[7]: https://www.orbital-apps.com/download/portable_apps_linux/uget +[8]: https://www.orbital-apps.com/download/portable_apps_linux/vlc +[9]: https://www.orbital-apps.com/download/portable_apps_linux/ +[10]: https://www.orbital-apps.com/download/superdeb_installers/ubuntu_16.04_64bits/chromium/ +[11]: https://www.orbital-apps.com/superdebs/ubuntu_16.04_64bits/ +[12]: http://itsfoss.com/32-bit-64-bit-ubuntu/ +[13]: https://www.orbital-apps.com/documentation +[14]: https://www.orbital-apps.com/contact +[15]: http://itsfoss.com/upgrade-or-update-ubuntu-offline-without-internet/ diff --git a/sources/tech/LFCS/Part 10 - LFCS--Understanding and Learning Basic Shell Scripting and Linux Filesystem Troubleshooting.md b/sources/tech/LFCS/Part 10 - LFCS--Understanding and Learning Basic Shell Scripting and Linux Filesystem Troubleshooting.md index 5dd1782a98..65a853bc84 100644 --- a/sources/tech/LFCS/Part 10 - LFCS--Understanding and Learning Basic Shell Scripting and Linux Filesystem Troubleshooting.md +++ b/sources/tech/LFCS/Part 10 - LFCS--Understanding and Learning Basic Shell Scripting and Linux Filesystem Troubleshooting.md @@ -1,4 +1,4 @@ -Translating by Xuanwo +GHLandy Translating Part 10 - LFCS: Understanding & Learning Basic Shell Scripting and Linux Filesystem Troubleshooting ================================================================================ @@ -314,4 +314,4 @@ via: http://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-tro [1]:http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/ [2]:http://www.tecmint.com/vi-editor-usage/ [3]:http://www.tecmint.com/learning-shell-scripting-language-a-guide-from-newbies-to-system-administrator/ -[4]:http://www.tecmint.com/basic-shell-programming-part-ii/ \ No newline at end of file +[4]:http://www.tecmint.com/basic-shell-programming-part-ii/ diff --git a/sources/tech/LFCS/Part 11 - How to Manage and Create LVM Using vgcreate, lvcreate and lvextend Commands.md b/sources/tech/LFCS/Part 11 - How to Manage and Create LVM Using vgcreate, lvcreate and lvextend Commands.md new file mode 100644 index 0000000000..4d2a9d7a13 --- /dev/null +++ b/sources/tech/LFCS/Part 11 - How to Manage and Create LVM Using vgcreate, lvcreate and lvextend Commands.md @@ -0,0 +1,206 @@ +Part 11 - How to Manage and Create LVM Using vgcreate, lvcreate and lvextend Commands +============================================================================================ + +Because of the changes in the LFCS exam requirements effective Feb. 2, 2016, we are adding the necessary topics to the [LFCS series][1] published here. To prepare for this exam, your are highly encouraged to use the [LFCE series][2] as well. + +![](http://www.tecmint.com/wp-content/uploads/2016/03/Manage-LVM-and-Create-LVM-Partition-in-Linux.png) +>LFCS: Manage LVM and Create LVM Partition – Part 11 + +One of the most important decisions while installing a Linux system is the amount of storage space to be allocated for system files, home directories, and others. If you make a mistake at that point, growing a partition that has run out of space can be burdensome and somewhat risky. + +**Logical Volumes Management** (also known as **LVM**), which have become a default for the installation of most (if not all) Linux distributions, have numerous advantages over traditional partitioning management. Perhaps the most distinguishing feature of LVM is that it allows logical divisions to be resized (reduced or increased) at will without much hassle. + +The structure of the LVM consists of: + +* One or more entire hard disks or partitions are configured as physical volumes (PVs). +* A volume group (**VG**) is created using one or more physical volumes. You can think of a volume group as a single storage unit. +* Multiple logical volumes can then be created in a volume group. Each logical volume is somewhat equivalent to a traditional partition – with the advantage that it can be resized at will as we mentioned earlier. + +In this article we will use three disks of **8 GB** each (**/dev/sdb**, **/dev/sdc**, and **/dev/sdd**) to create three physical volumes. You can either create the PVs directly on top of the device, or partition it first. + +Although we have chosen to go with the first method, if you decide to go with the second (as explained in [Part 4 – Create Partitions and File Systems in Linux][3] of this series) make sure to configure each partition as type `8e`. + +### Creating Physical Volumes, Volume Groups, and Logical Volumes + +To create physical volumes on top of **/dev/sdb**, **/dev/sdc**, and **/dev/sdd**, do: + +``` +# pvcreate /dev/sdb /dev/sdc /dev/sdd +``` + +You can list the newly created PVs with: + +``` +# pvs +``` + +and get detailed information about each PV with: + +``` +# pvdisplay /dev/sdX +``` + +(where **X** is b, c, or d) + +If you omit `/dev/sdX` as parameter, you will get information about all the PVs. + +To create a volume group named `vg00` using `/dev/sdb` and `/dev/sdc` (we will save `/dev/sdd` for later to illustrate the possibility of adding other devices to expand storage capacity when needed): + +``` +# vgcreate vg00 /dev/sdb /dev/sdc +``` + +As it was the case with physical volumes, you can also view information about this volume group by issuing: + +``` +# vgdisplay vg00 +``` + +Since `vg00` is formed with two **8 GB** disks, it will appear as a single **16 GB** drive: + +![](http://www.tecmint.com/wp-content/uploads/2016/03/List-LVM-Volume-Groups.png) +>List LVM Volume Groups + +When it comes to creating logical volumes, the distribution of space must take into consideration both current and future needs. It is considered good practice to name each logical volume according to its intended use. + +For example, let’s create two LVs named `vol_projects` (**10 GB**) and `vol_backups` (remaining space), which we can use later to store project documentation and system backups, respectively. + +The `-n` option is used to indicate a name for the LV, whereas `-L` sets a fixed size and `-l` (lowercase L) is used to indicate a percentage of the remaining space in the container VG. + +``` +# lvcreate -n vol_projects -L 10G vg00 +# lvcreate -n vol_backups -l 100%FREE vg00 +``` + +As before, you can view the list of LVs and basic information with: + +``` +# lvs +``` + +and detailed information with + +``` +# lvdisplay +``` + +To view information about a single **LV**, use **lvdisplay** with the **VG** and **LV** as parameters, as follows: + +``` +# lvdisplay vg00/vol_projects +``` + +![](http://www.tecmint.com/wp-content/uploads/2016/03/List-Logical-Volume.png) +>List Logical Volume + +In the image above we can see that the LVs were created as storage devices (refer to the LV Path line). Before each logical volume can be used, we need to create a filesystem on top of it. + +We’ll use ext4 as an example here since it allows us both to increase and reduce the size of each LV (as opposed to xfs that only allows to increase the size): + +``` +# mkfs.ext4 /dev/vg00/vol_projects +# mkfs.ext4 /dev/vg00/vol_backups +``` + +In the next section we will explain how to resize logical volumes and add extra physical storage space when the need arises to do so. + +### Resizing Logical Volumes and Extending Volume Groups + +Now picture the following scenario. You are starting to run out of space in `vol_backups`, while you have plenty of space available in `vol_projects`. Due to the nature of LVM, we can easily reduce the size of the latter (say **2.5 GB**) and allocate it for the former, while resizing each filesystem at the same time. + +Fortunately, this is as easy as doing: + +``` +# lvreduce -L -2.5G -r /dev/vg00/vol_projects +# lvextend -l +100%FREE -r /dev/vg00/vol_backups +``` + +![](http://www.tecmint.com/wp-content/uploads/2016/03/Resize-Reduce-Logical-Volume-and-Volume-Group.png) +>Resize Reduce Logical Volume and Volume Group + +It is important to include the minus `(-)` or plus `(+)` signs while resizing a logical volume. Otherwise, you’re setting a fixed size for the LV instead of resizing it. + +It can happen that you arrive at a point when resizing logical volumes cannot solve your storage needs anymore and you need to buy an extra storage device. Keeping it simple, you will need another disk. We are going to simulate this situation by adding the remaining PV from our initial setup (`/dev/sdd`). + +To add `/dev/sdd` to `vg00`, do + +``` +# vgextend vg00 /dev/sdd +``` + +If you run vgdisplay `vg00` before and after the previous command, you will see the increase in the size of the VG: + +``` +# vgdisplay vg00 +``` + +![](http://www.tecmint.com/wp-content/uploads/2016/03/List-Volume-Group-Size.png) +>Check Volume Group Disk Size + +Now you can use the newly added space to resize the existing LVs according to your needs, or to create additional ones as needed. + +### Mounting Logical Volumes on Boot and on Demand + +Of course there would be no point in creating logical volumes if we are not going to actually use them! To better identify a logical volume we will need to find out what its `UUID` (a non-changing attribute that uniquely identifies a formatted storage device) is. + +To do that, use blkid followed by the path to each device: + +``` +# blkid /dev/vg00/vol_projects +# blkid /dev/vg00/vol_backups +``` + +![](http://www.tecmint.com/wp-content/uploads/2016/03/Find-Logical-Volume-UUID.png) +>Find Logical Volume UUID + +Create mount points for each LV: + +``` +# mkdir /home/projects +# mkdir /home/backups +``` + +and insert the corresponding entries in `/etc/fstab` (make sure to use the UUIDs obtained before): + +``` +UUID=b85df913-580f-461c-844f-546d8cde4646 /home/projects ext4 defaults 0 0 +UUID=e1929239-5087-44b1-9396-53e09db6eb9e /home/backups ext4 defaults 0 0 +``` + +Then save the changes and mount the LVs: + +``` +# mount -a +# mount | grep home +``` + +![](http://www.tecmint.com/wp-content/uploads/2016/03/Find-Logical-Volume-UUID.png) +>Find Logical Volume UUID + +When it comes to actually using the LVs, you will need to assign proper `ugo+rwx` permissions as explained in [Part 8 – Manage Users and Groups in Linux][4] of this series. + +### Summary + +In this article we have introduced [Logical Volume Management][5], a versatile tool to manage storage devices that provides scalability. When combined with RAID (which we explained in [Part 6 – Create and Manage RAID in Linux][6] of this series), you can enjoy not only scalability (provided by LVM) but also redundancy (offered by RAID). + +In this type of setup, you will typically find `LVM` on top of `RAID`, that is, configure RAID first and then configure LVM on top of it. + +If you have questions about this article, or suggestions to improve it, feel free to reach us using the comment form below. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.tecmint.com/author/gacanepa/ +[1]: http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/ +[2]: http://www.tecmint.com/installing-network-services-and-configuring-services-at-system-boot/ +[3]: http://www.tecmint.com/create-partitions-and-filesystems-in-linux/ +[4]: http://www.tecmint.com/manage-users-and-groups-in-linux/ +[5]: http://www.tecmint.com/create-lvm-storage-in-linux/ +[6]: http://www.tecmint.com/creating-and-managing-raid-backups-in-linux/ diff --git a/sources/tech/LFCS/Part 2 - LFCS--How to Install and Use vi or vim as a Full Text Editor.md b/sources/tech/LFCS/Part 2 - LFCS--How to Install and Use vi or vim as a Full Text Editor.md deleted file mode 100644 index 1d069e08ea..0000000000 --- a/sources/tech/LFCS/Part 2 - LFCS--How to Install and Use vi or vim as a Full Text Editor.md +++ /dev/null @@ -1,389 +0,0 @@ -Translating by Xuanwo - -Part 2 - LFCS: How to Install and Use vi/vim as a Full Text Editor -================================================================================ -A couple of months ago, the Linux Foundation launched the LFCS (Linux Foundation Certified Sysadmin) certification in order to help individuals from all over the world to verify they are capable of doing basic to intermediate system administration tasks on Linux systems: system support, first-hand troubleshooting and maintenance, plus intelligent decision-making to know when it’s time to raise issues to upper support teams. - -![Learning VI Editor in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/LFCS-Part-2.png) - -Learning VI Editor in Linux - -Please take a look at the below video that explains The Linux Foundation Certification Program. - -注:youtube 视频 - - -This post is Part 2 of a 10-tutorial series, here in this part, we will cover the basic file editing operations and understanding modes in vi/m editor, that are required for the LFCS certification exam. - -### Perform Basic File Editing Operations Using vi/m ### - -Vi was the first full-screen text editor written for Unix. Although it was intended to be small and simple, it can be a bit challenging for people used exclusively to GUI text editors, such as NotePad++, or gedit, to name a few examples. - -To use Vi, we must first understand the 3 modes in which this powerful program operates, in order to begin learning later about the its powerful text-editing procedures. - -Please note that most modern Linux distributions ship with a variant of vi known as vim (“Vi improved”), which supports more features than the original vi does. For that reason, throughout this tutorial we will use vi and vim interchangeably. - -If your distribution does not have vim installed, you can install it as follows. - -- Ubuntu and derivatives: aptitude update && aptitude install vim -- Red Hat-based distributions: yum update && yum install vim -- openSUSE: zypper update && zypper install vim - -### Why should I want to learn vi? ### - -There are at least 2 good reasons to learn vi. - -1. vi is always available (no matter what distribution you’re using) since it is required by POSIX. - -2. vi does not consume a considerable amount of system resources and allows us to perform any imaginable tasks without lifting our fingers from the keyboard. - -In addition, vi has a very extensive built-in manual, which can be launched using the :help command right after the program is started. This built-in manual contains more information than vi/m’s man page. - -![vi Man Pages](http://www.tecmint.com/wp-content/uploads/2014/10/vi-man-pages.png) - -vi Man Pages - -#### Launching vi #### - -To launch vi, type vi in your command prompt. - -![Start vi Editor](http://www.tecmint.com/wp-content/uploads/2014/10/start-vi-editor.png) - -Start vi Editor - -Then press i to enter Insert mode, and you can start typing. Another way to launch vi/m is. - - # vi filename - -Which will open a new buffer (more on buffers later) named filename, which you can later save to disk. - -#### Understanding Vi modes #### - -1. In command mode, vi allows the user to navigate around the file and enter vi commands, which are brief, case-sensitive combinations of one or more letters. Almost all of them can be prefixed with a number to repeat the command that number of times. - -For example, yy (or Y) copies the entire current line, whereas 3yy (or 3Y) copies the entire current line along with the two next lines (3 lines in total). We can always enter command mode (regardless of the mode we’re working on) by pressing the Esc key. The fact that in command mode the keyboard keys are interpreted as commands instead of text tends to be confusing to beginners. - -2. In ex mode, we can manipulate files (including saving a current file and running outside programs). To enter this mode, we must type a colon (:) from command mode, directly followed by the name of the ex-mode command that needs to be used. After that, vi returns automatically to command mode. - -3. In insert mode (the letter i is commonly used to enter this mode), we simply enter text. Most keystrokes result in text appearing on the screen (one important exception is the Esc key, which exits insert mode and returns to command mode). - -![vi Insert Mode](http://www.tecmint.com/wp-content/uploads/2014/10/vi-insert-mode.png) - -vi Insert Mode - -#### Vi Commands #### - -The following table shows a list of commonly used vi commands. File edition commands can be enforced by appending the exclamation sign to the command (for example, - - - - - - -  Key command -  Description - - -  h or left arrow -  Go one character to the left - - -  j or down arrow -  Go down one line - - -  k or up arrow -  Go up one line - - -  l (lowercase L) or right arrow -  Go one character to the right - - -  H -  Go to the top of the screen - - -  L -  Go to the bottom of the screen - - -  G -  Go to the end of the file - - -  w -  Move one word to the right - - -  b -  Move one word to the left - - -  0 (zero) -  Go to the beginning of the current line - - -  ^ -  Go to the first nonblank character on the current line - - -  $ -  Go to the end of the current line - - -  Ctrl-B -  Go back one screen - - -  Ctrl-F -  Go forward one screen - - -  i -  Insert at the current cursor position - - -  I (uppercase i) -  Insert at the beginning of the current line - - -  J (uppercase j) -  Join current line with the next one (move next line up) - - -  a -  Append after the current cursor position - - -  o (lowercase O) -  Creates a blank line after the current line - - -  O (uppercase o) -  Creates a blank line before the current line - - -  r -  Replace the character at the current cursor position - - -  R -  Overwrite at the current cursor position - - -  x -  Delete the character at the current cursor position - - -  X -  Delete the character immediately before (to the left) of the current cursor position - - -  dd -  Cut (for later pasting) the entire current line - - -  D -  Cut from the current cursor position to the end of the line (this command is equivalent to d$) - - -  yX -  Give a movement command X, copy (yank) the appropriate number of characters, words, or lines from the current cursor position - - -  yy or Y -  Yank (copy) the entire current line - - -  p -  Paste after (next line) the current cursor position - - -  P -  Paste before (previous line) the current cursor position - - -  . (period) -  Repeat the last command - - -  u -  Undo the last command - - -  U -  Undo the last command in the last line. This will work as long as the cursor is still on the line. - - -  n -  Find the next match in a search - - -  N -  Find the previous match in a search - - -  :n -  Next file; when multiple files are specified for editing, this commands loads the next file. - - -  :e file -  Load file in place of the current file. - - -  :r file -  Insert the contents of file after (next line) the current cursor position - - -  :q -  Quit without saving changes. - - -  :w file -  Write the current buffer to file. To append to an existing file, use :w >> file. - - -  :wq -  Write the contents of the current file and quit. Equivalent to x! and ZZ - - -  :r! command -  Execute command and insert output after (next line) the current cursor position. - - - - -#### Vi Options #### - -The following options can come in handy while running vim (we need to add them in our ~/.vimrc file). - - # echo set number >> ~/.vimrc - # echo syntax on >> ~/.vimrc - # echo set tabstop=4 >> ~/.vimrc - # echo set autoindent >> ~/.vimrc - -![vi Editor Options](http://www.tecmint.com/wp-content/uploads/2014/10/vi-options.png) - -vi Editor Options - -- set number shows line numbers when vi opens an existing or a new file. -- syntax on turns on syntax highlighting (for multiple file extensions) in order to make code and config files more readable. -- set tabstop=4 sets the tab size to 4 spaces (default value is 8). -- set autoindent carries over previous indent to the next line. - -#### Search and replace #### - -vi has the ability to move the cursor to a certain location (on a single line or over an entire file) based on searches. It can also perform text replacements with or without confirmation from the user. - -a). Searching within a line: the f command searches a line and moves the cursor to the next occurrence of a specified character in the current line. - -For example, the command fh would move the cursor to the next instance of the letter h within the current line. Note that neither the letter f nor the character you’re searching for will appear anywhere on your screen, but the character will be highlighted after you press Enter. - -For example, this is what I get after pressing f4 in command mode. - -![Search String in Vi](http://www.tecmint.com/wp-content/uploads/2014/10/vi-search-string.png) - -Search String in Vi - -b). Searching an entire file: use the / command, followed by the word or phrase to be searched for. A search may be repeated using the previous search string with the n command, or the next one (using the N command). This is the result of typing /Jane in command mode. - -![Vi Search String in File](http://www.tecmint.com/wp-content/uploads/2014/10/vi-search-line.png) - -Vi Search String in File - -c). vi uses a command (similar to sed’s) to perform substitution operations over a range of lines or an entire file. To change the word “old” to “young” for the entire file, we must enter the following command. - - :%s/old/young/g - -**Notice**: The colon at the beginning of the command. - -![Vi Search and Replace](http://www.tecmint.com/wp-content/uploads/2014/10/vi-search-and-replace.png) - -Vi Search and Replace - -The colon (:) starts the ex command, s in this case (for substitution), % is a shortcut meaning from the first line to the last line (the range can also be specified as n,m which means “from line n to line m”), old is the search pattern, while young is the replacement text, and g indicates that the substitution should be performed on every occurrence of the search string in the file. - -Alternatively, a c can be added to the end of the command to ask for confirmation before performing any substitution. - - :%s/old/young/gc - -Before replacing the original text with the new one, vi/m will present us with the following message. - -![Replace String in Vi](http://www.tecmint.com/wp-content/uploads/2014/10/vi-replace-old-with-young.png) - -Replace String in Vi - -- y: perform the substitution (yes) -- n: skip this occurrence and go to the next one (no) -- a: perform the substitution in this and all subsequent instances of the pattern. -- q or Esc: quit substituting. -- l (lowercase L): perform this substitution and quit (last). -- Ctrl-e, Ctrl-y: Scroll down and up, respectively, to view the context of the proposed substitution. - -#### Editing Multiple Files at a Time #### - -Let’s type vim file1 file2 file3 in our command prompt. - - # vim file1 file2 file3 - -First, vim will open file1. To switch to the next file (file2), we need to use the :n command. When we want to return to the previous file, :N will do the job. - -In order to switch from file1 to file3. - -a). The :buffers command will show a list of the file currently being edited. - - :buffers - -![Edit Multiple Files](http://www.tecmint.com/wp-content/uploads/2014/10/vi-edit-multiple-files.png) - -Edit Multiple Files - -b). The command :buffer 3 (without the s at the end) will open file3 for editing. - -In the image above, a pound sign (#) indicates that the file is currently open but in the background, while %a marks the file that is currently being edited. On the other hand, a blank space after the file number (3 in the above example) indicates that the file has not yet been opened. - -#### Temporary vi buffers #### - -To copy a couple of consecutive lines (let’s say 4, for example) into a temporary buffer named a (not associated with a file) and place those lines in another part of the file later in the current vi section, we need to… - -1. Press the ESC key to be sure we are in vi Command mode. - -2. Place the cursor on the first line of the text we wish to copy. - -3. Type “a4yy to copy the current line, along with the 3 subsequent lines, into a buffer named a. We can continue editing our file – we do not need to insert the copied lines immediately. - -4. When we reach the location for the copied lines, use “a before the p or P commands to insert the lines copied into the buffer named a: - -- Type “ap to insert the lines copied into buffer a after the current line on which the cursor is resting. -- Type “aP to insert the lines copied into buffer a before the current line. - -If we wish, we can repeat the above steps to insert the contents of buffer a in multiple places in our file. A temporary buffer, as the one in this section, is disposed when the current window is closed. - -### Summary ### - -As we have seen, vi/m is a powerful and versatile text editor for the CLI. Feel free to share your own tricks and comments below. - -#### Reference Links #### - -- [About the LFCS][1] -- [Why get a Linux Foundation Certification?][2] -- [Register for the LFCS exam][3] - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/vi-editor-usage/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:https://training.linuxfoundation.org/certification/LFCS -[2]:https://training.linuxfoundation.org/certification/why-certify-with-us -[3]:https://identity.linuxfoundation.org/user?destination=pid/1 \ No newline at end of file diff --git a/sources/tech/LFCS/Part 3 - LFCS--How to Archive or Compress Files and Directories Setting File Attributes and Finding Files in Linux.md b/sources/tech/LFCS/Part 3 - LFCS--How to Archive or Compress Files and Directories Setting File Attributes and Finding Files in Linux.md deleted file mode 100644 index 77fe5cf040..0000000000 --- a/sources/tech/LFCS/Part 3 - LFCS--How to Archive or Compress Files and Directories Setting File Attributes and Finding Files in Linux.md +++ /dev/null @@ -1,384 +0,0 @@ -Translating by Xuanwo - -Part 3 - LFCS: How to Archive/Compress Files & Directories, Setting File Attributes and Finding Files in Linux -================================================================================ -Recently, the Linux Foundation started the LFCS (Linux Foundation Certified Sysadmin) certification, a brand new program whose purpose is allowing individuals from all corners of the globe to have access to an exam, which if approved, certifies that the person is knowledgeable in performing basic to intermediate system administration tasks on Linux systems. This includes supporting already running systems and services, along with first-level troubleshooting and analysis, plus the ability to decide when to escalate issues to engineering teams. - -![Linux Foundation Certified Sysadmin – Part 3](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-3.png) - -Linux Foundation Certified Sysadmin – Part 3 - -Please watch the below video that gives the idea about The Linux Foundation Certification Program. - -注:youtube 视频 - - -This post is Part 3 of a 10-tutorial series, here in this part, we will cover how to archive/compress files and directories, set file attributes, and find files on the filesystem, that are required for the LFCS certification exam. - -### Archiving and Compression Tools ### - -A file archiving tool groups a set of files into a single standalone file that we can backup to several types of media, transfer across a network, or send via email. The most frequently used archiving utility in Linux is tar. When an archiving utility is used along with a compression tool, it allows to reduce the disk size that is needed to store the same files and information. - -#### The tar utility #### - -tar bundles a group of files together into a single archive (commonly called a tar file or tarball). The name originally stood for tape archiver, but we must note that we can use this tool to archive data to any kind of writeable media (not only to tapes). Tar is normally used with a compression tool such as gzip, bzip2, or xz to produce a compressed tarball. - -**Basic syntax:** - - # tar [options] [pathname ...] - -Where … represents the expression used to specify which files should be acted upon. - -#### Most commonly used tar commands #### - -注:表格 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Long optionAbbreviationDescription
 –create c Creates a tar archive
 –concatenate A Appends tar files to an archive
 –append r Appends files to the end of an archive
 –update u Appends files newer than copy in archive
 –diff or –compare d Find differences between archive and file system
 –file archive f Use archive file or device ARCHIVE
 –list t Lists the contents of a tarball
 –extract or –get x Extracts files from an archive
- -#### Normally used operation modifiers #### - -注:表格 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Long optionAbbreviationDescription
 –directory dir C Changes to directory dir before performing operations
 –same-permissions p Preserves original permissions
 –verbose v Lists all files read or extracted. When this flag is used along with –list, the file sizes, ownership, and time stamps are displayed.
 –verify W Verifies the archive after writing it
 –exclude file — Excludes file from the archive
 –exclude=pattern X Exclude files, given as a PATTERN
 –gzip or –gunzip z Processes an archive through gzip
 –bzip2 j Processes an archive through bzip2
 –xz J Processes an archive through xz
- -Gzip is the oldest compression tool and provides the least compression, while bzip2 provides improved compression. In addition, xz is the newest but (usually) provides the best compression. This advantages of best compression come at a price: the time it takes to complete the operation, and system resources used during the process. - -Normally, tar files compressed with these utilities have .gz, .bz2, or .xz extensions, respectively. In the following examples we will be using these files: file1, file2, file3, file4, and file5. - -**Grouping and compressing with gzip, bzip2 and xz** - -Group all the files in the current working directory and compress the resulting bundle with gzip, bzip2, and xz (please note the use of a regular expression to specify which files should be included in the bundle – this is to prevent the archiving tool to group the tarballs created in previous steps). - - # tar czf myfiles.tar.gz file[0-9] - # tar cjf myfiles.tar.bz2 file[0-9] - # tar cJf myfile.tar.xz file[0-9] - -![Compress Multiple Files Using tar](http://www.tecmint.com/wp-content/uploads/2014/10/Compress-Multiple-Files.png) - -Compress Multiple Files - -**Listing the contents of a tarball and updating / appending files to the bundle** - -List the contents of a tarball and display the same information as a long directory listing. Note that update or append operations cannot be applied to compressed files directly (if you need to update or append a file to a compressed tarball, you need to uncompress the tar file and update / append to it, then compress again). - - # tar tvf [tarball] - -![Check Files in tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/List-Archive-Content.png) - -List Archive Content - -Run any of the following commands: - - # gzip -d myfiles.tar.gz [#1] - # bzip2 -d myfiles.tar.bz2 [#2] - # xz -d myfiles.tar.xz [#3] - -Then - - # tar --delete --file myfiles.tar file4 (deletes the file inside the tarball) - # tar --update --file myfiles.tar file4 (adds the updated file) - -and - - # gzip myfiles.tar [ if you choose #1 above ] - # bzip2 myfiles.tar [ if you choose #2 above ] - # xz myfiles.tar [ if you choose #3 above ] - -Finally, - - # tar tvf [tarball] #again - -and compare the modification date and time of file4 with the same information as shown earlier. - -**Excluding file types** - -Suppose you want to perform a backup of user’s home directories. A good sysadmin practice would be (may also be specified by company policies) to exclude all video and audio files from backups. - -Maybe your first approach would be to exclude from the backup all files with an .mp3 or .mp4 extension (or other extensions). What if you have a clever user who can change the extension to .txt or .bkp, your approach won’t do you much good. In order to detect an audio or video file, you need to check its file type with file. The following shell script will do the job. - - #!/bin/bash - # Pass the directory to backup as first argument. - DIR=$1 - # Create the tarball and compress it. Exclude files with the MPEG string in its file type. - # -If the file type contains the string mpeg, $? (the exit status of the most recently executed command) expands to 0, and the filename is redirected to the exclude option. Otherwise, it expands to 1. - # -If $? equals 0, add the file to the list of files to be backed up. - tar X <(for i in $DIR/*; do file $i | grep -i mpeg; if [ $? -eq 0 ]; then echo $i; fi;done) -cjf backupfile.tar.bz2 $DIR/* - -![Exclude Files in tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/Exclude-Files-in-Tar.png) - -Exclude Files in tar - -**Restoring backups with tar preserving permissions** - -You can then restore the backup to the original user’s home directory (user_restore in this example), preserving permissions, with the following command. - - # tar xjf backupfile.tar.bz2 --directory user_restore --same-permissions - -![Restore Files from tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/Restore-tar-Backup-Files.png) - -Restore Files from Archive - -**Read Also:** - -- [18 tar Command Examples in Linux][1] -- [Dtrx – An Intelligent Archive Tool for Linux][2] - -### Using find Command to Search for Files ### - -The find command is used to search recursively through directory trees for files or directories that match certain characteristics, and can then either print the matching files or directories or perform other operations on the matches. - -Normally, we will search by name, owner, group, type, permissions, date, and size. - -#### Basic syntax: #### - -# find [directory_to_search] [expression] - -**Finding files recursively according to Size** - -Find all files (-f) in the current directory (.) and 2 subdirectories below (-maxdepth 3 includes the current working directory and 2 levels down) whose size (-size) is greater than 2 MB. - - # find . -maxdepth 3 -type f -size +2M - -![Find Files by Size in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Files-Based-on-Size.png) - -Find Files Based on Size - -**Finding and deleting files that match a certain criteria** - -Files with 777 permissions are sometimes considered an open door to external attackers. Either way, it is not safe to let anyone do anything with files. We will take a rather aggressive approach and delete them! (‘{}‘ + is used to “collect” the results of the search). - - # find /home/user -perm 777 -exec rm '{}' + - -![Find all 777 Permission Files](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Files-with-777-Permission.png) - -Find Files with 777Permission - -**Finding files per atime or mtime** - -Search for configuration files in /etc that have been accessed (-atime) or modified (-mtime) more (+180) or less (-180) than 6 months ago or exactly 6 months ago (180). - -Modify the following command as per the example below: - - # find /etc -iname "*.conf" -mtime -180 -print - -![Find Files by Modification Time](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Modified-Files.png) - -Find Modified Files - -- Read Also: [35 Practical Examples of Linux ‘find’ Command][3] - -### File Permissions and Basic Attributes ### - -The first 10 characters in the output of ls -l are the file attributes. The first of these characters is used to indicate the file type: - -- – : a regular file -- -d : a directory -- -l : a symbolic link -- -c : a character device (which treats data as a stream of bytes, i.e. a terminal) -- -b : a block device (which handles data in blocks, i.e. storage devices) - -The next nine characters of the file attributes are called the file mode and represent the read (r), write (w), and execute (x) permissions of the file’s owner, the file’s group owner, and the rest of the users (commonly referred to as “the world”). - -Whereas the read permission on a file allows the same to be opened and read, the same permission on a directory allows its contents to be listed if the execute permission is also set. In addition, the execute permission in a file allows it to be handled as a program and run, while in a directory it allows the same to be cd’ed into it. - -File permissions are changed with the chmod command, whose basic syntax is as follows: - - # chmod [new_mode] file - -Where new_mode is either an octal number or an expression that specifies the new permissions. - -The octal number can be converted from its binary equivalent, which is calculated from the desired file permissions for the owner, the group, and the world, as follows: - -The presence of a certain permission equals a power of 2 (r=22, w=21, x=20), while its absence equates to 0. For example: - -![Linux File Permissions](http://www.tecmint.com/wp-content/uploads/2014/10/File-Permissions.png) - -File Permissions - -To set the file’s permissions as above in octal form, type: - - # chmod 744 myfile - -You can also set a file’s mode using an expression that indicates the owner’s rights with the letter u, the group owner’s rights with the letter g, and the rest with o. All of these “individuals” can be represented at the same time with the letter a. Permissions are granted (or revoked) with the + or – signs, respectively. - -**Revoking execute permission for a shell script to all users** - -As we explained earlier, we can revoke a certain permission prepending it with the minus sign and indicating whether it needs to be revoked for the owner, the group owner, or all users. The one-liner below can be interpreted as follows: Change mode for all (a) users, revoke (–) execute permission (x). - - # chmod a-x backup.sh - -Granting read, write, and execute permissions for a file to the owner and group owner, and read permissions for the world. - -When we use a 3-digit octal number to set permissions for a file, the first digit indicates the permissions for the owner, the second digit for the group owner and the third digit for everyone else: - -- Owner: (r=22 + w=21 + x=20 = 7) -- Group owner: (r=22 + w=21 + x=20 = 7) -- World: (r=22 + w=0 + x=0 = 4), - - # chmod 774 myfile - -In time, and with practice, you will be able to decide which method to change a file mode works best for you in each case. A long directory listing also shows the file’s owner and its group owner (which serve as a rudimentary yet effective access control to files in a system): - -![Linux File Listing](http://www.tecmint.com/wp-content/uploads/2014/10/Linux-File-Listing.png) - -Linux File Listing - -File ownership is changed with the chown command. The owner and the group owner can be changed at the same time or separately. Its basic syntax is as follows: - - # chown user:group file - -Where at least user or group need to be present. - -**Few Examples** - -Changing the owner of a file to a certain user. - - # chown gacanepa sent - -Changing the owner and group of a file to an specific user:group pair. - - # chown gacanepa:gacanepa TestFile - -Changing only the group owner of a file to a certain group. Note the colon before the group’s name. - - # chown :gacanepa email_body.txt - -### Conclusion ### - -As a sysadmin, you need to know how to create and restore backups, how to find files in your system and change their attributes, along with a few tricks that can make your life easier and will prevent you from running into future issues. - -I hope that the tips provided in the present article will help you to achieve that goal. Feel free to add your own tips and ideas in the comments section for the benefit of the community. Thanks in advance! -Reference Links - -- [About the LFCS][4] -- [Why get a Linux Foundation Certification?][5] -- [Register for the LFCS exam][6] - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/compress-files-and-finding-files-in-linux/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/18-tar-command-examples-in-linux/ -[2]:http://www.tecmint.com/dtrx-an-intelligent-archive-extraction-tar-zip-cpio-rpm-deb-rar-tool-for-linux/ -[3]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/ -[4]:https://training.linuxfoundation.org/certification/LFCS -[5]:https://training.linuxfoundation.org/certification/why-certify-with-us -[6]:https://identity.linuxfoundation.org/user?destination=pid/1 \ No newline at end of file diff --git a/sources/tech/LFCS/Part 4 - LFCS--Partitioning Storage Devices Formatting Filesystems and Configuring Swap Partition.md b/sources/tech/LFCS/Part 4 - LFCS--Partitioning Storage Devices Formatting Filesystems and Configuring Swap Partition.md deleted file mode 100644 index 93e4b2966b..0000000000 --- a/sources/tech/LFCS/Part 4 - LFCS--Partitioning Storage Devices Formatting Filesystems and Configuring Swap Partition.md +++ /dev/null @@ -1,193 +0,0 @@ -Translating by Xuanwo - -Part 4 - LFCS: Partitioning Storage Devices, Formatting Filesystems and Configuring Swap Partition -================================================================================ -Last August, the Linux Foundation launched the LFCS certification (Linux Foundation Certified Sysadmin), a shiny chance for system administrators to show, through a performance-based exam, that they can perform overall operational support of Linux systems: system support, first-level diagnosing and monitoring, plus issue escalation – if needed – to other support teams. - -![Linux Foundation Certified Sysadmin – Part 4](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-4.png) - -Linux Foundation Certified Sysadmin – Part 4 - -Please aware that Linux Foundation certifications are precise, totally based on performance and available through an online portal anytime, anywhere. Thus, you no longer have to travel to a examination center to get the certifications you need to establish your skills and expertise. - -Please watch the below video that explains The Linux Foundation Certification Program. - -注:youtube 视频 - - -This post is Part 4 of a 10-tutorial series, here in this part, we will cover the Partitioning storage devices, Formatting filesystems and Configuring swap partition, that are required for the LFCS certification exam. - -### Partitioning Storage Devices ### - -Partitioning is a means to divide a single hard drive into one or more parts or “slices” called partitions. A partition is a section on a drive that is treated as an independent disk and which contains a single type of file system, whereas a partition table is an index that relates those physical sections of the hard drive to partition identifications. - -In Linux, the traditional tool for managing MBR partitions (up to ~2009) in IBM PC compatible systems is fdisk. For GPT partitions (~2010 and later) we will use gdisk. Each of these tools can be invoked by typing its name followed by a device name (such as /dev/sdb). - -#### Managing MBR Partitions with fdisk #### - -We will cover fdisk first. - - # fdisk /dev/sdb - -A prompt appears asking for the next operation. If you are unsure, you can press the ‘m‘ key to display the help contents. - -![fdisk Help Menu](http://www.tecmint.com/wp-content/uploads/2014/10/fdisk-help.png) - -fdisk Help Menu - -In the above image, the most frequently used options are highlighted. At any moment, you can press ‘p‘ to display the current partition table. - -![Check Partition Table in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Show-Partition-Table.png) - -Show Partition Table - -The Id column shows the partition type (or partition id) that has been assigned by fdisk to the partition. A partition type serves as an indicator of the file system, the partition contains or, in simple words, the way data will be accessed in that partition. - -Please note that a comprehensive study of each partition type is out of the scope of this tutorial – as this series is focused on the LFCS exam, which is performance-based. - -**Some of the options used by fdisk as follows:** - -You can list all the partition types that can be managed by fdisk by pressing the ‘l‘ option (lowercase l). - -Press ‘d‘ to delete an existing partition. If more than one partition is found in the drive, you will be asked which one should be deleted. - -Enter the corresponding number, and then press ‘w‘ (write modifications to partition table) to apply changes. - -In the following example, we will delete /dev/sdb2, and then print (p) the partition table to verify the modifications. - -![fdisk Command Options](http://www.tecmint.com/wp-content/uploads/2014/10/fdisk-options.png) - -fdisk Command Options - -Press ‘n‘ to create a new partition, then ‘p‘ to indicate it will be a primary partition. Finally, you can accept all the default values (in which case the partition will occupy all the available space), or specify a size as follows. - -![Create New Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-New-Partition.png) - -Create New Partition - -If the partition Id that fdisk chose is not the right one for our setup, we can press ‘t‘ to change it. - -![Change Partition Name in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Change-Partition-Name.png) - -Change Partition Name - -When you’re done setting up the partitions, press ‘w‘ to commit the changes to disk. - -![Save Partition Changes](http://www.tecmint.com/wp-content/uploads/2014/10/Save-Partition-Changes.png) - -Save Partition Changes - -#### Managing GPT Partitions with gdisk #### - -In the following example, we will use /dev/sdb. - - # gdisk /dev/sdb - -We must note that gdisk can be used either to create MBR or GPT partitions. - -![Create GPT Partitions in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-GPT-Partitions.png) - -Create GPT Partitions - -The advantage of using GPT partitioning is that we can create up to 128 partitions in the same disk whose size can be up to the order of petabytes, whereas the maximum size for MBR partitions is 2 TB. - -Note that most of the options in fdisk are the same in gdisk. For that reason, we will not go into detail about them, but here’s a screenshot of the process. - -![gdisk Command Options](http://www.tecmint.com/wp-content/uploads/2014/10/gdisk-options.png) - -gdisk Command Options - -### Formatting Filesystems ### - -Once we have created all the necessary partitions, we must create filesystems. To find out the list of filesystems supported in your system, run. - - # ls /sbin/mk* - -![Check Filesystems Type in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Check-Filesystems.png) - -Check Filesystems Type - -The type of filesystem that you should choose depends on your requirements. You should consider the pros and cons of each filesystem and its own set of features. Two important attributes to look for in a filesystem are. - -- Journaling support, which allows for faster data recovery in the event of a system crash. -- Security Enhanced Linux (SELinux) support, as per the project wiki, “a security enhancement to Linux which allows users and administrators more control over access control”. - -In our next example, we will create an ext4 filesystem (supports both journaling and SELinux) labeled Tecmint on /dev/sdb1, using mkfs, whose basic syntax is. - - # mkfs -t [filesystem] -L [label] device - or - # mkfs.[filesystem] -L [label] device - -![Create ext4 Filesystems in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-ext4-Filesystems.png) - -Create ext4 Filesystems - -### Creating and Using Swap Partitions ### - -Swap partitions are necessary if we need our Linux system to have access to virtual memory, which is a section of the hard disk designated for use as memory, when the main system memory (RAM) is all in use. For that reason, a swap partition may not be needed on systems with enough RAM to meet all its requirements; however, even in that case it’s up to the system administrator to decide whether to use a swap partition or not. - -A simple rule of thumb to decide the size of a swap partition is as follows. - -Swap should usually equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB. - -So, if: - -M = Amount of RAM in GB, and S = Amount of swap in GB, then - - If M < 2 - S = M *2 - Else - S = M + 2 - -Remember this is just a formula and that only you, as a sysadmin, have the final word as to the use and size of a swap partition. - -To configure a swap partition, create a regular partition as demonstrated earlier with the desired size. Next, we need to add the following entry to the /etc/fstab file (X can be either b or c). - - /dev/sdX1 swap swap sw 0 0 - -Finally, let’s format and enable the swap partition. - - # mkswap /dev/sdX1 - # swapon -v /dev/sdX1 - -To display a snapshot of the swap partition(s). - - # cat /proc/swaps - -To disable the swap partition. - - # swapoff /dev/sdX1 - -For the next example, we’ll use /dev/sdc1 (=512 MB, for a system with 256 MB of RAM) to set up a partition with fdisk that we will use as swap, following the steps detailed above. Note that we will specify a fixed size in this case. - -![Create-Swap-Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-Swap-Partition.png) - -Create Swap Partition - -![Add Swap Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Enable-Swap-Partition.png) - -Enable Swap Partition - -### Conclusion ### - -Creating partitions (including swap) and formatting filesystems are crucial in your road to Sysadminship. I hope that the tips given in this article will guide you to achieve your goals. Feel free to add your own tips & ideas in the comments section below, for the benefit of the community. -Reference Links - -- [About the LFCS][1] -- [Why get a Linux Foundation Certification?][2] -- [Register for the LFCS exam][3] - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/create-partitions-and-filesystems-in-linux/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:https://training.linuxfoundation.org/certification/LFCS -[2]:https://training.linuxfoundation.org/certification/why-certify-with-us -[3]:https://identity.linuxfoundation.org/user?destination=pid/1 \ No newline at end of file diff --git a/sources/tech/LFCS/Part 5 - LFCS--How to Mount or Unmount Local and Network Samba and NFS Filesystems in Linux.md b/sources/tech/LFCS/Part 5 - LFCS--How to Mount or Unmount Local and Network Samba and NFS Filesystems in Linux.md deleted file mode 100644 index 4316e32c16..0000000000 --- a/sources/tech/LFCS/Part 5 - LFCS--How to Mount or Unmount Local and Network Samba and NFS Filesystems in Linux.md +++ /dev/null @@ -1,234 +0,0 @@ -Translating by Xuanwo - -Part 5 - LFCS: How to Mount/Unmount Local and Network (Samba & NFS) Filesystems in Linux -================================================================================ -The Linux Foundation launched the LFCS certification (Linux Foundation Certified Sysadmin), a brand new program whose purpose is allowing individuals from all corners of the globe to get certified in basic to intermediate system administration tasks for Linux systems, which includes supporting running systems and services, along with overall monitoring and analysis, plus smart decision-making when it comes to raising issues to upper support teams. - -![Linux Foundation Certified Sysadmin – Part 5](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-5.png) - -Linux Foundation Certified Sysadmin – Part 5 - -The following video shows an introduction to The Linux Foundation Certification Program. - -注:youtube 视频 - - -This post is Part 5 of a 10-tutorial series, here in this part, we will explain How to mount/unmount local and network filesystems in linux, that are required for the LFCS certification exam. - -### Mounting Filesystems ### - -Once a disk has been partitioned, Linux needs some way to access the data on the partitions. Unlike DOS or Windows (where this is done by assigning a drive letter to each partition), Linux uses a unified directory tree where each partition is mounted at a mount point in that tree. - -A mount point is a directory that is used as a way to access the filesystem on the partition, and mounting the filesystem is the process of associating a certain filesystem (a partition, for example) with a specific directory in the directory tree. - -In other words, the first step in managing a storage device is attaching the device to the file system tree. This task can be accomplished on a one-time basis by using tools such as mount (and then unmounted with umount) or persistently across reboots by editing the /etc/fstab file. - -The mount command (without any options or arguments) shows the currently mounted filesystems. - - # mount - -![Check Mounted Filesystem in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/check-mounted-filesystems.png) - -Check Mounted Filesystem - -In addition, mount is used to mount filesystems into the filesystem tree. Its standard syntax is as follows. - - # mount -t type device dir -o options - -This command instructs the kernel to mount the filesystem found on device (a partition, for example, that has been formatted with a filesystem type) at the directory dir, using all options. In this form, mount does not look in /etc/fstab for instructions. - -If only a directory or device is specified, for example. - - # mount /dir -o options - or - # mount device -o options - -mount tries to find a mount point and if it can’t find any, then searches for a device (both cases in the /etc/fstab file), and finally attempts to complete the mount operation (which usually succeeds, except for the case when either the directory or the device is already being used, or when the user invoking mount is not root). - -You will notice that every line in the output of mount has the following format. - - device on directory type (options) - -For example, - - /dev/mapper/debian-home on /home type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered) - -Reads: - -dev/mapper/debian-home is mounted on /home, which has been formatted as ext4, with the following options: rw,relatime,user_xattr,barrier=1,data=ordered - -**Mount Options** - -Most frequently used mount options include. - -- async: allows asynchronous I/O operations on the file system being mounted. -- auto: marks the file system as enabled to be mounted automatically using mount -a. It is the opposite of noauto. -- defaults: this option is an alias for async,auto,dev,exec,nouser,rw,suid. Note that multiple options must be separated by a comma without any spaces. If by accident you type a space between options, mount will interpret the subsequent text string as another argument. -- loop: Mounts an image (an .iso file, for example) as a loop device. This option can be used to simulate the presence of the disk’s contents in an optical media reader. -- noexec: prevents the execution of executable files on the particular filesystem. It is the opposite of exec. -- nouser: prevents any users (other than root) to mount and unmount the filesystem. It is the opposite of user. -- remount: mounts the filesystem again in case it is already mounted. -- ro: mounts the filesystem as read only. -- rw: mounts the file system with read and write capabilities. -- relatime: makes access time to files be updated only if atime is earlier than mtime. -- user_xattr: allow users to set and remote extended filesystem attributes. - -**Mounting a device with ro and noexec options** - - # mount -t ext4 /dev/sdg1 /mnt -o ro,noexec - -In this case we can see that attempts to write a file to or to run a binary file located inside our mounting point fail with corresponding error messages. - - # touch /mnt/myfile - # /mnt/bin/echo “Hi there” - -![Mount Device in Read Write Mode](http://www.tecmint.com/wp-content/uploads/2014/10/Mount-Device-Read-Write.png) - -Mount Device Read Write - -**Mounting a device with default options** - -In the following scenario, we will try to write a file to our newly mounted device and run an executable file located within its filesystem tree using the same commands as in the previous example. - - # mount -t ext4 /dev/sdg1 /mnt -o defaults - -![Mount Device in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Mount-Device.png) - -Mount Device - -In this last case, it works perfectly. - -### Unmounting Devices ### - -Unmounting a device (with the umount command) means finish writing all the remaining “on transit” data so that it can be safely removed. Note that if you try to remove a mounted device without properly unmounting it first, you run the risk of damaging the device itself or cause data loss. - -That being said, in order to unmount a device, you must be “standing outside” its block device descriptor or mount point. In other words, your current working directory must be something else other than the mounting point. Otherwise, you will get a message saying that the device is busy. - -![Unmount Device in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Unmount-Device.png) - -Unmount Device - -An easy way to “leave” the mounting point is typing the cd command which, in lack of arguments, will take us to our current user’s home directory, as shown above. - -### Mounting Common Networked Filesystems ### - -The two most frequently used network file systems are SMB (which stands for “Server Message Block”) and NFS (“Network File System”). Chances are you will use NFS if you need to set up a share for Unix-like clients only, and will opt for Samba if you need to share files with Windows-based clients and perhaps other Unix-like clients as well. - -Read Also - -- [Setup Samba Server in RHEL/CentOS and Fedora][1] -- [Setting up NFS (Network File System) on RHEL/CentOS/Fedora and Debian/Ubuntu][2] - -The following steps assume that Samba and NFS shares have already been set up in the server with IP 192.168.0.10 (please note that setting up a NFS share is one of the competencies required for the LFCE exam, which we will cover after the present series). - -#### Mounting a Samba share on Linux #### - -Step 1: Install the samba-client samba-common and cifs-utils packages on Red Hat and Debian based distributions. - - # yum update && yum install samba-client samba-common cifs-utils - # aptitude update && aptitude install samba-client samba-common cifs-utils - -Then run the following command to look for available samba shares in the server. - - # smbclient -L 192.168.0.10 - -And enter the password for the root account in the remote machine. - -![Mount Samba Share in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Mount-Samba-Share.png) - -Mount Samba Share - -In the above image we have highlighted the share that is ready for mounting on our local system. You will need a valid samba username and password on the remote server in order to access it. - -Step 2: When mounting a password-protected network share, it is not a good idea to write your credentials in the /etc/fstab file. Instead, you can store them in a hidden file somewhere with permissions set to 600, like so. - - # mkdir /media/samba - # echo “username=samba_username” > /media/samba/.smbcredentials - # echo “password=samba_password” >> /media/samba/.smbcredentials - # chmod 600 /media/samba/.smbcredentials - -Step 3: Then add the following line to /etc/fstab file. - - # //192.168.0.10/gacanepa /media/samba cifs credentials=/media/samba/.smbcredentials,defaults 0 0 - -Step 4: You can now mount your samba share, either manually (mount //192.168.0.10/gacanepa) or by rebooting your machine so as to apply the changes made in /etc/fstab permanently. - -![Mount Password Protect Samba Share](http://www.tecmint.com/wp-content/uploads/2014/10/Mount-Password-Protect-Samba-Share.png) - -Mount Password Protect Samba Share - -#### Mounting a NFS share on Linux #### - -Step 1: Install the nfs-common and portmap packages on Red Hat and Debian based distributions. - - # yum update && yum install nfs-utils nfs-utils-lib - # aptitude update && aptitude install nfs-common - -Step 2: Create a mounting point for the NFS share. - - # mkdir /media/nfs - -Step 3: Add the following line to /etc/fstab file. - -192.168.0.10:/NFS-SHARE /media/nfs nfs defaults 0 0 - -Step 4: You can now mount your nfs share, either manually (mount 192.168.0.10:/NFS-SHARE) or by rebooting your machine so as to apply the changes made in /etc/fstab permanently. - -![Mount NFS Share in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Mount-NFS-Share.png) - -Mount NFS Share - -### Mounting Filesystems Permanently ### - -As shown in the previous two examples, the /etc/fstab file controls how Linux provides access to disk partitions and removable media devices and consists of a series of lines that contain six fields each; the fields are separated by one or more spaces or tabs. A line that begins with a hash mark (#) is a comment and is ignored. - -Each line has the following format. - - - -Where: - -- : The first column specifies the mount device. Most distributions now specify partitions by their labels or UUIDs. This practice can help reduce problems if partition numbers change. -- : The second column specifies the mount point. -- : The file system type code is the same as the type code used to mount a filesystem with the mount command. A file system type code of auto lets the kernel auto-detect the filesystem type, which can be a convenient option for removable media devices. Note that this option may not be available for all filesystems out there. -- : One (or more) mount option(s). -- : You will most likely leave this to 0 (otherwise set it to 1) to disable the dump utility to backup the filesystem upon boot (The dump program was once a common backup tool, but it is much less popular today.) -- : This column specifies whether the integrity of the filesystem should be checked at boot time with fsck. A 0 means that fsck should not check a filesystem. The higher the number, the lowest the priority. Thus, the root partition will most likely have a value of 1, while all others that should be checked should have a value of 2. - -**Mount Examples** - -1. To mount a partition with label TECMINT at boot time with rw and noexec attributes, you should add the following line in /etc/fstab file. - - LABEL=TECMINT /mnt ext4 rw,noexec 0 0 - -2. If you want the contents of a disk in your DVD drive be available at boot time. - - /dev/sr0 /media/cdrom0 iso9660 ro,user,noauto 0 0 - -Where /dev/sr0 is your DVD drive. - -### Summary ### - -You can rest assured that mounting and unmounting local and network filesystems from the command line will be part of your day-to-day responsibilities as sysadmin. You will also need to master /etc/fstab. I hope that you have found this article useful to help you with those tasks. Feel free to add your comments (or ask questions) below and to share this article through your network social profiles. -Reference Links - -- [About the LFCS][3] -- [Why get a Linux Foundation Certification?][4] -- [Register for the LFCS exam][5] - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/mount-filesystem-in-linux/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/setup-samba-server-using-tdbsam-backend-on-rhel-centos-6-3-5-8-and-fedora-17-12/ -[2]:http://www.tecmint.com/how-to-setup-nfs-server-in-linux/ -[3]:https://training.linuxfoundation.org/certification/LFCS -[4]:https://training.linuxfoundation.org/certification/why-certify-with-us -[5]:https://identity.linuxfoundation.org/user?destination=pid/1 \ No newline at end of file diff --git a/sources/tech/LFCS/Part 6 - LFCS--Assembling Partitions as RAID Devices – Creating & Managing System Backups.md b/sources/tech/LFCS/Part 6 - LFCS--Assembling Partitions as RAID Devices – Creating & Managing System Backups.md deleted file mode 100644 index 901fb7b4f1..0000000000 --- a/sources/tech/LFCS/Part 6 - LFCS--Assembling Partitions as RAID Devices – Creating & Managing System Backups.md +++ /dev/null @@ -1,278 +0,0 @@ -Translating by Xuanwo - -Part 6 - LFCS: Assembling Partitions as RAID Devices – Creating & Managing System Backups -================================================================================ -Recently, the Linux Foundation launched the LFCS (Linux Foundation Certified Sysadmin) certification, a shiny chance for system administrators everywhere to demonstrate, through a performance-based exam, that they are capable of performing overall operational support on Linux systems: system support, first-level diagnosing and monitoring, plus issue escalation, when required, to other support teams. - -![Linux Foundation Certified Sysadmin – Part 6](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-6.png) - -Linux Foundation Certified Sysadmin – Part 6 - -The following video provides an introduction to The Linux Foundation Certification Program. - -注:youtube 视频 - - -This post is Part 6 of a 10-tutorial series, here in this part, we will explain How to Assemble Partitions as RAID Devices – Creating & Managing System Backups, that are required for the LFCS certification exam. - -### Understanding RAID ### - -The technology known as Redundant Array of Independent Disks (RAID) is a storage solution that combines multiple hard disks into a single logical unit to provide redundancy of data and/or improve performance in read / write operations to disk. - -However, the actual fault-tolerance and disk I/O performance lean on how the hard disks are set up to form the disk array. Depending on the available devices and the fault tolerance / performance needs, different RAID levels are defined. You can refer to the RAID series here in Tecmint.com for a more detailed explanation on each RAID level. - -- RAID Guide: [What is RAID, Concepts of RAID and RAID Levels Explained][1] - -Our tool of choice for creating, assembling, managing, and monitoring our software RAIDs is called mdadm (short for multiple disks admin). - - ---------------- Debian and Derivatives ---------------- - # aptitude update && aptitude install mdadm - ----------- - - ---------------- Red Hat and CentOS based Systems ---------------- - # yum update && yum install mdadm - ----------- - - ---------------- On openSUSE ---------------- - # zypper refresh && zypper install mdadm # - -#### Assembling Partitions as RAID Devices #### - -The process of assembling existing partitions as RAID devices consists of the following steps. - -**1. Create the array using mdadm** - -If one of the partitions has been formatted previously, or has been a part of another RAID array previously, you will be prompted to confirm the creation of the new array. Assuming you have taken the necessary precautions to avoid losing important data that may have resided in them, you can safely type y and press Enter. - - # mdadm --create --verbose /dev/md0 --level=stripe --raid-devices=2 /dev/sdb1 /dev/sdc1 - -![Creating RAID Array](http://www.tecmint.com/wp-content/uploads/2014/10/Creating-RAID-Array.png) - -Creating RAID Array - -**2. Check the array creation status** - -After creating RAID array, you an check the status of the array using the following commands. - - # cat /proc/mdstat - or - # mdadm --detail /dev/md0 [More detailed summary] - -![Check RAID Array Status](http://www.tecmint.com/wp-content/uploads/2014/10/Check-RAID-Array-Status.png) - -Check RAID Array Status - -**3. Format the RAID Device** - -Format the device with a filesystem as per your needs / requirements, as explained in [Part 4][2] of this series. - -**4. Monitor RAID Array Service** - -Instruct the monitoring service to “keep an eye” on the array. Add the output of mdadm –detail –scan to /etc/mdadm/mdadm.conf (Debian and derivatives) or /etc/mdadm.conf (CentOS / openSUSE), like so. - - # mdadm --detail --scan - -![Monitor RAID Array](http://www.tecmint.com/wp-content/uploads/2014/10/Monitor-RAID-Array.png) - -Monitor RAID Array - - # mdadm --assemble --scan [Assemble the array] - -To ensure the service starts on system boot, run the following commands as root. - -**Debian and Derivatives** - -Debian and derivatives, though it should start running on boot by default. - - # update-rc.d mdadm defaults - -Edit the /etc/default/mdadm file and add the following line. - - AUTOSTART=true - -**On CentOS and openSUSE (systemd-based)** - - # systemctl start mdmonitor - # systemctl enable mdmonitor - -**On CentOS and openSUSE (SysVinit-based)** - - # service mdmonitor start - # chkconfig mdmonitor on - -**5. Check RAID Disk Failure** - -In RAID levels that support redundancy, replace failed drives when needed. When a device in the disk array becomes faulty, a rebuild automatically starts only if there was a spare device added when we first created the array. - -![Check RAID Faulty Disk](http://www.tecmint.com/wp-content/uploads/2014/10/Check-RAID-Faulty-Disk.png) - -Check RAID Faulty Disk - -Otherwise, we need to manually attach an extra physical drive to our system and run. - - # mdadm /dev/md0 --add /dev/sdX1 - -Where /dev/md0 is the array that experienced the issue and /dev/sdX1 is the new device. - -**6. Disassemble a working array** - -You may have to do this if you need to create a new array using the devices – (Optional Step). - - # mdadm --stop /dev/md0 # Stop the array - # mdadm --remove /dev/md0 # Remove the RAID device - # mdadm --zero-superblock /dev/sdX1 # Overwrite the existing md superblock with zeroes - -**7. Set up mail alerts** - -You can configure a valid email address or system account to send alerts to (make sure you have this line in mdadm.conf). – (Optional Step) - - MAILADDR root - -In this case, all alerts that the RAID monitoring daemon collects will be sent to the local root account’s mail box. One of such alerts looks like the following. - -**Note**: This event is related to the example in STEP 5, where a device was marked as faulty and the spare device was automatically built into the array by mdadm. Thus, we “ran out” of healthy spare devices and we got the alert. - -![RAID Monitoring Alerts](http://www.tecmint.com/wp-content/uploads/2014/10/RAID-Monitoring-Alerts.png) - -RAID Monitoring Alerts - -#### Understanding RAID Levels #### - -**RAID 0** - -The total array size is n times the size of the smallest partition, where n is the number of independent disks in the array (you will need at least two drives). Run the following command to assemble a RAID 0 array using partitions /dev/sdb1 and /dev/sdc1. - - # mdadm --create --verbose /dev/md0 --level=stripe --raid-devices=2 /dev/sdb1 /dev/sdc1 - -Common uses: Setups that support real-time applications where performance is more important than fault-tolerance. - -**RAID 1 (aka Mirroring)** - -The total array size equals the size of the smallest partition (you will need at least two drives). Run the following command to assemble a RAID 1 array using partitions /dev/sdb1 and /dev/sdc1. - - # mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1 - -Common uses: Installation of the operating system or important subdirectories, such as /home. - -**RAID 5 (aka drives with Parity)** - -The total array size will be (n – 1) times the size of the smallest partition. The “lost” space in (n-1) is used for parity (redundancy) calculation (you will need at least three drives). - -Note that you can specify a spare device (/dev/sde1 in this case) to replace a faulty part when an issue occurs. Run the following command to assemble a RAID 5 array using partitions /dev/sdb1, /dev/sdc1, /dev/sdd1, and /dev/sde1 as spare. - - # mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 --spare-devices=1 /dev/sde1 - -Common uses: Web and file servers. - -**RAID 6 (aka drives with double Parity** - -The total array size will be (n*s)-2*s, where n is the number of independent disks in the array and s is the size of the smallest disk. Note that you can specify a spare device (/dev/sdf1 in this case) to replace a faulty part when an issue occurs. - -Run the following command to assemble a RAID 6 array using partitions /dev/sdb1, /dev/sdc1, /dev/sdd1, /dev/sde1, and /dev/sdf1 as spare. - - # mdadm --create --verbose /dev/md0 --level=6 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde --spare-devices=1 /dev/sdf1 - -Common uses: File and backup servers with large capacity and high availability requirements. - -**RAID 1+0 (aka stripe of mirrors)** - -The total array size is computed based on the formulas for RAID 0 and RAID 1, since RAID 1+0 is a combination of both. First, calculate the size of each mirror and then the size of the stripe. - -Note that you can specify a spare device (/dev/sdf1 in this case) to replace a faulty part when an issue occurs. Run the following command to assemble a RAID 1+0 array using partitions /dev/sdb1, /dev/sdc1, /dev/sdd1, /dev/sde1, and /dev/sdf1 as spare. - - # mdadm --create --verbose /dev/md0 --level=10 --raid-devices=4 /dev/sd[b-e]1 --spare-devices=1 /dev/sdf1 - -Common uses: Database and application servers that require fast I/O operations. - -#### Creating and Managing System Backups #### - -It never hurts to remember that RAID with all its bounties IS NOT A REPLACEMENT FOR BACKUPS! Write it 1000 times on the chalkboard if you need to, but make sure you keep that idea in mind at all times. Before we begin, we must note that there is no one-size-fits-all solution for system backups, but here are some things that you do need to take into account while planning a backup strategy. - -- What do you use your system for? (Desktop or server? If the latter case applies, what are the most critical services – whose configuration would be a real pain to lose?) -- How often do you need to take backups of your system? -- What is the data (e.g. files / directories / database dumps) that you want to backup? You may also want to consider if you really need to backup huge files (such as audio or video files). -- Where (meaning physical place and media) will those backups be stored? - -**Backing Up Your Data** - -Method 1: Backup entire drives with dd command. You can either back up an entire hard disk or a partition by creating an exact image at any point in time. Note that this works best when the device is offline, meaning it’s not mounted and there are no processes accessing it for I/O operations. - -The downside of this backup approach is that the image will have the same size as the disk or partition, even when the actual data occupies a small percentage of it. For example, if you want to image a partition of 20 GB that is only 10% full, the image file will still be 20 GB in size. In other words, it’s not only the actual data that gets backed up, but the entire partition itself. You may consider using this method if you need exact backups of your devices. - -**Creating an image file out of an existing device** - - # dd if=/dev/sda of=/system_images/sda.img - OR - --------------------- Alternatively, you can compress the image file --------------------- - # dd if=/dev/sda | gzip -c > /system_images/sda.img.gz - -**Restoring the backup from the image file** - - # dd if=/system_images/sda.img of=/dev/sda - OR - - --------------------- Depending on your choice while creating the image --------------------- - gzip -dc /system_images/sda.img.gz | dd of=/dev/sda - -Method 2: Backup certain files / directories with tar command – already covered in [Part 3][3] of this series. You may consider using this method if you need to keep copies of specific files and directories (configuration files, users’ home directories, and so on). - -Method 3: Synchronize files with rsync command. Rsync is a versatile remote (and local) file-copying tool. If you need to backup and synchronize your files to/from network drives, rsync is a go. - -Whether you’re synchronizing two local directories or local < — > remote directories mounted on the local filesystem, the basic syntax is the same. -Synchronizing two local directories or local < — > remote directories mounted on the local filesystem - - # rsync -av source_directory destination directory - -Where, -a recurse into subdirectories (if they exist), preserve symbolic links, timestamps, permissions, and original owner / group and -v verbose. - -![rsync Synchronizing Files](http://www.tecmint.com/wp-content/uploads/2014/10/rsync-synchronizing-Files.png) - -rsync Synchronizing Files - -In addition, if you want to increase the security of the data transfer over the wire, you can use ssh over rsync. - -**Synchronizing local → remote directories over ssh** - - # rsync -avzhe ssh backups root@remote_host:/remote_directory/ - -This example will synchronize the backups directory on the local host with the contents of /root/remote_directory on the remote host. - -Where the -h option shows file sizes in human-readable format, and the -e flag is used to indicate a ssh connection. - -![rsync Synchronize Remote Files](http://www.tecmint.com/wp-content/uploads/2014/10/rsync-synchronize-Remote-Files.png) - -rsync Synchronize Remote Files - -Synchronizing remote → local directories over ssh. - -In this case, switch the source and destination directories from the previous example. - - # rsync -avzhe ssh root@remote_host:/remote_directory/ backups - -Please note that these are only 3 examples (most frequent cases you’re likely to run into) of the use of rsync. For more examples and usages of rsync commands can be found at the following article. - -- Read Also: [10 rsync Commands to Sync Files in Linux][4] - -### Summary ### - -As a sysadmin, you need to ensure that your systems perform as good as possible. If you’re well prepared, and if the integrity of your data is well supported by a storage technology such as RAID and regular system backups, you’ll be safe. - -If you have questions, comments, or further ideas on how this article can be improved, feel free to speak out below. In addition, please consider sharing this series through your social network profiles. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/creating-and-managing-raid-backups-in-linux/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/understanding-raid-setup-in-linux/ -[2]:http://www.tecmint.com/create-partitions-and-filesystems-in-linux/ -[3]:http://www.tecmint.com/compress-files-and-finding-files-in-linux/ -[4]:http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/ \ No newline at end of file diff --git a/sources/tech/LFCS/Part 7 - LFCS--Managing System Startup Process and Services SysVinit Systemd and Upstart.md b/sources/tech/LFCS/Part 7 - LFCS--Managing System Startup Process and Services SysVinit Systemd and Upstart.md deleted file mode 100644 index 4b7cdf9fe2..0000000000 --- a/sources/tech/LFCS/Part 7 - LFCS--Managing System Startup Process and Services SysVinit Systemd and Upstart.md +++ /dev/null @@ -1,369 +0,0 @@ -Translating by Xuanwo - -Part 7 - LFCS: Managing System Startup Process and Services (SysVinit, Systemd and Upstart) -================================================================================ -A couple of months ago, the Linux Foundation announced the LFCS (Linux Foundation Certified Sysadmin) certification, an exciting new program whose aim is allowing individuals from all ends of the world to get certified in performing basic to intermediate system administration tasks on Linux systems. This includes supporting already running systems and services, along with first-hand problem-finding and analysis, plus the ability to decide when to raise issues to engineering teams. - -![Linux Foundation Certified Sysadmin – Part 7](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-7.png) - -Linux Foundation Certified Sysadmin – Part 7 - -The following video describes an brief introduction to The Linux Foundation Certification Program. - -注:youtube 视频 - - -This post is Part 7 of a 10-tutorial series, here in this part, we will explain how to Manage Linux System Startup Process and Services, that are required for the LFCS certification exam. - -### Managing the Linux Startup Process ### - -The boot process of a Linux system consists of several phases, each represented by a different component. The following diagram briefly summarizes the boot process and shows all the main components involved. - -![Linux Boot Process](http://www.tecmint.com/wp-content/uploads/2014/10/Linux-Boot-Process.png) - -Linux Boot Process - -When you press the Power button on your machine, the firmware that is stored in a EEPROM chip in the motherboard initializes the POST (Power-On Self Test) to check on the state of the system’s hardware resources. When the POST is finished, the firmware then searches and loads the 1st stage boot loader, located in the MBR or in the EFI partition of the first available disk, and gives control to it. - -#### MBR Method #### - -The MBR is located in the first sector of the disk marked as bootable in the BIOS settings and is 512 bytes in size. - -- First 446 bytes: The bootloader contains both executable code and error message text. -- Next 64 bytes: The Partition table contains a record for each of four partitions (primary or extended). Among other things, each record indicates the status (active / not active), size, and start / end sectors of each partition. -- Last 2 bytes: The magic number serves as a validation check of the MBR. - -The following command performs a backup of the MBR (in this example, /dev/sda is the first hard disk). The resulting file, mbr.bkp can come in handy should the partition table become corrupt, for example, rendering the system unbootable. - -Of course, in order to use it later if the need arises, we will need to save it and store it somewhere else (like a USB drive, for example). That file will help us restore the MBR and will get us going once again if and only if we do not change the hard drive layout in the meanwhile. - -**Backup MBR** - - # dd if=/dev/sda of=mbr.bkp bs=512 count=1 - -![Backup MBR in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Backup-MBR-in-Linux.png) - -Backup MBR in Linux - -**Restoring MBR** - - # dd if=mbr.bkp of=/dev/sda bs=512 count=1 - -![Restore MBR in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Restore-MBR-in-Linux.png) - -Restore MBR in Linux - -#### EFI/UEFI Method #### - -For systems using the EFI/UEFI method, the UEFI firmware reads its settings to determine which UEFI application is to be launched and from where (i.e., in which disk and partition the EFI partition is located). - -Next, the 2nd stage boot loader (aka boot manager) is loaded and run. GRUB [GRand Unified Boot] is the most frequently used boot manager in Linux. One of two distinct versions can be found on most systems used today. - -- GRUB legacy configuration file: /boot/grub/menu.lst (older distributions, not supported by EFI/UEFI firmwares). -- GRUB2 configuration file: most likely, /etc/default/grub. - -Although the objectives of the LFCS exam do not explicitly request knowledge about GRUB internals, if you’re brave and can afford to mess up your system (you may want to try it first on a virtual machine, just in case), you need to run. - - # update-grub - -As root after modifying GRUB’s configuration in order to apply the changes. - -Basically, GRUB loads the default kernel and the initrd or initramfs image. In few words, initrd or initramfs help to perform the hardware detection, the kernel module loading and the device discovery necessary to get the real root filesystem mounted. - -Once the real root filesystem is up, the kernel executes the system and service manager (init or systemd, whose process identification or PID is always 1) to begin the normal user-space boot process in order to present a user interface. - -Both init and systemd are daemons (background processes) that manage other daemons, as the first service to start (during boot) and the last service to terminate (during shutdown). - -![Systemd and Init](http://www.tecmint.com/wp-content/uploads/2014/10/systemd-and-init.png) - -Systemd and Init - -### Starting Services (SysVinit) ### - -The concept of runlevels in Linux specifies different ways to use a system by controlling which services are running. In other words, a runlevel controls what tasks can be accomplished in the current execution state = runlevel (and which ones cannot). - -Traditionally, this startup process was performed based on conventions that originated with System V UNIX, with the system passing executing collections of scripts that start and stop services as the machine entered a specific runlevel (which, in other words, is a different mode of running the system). - -Within each runlevel, individual services can be set to run, or to be shut down if running. Latest versions of some major distributions are moving away from the System V standard in favour of a rather new service and system manager called systemd (which stands for system daemon), but usually support sysv commands for compatibility purposes. This means that you can run most of the well-known sysv init tools in a systemd-based distribution. - -- Read Also: [Why ‘systemd’ replaces ‘init’ in Linux][1] - -Besides starting the system process, init looks to the /etc/inittab file to decide what runlevel must be entered. - -注:表格 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Runlevel Description
0 Halt the system. Runlevel 0 is a special transitional state used to shutdown the system quickly.
1 Also aliased to s, or S, this runlevel is sometimes called maintenance mode. What services, if any, are started at this runlevel varies by distribution. It’s typically used for low-level system maintenance that may be impaired by normal system operation.
2 Multiuser. On Debian systems and derivatives, this is the default runlevel, and includes -if available- a graphical login. On Red-Hat based systems, this is multiuser mode without networking.
3 On Red-Hat based systems, this is the default multiuser mode, which runs everything except the graphical environment. This runlevel and levels 4 and 5 usually are not used on Debian-based systems.
4 Typically unused by default and therefore available for customization.
5 On Red-Hat based systems, full multiuser mode with GUI login. This runlevel is like level 3, but with a GUI login available.
6 Reboot the system.
- -To switch between runlevels, we can simply issue a runlevel change using the init command: init N (where N is one of the runlevels listed above). Please note that this is not the recommended way of taking a running system to a different runlevel because it gives no warning to existing logged-in users (thus causing them to lose work and processes to terminate abnormally). - -Instead, the shutdown command should be used to restart the system (which first sends a warning message to all logged-in users and blocks any further logins; it then signals init to switch runlevels); however, the default runlevel (the one the system will boot to) must be edited in the /etc/inittab file first. - -For that reason, follow these steps to properly switch between runlevels, As root, look for the following line in /etc/inittab. - - id:2:initdefault: - -and change the number 2 for the desired runlevel with your preferred text editor, such as vim (described in [How to use vi/vim editor in Linux – Part 2][2] of this series). - -Next, run as root. - - # shutdown -r now - -That last command will restart the system, causing it to start in the specified runlevel during next boot, and will run the scripts located in the /etc/rc[runlevel].d directory in order to decide which services should be started and which ones should not. For example, for runlevel 2 in the following system. - -![Change Runlevels in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Change-Runlevels-in-Linux.jpeg) - -Change Runlevels in Linux - -#### Manage Services using chkconfig #### - -To enable or disable system services on boot, we will use [chkconfig command][3] in CentOS / openSUSE and sysv-rc-conf in Debian and derivatives. This tool can also show us what is the preconfigured state of a service for a particular runlevel. - -- Read Also: [How to Stop and Disable Unwanted Services in Linux][4] - -Listing the runlevel configuration for a service. - - # chkconfig --list [service name] - # chkconfig --list postfix - # chkconfig --list mysqld - -![Listing Runlevel Configuration](http://www.tecmint.com/wp-content/uploads/2014/10/Listing-Runlevel-Configuration.png) - -Listing Runlevel Configuration - -In the above image we can see that postfix is set to start when the system enters runlevels 2 through 5, whereas mysqld will be running by default for runlevels 2 through 4. Now suppose that this is not the expected behaviour. - -For example, we need to turn on mysqld for runlevel 5 as well, and turn off postfix for runlevels 4 and 5. Here’s what we would do in each case (run the following commands as root). - -**Enabling a service for a particular runlevel** - - # chkconfig --level [level(s)] service on - # chkconfig --level 5 mysqld on - -**Disabling a service for particular runlevels** - - # chkconfig --level [level(s)] service off - # chkconfig --level 45 postfix off - -![Enable Disable Services in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Enable-Disable-Services.png) - -Enable Disable Services - -We will now perform similar tasks in a Debian-based system using sysv-rc-conf. - -#### Manage Services using sysv-rc-conf #### - -Configuring a service to start automatically on a specific runlevel and prevent it from starting on all others. - -1. Let’s use the following command to see what are the runlevels where mdadm is configured to start. - - # ls -l /etc/rc[0-6].d | grep -E 'rc[0-6]|mdadm' - -![Check Runlevel of Service Running](http://www.tecmint.com/wp-content/uploads/2014/10/Check-Service-Runlevel.png) - -Check Runlevel of Service Running - -2. We will use sysv-rc-conf to prevent mdadm from starting on all runlevels except 2. Just check or uncheck (with the space bar) as desired (you can move up, down, left, and right with the arrow keys). - - # sysv-rc-conf - -![SysV Runlevel Config](http://www.tecmint.com/wp-content/uploads/2014/10/SysV-Runlevel-Config.png) - -SysV Runlevel Config - -Then press q to quit. - -3. We will restart the system and run again the command from STEP 1. - - # ls -l /etc/rc[0-6].d | grep -E 'rc[0-6]|mdadm' - -![Verify Service Runlevel](http://www.tecmint.com/wp-content/uploads/2014/10/Verify-Service-Runlevel.png) - -Verify Service Runlevel - -In the above image we can see that mdadm is configured to start only on runlevel 2. - -### What About systemd? ### - -systemd is another service and system manager that is being adopted by several major Linux distributions. It aims to allow more processing to be done in parallel during system startup (unlike sysvinit, which always tends to be slower because it starts processes one at a time, checks whether one depends on another, and waits for daemons to launch so more services can start), and to serve as a dynamic resource management to a running system. - -Thus, services are started when needed (to avoid consuming system resources) instead of being launched without a solid reason during boot. - -Viewing the status of all the processes running on your system, both systemd native and SysV services, run the following command. - - # systemctl - -![Check All Running Processes in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Check-All-Running-Processes.png) - -Check All Running Processes - -The LOAD column shows whether the unit definition (refer to the UNIT column, which shows the service or anything maintained by systemd) was properly loaded, while the ACTIVE and SUB columns show the current status of such unit. -Displaying information about the current status of a service - -When the ACTIVE column indicates that an unit’s status is other than active, we can check what happened using. - - # systemctl status [unit] - -For example, in the image above, media-samba.mount is in failed state. Let’s run. - - # systemctl status media-samba.mount - -![Check Linux Service Status](http://www.tecmint.com/wp-content/uploads/2014/10/Check-Service-Status.png) - -Check Service Status - -We can see that media-samba.mount failed because the mount process on host dev1 was unable to find the network share at //192.168.0.10/gacanepa. - -### Starting or Stopping Services ### - -Once the network share //192.168.0.10/gacanepa becomes available, let’s try to start, then stop, and finally restart the unit media-samba.mount. After performing each action, let’s run systemctl status media-samba.mount to check on its status. - - # systemctl start media-samba.mount - # systemctl status media-samba.mount - # systemctl stop media-samba.mount - # systemctl restart media-samba.mount - # systemctl status media-samba.mount - -![Starting Stoping Services](http://www.tecmint.com/wp-content/uploads/2014/10/Starting-Stoping-Service.jpeg) - -Starting Stoping Services - -**Enabling or disabling a service to start during boot** - -Under systemd you can enable or disable a service when it boots. - - # systemctl enable [service] # enable a service - # systemctl disable [service] # prevent a service from starting at boot - -The process of enabling or disabling a service to start automatically on boot consists in adding or removing symbolic links in the /etc/systemd/system/multi-user.target.wants directory. - -![Enabling Disabling Services](http://www.tecmint.com/wp-content/uploads/2014/10/Enabling-Disabling-Services.jpeg) - -Enabling Disabling Services - -Alternatively, you can find out a service’s current status (enabled or disabled) with the command. - - # systemctl is-enabled [service] - -For example, - - # systemctl is-enabled postfix.service - -In addition, you can reboot or shutdown the system with. - - # systemctl reboot - # systemctl shutdown - -### Upstart ### - -Upstart is an event-based replacement for the /sbin/init daemon and was born out of the need for starting services only, when they are needed (also supervising them while they are running), and handling events as they occur, thus surpassing the classic, dependency-based sysvinit system. - -It was originally developed for the Ubuntu distribution, but is used in Red Hat Enterprise Linux 6.0. Though it was intended to be suitable for deployment in all Linux distributions as a replacement for sysvinit, in time it was overshadowed by systemd. On February 14, 2014, Mark Shuttleworth (founder of Canonical Ltd.) announced that future releases of Ubuntu would use systemd as the default init daemon. - -Because the SysV startup script for system has been so common for so long, a large number of software packages include SysV startup scripts. To accommodate such packages, Upstart provides a compatibility mode: It runs SysV startup scripts in the usual locations (/etc/rc.d/rc?.d, /etc/init.d/rc?.d, /etc/rc?.d, or a similar location). Thus, if we install a package that doesn’t yet include an Upstart configuration script, it should still launch in the usual way. - -Furthermore, if we have installed utilities such as [chkconfig][5], you should be able to use them to manage your SysV-based services just as we would on sysvinit based systems. - -Upstart scripts also support starting or stopping services based on a wider variety of actions than do SysV startup scripts; for example, Upstart can launch a service whenever a particular hardware device is attached. - -A system that uses Upstart and its native scripts exclusively replaces the /etc/inittab file and the runlevel-specific SysV startup script directories with .conf scripts in the /etc/init directory. - -These *.conf scripts (also known as job definitions) generally consists of the following: - -- Description of the process. -- Runlevels where the process should run or events that should trigger it. -- Runlevels where process should be stopped or events that should stop it. -- Options. -- Command to launch the process. - -For example, - - # My test service - Upstart script demo description "Here goes the description of 'My test service'" author "Dave Null " - # Stanzas - - # - # Stanzas define when and how a process is started and stopped - # See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas#respawn - # When to start the service - start on runlevel [2345] - # When to stop the service - stop on runlevel [016] - # Automatically restart process in case of crash - respawn - # Specify working directory - chdir /home/dave/myfiles - # Specify the process/command (add arguments if needed) to run - exec bash backup.sh arg1 arg2 - -To apply changes, you will need to tell upstart to reload its configuration. - - # initctl reload-configuration - -Then start your job by typing the following command. - - $ sudo start yourjobname - -Where yourjobname is the name of the job that was added earlier with the yourjobname.conf script. - -A more complete and detailed reference guide for Upstart is available in the project’s web site under the menu “[Cookbook][6]”. - -### Summary ### - -A knowledge of the Linux boot process is necessary to help you with troubleshooting tasks as well as with adapting the computer’s performance and running services to your needs. - -In this article we have analyzed what happens from the moment when you press the Power switch to turn on the machine until you get a fully operational user interface. I hope you have learned reading it as much as I did while putting it together. Feel free to leave your comments or questions below. We always look forward to hearing from our readers! - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/linux-boot-process-and-manage-services/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/systemd-replaces-init-in-linux/ -[2]:http://www.tecmint.com/vi-editor-usage/ -[3]:http://www.tecmint.com/chkconfig-command-examples/ -[4]:http://www.tecmint.com/remove-unwanted-services-from-linux/ -[5]:http://www.tecmint.com/chkconfig-command-examples/ -[6]:http://upstart.ubuntu.com/cookbook/ \ No newline at end of file diff --git a/sources/tech/LFCS/Part 8 - LFCS--Managing Users and Groups File Permissions and Attributes and Enabling sudo Access on Accounts.md b/sources/tech/LFCS/Part 8 - LFCS--Managing Users and Groups File Permissions and Attributes and Enabling sudo Access on Accounts.md deleted file mode 100644 index 50f39ee2d9..0000000000 --- a/sources/tech/LFCS/Part 8 - LFCS--Managing Users and Groups File Permissions and Attributes and Enabling sudo Access on Accounts.md +++ /dev/null @@ -1,332 +0,0 @@ -Translating by Xuanwo - -Part 8 - LFCS: Managing Users & Groups, File Permissions & Attributes and Enabling sudo Access on Accounts -================================================================================ -Last August, the Linux Foundation started the LFCS certification (Linux Foundation Certified Sysadmin), a brand new program whose purpose is to allow individuals everywhere and anywhere take an exam in order to get certified in basic to intermediate operational support for Linux systems, which includes supporting running systems and services, along with overall monitoring and analysis, plus intelligent decision-making to be able to decide when it’s necessary to escalate issues to higher level support teams. - -![Linux Users and Groups Management](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-8.png) - -Linux Foundation Certified Sysadmin – Part 8 - -Please have a quick look at the following video that describes an introduction to the Linux Foundation Certification Program. - -注:youtube视频 - - -This article is Part 8 of a 10-tutorial long series, here in this section, we will guide you on how to manage users and groups permissions in Linux system, that are required for the LFCS certification exam. - -Since Linux is a multi-user operating system (in that it allows multiple users on different computers or terminals to access a single system), you will need to know how to perform effective user management: how to add, edit, suspend, or delete user accounts, along with granting them the necessary permissions to do their assigned tasks. - -### Adding User Accounts ### - -To add a new user account, you can run either of the following two commands as root. - - # adduser [new_account] - # useradd [new_account] - -When a new user account is added to the system, the following operations are performed. - -1. His/her home directory is created (/home/username by default). - -2. The following hidden files are copied into the user’s home directory, and will be used to provide environment variables for his/her user session. - - .bash_logout - .bash_profile - .bashrc - -3. A mail spool is created for the user at /var/spool/mail/username. - -4. A group is created and given the same name as the new user account. - -**Understanding /etc/passwd** - -The full account information is stored in the /etc/passwd file. This file contains a record per system user account and has the following format (fields are delimited by a colon). - - [username]:[x]:[UID]:[GID]:[Comment]:[Home directory]:[Default shell] - -- Fields [username] and [Comment] are self explanatory. -- The x in the second field indicates that the account is protected by a shadowed password (in /etc/shadow), which is needed to logon as [username]. -- The [UID] and [GID] fields are integers that represent the User IDentification and the primary Group IDentification to which [username] belongs, respectively. -- The [Home directory] indicates the absolute path to [username]’s home directory, and -- The [Default shell] is the shell that will be made available to this user when he or she logins the system. - -**Understanding /etc/group** - -Group information is stored in the /etc/group file. Each record has the following format. - - [Group name]:[Group password]:[GID]:[Group members] - -- [Group name] is the name of group. -- An x in [Group password] indicates group passwords are not being used. -- [GID]: same as in /etc/passwd. -- [Group members]: a comma separated list of users who are members of [Group name]. - -![Add User Accounts in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/add-user-accounts.png) - -Add User Accounts - -After adding an account, you can edit the following information (to name a few fields) using the usermod command, whose basic syntax of usermod is as follows. - - # usermod [options] [username] - -**Setting the expiry date for an account** - -Use the –expiredate flag followed by a date in YYYY-MM-DD format. - - # usermod --expiredate 2014-10-30 tecmint - -**Adding the user to supplementary groups** - -Use the combined -aG, or –append –groups options, followed by a comma separated list of groups. - - # usermod --append --groups root,users tecmint - -**Changing the default location of the user’s home directory** - -Use the -d, or –home options, followed by the absolute path to the new home directory. - - # usermod --home /tmp tecmint - -**Changing the shell the user will use by default** - -Use –shell, followed by the path to the new shell. - - # usermod --shell /bin/sh tecmint - -**Displaying the groups an user is a member of** - - # groups tecmint - # id tecmint - -Now let’s execute all the above commands in one go. - - # usermod --expiredate 2014-10-30 --append --groups root,users --home /tmp --shell /bin/sh tecmint - -![usermod Command Examples](http://www.tecmint.com/wp-content/uploads/2014/10/usermod-command-examples.png) - -usermod Command Examples - -Read Also: - -- [15 useradd Command Examples in Linux][1] -- [15 usermod Command Examples in Linux][2] - -For existing accounts, we can also do the following. - -**Disabling account by locking password** - -Use the -L (uppercase L) or the –lock option to lock a user’s password. - - # usermod --lock tecmint - -**Unlocking user password** - -Use the –u or the –unlock option to unlock a user’s password that was previously blocked. - - # usermod --unlock tecmint - -![Lock User in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/lock-user-in-linux.png) - -Lock User Accounts - -**Creating a new group for read and write access to files that need to be accessed by several users** - -Run the following series of commands to achieve the goal. - - # groupadd common_group # Add a new group - # chown :common_group common.txt # Change the group owner of common.txt to common_group - # usermod -aG common_group user1 # Add user1 to common_group - # usermod -aG common_group user2 # Add user2 to common_group - # usermod -aG common_group user3 # Add user3 to common_group - -**Deleting a group** - -You can delete a group with the following command. - - # groupdel [group_name] - -If there are files owned by group_name, they will not be deleted, but the group owner will be set to the GID of the group that was deleted. - -### Linux File Permissions ### - -Besides the basic read, write, and execute permissions that we discussed in [Setting File Attributes – Part 3][3] of this series, there are other less used (but not less important) permission settings, sometimes referred to as “special permissions”. - -Like the basic permissions discussed earlier, they are set using an octal file or through a letter (symbolic notation) that indicates the type of permission. -Deleting user accounts - -You can delete an account (along with its home directory, if it’s owned by the user, and all the files residing therein, and also the mail spool) using the userdel command with the –remove option. - - # userdel --remove [username] - -#### Group Management #### - -Every time a new user account is added to the system, a group with the same name is created with the username as its only member. Other users can be added to the group later. One of the purposes of groups is to implement a simple access control to files and other system resources by setting the right permissions on those resources. - -For example, suppose you have the following users. - -- user1 (primary group: user1) -- user2 (primary group: user2) -- user3 (primary group: user3) - -All of them need read and write access to a file called common.txt located somewhere on your local system, or maybe on a network share that user1 has created. You may be tempted to do something like, - - # chmod 660 common.txt - OR - # chmod u=rw,g=rw,o= common.txt [notice the space between the last equal sign and the file name] - -However, this will only provide read and write access to the owner of the file and to those users who are members of the group owner of the file (user1 in this case). Again, you may be tempted to add user2 and user3 to group user1, but that will also give them access to the rest of the files owned by user user1 and group user1. - -This is where groups come in handy, and here’s what you should do in a case like this. - -**Understanding Setuid** - -When the setuid permission is applied to an executable file, an user running the program inherits the effective privileges of the program’s owner. Since this approach can reasonably raise security concerns, the number of files with setuid permission must be kept to a minimum. You will likely find programs with this permission set when a system user needs to access a file owned by root. - -Summing up, it isn’t just that the user can execute the binary file, but also that he can do so with root’s privileges. For example, let’s check the permissions of /bin/passwd. This binary is used to change the password of an account, and modifies the /etc/shadow file. The superuser can change anyone’s password, but all other users should only be able to change their own. - -![passwd Command Examples](http://www.tecmint.com/wp-content/uploads/2014/10/passwd-command.png) - -passwd Command Examples - -Thus, any user should have permission to run /bin/passwd, but only root will be able to specify an account. Other users can only change their corresponding passwords. - -![Change User Password in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/change-user-password.png) - -Change User Password - -**Understanding Setgid** - -When the setgid bit is set, the effective GID of the real user becomes that of the group owner. Thus, any user can access a file under the privileges granted to the group owner of such file. In addition, when the setgid bit is set on a directory, newly created files inherit the same group as the directory, and newly created subdirectories will also inherit the setgid bit of the parent directory. You will most likely use this approach whenever members of a certain group need access to all the files in a directory, regardless of the file owner’s primary group. - - # chmod g+s [filename] - -To set the setgid in octal form, prepend the number 2 to the current (or desired) basic permissions. - - # chmod 2755 [directory] - -**Setting the SETGID in a directory** - -![Add Setgid in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/add-setgid-to-directory.png) - -Add Setgid to Directory - -**Understanding Sticky Bit** - -When the “sticky bit” is set on files, Linux just ignores it, whereas for directories it has the effect of preventing users from deleting or even renaming the files it contains unless the user owns the directory, the file, or is root. - -# chmod o+t [directory] - -To set the sticky bit in octal form, prepend the number 1 to the current (or desired) basic permissions. - -# chmod 1755 [directory] - -Without the sticky bit, anyone able to write to the directory can delete or rename files. For that reason, the sticky bit is commonly found on directories, such as /tmp, that are world-writable. - -![Add Stickybit in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/add-sticky-bit-to-directory.png) - -Add Stickybit to Directory - -### Special Linux File Attributes ### - -There are other attributes that enable further limits on the operations that are allowed on files. For example, prevent the file from being renamed, moved, deleted, or even modified. They are set with the [chattr command][4] and can be viewed using the lsattr tool, as follows. - - # chattr +i file1 - # chattr +a file2 - -After executing those two commands, file1 will be immutable (which means it cannot be moved, renamed, modified or deleted) whereas file2 will enter append-only mode (can only be open in append mode for writing). - -![Protect File from Deletion](http://www.tecmint.com/wp-content/uploads/2014/10/chattr-command.png) - -Chattr Command to Protect Files - -### Accessing the root Account and Using sudo ### - -One of the ways users can gain access to the root account is by typing. - - $ su - -and then entering root’s password. - -If authentication succeeds, you will be logged on as root with the current working directory as the same as you were before. If you want to be placed in root’s home directory instead, run. - - $ su - - -and then enter root’s password. - -![Enable sudo Access on Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Enable-Sudo-Access.png) - -Enable Sudo Access on Users - -The above procedure requires that a normal user knows root’s password, which poses a serious security risk. For that reason, the sysadmin can configure the sudo command to allow an ordinary user to execute commands as a different user (usually the superuser) in a very controlled and limited way. Thus, restrictions can be set on a user so as to enable him to run one or more specific privileged commands and no others. - -- Read Also: [Difference Between su and sudo User][5] - -To authenticate using sudo, the user uses his/her own password. After entering the command, we will be prompted for our password (not the superuser’s) and if the authentication succeeds (and if the user has been granted privileges to run the command), the specified command is carried out. - -To grant access to sudo, the system administrator must edit the /etc/sudoers file. It is recommended that this file is edited using the visudo command instead of opening it directly with a text editor. - - # visudo - -This opens the /etc/sudoers file using vim (you can follow the instructions given in [Install and Use vim as Editor – Part 2][6] of this series to edit the file). - -These are the most relevant lines. - - Defaults secure_path="/usr/sbin:/usr/bin:/sbin" - root ALL=(ALL) ALL - tecmint ALL=/bin/yum update - gacanepa ALL=NOPASSWD:/bin/updatedb - %admin ALL=(ALL) ALL - -Let’s take a closer look at them. - - Defaults secure_path="/usr/sbin:/usr/bin:/sbin:/usr/local/bin" - -This line lets you specify the directories that will be used for sudo, and is used to prevent using user-specific directories, which can harm the system. - -The next lines are used to specify permissions. - - root ALL=(ALL) ALL - -- The first ALL keyword indicates that this rule applies to all hosts. -- The second ALL indicates that the user in the first column can run commands with the privileges of any user. -- The third ALL means any command can be run. - - tecmint ALL=/bin/yum update - -If no user is specified after the = sign, sudo assumes the root user. In this case, user tecmint will be able to run yum update as root. - - gacanepa ALL=NOPASSWD:/bin/updatedb - -The NOPASSWD directive allows user gacanepa to run /bin/updatedb without needing to enter his password. - - %admin ALL=(ALL) ALL - -The % sign indicates that this line applies to a group called “admin”. The meaning of the rest of the line is identical to that of an regular user. This means that members of the group “admin” can run all commands as any user on all hosts. - -To see what privileges are granted to you by sudo, use the “-l” option to list them. - -![Sudo Access Rules](http://www.tecmint.com/wp-content/uploads/2014/10/sudo-access-rules.png) - -Sudo Access Rules - -### Summary ### - -Effective user and file management skills are essential tools for any system administrator. In this article we have covered the basics and hope you can use it as a good starting to point to build upon. Feel free to leave your comments or questions below, and we’ll respond quickly. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/manage-users-and-groups-in-linux/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/add-users-in-linux/ -[2]:http://www.tecmint.com/usermod-command-examples/ -[3]:http://www.tecmint.com/compress-files-and-finding-files-in-linux/ -[4]:http://www.tecmint.com/chattr-command-examples/ -[5]:http://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/ -[6]:http://www.tecmint.com/vi-editor-usage/ \ No newline at end of file diff --git a/sources/tech/LFCS/Part 9 - LFCS--Linux Package Management with Yum RPM Apt Dpkg Aptitude and Zypper.md b/sources/tech/LFCS/Part 9 - LFCS--Linux Package Management with Yum RPM Apt Dpkg Aptitude and Zypper.md deleted file mode 100644 index a363a50c09..0000000000 --- a/sources/tech/LFCS/Part 9 - LFCS--Linux Package Management with Yum RPM Apt Dpkg Aptitude and Zypper.md +++ /dev/null @@ -1,231 +0,0 @@ -Translating by Xuanwo - -Part 9 - LFCS: Linux Package Management with Yum, RPM, Apt, Dpkg, Aptitude and Zypper -================================================================================ -Last August, the Linux Foundation announced the LFCS certification (Linux Foundation Certified Sysadmin), a shiny chance for system administrators everywhere to demonstrate, through a performance-based exam, that they are capable of succeeding at overall operational support for Linux systems. A Linux Foundation Certified Sysadmin has the expertise to ensure effective system support, first-level troubleshooting and monitoring, including finally issue escalation, when needed, to engineering support teams. - -![Linux Package Management](http://www.tecmint.com/wp-content/uploads/2014/11/lfcs-Part-9.png) - -Linux Foundation Certified Sysadmin – Part 9 - -Watch the following video that explains about the Linux Foundation Certification Program. - -注:youtube 视频 - - -This article is a Part 9 of 10-tutorial long series, today in this article we will guide you about Linux Package Management, that are required for the LFCS certification exam. - -### Package Management ### - -In few words, package management is a method of installing and maintaining (which includes updating and probably removing as well) software on the system. - -In the early days of Linux, programs were only distributed as source code, along with the required man pages, the necessary configuration files, and more. Nowadays, most Linux distributors use by default pre-built programs or sets of programs called packages, which are presented to users ready for installation on that distribution. However, one of the wonders of Linux is still the possibility to obtain source code of a program to be studied, improved, and compiled. - -**How package management systems work** - -If a certain package requires a certain resource such as a shared library, or another package, it is said to have a dependency. All modern package management systems provide some method of dependency resolution to ensure that when a package is installed, all of its dependencies are installed as well. - -**Packaging Systems** - -Almost all the software that is installed on a modern Linux system will be found on the Internet. It can either be provided by the distribution vendor through central repositories (which can contain several thousands of packages, each of which has been specifically built, tested, and maintained for the distribution) or be available in source code that can be downloaded and installed manually. - -Because different distribution families use different packaging systems (Debian: *.deb / CentOS: *.rpm / openSUSE: *.rpm built specially for openSUSE), a package intended for one distribution will not be compatible with another distribution. However, most distributions are likely to fall into one of the three distribution families covered by the LFCS certification. - -**High and low-level package tools** - -In order to perform the task of package management effectively, you need to be aware that you will have two types of available utilities: low-level tools (which handle in the backend the actual installation, upgrade, and removal of package files), and high-level tools (which are in charge of ensuring that the tasks of dependency resolution and metadata searching -”data about the data”- are performed). - -注:表格 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DISTRIBUTIONLOW-LEVEL TOOLHIGH-LEVEL TOOL
 Debian and derivatives dpkg apt-get / aptitude
 CentOS rpm yum
 openSUSE rpm zypper
- -Let us see the descrption of the low-level and high-level tools. - -dpkg is a low-level package manager for Debian-based systems. It can install, remove, provide information about and build *.deb packages but it can’t automatically download and install their corresponding dependencies. - -- Read More: [15 dpkg Command Examples][1] - -apt-get is a high-level package manager for Debian and derivatives, and provides a simple way to retrieve and install packages, including dependency resolution, from multiple sources using the command line. Unlike dpkg, apt-get does not work directly with *.deb files, but with the package proper name. - -- Read More: [25 apt-get Command Examples][2] - -aptitude is another high-level package manager for Debian-based systems, and can be used to perform management tasks (installing, upgrading, and removing packages, also handling dependency resolution automatically) in a fast and easy way. It provides the same functionality as apt-get and additional ones, such as offering access to several versions of a package. - -rpm is the package management system used by Linux Standard Base (LSB)-compliant distributions for low-level handling of packages. Just like dpkg, it can query, install, verify, upgrade, and remove packages, and is more frequently used by Fedora-based distributions, such as RHEL and CentOS. - -- Read More: [20 rpm Command Examples][3] - -yum adds the functionality of automatic updates and package management with dependency management to RPM-based systems. As a high-level tool, like apt-get or aptitude, yum works with repositories. - -- Read More: [20 yum Command Examples][4] -- -### Common Usage of Low-Level Tools ### - -The most frequent tasks that you will do with low level tools are as follows: - -**1. Installing a package from a compiled (*.deb or *.rpm) file** - -The downside of this installation method is that no dependency resolution is provided. You will most likely choose to install a package from a compiled file when such package is not available in the distribution’s repositories and therefore cannot be downloaded and installed through a high-level tool. Since low-level tools do not perform dependency resolution, they will exit with an error if we try to install a package with unmet dependencies. - - # dpkg -i file.deb [Debian and derivative] - # rpm -i file.rpm [CentOS / openSUSE] - -**Note**: Do not attempt to install on CentOS a *.rpm file that was built for openSUSE, or vice-versa! - -**2. Upgrading a package from a compiled file** - -Again, you will only upgrade an installed package manually when it is not available in the central repositories. - - # dpkg -i file.deb [Debian and derivative] - # rpm -U file.rpm [CentOS / openSUSE] - -**3. Listing installed packages** - -When you first get your hands on an already working system, chances are you’ll want to know what packages are installed. - - # dpkg -l [Debian and derivative] - # rpm -qa [CentOS / openSUSE] - -If you want to know whether a specific package is installed, you can pipe the output of the above commands to grep, as explained in [manipulate files in Linux – Part 1][6] of this series. Suppose we need to verify if package mysql-common is installed on an Ubuntu system. - - # dpkg -l | grep mysql-common - -![Check Installed Packages in Linux](http://www.tecmint.com/wp-content/uploads/2014/11/Check-Installed-Package.png) - -Check Installed Packages - -Another way to determine if a package is installed. - - # dpkg --status package_name [Debian and derivative] - # rpm -q package_name [CentOS / openSUSE] - -For example, let’s find out whether package sysdig is installed on our system. - - # rpm -qa | grep sysdig - -![Check sysdig Package](http://www.tecmint.com/wp-content/uploads/2014/11/Check-sysdig-Package.png) - -Check sysdig Package - -**4. Finding out which package installed a file** - - # dpkg --search file_name - # rpm -qf file_name - -For example, which package installed pw_dict.hwm? - - # rpm -qf /usr/share/cracklib/pw_dict.hwm - -![Query File in Linux](http://www.tecmint.com/wp-content/uploads/2014/11/Query-File-in-Linux.png) - -Query File in Linux - -### Common Usage of High-Level Tools ### - -The most frequent tasks that you will do with high level tools are as follows. - -**1. Searching for a package** - -aptitude update will update the list of available packages, and aptitude search will perform the actual search for package_name. - - # aptitude update && aptitude search package_name - -In the search all option, yum will search for package_name not only in package names, but also in package descriptions. - - # yum search package_name - # yum search all package_name - # yum whatprovides “*/package_name” - -Let’s supposed we need a file whose name is sysdig. To know that package we will have to install, let’s run. - - # yum whatprovides “*/sysdig” - -![Check Package Description in Linux](http://www.tecmint.com/wp-content/uploads/2014/11/Check-Package-Description.png) - -Check Package Description - -whatprovides tells yum to search the package the will provide a file that matches the above regular expression. - - # zypper refresh && zypper search package_name [On openSUSE] - -**2. Installing a package from a repository** - -While installing a package, you may be prompted to confirm the installation after the package manager has resolved all dependencies. Note that running update or refresh (according to the package manager being used) is not strictly necessary, but keeping installed packages up to date is a good sysadmin practice for security and dependency reasons. - - # aptitude update && aptitude install package_name [Debian and derivatives] - # yum update && yum install package_name [CentOS] - # zypper refresh && zypper install package_name [openSUSE] - -**3. Removing a package** - -The option remove will uninstall the package but leaving configuration files intact, whereas purge will erase every trace of the program from your system. -# aptitude remove / purge package_name -# yum erase package_name - - ---Notice the minus sign in front of the package that will be uninstalled, openSUSE --- - - # zypper remove -package_name - -Most (if not all) package managers will prompt you, by default, if you’re sure about proceeding with the uninstallation before actually performing it. So read the onscreen messages carefully to avoid running into unnecessary trouble! - -**4. Displaying information about a package** - -The following command will display information about the birthday package. - - # aptitude show birthday - # yum info birthday - # zypper info birthday - -![Check Package Information in Linux](http://www.tecmint.com/wp-content/uploads/2014/11/Check-Package-Information.png) - -Check Package Information - -### Summary ### - -Package management is something you just can’t sweep under the rug as a system administrator. You should be prepared to use the tools described in this article at a moment’s notice. Hope you find it useful in your preparation for the LFCS exam and for your daily tasks. Feel free to leave your comments or questions below. We will be more than glad to get back to you as soon as possible. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/linux-package-management/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/dpkg-command-examples/ -[2]:http://www.tecmint.com/useful-basic-commands-of-apt-get-and-apt-cache-for-package-management/ -[3]:http://www.tecmint.com/20-practical-examples-of-rpm-commands-in-linux/ -[4]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ -[5]:http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/ \ No newline at end of file diff --git a/sources/tech/LXD/Part 4 - LXD 2.0--Resource control.md b/sources/tech/LXD/Part 4 - LXD 2.0--Resource control.md new file mode 100644 index 0000000000..736c5b84bc --- /dev/null +++ b/sources/tech/LXD/Part 4 - LXD 2.0--Resource control.md @@ -0,0 +1,408 @@ +ezio is translating + + +Part 4 - LXD 2.0: Resource control +====================================== + +This is the fourth blog post [in this series about LXD 2.0][0]. + +As there are a lot of commands involved with managing LXD containers, this post is rather long. If you’d instead prefer a quick step-by-step tour of those same commands, you can [try our online demo instead][1]! + +![](https://linuxcontainers.org/static/img/containers.png) + +### Available resource limits + +LXD offers a variety of resource limits. Some of those are tied to the container itself, like memory quotas, CPU limits and I/O priorities. Some are tied to a particular device instead, like I/O bandwidth or disk usage limits. + +As with all LXD configuration, resource limits can be dynamically changed while the container is running. Some may fail to apply, for example if setting a memory value smaller than the current memory usage, but LXD will try anyway and report back on failure. + +All limits can also be inherited through profiles in which case each affected container will be constrained by that limit. That is, if you set limits.memory=256MB in the default profile, every container using the default profile (typically all of them) will have a memory limit of 256MB. + +We don’t support resource limits pooling where a limit would be shared by a group of containers, there is simply no good way to implement something like that with the existing kernel APIs. + +#### Disk + +This is perhaps the most requested and obvious one. Simply setting a size limit on the container’s filesystem and have it enforced against the container. + +And that’s exactly what LXD lets you do! +Unfortunately this is far more complicated than it sounds. Linux doesn’t have path-based quotas, instead most filesystems only have user and group quotas which are of little use to containers. + +This means that right now LXD only supports disk limits if you’re using the ZFS or btrfs storage backend. It may be possible to implement this feature for LVM too but this depends on the filesystem being used with it and gets tricky when combined with live updates as not all filesystems allow online growth and pretty much none of them allow online shrink. + +#### CPU + +When it comes to CPU limits, we support 4 different things: + +* Just give me X CPUs + + In this mode, you let LXD pick a bunch of cores for you and then load-balance things as more containers and CPUs go online/offline. + + The container only sees that number of CPU. +* Give me a specific set of CPUs (say, core 1, 3 and 5) + + Similar to the first mode except that no load-balancing is happening, you’re stuck with those cores no matter how busy they may be. +* Give me 20% of whatever you have + + In this mode, you get to see all the CPUs but the scheduler will restrict you to 20% of the CPU time but only when under load! So if the system isn’t busy, your container can have as much fun as it wants. When containers next to it start using the CPU, then it gets capped. +* Out of every measured 200ms, give me 50ms (and no more than that) + + This mode is similar to the previous one in that you get to see all the CPUs but this time, you can only use as much CPU time as you set in the limit, no matter how idle the system may be. On a system without over-commit this lets you slice your CPU very neatly and guarantees constant performance to those containers. + +It’s also possible to combine one of the first two with one of the last two, that is, request a set of CPUs and then further restrict how much CPU time you get on those. + +On top of that, we also have a generic priority knob which is used to tell the scheduler who wins when you’re under load and two containers are fighting for the same resource. + +#### Memory + +Memory sounds pretty simple, just give me X MB of RAM! + +And it absolutely can be that simple. We support that kind of limits as well as percentage based requests, just give me 10% of whatever the host has! + +Then we support some extra stuff on top. For example, you can choose to turn swap on and off on a per-container basis and if it’s on, set a priority so you can choose what container will have their memory swapped out to disk first! + +Oh and memory limits are “hard” by default. That is, when you run out of memory, the kernel out of memory killer will start having some fun with your processes. + +Alternatively you can set the enforcement policy to “soft”, in which case you’ll be allowed to use as much memory as you want so long as nothing else is. As soon as something else wants that memory, you won’t be able to allocate anything until you’re back under your limit or until the host has memory to spare again. + +#### Network I/O + +Network I/O is probably our simplest looking limit, trust me, the implementation really isn’t simple though! + +We support two things. The first is a basic bit/s limits on network interfaces. You can set a limit of ingress and egress or just set the “max” limit which then applies to both. This is only supported for “bridged” and “p2p” type interfaces. + +The second thing is a global network I/O priority which only applies when the network interface you’re trying to talk through is saturated. + +#### Block I/O + +I kept the weirdest for last. It may look straightforward and feel like that to the user but there are a bunch of cases where it won’t exactly do what you think it should. + +What we support here is basically identical to what I described in Network I/O. + +You can set IOps or byte/s read and write limits directly on a disk device entry and there is a global block I/O priority which tells the I/O scheduler who to prefer. + +The weirdness comes from how and where those limits are applied. Unfortunately the underlying feature we use to implement those uses full block devices. That means we can’t set per-partition I/O limits let alone per-path. + +It also means that when using ZFS or btrfs which can use multiple block devices to back a given path (with or without RAID), we effectively don’t know what block device is providing a given path. + +This means that it’s entirely possible, in fact likely, that a container may have multiple disk entries (bind-mounts or straight mounts) which are coming from the same underlying disk. + +And that’s where things get weird. To make things work, LXD has logic to guess what block devices back a given path, this does include interrogating the ZFS and btrfs tools and even figures things out recursively when it finds a loop mounted file backing a filesystem. + +That logic while not perfect, usually yields a set of block devices that should have a limit applied. LXD then records that and moves on to the next path. When it’s done looking at all the paths, it gets to the very weird part. It averages the limits you’ve set for every affected block devices and then applies those. + +That means that “in average” you’ll be getting the right speed in the container, but it also means that you can’t have a “/fast” and a “/slow” directory both coming from the same physical disk and with differing speed limits. LXD will let you set it up but in the end, they’ll both give you the average of the two values. + +### How does it all work? + +Most of the limits described above are applied through the Linux kernel Cgroups API. That’s with the exception of the network limits which are applied through good old “tc”. + +LXD at startup time detects what cgroups are enabled in your kernel and will only apply the limits which your kernel support. Should you be missing some cgroups, a warning will also be printed by the daemon which will then get logged by your init system. + +On Ubuntu 16.04, everything is enabled by default with the exception of swap memory accounting which requires you pass the “swapaccount=1” kernel boot parameter. + +### Applying some limits + +All the limits described above are applied directly to the container or to one of its profiles. Container-wide limits are applied with: + +``` +lxc config set CONTAINER KEY VALUE +``` + +or for a profile: + +``` +lxc profile set PROFILE KEY VALUE +``` + +while device-specific ones are applied with: + +``` +lxc config device set CONTAINER DEVICE KEY VALUE +``` + +or for a profile: + +``` +lxc profile device set PROFILE DEVICE KEY VALUE +``` + +The complete list of valid configuration keys, device types and device keys can be [found here][1]. + +#### CPU + +To just limit a container to any 2 CPUs, do: + +``` +lxc config set my-container limits.cpu 2 +``` + +To pin to specific CPU cores, say the second and fourth: + +``` +lxc config set my-container limits.cpu 1,3 +``` + +More complex pinning ranges like this works too: + +``` +lxc config set my-container limits.cpu 0-3,7-11 +``` + +The limits are applied live, as can be seen in this example: + +``` +stgraber@dakara:~$ lxc exec zerotier -- cat /proc/cpuinfo | grep ^proces +processor : 0 +processor : 1 +processor : 2 +processor : 3 +stgraber@dakara:~$ lxc config set zerotier limits.cpu 2 +stgraber@dakara:~$ lxc exec zerotier -- cat /proc/cpuinfo | grep ^proces +processor : 0 +processor : 1 +``` + +Note that to avoid utterly confusing userspace, lxcfs arranges the /proc/cpuinfo entries so that there are no gaps. + +As with just about everything in LXD, those settings can also be applied in profiles: + +``` +stgraber@dakara:~$ lxc exec snappy -- cat /proc/cpuinfo | grep ^proces +processor : 0 +processor : 1 +processor : 2 +processor : 3 +stgraber@dakara:~$ lxc profile set default limits.cpu 3 +stgraber@dakara:~$ lxc exec snappy -- cat /proc/cpuinfo | grep ^proces +processor : 0 +processor : 1 +processor : 2 +``` + +To limit the CPU time of a container to 10% of the total, set the CPU allowance: + +``` +lxc config set my-container limits.cpu.allowance 10% +``` + +Or to give it a fixed slice of CPU time: + +``` +lxc config set my-container limits.cpu.allowance 25ms/200ms +``` + +And lastly, to reduce the priority of a container to a minimum: + +``` +lxc config set my-container limits.cpu.priority 0 +``` + +#### Memory + +To apply a straightforward memory limit run: + +``` +lxc config set my-container limits.memory 256MB +``` + +(The supported suffixes are kB, MB, GB, TB, PB and EB) + +To turn swap off for the container (defaults to enabled): + +``` +lxc config set my-container limits.memory.swap false +``` + +To tell the kernel to swap this container’s memory first: + +``` +lxc config set my-container limits.memory.swap.priority 0 +``` + +And finally if you don’t want hard memory limit enforcement: + +``` +lxc config set my-container limits.memory.enforce soft +``` + +#### Disk and block I/O + +Unlike CPU and memory, disk and I/O limits are applied to the actual device entry, so you either need to edit the original device or mask it with a more specific one. + +To set a disk limit (requires btrfs or ZFS): + +``` +lxc config device set my-container root size 20GB +``` + +For example: + +``` +stgraber@dakara:~$ lxc exec zerotier -- df -h / +Filesystem Size Used Avail Use% Mounted on +encrypted/lxd/containers/zerotier 179G 542M 178G 1% / +stgraber@dakara:~$ lxc config device set zerotier root size 20GB +stgraber@dakara:~$ lxc exec zerotier -- df -h / +Filesystem Size Used Avail Use% Mounted on +encrypted/lxd/containers/zerotier 20G 542M 20G 3% / +``` + +To restrict speed you can do the following: + +``` +lxc config device set my-container root limits.read 30MB +lxc config device set my-container root.limits.write 10MB +``` + +Or to restrict IOps instead: + +``` +lxc config device set my-container root limits.read 20Iops +lxc config device set my-container root limits.write 10Iops +``` + +And lastly, if you’re on a busy system with over-commit, you may want to also do: + +``` +lxc config set my-container limits.disk.priority 10 +``` + +To increase the I/O priority for that container to the maximum. + +#### Network I/O + +Network I/O is basically identical to block I/O as far the knobs available. + +For example: + +``` +stgraber@dakara:~$ lxc exec zerotier -- wget http://speedtest.newark.linode.com/100MB-newark.bin -O /dev/null +--2016-03-26 22:17:34-- http://speedtest.newark.linode.com/100MB-newark.bin +Resolving speedtest.newark.linode.com (speedtest.newark.linode.com)... 50.116.57.237, 2600:3c03::4b +Connecting to speedtest.newark.linode.com (speedtest.newark.linode.com)|50.116.57.237|:80... connected. +HTTP request sent, awaiting response... 200 OK +Length: 104857600 (100M) [application/octet-stream] +Saving to: '/dev/null' + +/dev/null 100%[===================>] 100.00M 58.7MB/s in 1.7s + +2016-03-26 22:17:36 (58.7 MB/s) - '/dev/null' saved [104857600/104857600] + +stgraber@dakara:~$ lxc profile device set default eth0 limits.ingress 100Mbit +stgraber@dakara:~$ lxc profile device set default eth0 limits.egress 100Mbit +stgraber@dakara:~$ lxc exec zerotier -- wget http://speedtest.newark.linode.com/100MB-newark.bin -O /dev/null +--2016-03-26 22:17:47-- http://speedtest.newark.linode.com/100MB-newark.bin +Resolving speedtest.newark.linode.com (speedtest.newark.linode.com)... 50.116.57.237, 2600:3c03::4b +Connecting to speedtest.newark.linode.com (speedtest.newark.linode.com)|50.116.57.237|:80... connected. +HTTP request sent, awaiting response... 200 OK +Length: 104857600 (100M) [application/octet-stream] +Saving to: '/dev/null' + +/dev/null 100%[===================>] 100.00M 11.4MB/s in 8.8s + +2016-03-26 22:17:56 (11.4 MB/s) - '/dev/null' saved [104857600/104857600] +``` + +And that’s how you throttle an otherwise nice gigabit connection to a mere 100Mbit/s one! + +And as with block I/O, you can set an overall network priority with: + +``` +lxc config set my-container limits.network.priority 5 +``` + +### Getting the current resource usage + +The [LXD API][2] exports quite a bit of information on current container resource usage, you can get: + +* Memory: current, peak, current swap and peak swap +* Disk: current disk usage +* Network: bytes and packets received and transferred for every interface + +And now if you’re running a very recent LXD (only in git at the time of this writing), you can also get all of those in “lxc info”: + +``` +stgraber@dakara:~$ lxc info zerotier +Name: zerotier +Architecture: x86_64 +Created: 2016/02/20 20:01 UTC +Status: Running +Type: persistent +Profiles: default +Pid: 29258 +Ips: + eth0: inet 172.17.0.101 + eth0: inet6 2607:f2c0:f00f:2700:216:3eff:feec:65a8 + eth0: inet6 fe80::216:3eff:feec:65a8 + lo: inet 127.0.0.1 + lo: inet6 ::1 + lxcbr0: inet 10.0.3.1 + lxcbr0: inet6 fe80::f0bd:55ff:feee:97a2 + zt0: inet 29.17.181.59 + zt0: inet6 fd80:56c2:e21c:0:199:9379:e711:b3e1 + zt0: inet6 fe80::79:e7ff:fe0d:5123 +Resources: + Processes: 33 + Disk usage: + root: 808.07MB + Memory usage: + Memory (current): 106.79MB + Memory (peak): 195.51MB + Swap (current): 124.00kB + Swap (peak): 124.00kB + Network usage: + lxcbr0: + Bytes received: 0 bytes + Bytes sent: 570 bytes + Packets received: 0 + Packets sent: 0 + zt0: + Bytes received: 1.10MB + Bytes sent: 806 bytes + Packets received: 10957 + Packets sent: 10957 + eth0: + Bytes received: 99.35MB + Bytes sent: 5.88MB + Packets received: 64481 + Packets sent: 64481 + lo: + Bytes received: 9.57kB + Bytes sent: 9.57kB + Packets received: 81 + Packets sent: 81 +Snapshots: + zerotier/blah (taken at 2016/03/08 23:55 UTC) (stateless) +``` + +### Conclusion + +The LXD team spent quite a few months iterating over the language we’re using for those limits. It’s meant to be as simple as it can get while remaining very powerful and specific when you want it to. + +Live application of those limits and inheritance through profiles makes it a very powerful tool to live manage the load on your servers without impacting the running services. + +### Extra information + +The main LXD website is at: +Development happens on Github at: +Mailing-list support happens on: +IRC support happens in: #lxcontainers on irc.freenode.net + +And if you don’t want or can’t install LXD on your own machine, you can always [try it online instead][3]! + + +-------------------------------------------------------------------------------- + +via: https://www.stgraber.org/2016/03/26/lxd-2-0-resource-control-412/ + +作者:[Stéphane Graber][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.stgraber.org/author/stgraber/ +[0]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[1]: https://github.com/lxc/lxd/blob/master/doc/configuration.md +[2]: https://github.com/lxc/lxd/blob/master/doc/rest-api.md +[3]: https://linuxcontainers.org/lxd/try-it diff --git a/sources/tech/LXD/Part 5 - LXD 2.0--Image management.md b/sources/tech/LXD/Part 5 - LXD 2.0--Image management.md new file mode 100644 index 0000000000..1e2e9ace01 --- /dev/null +++ b/sources/tech/LXD/Part 5 - LXD 2.0--Image management.md @@ -0,0 +1,458 @@ +Part 5 - LXD 2.0: Image management +================================== +This is the fifth blog post [in this series about LXD 2.0][0]. + +As there are a lot of commands involved with managing LXD containers, this post is rather long. If you’d instead prefer a quick step-by-step tour of those same commands, you can [try our online demo instead][1]! + +![](https://linuxcontainers.org/static/img/containers.png) + +### Container images + +If you’ve used LXC before, you probably remember those LXC “templates”, basically shell scripts that spit out a container filesystem and a bit of configuration. + +Most templates generate the filesystem by doing a full distribution bootstrapping on your local machine. This may take quite a while, won’t work for all distributions and may require significant network bandwidth. + +Back in LXC 1.0, I wrote a “download” template which would allow users to download pre-packaged container images, generated on a central server from the usual template scripts and then heavily compressed, signed and distributed over https. A lot of our users switched from the old style container generation to using this new, much faster and much more reliable method of creating a container. + +With LXD, we’re taking this one step further by being all-in on the image based workflow. All containers are created from an image and we have advanced image caching and pre-loading support in LXD to keep the image store up to date. + +### Interacting with LXD images + +Before digging deeper into the image format, lets quickly go through what LXD lets you do with those images. + +#### Transparently importing images + +All containers are created from an image. The image may have come from a remote image server and have been pulled using its full hash, short hash or an alias, but in the end, every LXD container is created from a local image. + +Here are a few examples: + +``` +lxc launch ubuntu:14.04 c1 +lxc launch ubuntu:75182b1241be475a64e68a518ce853e800e9b50397d2f152816c24f038c94d6e c2 +lxc launch ubuntu:75182b1241be c3 +``` + +All of those refer to the same remote image (at the time of this writing), the first time one of those is run, the remote image will be imported in the local LXD image store as a cached image, then the container will be created from it. + +The next time one of those commands are run, LXD will only check that the image is still up to date (when not referring to it by its fingerprint), if it is, it will create the container without downloading anything. + +Now that the image is cached in the local image store, you can also just start it from there without even checking if it’s up to date: + +``` +lxc launch 75182b1241be c4 +``` + +And lastly, if you have your own local image under the name “myimage”, you can just do: + +``` +lxc launch my-image c5 +``` + +If you want to change some of that automatic caching and expiration behavior, there are instructions in an earlier post in this series. + +#### Manually importing images + +##### Copying from an image server + +If you want to copy some remote image into your local image store but not immediately create a container from it, you can use the “lxc image copy” command. It also lets you tweak some of the image flags, for example: + +``` +lxc image copy ubuntu:14.04 local: +``` + +This simply copies the remote image into the local image store. + +If you want to be able to refer to your copy of the image by something easier to remember than its fingerprint, you can add an alias at the time of the copy: + +``` +lxc image copy ubuntu:12.04 local: --alias old-ubuntu +lxc launch old-ubuntu c6 +``` + +And if you would rather just use the aliases that were set on the source server, you can ask LXD to copy the for you: + +lxc image copy ubuntu:15.10 local: --copy-aliases +lxc launch 15.10 c7 +All of the copies above were one-shot copy, so copying the current version of the remote image into the local image store. If you want to have LXD keep the image up to date, as it does for the ones stored in its cache, you need to request it with the `–auto-update` flag: + +``` +lxc image copy images:gentoo/current/amd64 local: --alias gentoo --auto-update +``` + +##### Importing a tarball + +If someone provides you with a LXD image as a single tarball, you can import it with: + +``` +lxc image import +``` + +If you want to set an alias at import time, you can do it with: + +``` +lxc image import --alias random-image +``` + +Now if you were provided with two tarballs, identify which contains the LXD metadata. Usually the tarball name gives it away, if not, pick the smallest of the two, metadata tarballs are tiny. Then import them both together with: + +``` +lxc image import +``` + +##### Importing from a URL + +“lxc image import” also works with some special URLs. If you have an https web server which serves a path with the LXD-Image-URL and LXD-Image-Hash headers set, then LXD will pull that image into its image store. + +For example you can do: + +``` +lxc image import https://dl.stgraber.org/lxd --alias busybox-amd64 +``` + +When pulling the image, LXD also sets some headers which the remote server could check to return an appropriate image. Those are LXD-Server-Architectures and LXD-Server-Version. + +This is meant as a poor man’s image server. It can be made to work with any static web server and provides a user friendly way to import your image. + +#### Managing the local image store + +Now that we have a bunch of images in our local image store, lets see what we can do with them. We’ve already covered the most obvious, creating containers from them but there are a few more things you can do with the local image store. + +##### Listing images + +To get a list of all images in the store, just run “lxc image list”: + +``` +stgraber@dakara:~$ lxc image list ++---------------+--------------+--------+------------------------------------------------------+--------+----------+------------------------------+ +| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE | ++---------------+--------------+--------+------------------------------------------------------+--------+----------+------------------------------+ +| alpine-32 | 6d9c131efab3 | yes | Alpine edge (i386) (20160329_23:52) | i686 | 2.50MB | Mar 30, 2016 at 4:36am (UTC) | ++---------------+--------------+--------+------------------------------------------------------+--------+----------+------------------------------+ +| busybox-amd64 | 74186c79ca2f | no | Busybox x86_64 | x86_64 | 0.79MB | Mar 30, 2016 at 4:33am (UTC) | ++---------------+--------------+--------+------------------------------------------------------+--------+----------+------------------------------+ +| gentoo | 1a134c5951e0 | no | Gentoo current (amd64) (20160329_14:12) | x86_64 | 232.50MB | Mar 30, 2016 at 4:34am (UTC) | ++---------------+--------------+--------+------------------------------------------------------+--------+----------+------------------------------+ +| my-image | c9b6e738fae7 | no | Scientific Linux 6 x86_64 (default) (20160215_02:36) | x86_64 | 625.34MB | Mar 2, 2016 at 4:56am (UTC) | ++---------------+--------------+--------+------------------------------------------------------+--------+----------+------------------------------+ +| old-ubuntu | 4d558b08f22f | no | ubuntu 12.04 LTS amd64 (release) (20160315) | x86_64 | 155.09MB | Mar 30, 2016 at 4:30am (UTC) | ++---------------+--------------+--------+------------------------------------------------------+--------+----------+------------------------------+ +| w (11 more) | d3703a994910 | no | ubuntu 15.10 amd64 (release) (20160315) | x86_64 | 153.35MB | Mar 30, 2016 at 4:31am (UTC) | ++---------------+--------------+--------+------------------------------------------------------+--------+----------+------------------------------+ +| | 75182b1241be | no | ubuntu 14.04 LTS amd64 (release) (20160314) | x86_64 | 118.17MB | Mar 30, 2016 at 4:27am (UTC) | ++---------------+--------------+--------+------------------------------------------------------+--------+----------+------------------------------+ +``` + +You can filter based on the alias or fingerprint simply by doing: + +``` +stgraber@dakara:~$ lxc image list amd64 ++---------------+--------------+--------+-----------------------------------------+--------+----------+------------------------------+ +| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE | ++---------------+--------------+--------+-----------------------------------------+--------+----------+------------------------------+ +| busybox-amd64 | 74186c79ca2f | no | Busybox x86_64 | x86_64 | 0.79MB | Mar 30, 2016 at 4:33am (UTC) | ++---------------+--------------+--------+-----------------------------------------+--------+----------+------------------------------+ +| w (11 more) | d3703a994910 | no | ubuntu 15.10 amd64 (release) (20160315) | x86_64 | 153.35MB | Mar 30, 2016 at 4:31am (UTC) | ++---------------+--------------+--------+-----------------------------------------+--------+----------+------------------------------+ +``` + +Or by specifying a key=value filter of image properties: + +``` +stgraber@dakara:~$ lxc image list os=ubuntu ++-------------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+ +| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE | ++-------------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+ +| old-ubuntu | 4d558b08f22f | no | ubuntu 12.04 LTS amd64 (release) (20160315) | x86_64 | 155.09MB | Mar 30, 2016 at 4:30am (UTC) | ++-------------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+ +| w (11 more) | d3703a994910 | no | ubuntu 15.10 amd64 (release) (20160315) | x86_64 | 153.35MB | Mar 30, 2016 at 4:31am (UTC) | ++-------------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+ +| | 75182b1241be | no | ubuntu 14.04 LTS amd64 (release) (20160314) | x86_64 | 118.17MB | Mar 30, 2016 at 4:27am (UTC) | ++-------------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+ +``` + +To see everything LXD knows about a given image, you can use “lxc image info”: + +``` +stgraber@castiana:~$ lxc image info ubuntu +Fingerprint: e8a33ec326ae7dd02331bd72f5d22181ba25401480b8e733c247da5950a7d084 +Size: 139.43MB +Architecture: i686 +Public: no +Timestamps: + Created: 2016/03/15 00:00 UTC + Uploaded: 2016/03/16 05:50 UTC + Expires: 2017/04/26 00:00 UTC +Properties: + version: 12.04 + aliases: 12.04,p,precise + architecture: i386 + description: ubuntu 12.04 LTS i386 (release) (20160315) + label: release + os: ubuntu + release: precise + serial: 20160315 +Aliases: + - ubuntu +Auto update: enabled +Source: + Server: https://cloud-images.ubuntu.com/releases + Protocol: simplestreams + Alias: precise/i386 +``` + +##### Editing images + +A convenient way to edit image properties and some of the flags is to use: + +lxc image edit +This opens up your default text editor with something like this: + +autoupdate: true +properties: + aliases: 14.04,default,lts,t,trusty + architecture: amd64 + description: ubuntu 14.04 LTS amd64 (release) (20160314) + label: release + os: ubuntu + release: trusty + serial: "20160314" + version: "14.04" +public: false +You can change any property you want, turn auto-update on and off or mark an image as publicly available (more on that later). + +##### Deleting images + +Remove an image is a simple matter of running: + +``` +lxc image delete +``` + +Note that you don’t have to remove cached entries, those will automatically be removed by LXD after they expire (by default, after 10 days since they were last used). + +##### Exporting images + +If you want to get image tarballs from images currently in your image store, you can use “lxc image export”, like: + +``` +stgraber@dakara:~$ lxc image export old-ubuntu . +Output is in . +stgraber@dakara:~$ ls -lh *.tar.xz +-rw------- 1 stgraber domain admins 656 Mar 30 00:55 meta-ubuntu-12.04-server-cloudimg-amd64-lxd.tar.xz +-rw------- 1 stgraber domain admins 156M Mar 30 00:55 ubuntu-12.04-server-cloudimg-amd64-lxd.tar.xz +``` + +#### Image formats + +LXD right now supports two image layouts, unified or split. Both of those are effectively LXD-specific though the latter makes it easier to re-use the filesystem with other container or virtual machine runtimes. + +LXD being solely focused on system containers, doesn’t support any of the application container “standard” image formats out there, nor do we plan to. + +Our images are pretty simple, they’re made of a container filesystem, a metadata file describing things like when the image was made, when it expires, what architecture its for, … and optionally a bunch of file templates. + +See this document for up to date details on the [image format][1]. + +##### Unified image (single tarball) + +The unified image format is what LXD uses when generating images itself. They are a single big tarball, containing the container filesystem inside a “rootfs” directory, have the metadata.yaml file at the root of the tarball and any template goes into a “templates” directory. + +Any compression (or none at all) can be used for that tarball. The image hash is the sha256 of the resulting compressed tarball. + +##### Split image (two tarballs) + +This format is most commonly used by anyone rolling their own images and who already have a compressed filesystem tarball. + +They are made of two distinct tarball, the first contains just the metadata bits that LXD uses, so the metadata.yaml file at the root and any template in the “templates” directory. + +The second tarball contains only the container filesystem directly at its root. Most distributions already produce such tarballs as they are common for bootstrapping new machines. This image format allows re-using them unmodified. + +Any compression (or none at all) can be used for either tarball, they can absolutely use different compression algorithms. The image hash is the sha256 of the concatenation of the metadata and rootfs tarballs. + +##### Image metadata + +A typical metadata.yaml file looks something like: + +``` +architecture: "i686" +creation_date: 1458040200 +properties: + architecture: "i686" + description: "Ubuntu 12.04 LTS server (20160315)" + os: "ubuntu" + release: "precise" +templates: + /var/lib/cloud/seed/nocloud-net/meta-data: + when: + - start + template: cloud-init-meta.tpl + /var/lib/cloud/seed/nocloud-net/user-data: + when: + - start + template: cloud-init-user.tpl + properties: + default: | + #cloud-config + {} + /var/lib/cloud/seed/nocloud-net/vendor-data: + when: + - start + template: cloud-init-vendor.tpl + properties: + default: | + #cloud-config + {} + /etc/init/console.override: + when: + - create + template: upstart-override.tpl + /etc/init/tty1.override: + when: + - create + template: upstart-override.tpl + /etc/init/tty2.override: + when: + - create + template: upstart-override.tpl + /etc/init/tty3.override: + when: + - create + template: upstart-override.tpl + /etc/init/tty4.override: + when: + - create + template: upstart-override.tpl +``` + +##### Properties + +The two only mandatory fields are the creation date (UNIX EPOCH) and the architecture. Everything else can be left unset and the image will import fine. + +The extra properties are mainly there to help the user figure out what the image is about. The “description” property for example is what’s visible in “lxc image list”. The other properties can be used by the user to search for specific images using key/value search. + +Those properties can then be edited by the user through “lxc image edit” in contrast, the creation date and architecture fields are immutable. + +##### Templates + +The template mechanism allows for some files in the container to be generated or re-generated at some point in the container lifecycle. + +We use the pongo2 templating engine for those and we export just about everything we know about the container to the template. That way you can have custom images which use user-defined container properties or normal LXD properties to change the content of some specific files. + +As you can see in the example above, we’re using those in Ubuntu to seed cloud-init and to turn off some init scripts. + +### Creating your own images + +LXD being focused on running full Linux systems means that we expect most users to just use clean distribution images and not spin their own image. + +However there are a few cases where having your own images is useful. Such as having pre-configured images of your production servers or building your own images for a distribution or architecture that we don’t build images for. + +#### Turning a container into an image + +The easiest way by far to build an image with LXD is to just turn a container into an image. + +This can be done with: + +``` +lxc launch ubuntu:14.04 my-container +lxc exec my-container bash + +lxc publish my-container --alias my-new-image +``` + +You can even turn a past container snapshot into a new image: + +``` +lxc publish my-container/some-snapshot --alias some-image +``` + +#### Manually building an image + +Building your own image is also pretty simple. + +1. Generate a container filesystem. This entirely depends on the distribution you’re using. For Ubuntu and Debian, it would be by using debootstrap. +2. Configure anything that’s needed for the distribution to work properly in a container (if anything is needed). +3. Make a tarball of that container filesystem, optionally compress it. +4. Write a new metadata.yaml file based on the one described above. +5. Create another tarball containing that metadata.yaml file. +6. Import those two tarballs as a LXD image with: + ``` + lxc image import --alias some-name + ``` + +You will probably need to go through this a few times before everything works, tweaking things here and there, possibly adding some templates and properties. + +### Publishing your images + +All LXD daemons act as image servers. Unless told otherwise all images loaded in the image store are marked as private and so only trusted clients can retrieve those images, but should you want to make a public image server, all you have to do is tag a few images as public and make sure you LXD daemon is listening to the network. + +#### Just running a public LXD server + +The easiest way to share LXD images is to run a publicly visible LXD daemon. + +You typically do that by running: + +``` +lxc config set core.https_address "[::]:8443" +``` + +Remote users can then add your server as a public image server with: + +``` +lxc remote add --public +``` + +They can then use it just as they would any of the default image servers. As the remote server was added with “–public”, no authentication is required and the client is restricted to images which have themselves been marked as public. + +To change what images are public, just “lxc image edit” them and set the public flag to true. + +#### Use a static web server + +As mentioned above, “lxc image import” supports downloading from a static http server. The requirements are basically: + +* The server must support HTTPs with a valid certificate, TLS1.2 and EC ciphers +* When hitting the URL provided to “lxc image import”, the server must return an answer including the LXD-Image-Hash and LXD-Image-URL HTTP headers + +If you want to make this dynamic, you can have your server look for the LXD-Server-Architectures and LXD-Server-Version HTTP headers which LXD will provide when fetching the image. This allows you to return the right image for the server’s architecture. + +#### Build a simplestreams server + +The “ubuntu:” and “ubuntu-daily:” remotes aren’t using the LXD protocol (“images:” is), those are instead using a different protocol called simplestreams. + +simplestreams is basically an image server description format, using JSON to describe a list of products and files related to those products. + +It is used by a variety of tools like OpenStack, Juju, MAAS, … to find, download or mirror system images and LXD supports it as a native protocol for image retrieval. + +While certainly not the easiest way to start providing LXD images, it may be worth considering if your images can also be used by some of those other tools. + +More information can be found here. + +### Conclusion + +I hope this gave you a good idea of how LXD manages its images and how to build and distribute your own. The ability to have the exact same image easily available bit for bit on a bunch of globally distributed system is a big step up from the old LXC days and leads the way to more reproducible infrastructure. + +### Extra information + +The main LXD website is at: +Development happens on Github at: +Mailing-list support happens on: +IRC support happens in: #lxcontainers on irc.freenode.net + +And if you don’t want or can’t install LXD on your own machine, you can always [try it online instead][3]! + + +-------------------------------------------------------------------------------- + +via: https://www.stgraber.org/2016/03/30/lxd-2-0-image-management-512/ + +作者:[Stéphane Graber][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.stgraber.org/author/stgraber/ +[0]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[1]: https://github.com/lxc/lxd/blob/master/doc/image-handling.md +[2]: https://launchpad.net/simplestreams +[3]: https://linuxcontainers.org/lxd/try-it + +原文:https://www.stgraber.org/2016/03/30/lxd-2-0-image-management-512/ diff --git a/sources/tech/LXD/Part 6 - LXD 2.0--Remote hosts and container migration.md b/sources/tech/LXD/Part 6 - LXD 2.0--Remote hosts and container migration.md new file mode 100644 index 0000000000..bbeb4f3eea --- /dev/null +++ b/sources/tech/LXD/Part 6 - LXD 2.0--Remote hosts and container migration.md @@ -0,0 +1,209 @@ +Part 6 - LXD 2.0: Remote hosts and container migration +======================================================= + +This is the third blog post [in this series about LXD 2.0][0]. + +![](https://linuxcontainers.org/static/img/containers.png) + +### Remote protocols + +LXD 2.0 supports two protocols: + +* LXD 1.0 API: That’s the REST API used between the clients and a LXD daemon as well as between LXD daemons when copying/moving images and containers. +* Simplestreams: The Simplestreams protocol is a read-only, image-only protocol used by both the LXD client and daemon to get image information and import images from some public image servers (like the Ubuntu images). + +Everything below will be using the first of those two. + +### Security + +Authentication for the LXD API is done through client certificate authentication over TLS 1.2 using recent ciphers. When two LXD daemons must exchange information directly, a temporary token is generated by the source daemon and transferred through the client to the target daemon. This token may only be used to access a particular stream and is immediately revoked so cannot be re-used. + +To avoid Man In The Middle attacks, the client tool also sends the certificate of the source server to the target. That means that for a particular download operation, the target server is provided with the source server URL, a one-time access token for the resource it needs and the certificate that the server is supposed to be using. This prevents MITM attacks and only give temporary access to the object of the transfer. + +### Network requirements + +LXD 2.0 uses a model where the target of an operation (the receiving end) is connecting directly to the source to fetch the data. + +This means that you must ensure that the target server can connect to the source directly, updating any needed firewall along the way. + +We have [a plan][1] to allow this to be reversed and also to allow proxying through the client itself for those rare cases where draconian firewalls are preventing any communication between the two hosts. + +### Interacting with remote hosts + +Rather than having our users have to always provide hostname or IP addresses and then validating certificate information whenever they want to interact with a remote host, LXD is using the concept of “remotes”. + +By default, the only real LXD remote configured is “local:” which also happens to be the default remote (so you don’t have to type its name). The local remote uses the LXD REST API to talk to the local daemon over a unix socket. + +### Adding a remote + +Say you have two machines with LXD installed, your local machine and a remote host that we’ll call “foo”. + +First you need to make sure that “foo” is listening to the network and has a password set, so get a remote shell on it and run: + +``` +lxc config set core.https_address [::]:8443 +lxc config set core.trust_password something-secure +``` + +Now on your local LXD, we just need to make it visible to the network so we can transfer containers and images from it: + +lxc config set core.https_address [::]:8443 +Now that the daemon configuration is done on both ends, you can add “foo” to your local client with: + +``` +lxc remote add foo 1.2.3.4 +``` + +(replacing 1.2.3.4 by your IP address or FQDN) + +You’ll see something like this: + +``` +stgraber@dakara:~$ lxc remote add foo 2607:f2c0:f00f:2770:216:3eff:fee1:bd67 +Certificate fingerprint: fdb06d909b77a5311d7437cabb6c203374462b907f3923cefc91dd5fce8d7b60 +ok (y/n)? y +Admin password for foo: +Client certificate stored at server: foo +``` + +You can then list your remotes and you’ll see “foo” listed there: + +``` +stgraber@dakara:~$ lxc remote list ++-----------------+-------------------------------------------------------+---------------+--------+--------+ +| NAME | URL | PROTOCOL | PUBLIC | STATIC | ++-----------------+-------------------------------------------------------+---------------+--------+--------+ +| foo | https://[2607:f2c0:f00f:2770:216:3eff:fee1:bd67]:8443 | lxd | NO | NO | ++-----------------+-------------------------------------------------------+---------------+--------+--------+ +| images | https://images.linuxcontainers.org:8443 | lxd | YES | NO | ++-----------------+-------------------------------------------------------+---------------+--------+--------+ +| local (default) | unix:// | lxd | NO | YES | ++-----------------+-------------------------------------------------------+---------------+--------+--------+ +| ubuntu | https://cloud-images.ubuntu.com/releases | simplestreams | YES | YES | ++-----------------+-------------------------------------------------------+---------------+--------+--------+ +| ubuntu-daily | https://cloud-images.ubuntu.com/daily | simplestreams | YES | YES | ++-----------------+-------------------------------------------------------+---------------+--------+--------+ +``` + +### Interacting with it + +Ok, so we have a remote server defined, what can we do with it now? + +Well, just about everything you saw in the posts until now, the only difference being that you must tell LXD what host to run against. + +For example: + +``` +lxc launch ubuntu:14.04 c1 +``` + +Will run on the default remote (“lxc remote get-default”) which is your local host. + +``` +lxc launch ubuntu:14.04 foo:c1 +``` + +Will instead run on foo. + +Listing running containers on a remote host can be done with: + +``` +stgraber@dakara:~$ lxc list foo: ++------+---------+---------------------+-----------------------------------------------+------------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++------+---------+---------------------+-----------------------------------------------+------------+-----------+ +| c1 | RUNNING | 10.245.81.95 (eth0) | 2607:f2c0:f00f:2770:216:3eff:fe43:7994 (eth0) | PERSISTENT | 0 | ++------+---------+---------------------+-----------------------------------------------+------------+-----------+ +``` + +One thing to keep in mind is that you have to specify the remote host for both images and containers. So if you have a local image called “my-image” on “foo” and want to create a container called “c2” from it, you have to run: + +``` +lxc launch foo:my-image foo:c2 +``` + +Finally, getting a shell into a remote container works just as you would expect: + +``` +lxc exec foo:c1 bash +``` + +### Copying containers + +Copying containers between hosts is as easy as it sounds: + +``` +lxc copy foo:c1 c2 +``` +And you’ll have a new local container called “c2” created from a copy of the remote “c1” container. This requires “c1” to be stopped first, but you could just copy a snapshot instead and do it while the source container is running: + +``` +lxc snapshot foo:c1 current +lxc copy foo:c1/current c3 +``` + +### Moving containers + +Unless you’re doing live migration (which will be covered in a later post), you have to stop the source container prior to moving it, after which everything works as you’d expect. + +``` +lxc stop foo:c1 +lxc move foo:c1 local: +``` + +This example is functionally identical to: + +``` +lxc stop foo:c1 +lxc move foo:c1 c1 +``` + +### How this all works + +Interactions with remote containers work as you would expect, rather than using the REST API over a local Unix socket, LXD just uses the exact same API over a remote HTTPS transport. + +Where it gets a bit trickier is when interaction between two daemons must occur, as is the case for copy and move. + +In those cases the following happens: + +1. The user runs “lxc move foo:c1 c1”. +2. The client contacts the local: remote to check for an existing “c1” container. +3. The client fetches container information from “foo”. +4. The client requests a migration token from the source “foo” daemon. +5. The client sends that migration token as well as the source URL and “foo”‘s certificate to the local LXD daemon alongside the container configuration and devices. +6. The local LXD daemon then connects directly to “foo” using the provided token + A. It connects to a first control websocket + B. It negotiates the filesystem transfer protocol (zfs send/receive, btrfs send/receive or plain rsync) + C. If available locally, it unpacks the image which was used to create the source container. This is to avoid needless data transfer. + D. It then transfers the container and any of its snapshots as a delta. +7. If succesful, the client then instructs “foo” to delete the source container. + +### Try all this online + +Don’t have two machines to try remote interactions and moving/copying containers? + +That’s okay, you can test it all online using our [demo service][2]. +The included step-by-step walkthrough even covers it! + +### Extra information + +The main LXD website is at: +Development happens on Github at: +Mailing-list support happens on: +IRC support happens in: #lxcontainers on irc.freenode.net + + +-------------------------------------------------------------------------------- + +via: https://www.stgraber.org/2016/03/19/lxd-2-0-your-first-lxd-container-312/ + +作者:[Stéphane Graber][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.stgraber.org/author/stgraber/ +[0]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[1]: https://github.com/lxc/lxd/issues/553 +[2]: https://linuxcontainers.org/lxd/try-it/ diff --git a/sources/tech/LXD/Part 7 - LXD 2.0--Docker in LXD.md b/sources/tech/LXD/Part 7 - LXD 2.0--Docker in LXD.md new file mode 100644 index 0000000000..d9b35735b8 --- /dev/null +++ b/sources/tech/LXD/Part 7 - LXD 2.0--Docker in LXD.md @@ -0,0 +1,145 @@ +Part 7 - LXD 2.0: Docker in LXD +================================== + +This is the seventh blog post [in this series about LXD 2.0][0]. + +![](https://linuxcontainers.org/static/img/containers.png) + +### Why run Docker inside LXD + +As I briefly covered in the [first post of this series][1], LXD’s focus is system containers. That is, we run a full unmodified Linux distribution inside our containers. LXD for all intent and purposes doesn’t care about the workload running in the container. It just sets up the container namespaces and security policies, then spawns /sbin/init and waits for the container to stop. + +Application containers such as those implemented by Docker or Rkt are pretty different in that they are used to distribute applications, will typically run a single main process inside them and be much more ephemeral than a LXD container. + +Those two container types aren’t mutually exclusive and we certainly see the value of using Docker containers to distribute applications. That’s why we’ve been working hard over the past year to make it possible to run Docker inside LXD. + +This means that with Ubuntu 16.04 and LXD 2.0, you can create containers for your users who will then be able to connect into them just like a normal Ubuntu system and then run Docker to install the services and applications they want. + +### Requirements + +There are a lot of moving pieces to make all of this working and we got it all included in Ubuntu 16.04: + +- A kernel with CGroup namespace support (4.4 Ubuntu or 4.6 mainline) +- LXD 2.0 using LXC 2.0 and LXCFS 2.0 +- A custom version of Docker (or one built with all the patches that we submitted) +- A Docker image which behaves when confined by user namespaces, or alternatively make the parent LXD container a privileged container (security.privileged=true) + +### Running a basic Docker workload + +Enough talking, lets run some Docker containers! + +First of all, you need an Ubuntu 16.04 container which you can get with: + +``` +lxc launch ubuntu-daily:16.04 docker -p default -p docker +``` + +The “-p default -p docker” instructs LXD to apply both the “default” and “docker” profiles to the container. The default profile contains the basic network configuration while the docker profile tells LXD to load a few required kernel modules and set up some mounts for the container. The docker profile also enables container nesting. + +Now lets make sure the container is up to date and install docker: + +``` +lxc exec docker -- apt update +lxc exec docker -- apt dist-upgrade -y +lxc exec docker -- apt install docker.io -y +``` + +And that’s it! You’ve got Docker installed and running in your container. +Now lets start a basic web service made of two Docker containers: + +``` +stgraber@dakara:~$ lxc exec docker -- docker run --detach --name app carinamarina/hello-world-app +Unable to find image 'carinamarina/hello-world-app:latest' locally +latest: Pulling from carinamarina/hello-world-app +efd26ecc9548: Pull complete +a3ed95caeb02: Pull complete +d1784d73276e: Pull complete +72e581645fc3: Pull complete +9709ddcc4d24: Pull complete +2d600f0ec235: Pull complete +c4cf94f61cbd: Pull complete +c40f2ab60404: Pull complete +e87185df6de7: Pull complete +62a11c66eb65: Pull complete +4c5eea9f676d: Pull complete +498df6a0d074: Pull complete +Digest: sha256:6a159db50cb9c0fbe127fb038ed5a33bb5a443fcdd925ec74bf578142718f516 +Status: Downloaded newer image for carinamarina/hello-world-app:latest +c8318f0401fb1e119e6c5bb23d1e706e8ca080f8e44b42613856ccd0bf8bfb0d + +stgraber@dakara:~$ lxc exec docker -- docker run --detach --name web --link app:helloapp -p 80:5000 carinamarina/hello-world-web +Unable to find image 'carinamarina/hello-world-web:latest' locally +latest: Pulling from carinamarina/hello-world-web +efd26ecc9548: Already exists +a3ed95caeb02: Already exists +d1784d73276e: Already exists +72e581645fc3: Already exists +9709ddcc4d24: Already exists +2d600f0ec235: Already exists +c4cf94f61cbd: Already exists +c40f2ab60404: Already exists +e87185df6de7: Already exists +f2d249ff479b: Pull complete +97cb83fe7a9a: Pull complete +d7ce7c58a919: Pull complete +Digest: sha256:c31cf04b1ab6a0dac40d0c5e3e64864f4f2e0527a8ba602971dab5a977a74f20 +Status: Downloaded newer image for carinamarina/hello-world-web:latest +d7b8963401482337329faf487d5274465536eebe76f5b33c89622b92477a670f +``` + +With those two Docker containers now running, we can then get the IP address of our LXD container and access the service! + +``` +stgraber@dakara:~$ lxc list ++--------+---------+----------------------+----------------------------------------------+------------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++--------+---------+----------------------+----------------------------------------------+------------+-----------+ +| docker | RUNNING | 172.17.0.1 (docker0) | 2001:470:b368:4242:216:3eff:fe55:45f4 (eth0) | PERSISTENT | 0 | +| | | 10.178.150.73 (eth0) | | | | ++--------+---------+----------------------+----------------------------------------------+------------+-----------+ + +stgraber@dakara:~$ curl http://10.178.150.73 +The linked container said... "Hello World!" +``` + +### Conclusion + +That’s it! It’s really that simple to run Docker containers inside a LXD container. + +Now as I mentioned earlier, not all Docker images will behave as well as my example, that’s typically because of the extra confinement that comes with LXD, specifically the user namespace. + +Only the overlayfs storage driver of Docker works in this mode. That storage driver may come with its own set of limitation which may further limit how many images will work in this environment. + +If your workload doesn’t work properly and you trust the user inside the LXD container, you can try: + +``` +lxc config set docker security.privileged true +lxc restart docker +``` + +That will de-activate the user namespace and will run the container in privileged mode. + +Note however that in this mode, root inside the container is the same uid as root on the host. There are a number of known ways for users to escape such containers and gain root privileges on the host, so you should only ever do that if you’d trust the user inside your LXD container with root privileges on the host. + +### Extra information + +The main LXD website is at: +Development happens on Github at: +Mailing-list support happens on: +IRC support happens in: #lxcontainers on irc.freenode.net + + +-------------------------------------------------------------------------------- + +via: https://www.stgraber.org/2016/04/13/lxd-2-0-docker-in-lxd-712/ + +作者:[Stéphane Graber][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.stgraber.org/author/stgraber/ +[0]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[1]: https://www.stgraber.org/2016/03/11/lxd-2-0-introduction-to-lxd-112/ +[2]: https://linuxcontainers.org/lxd/try-it/ diff --git a/sources/tech/LXD/Part 8 - LXD 2.0--LXD in LXD.md b/sources/tech/LXD/Part 8 - LXD 2.0--LXD in LXD.md new file mode 100644 index 0000000000..85d9873313 --- /dev/null +++ b/sources/tech/LXD/Part 8 - LXD 2.0--LXD in LXD.md @@ -0,0 +1,126 @@ +Part 8 - LXD 2.0: LXD in LXD +============================== + +This is the eighth blog post [in this series about LXD 2.0][0]. + +![](https://linuxcontainers.org/static/img/containers.png) + +### Introduction + +In the previous post I covered how to run [Docker inside LXD][1] which is a good way to get access to the portfolio of application provided by Docker while running in the safety of the LXD environment. + +One use case I mentioned was offering a LXD container to your users and then have them use their container to run Docker. Well, what if they themselves want to run other Linux distributions inside their container using LXD, or even allow another group of people to have access to a Linux system by running a container for them? + +Turns out, LXD makes it very simple to allow your users to run nested containers. + +### Nesting LXD + +The most simple case can be shown by using an Ubuntu 16.04 image. Ubuntu 16.04 cloud images come with LXD pre-installed. The daemon itself isn’t running as it’s socket-activated so it doesn’t use any resources until you actually talk to it. + +So lets start an Ubuntu 16.04 container with nesting enabled: + +``` +lxc launch ubuntu-daily:16.04 c1 -c security.nesting=true +``` + +You can also set the security.nesting key on an existing container with: + +``` +lxc config set security.nesting true +``` + +Or for all containers using a particular profile with: + +``` +lxc profile set security.nesting true +``` + +With that container started, you can now get a shell inside it, configure LXD and spawn a container: + +``` +stgraber@dakara:~$ lxc launch ubuntu-daily:16.04 c1 -c security.nesting=true +Creating c1 +Starting c1 + +stgraber@dakara:~$ lxc exec c1 bash +root@c1:~# lxd init +Name of the storage backend to use (dir or zfs): dir + +We detected that you are running inside an unprivileged container. +This means that unless you manually configured your host otherwise, +you will not have enough uid and gid to allocate to your containers. + +LXD can re-use your container's own allocation to avoid the problem. +Doing so makes your nested containers slightly less safe as they could +in theory attack their parent container and gain more privileges than +they otherwise would. + +Would you like to have your containers share their parent's allocation (yes/no)? yes +Would you like LXD to be available over the network (yes/no)? no +Do you want to configure the LXD bridge (yes/no)? yes +Warning: Stopping lxd.service, but it can still be activated by: + lxd.socket +LXD has been successfully configured. + +root@c1:~# lxc launch ubuntu:14.04 trusty +Generating a client certificate. This may take a minute... +If this is your first time using LXD, you should also run: sudo lxd init + +Creating trusty +Retrieving image: 100% +Starting trusty + +root@c1:~# lxc list ++--------+---------+-----------------------+----------------------------------------------+------------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++--------+---------+-----------------------+----------------------------------------------+------------+-----------+ +| trusty | RUNNING | 10.153.141.124 (eth0) | fd7:f15d:d1d6:da14:216:3eff:fef1:4002 (eth0) | PERSISTENT | 0 | ++--------+---------+-----------------------+----------------------------------------------+------------+-----------+ +root@c1:~# +``` + +It really is that simple! + +### The online demo server + +As this post is pretty short, I figured I would spend a bit of time to talk about the [demo server][2] we’re running. We also just reached the 10000 sessions mark earlier today! + +That server is basically just a normal LXD running inside a pretty beefy virtual machine with a tiny daemon implementing the REST API used by our website. + +When you accept the terms of service, a new LXD container is created for you with security.nesting enabled as we saw above. You are then attached to that container as you would when using “lxc exec” except that we’re doing it using websockets and javascript. + +The containers you then create inside this environment are all nested LXD containers. +You can then nest even further in there if you want to. + +We are using the whole range of [LXD resource limitations][3] to prevent one user’s actions from impacting the others and pretty closely monitor the server for any sign of abuse. + +If you want to run your own similar server, you can grab the code for our website and the daemon with: + +``` +git clone https://github.com/lxc/linuxcontainers.org +git clone https://github.com/lxc/lxd-demo-server +``` + +### Extra information + +The main LXD website is at: +Development happens on Github at: +Mailing-list support happens on: +IRC support happens in: #lxcontainers on irc.freenode.net + + +-------------------------------------------------------------------------------- + +via: https://www.stgraber.org/2016/04/14/lxd-2-0-lxd-in-lxd-812/ + +作者:[Stéphane Graber][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.stgraber.org/author/stgraber/ +[0]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[1]: https://www.stgraber.org/2016/04/13/lxd-2-0-docker-in-lxd-712/ +[2]: https://linuxcontainers.org/lxd/try-it/ +[3]: https://www.stgraber.org/2016/03/26/lxd-2-0-resource-control-412/ diff --git a/sources/tech/LXD/Part 9 - LXD 2.0--Live migration.md b/sources/tech/LXD/Part 9 - LXD 2.0--Live migration.md new file mode 100644 index 0000000000..51f9c8b1a7 --- /dev/null +++ b/sources/tech/LXD/Part 9 - LXD 2.0--Live migration.md @@ -0,0 +1,328 @@ +Part 9 - LXD 2.0: Live migration +================================= + +This is the ninth blog post [in this series about LXD 2.0][0]. + +![](https://linuxcontainers.org/static/img/containers.png) + +### Introduction + +One of the very exciting feature of LXD 2.0, albeit experimental, is the support for container checkpoint and restore. + +Simply put, checkpoint/restore means that the running container state can be serialized down to disk and then restored, either on the same host as a stateful snapshot of the container or on another host which equates to live migration. + +### Requirements + +To have access to container live migration and stateful snapshots, you need the following: + +- A very recent Linux kernel, 4.4 or higher. +- CRIU 2.0, possibly with some cherry-picked commits depending on your exact kernel configuration. +- Run LXD directly on the host. It’s not possible to use those features with container nesting. +- For migration, the target machine must at least implement the instruction set of the source, the target kernel must at least offer the same syscalls as the source and any kernel filesystem which was mounted on the source must also be mountable on the target. + +All the needed dependencies are provided by Ubuntu 16.04 LTS, in which case, all you need to do is install CRIU itself: + +``` +apt install criu +``` + +### Using the thing + +#### Stateful snapshots + +A normal container snapshot looks like: + +``` +stgraber@dakara:~$ lxc snapshot c1 first +stgraber@dakara:~$ lxc info c1 | grep first + first (taken at 2016/04/25 19:35 UTC) (stateless) + ``` + +A stateful snapshot instead looks like: + +``` +stgraber@dakara:~$ lxc snapshot c1 second --stateful +stgraber@dakara:~$ lxc info c1 | grep second + second (taken at 2016/04/25 19:36 UTC) (stateful) + ``` + +This means that all the container runtime state was serialized to disk and included as part of the snapshot. Restoring one such snapshot is done as you would a stateless one: + +``` +stgraber@dakara:~$ lxc restore c1 second +stgraber@dakara:~$ +``` + +#### Stateful stop/start + +Say you want to reboot your server for a kernel update or similar maintenance. Rather than have to wait for all the containers to start from scratch after reboot, you can do: + +``` +stgraber@dakara:~$ lxc stop c1 --stateful +``` + +The container state will be written to disk and then picked up the next time you start it. + +You can even look at what the state looks like: + +``` +root@dakara:~# tree /var/lib/lxd/containers/c1/rootfs/state/ +/var/lib/lxd/containers/c1/rootfs/state/ +├── cgroup.img +├── core-101.img +├── core-102.img +├── core-107.img +├── core-108.img +├── core-109.img +├── core-113.img +├── core-114.img +├── core-122.img +├── core-125.img +├── core-126.img +├── core-127.img +├── core-183.img +├── core-1.img +├── core-245.img +├── core-246.img +├── core-50.img +├── core-52.img +├── core-95.img +├── core-96.img +├── core-97.img +├── core-98.img +├── dump.log +├── eventfd.img +├── eventpoll.img +├── fdinfo-10.img +├── fdinfo-11.img +├── fdinfo-12.img +├── fdinfo-13.img +├── fdinfo-14.img +├── fdinfo-2.img +├── fdinfo-3.img +├── fdinfo-4.img +├── fdinfo-5.img +├── fdinfo-6.img +├── fdinfo-7.img +├── fdinfo-8.img +├── fdinfo-9.img +├── fifo-data.img +├── fifo.img +├── filelocks.img +├── fs-101.img +├── fs-113.img +├── fs-122.img +├── fs-183.img +├── fs-1.img +├── fs-245.img +├── fs-246.img +├── fs-50.img +├── fs-52.img +├── fs-95.img +├── fs-96.img +├── fs-97.img +├── fs-98.img +├── ids-101.img +├── ids-113.img +├── ids-122.img +├── ids-183.img +├── ids-1.img +├── ids-245.img +├── ids-246.img +├── ids-50.img +├── ids-52.img +├── ids-95.img +├── ids-96.img +├── ids-97.img +├── ids-98.img +├── ifaddr-9.img +├── inetsk.img +├── inotify.img +├── inventory.img +├── ip6tables-9.img +├── ipcns-var-10.img +├── iptables-9.img +├── mm-101.img +├── mm-113.img +├── mm-122.img +├── mm-183.img +├── mm-1.img +├── mm-245.img +├── mm-246.img +├── mm-50.img +├── mm-52.img +├── mm-95.img +├── mm-96.img +├── mm-97.img +├── mm-98.img +├── mountpoints-12.img +├── netdev-9.img +├── netlinksk.img +├── netns-9.img +├── netns-ct-9.img +├── netns-exp-9.img +├── packetsk.img +├── pagemap-101.img +├── pagemap-113.img +├── pagemap-122.img +├── pagemap-183.img +├── pagemap-1.img +├── pagemap-245.img +├── pagemap-246.img +├── pagemap-50.img +├── pagemap-52.img +├── pagemap-95.img +├── pagemap-96.img +├── pagemap-97.img +├── pagemap-98.img +├── pages-10.img +├── pages-11.img +├── pages-12.img +├── pages-13.img +├── pages-1.img +├── pages-2.img +├── pages-3.img +├── pages-4.img +├── pages-5.img +├── pages-6.img +├── pages-7.img +├── pages-8.img +├── pages-9.img +├── pipes-data.img +├── pipes.img +├── pstree.img +├── reg-files.img +├── remap-fpath.img +├── route6-9.img +├── route-9.img +├── rule-9.img +├── seccomp.img +├── sigacts-101.img +├── sigacts-113.img +├── sigacts-122.img +├── sigacts-183.img +├── sigacts-1.img +├── sigacts-245.img +├── sigacts-246.img +├── sigacts-50.img +├── sigacts-52.img +├── sigacts-95.img +├── sigacts-96.img +├── sigacts-97.img +├── sigacts-98.img +├── signalfd.img +├── stats-dump +├── timerfd.img +├── tmpfs-dev-104.tar.gz.img +├── tmpfs-dev-109.tar.gz.img +├── tmpfs-dev-110.tar.gz.img +├── tmpfs-dev-112.tar.gz.img +├── tmpfs-dev-114.tar.gz.img +├── tty.info +├── unixsk.img +├── userns-13.img +└── utsns-11.img + +0 directories, 154 files +``` + +Restoring the container can be done with a simple: + +``` +stgraber@dakara:~$ lxc start c1 +``` + +### Live migration + +Live migration is basically the same as the stateful stop/start above, except that the container directory and configuration happens to be moved to another machine too. + +``` +stgraber@dakara:~$ lxc list c1 ++------+---------+-----------------------+----------------------------------------------+------------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++------+---------+-----------------------+----------------------------------------------+------------+-----------+ +| c1 | RUNNING | 10.178.150.197 (eth0) | 2001:470:b368:4242:216:3eff:fe19:27b0 (eth0) | PERSISTENT | 2 | ++------+---------+-----------------------+----------------------------------------------+------------+-----------+ + +stgraber@dakara:~$ lxc list s-tollana: ++------+-------+------+------+------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++------+-------+------+------+------+-----------+ + +stgraber@dakara:~$ lxc move c1 s-tollana: + +stgraber@dakara:~$ lxc list c1 ++------+-------+------+------+------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++------+-------+------+------+------+-----------+ + +stgraber@dakara:~$ lxc list s-tollana: ++------+---------+-----------------------+----------------------------------------------+------------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++------+---------+-----------------------+----------------------------------------------+------------+-----------+ +| c1 | RUNNING | 10.178.150.197 (eth0) | 2001:470:b368:4242:216:3eff:fe19:27b0 (eth0) | PERSISTENT | 2 | ++------+---------+-----------------------+----------------------------------------------+------------+-----------+ +``` + +### Limitations + +As I said before, checkpoint/restore of containers is still pretty new and we’re still very much working on this feature, fixing issues as we are made aware of them. We do need more people trying this feature and sending us feedback, I would however not recommend using this in production just yet. + +The current list of issues we’re tracking is [available on Launchpad][1]. + +We expect a basic Ubuntu container with a few services to work properly with CRIU in Ubuntu 16.04. However more complex containers, using device passthrough, complex network services or special storage configurations are likely to fail. + +Whenever possible, CRIU will fail at dump time, rather than at restore time. In such cases, the source container will keep running, the snapshot or migration will simply fail and a log file will be generated for debugging. + +In rare cases, CRIU fails to restore the container, in which case the source container will still be around but will be stopped and will have to be manually restarted. + +### Sending bug reports + +We’re tracking bugs related to checkpoint/restore against the CRIU Ubuntu package on Launchpad. Most of the work to fix those bugs will then happen upstream either on CRIU itself or the Linux kernel, but it’s easier for us to track things this way. + +To file a new bug report, head here. + +Please make sure to include: + +The command you ran and the error message as displayed to you + +- Output of “lxc info” (*) +- Output of “lxc info ” +- Output of “lxc config show –expanded ” +- Output of “dmesg” (*) +- Output of “/proc/self/mountinfo” (*) +- Output of “lxc exec — cat /proc/self/mountinfo” +- Output of “uname -a” (*) +- The content of /var/log/lxd.log (*) +- The content of /etc/default/lxd-bridge (*) +- A tarball of /var/log/lxd// (*) + +If reporting a migration bug as opposed to a stateful snapshot or stateful stop bug, please include the data for both the source and target for any of the above which has been marked with a (*). + +### Extra information + +The CRIU website can be found at: + +The main LXD website is at: + +Development happens on Github at: + +Mailing-list support happens on: + +IRC support happens in: #lxcontainers on irc.freenode.net + + +-------------------------------------------------------------------------------- + +via: https://www.stgraber.org/2016/03/19/lxd-2-0-your-first-lxd-container-312/ + +作者:[Stéphane Graber][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.stgraber.org/author/stgraber/ +[0]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[1]: https://bugs.launchpad.net/ubuntu/+source/criu/+bugs +[3]: https://launchpad.net/ubuntu/+source/criu/+filebug?no-redirect diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 10--Yum Package Management, Automating Tasks with Cron and Monitoring System Logs.md b/sources/tech/RHCSA Series/RHCSA Series--Part 10--Yum Package Management, Automating Tasks with Cron and Monitoring System Logs.md deleted file mode 100644 index 307ec72515..0000000000 --- a/sources/tech/RHCSA Series/RHCSA Series--Part 10--Yum Package Management, Automating Tasks with Cron and Monitoring System Logs.md +++ /dev/null @@ -1,198 +0,0 @@ -[xiqingongzi translating] -RHCSA Series: Yum Package Management, Automating Tasks with Cron and Monitoring System Logs – Part 10 -================================================================================ -In this article we will review how to install, update, and remove packages in Red Hat Enterprise Linux 7. We will also cover how to automate tasks using cron, and will finish this guide explaining how to locate and interpret system logs files with the focus of teaching you why all of these are essential skills for every system administrator. - -![Yum Package Management Cron Jobs Log Monitoring Linux](http://www.tecmint.com/wp-content/uploads/2015/05/Yum-Package-Management-Cron-Job-Log-Monitoring-Linux.jpg) - -RHCSA: Yum Package Management, Cron Job Scheduling and Log Monitoring – Part 10 - -### Managing Packages Via Yum ### - -To install a package along with all its dependencies that are not already installed, you will use: - - # yum -y install package_name(s) - -Where package_name(s) represent at least one real package name. - -For example, to install httpd and mlocate (in that order), type. - - # yum -y install httpd mlocate - -**Note**: That the letter y in the example above bypasses the confirmation prompts that yum presents before performing the actual download and installation of the requested programs. You can leave it out if you want. - -By default, yum will install the package with the architecture that matches the OS architecture, unless overridden by appending the package architecture to its name. - -For example, on a 64 bit system, yum install package will install the x86_64 version of package, whereas yum install package.x86 (if available) will install the 32-bit one. - -There will be times when you want to install a package but don’t know its exact name. The search all or search options can search the currently enabled repositories for a certain keyword in the package name and/or in its description as well, respectively. - -For example, - - # yum search log - -will search the installed repositories for packages with the word log in their names and summaries, whereas - - # yum search all log - -will look for the same keyword in the package description and url fields as well. - -Once the search returns a package listing, you may want to display further information about some of them before installing. That is when the info option will come in handy: - - # yum info logwatch - -![Search Package Information](http://www.tecmint.com/wp-content/uploads/2015/05/Search-Package-Information.png) - -Search Package Information - -You can regularly check for updates with the following command: - - # yum check-update - -The above command will return all the installed packages for which an update is available. In the example shown in the image below, only rhel-7-server-rpms has an update available: - -![Check For Package Updates](http://www.tecmint.com/wp-content/uploads/2015/05/Check-For-Updates.png) - -Check For Package Updates - -You can then update that package alone with, - - # yum update rhel-7-server-rpms - -If there are several packages that can be updated, yum update will update all of them at once. - -Now what happens when you know the name of an executable, such as ps2pdf, but don’t know which package provides it? You can find out with `yum whatprovides “*/[executable]”`: - - # yum whatprovides “*/ps2pdf” - -![Find Package Belongs to Which Package](http://www.tecmint.com/wp-content/uploads/2015/05/Find-Package-Information.png) - -Find Package Belongs to Which Package - -Now, when it comes to removing a package, you can do so with yum remove package. Easy, huh? This goes to show that yum is a complete and powerful package manager. - - # yum remove httpd - -Read Also: [20 Yum Commands to Manage RHEL 7 Package Management][1] - -### Good Old Plain RPM ### - -RPM (aka RPM Package Manager, or originally RedHat Package Manager) can also be used to install or update packages when they come in form of standalone `.rpm` packages. - -It is often utilized with the `-Uvh` flags to indicate that it should install the package if it’s not already present or attempt to update it if it’s installed `(-U)`, producing a verbose output `(-v)` and a progress bar with hash marks `(-h)` while the operation is being performed. For example, - - # rpm -Uvh package.rpm - -Another typical use of rpm is to produce a list of currently installed packages with code>rpm -qa (short for query all): - - # rpm -qa - -![Query All RPM Packages](http://www.tecmint.com/wp-content/uploads/2015/05/Query-All-RPM-Packages.png) - -Query All RPM Packages - -Read Also: [20 RPM Commands to Install Packages in RHEL 7][2] - -### Scheduling Tasks using Cron ### - -Linux and other Unix-like operating systems include a tool called cron that allows you to schedule tasks (i.e. commands or shell scripts) to run on a periodic basis. Cron checks every minute the /var/spool/cron directory for files which are named after accounts in /etc/passwd. - -When executing commands, any output is mailed to the owner of the crontab (or to the user specified in the MAILTO environment variable in the /etc/crontab, if it exists). - -Crontab files (which are created by typing crontab -e and pressing Enter) have the following format: - -![Crontab Entries](http://www.tecmint.com/wp-content/uploads/2015/05/Crontab-Format.png) - -Crontab Entries - -Thus, if we want to update the local file database (which is used by locate to find files by name or pattern) every second day of the month at 2:15 am, we need to add the following crontab entry: - - 15 02 2 * * /bin/updatedb - -The above crontab entry reads, “Run /bin/updatedb on the second day of the month, every month of the year, regardless of the day of the week, at 2:15 am”. As I’m sure you already guessed, the star symbol is used as a wildcard character. - -After adding a cron job, you can see that a file named root was added inside /var/spool/cron, as we mentioned earlier. That file lists all the tasks that the crond daemon should run: - - # ls -l /var/spool/cron - -![Check All Cron Jobs](http://www.tecmint.com/wp-content/uploads/2015/05/Check-All-Cron-Jobs.png) - -Check All Cron Jobs - -In the above image, the current user’s crontab can be displayed either using cat /var/spool/cron/root or, - - # crontab -l - -If you need to run a task on a more fine-grained basis (for example, twice a day or three times each month), cron can also help you to do that. - -For example, to run /my/script on the 1st and 15th of each month and send any output to /dev/null, you can add two crontab entries as follows: - - 01 00 1 * * /myscript > /dev/null 2>&1 - 01 00 15 * * /my/script > /dev/null 2>&1 - -But in order for the task to be easier to maintain, you can combine both entries into one: - - 01 00 1,15 * * /my/script > /dev/null 2>&1 - -Following the previous example, we can run /my/other/script at 1:30 am on the first day of the month every three months: - - 30 01 1 1,4,7,10 * /my/other/script > /dev/null 2>&1 - -But when you have to repeat a certain task every “x” minutes, hours, days, or months, you can divide the right position by the desired frequency. The following crontab entry has the exact same meaning as the previous one: - - 30 01 1 */3 * /my/other/script > /dev/null 2>&1 - -Or perhaps you need to run a certain job on a fixed frequency or after the system boots, for example. You can use one of the following string instead of the five fields to indicate the exact time when you want your job to run: - - @reboot Run when the system boots. - @yearly Run once a year, same as 00 00 1 1 *. - @monthly Run once a month, same as 00 00 1 * *. - @weekly Run once a week, same as 00 00 * * 0. - @daily Run once a day, same as 00 00 * * *. - @hourly Run once an hour, same as 00 * * * *. - -Read Also: [11 Commands to Schedule Cron Jobs in RHEL 7][3] - -### Locating and Checking Logs ### - -System logs are located (and rotated) inside the /var/log directory. According to the Linux Filesystem Hierarchy Standard, this directory contains miscellaneous log files, which are written to it or an appropriate subdirectory (such as audit, httpd, or samba in the image below) by the corresponding daemons during system operation: - - # ls /var/log - -![Linux Log Files Location](http://www.tecmint.com/wp-content/uploads/2015/05/Linux-Log-Files.png) - -Linux Log Files Location - -Other interesting logs are [dmesg][4] (contains all messages from kernel ring buffer), secure (logs connection attempts that require user authentication), messages (system-wide messages) and wtmp (records of all user logins and logouts). - -Logs are very important in that they allow you to have a glimpse of what is going on at all times in your system, and what has happened in the past. They represent a priceless tool to troubleshoot and monitor a Linux server, and thus are often used with the `tail -f command` to display events, in real time, as they happen and are recorded in a log. - -For example, if you want to display kernel-related events, type the following command: - - # tail -f /var/log/dmesg - -Same if you want to view access to your web server: - - # tail -f /var/log/httpd/access.log - -### Summary ### - -If you know how to efficiently manage packages, schedule tasks, and where to look for information about the current and past operation of your system you can rest assure that you will not run into surprises very often. I hope this article has helped you learn or refresh your knowledge about these basic skills. - -Don’t hesitate to drop us a line using the contact form below if you have any questions or comments. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/yum-package-management-cron-job-scheduling-monitoring-linux-logs/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ -[2]:http://www.tecmint.com/20-practical-examples-of-rpm-commands-in-linux/ -[3]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/ -[4]:http://www.tecmint.com/dmesg-commands/ diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 12--Automate RHEL 7 Installations Using 'Kickstart'.md b/sources/tech/RHCSA Series/RHCSA Series--Part 12--Automate RHEL 7 Installations Using 'Kickstart'.md deleted file mode 100644 index 3d8b578a32..0000000000 --- a/sources/tech/RHCSA Series/RHCSA Series--Part 12--Automate RHEL 7 Installations Using 'Kickstart'.md +++ /dev/null @@ -1,144 +0,0 @@ -FSSlc translating - -RHCSA Series: Automate RHEL 7 Installations Using ‘Kickstart’ – Part 12 -================================================================================ -Linux servers are rarely standalone boxes. Whether it is in a datacenter or in a lab environment, chances are that you have had to install several machines that will interact one with another in some way. If you multiply the time that it takes to install Red Hat Enterprise Linux 7 manually on a single server by the number of boxes that you need to set up, this can lead to a rather lengthy effort that can be avoided through the use of an unattended installation tool known as kickstart. - -In this article we will show what you need to use kickstart utility so that you can forget about babysitting servers during the installation process. - -![Automatic Kickstart Installation of RHEL 7](http://www.tecmint.com/wp-content/uploads/2015/05/Automatic-Kickstart-Installation-of-RHEL-7.jpg) - -RHCSA: Automatic Kickstart Installation of RHEL 7 - -#### Introducing Kickstart and Automated Installations #### - -Kickstart is an automated installation method used primarily by Red Hat Enterprise Linux (and other Fedora spin-offs, such as CentOS, Oracle Linux, etc.) to execute unattended operating system installation and configuration. Thus, kickstart installations allow system administrators to have identical systems, as far as installed package groups and system configuration are concerned, while sparing them the hassle of having to manually install each of them. - -### Preparing for a Kickstart Installation ### - -To perform a kickstart installation, we need to follow these steps: - -1. Create a Kickstart file, a plain text file with several predefined configuration options. - -2. Make the Kickstart file available on removable media, a hard drive or a network location. The client will use the rhel-server-7.0-x86_64-boot.iso file, whereas you will need to make the full ISO image (rhel-server-7.0-x86_64-dvd.iso) available from a network resource, such as a HTTP of FTP server (in our present case, we will use another RHEL 7 box with IP 192.168.0.18). - -3. Start the Kickstart installation - -To create a kickstart file, login to your Red Hat Customer Portal account, and use the [Kickstart configuration tool][1] to choose the desired installation options. Read each one of them carefully before scrolling down, and choose what best fits your needs: - -![Kickstart Configuration Tool](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-Configuration-Tool.png) - -Kickstart Configuration Tool - -If you specify that the installation should be performed either through HTTP, FTP, or NFS, make sure the firewall on the server allows those services. - -Although you can use the Red Hat online tool to create a kickstart file, you can also create it manually using the following lines as reference. You will notice, for example, that the installation process will be in English, using the latin american keyboard layout and the America/Argentina/San_Luis time zone: - - lang en_US - keyboard la-latin1 - timezone America/Argentina/San_Luis --isUtc - rootpw $1$5sOtDvRo$In4KTmX7OmcOW9HUvWtfn0 --iscrypted - #platform x86, AMD64, or Intel EM64T - text - url --url=http://192.168.0.18//kickstart/media - bootloader --location=mbr --append="rhgb quiet crashkernel=auto" - zerombr - clearpart --all --initlabel - autopart - auth --passalgo=sha512 --useshadow - selinux --enforcing - firewall --enabled - firstboot --disable - %packages - @base - @backup-server - @print-server - %end - -In the online configuration tool, use 192.168.0.18 for HTTP Server and `/kickstart/tecmint.bin` for HTTP Directory in the Installation section after selecting HTTP as installation source. Finally, click the Download button at the right top corner to download the kickstart file. - -In the kickstart sample file above, you need to pay careful attention to. - - url --url=http://192.168.0.18//kickstart/media - -That directory is where you need to extract the contents of the DVD or ISO installation media. Before doing that, we will mount the ISO installation file in /media/rhel as a loop device: - - # mount -o loop /var/www/html/kickstart/rhel-server-7.0-x86_64-dvd.iso /media/rhel - -![Mount RHEL ISO Image](http://www.tecmint.com/wp-content/uploads/2015/05/Mount-RHEL-ISO-Image.png) - -Mount RHEL ISO Image - -Next, copy all the contents of /media/rhel to /var/www/html/kickstart/media: - - # cp -R /media/rhel /var/www/html/kickstart/media - -When you’re done, the directory listing and disk usage of /var/www/html/kickstart/media should look as follows: - -![Kickstart Media Files](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-media-Files.png) - -Kickstart Media Files - -Now we’re ready to kick off the kickstart installation. - -Regardless of how you choose to create the kickstart file, it’s always a good idea to check its syntax before proceeding with the installation. To do that, install the pykickstart package. - - # yum update && yum install pykickstart - -And then use the ksvalidator utility to check the file: - - # ksvalidator /var/www/html/kickstart/tecmint.bin - -If the syntax is correct, you will not get any output, whereas if there’s an error in the file, you will get a warning notice indicating the line where the syntax is not correct or unknown. - -### Performing a Kickstart Installation ### - -To start, boot your client using the rhel-server-7.0-x86_64-boot.iso file. When the initial screen appears, select Install Red Hat Enterprise Linux 7.0 and press the Tab key to append the following stanza and press Enter: - - # inst.ks=http://192.168.0.18/kickstart/tecmint.bin - -![RHEL Kickstart Installation](http://www.tecmint.com/wp-content/uploads/2015/05/RHEL-Kickstart-Installation.png) - -RHEL Kickstart Installation - -Where tecmint.bin is the kickstart file created earlier. - -When you press Enter, the automated installation will begin, and you will see the list of packages that are being installed (the number and the names will differ depending on your choice of programs and package groups): - -![Automatic Kickstart Installation of RHEL 7](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-Automatic-Installation.png) - -Automatic Kickstart Installation of RHEL 7 - -When the automated process ends, you will be prompted to remove the installation media and then you will be able to boot into your newly installed system: - -![RHEL 7 Boot Screen](http://www.tecmint.com/wp-content/uploads/2015/05/RHEL-7.png) - -RHEL 7 Boot Screen - -Although you can create your kickstart files manually as we mentioned earlier, you should consider using the recommended approach whenever possible. You can either use the online configuration tool, or the anaconda-ks.cfg file that is created by the installation process in root’s home directory. - -This file actually is a kickstart file, so you may want to install the first box manually with all the desired options (maybe modify the logical volumes layout or the file system on top of each one) and then use the resulting anaconda-ks.cfg file to automate the installation of the rest. - -In addition, using the online configuration tool or the anaconda-ks.cfg file to guide future installations will allow you to perform them using an encrypted root password out-of-the-box. - -### Conclusion ### - -Now that you know how to create kickstart files and how to use them to automate the installation of Red Hat Enterprise Linux 7 servers, you can forget about babysitting the installation process. This will give you time to do other things, or perhaps some leisure time if you’re lucky. - -Either way, let us know what you think about this article using the form below. Questions are also welcome! - -Read Also: [Automated Installations of Multiple RHEL/CentOS 7 Distributions using PXE and Kickstart][2] - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/automatic-rhel-installations-using-kickstart/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:https://access.redhat.com/labs/kickstartconfig/ -[2]:http://www.tecmint.com/multiple-centos-installations-using-kickstart/ diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 13--Mandatory Access Control Essentials with SELinux in RHEL 7.md b/sources/tech/RHCSA Series/RHCSA Series--Part 13--Mandatory Access Control Essentials with SELinux in RHEL 7.md deleted file mode 100644 index 1a0d08df8f..0000000000 --- a/sources/tech/RHCSA Series/RHCSA Series--Part 13--Mandatory Access Control Essentials with SELinux in RHEL 7.md +++ /dev/null @@ -1,176 +0,0 @@ -RHCSA Series: Mandatory Access Control Essentials with SELinux in RHEL 7 – Part 13 -================================================================================ -During this series we have explored in detail at least two access control methods: standard ugo/rwx permissions ([Manage Users and Groups – Part 3][1]) and access control lists ([Configure ACL’s on File Systems – Part 7][2]). - -![RHCSA Exam: SELinux Essentials and Control FileSystem Access](http://www.tecmint.com/wp-content/uploads/2015/06/SELinux-Control-File-System-Access.png) - -RHCSA Exam: SELinux Essentials and Control FileSystem Access - -Although necessary as first level permissions and access control mechanisms, they have some limitations that are addressed by Security Enhanced Linux (aka SELinux for short). - -One of such limitations is that a user can expose a file or directory to a security breach through a poorly elaborated chmod command and thus cause an unexpected propagation of access rights. As a result, any process started by that user can do as it pleases with the files owned by the user, where finally a malicious or otherwise compromised software can achieve root-level access to the entire system. - -With those limitations in mind, the United States National Security Agency (NSA) first devised SELinux, a flexible mandatory access control method, to restrict the ability of processes to access or perform other operations on system objects (such as files, directories, network ports, etc) to the least permission model, which can be modified later as needed. In few words, each element of the system is given only the access required to function. - -In RHEL 7, SELinux is incorporated into the kernel itself and is enabled in Enforcing mode by default. In this article we will explain briefly the basic concepts associated with SELinux and its operation. - -### SELinux Modes ### - -SELinux can operate in three different ways: - -- Enforcing: SELinux denies access based on SELinux policy rules, a set of guidelines that control the security engine. -- Permissive: SELinux does not deny access, but denials are logged for actions that would have been denied if running in enforcing mode. -- Disabled (self-explanatory). - -The `getenforce` command displays the current mode of SELinux, whereas `setenforce` (followed by a 1 or a 0) is used to change the mode to Enforcing or Permissive, respectively, during the current session only. - -In order to achieve persistence across logouts and reboots, you will need to edit the `/etc/selinux/config` file and set the SELINUX variable to either enforcing, permissive, or disabled: - - # getenforce - # setenforce 0 - # getenforce - # setenforce 1 - # getenforce - # cat /etc/selinux/config - -![Set SELinux Mode](http://www.tecmint.com/wp-content/uploads/2015/05/Set-SELinux-Mode.png) - -Set SELinux Mode - -Typically you will use setenforce to toggle between SELinux modes (enforcing to permissive and back) as a first troubleshooting step. If SELinux is currently set to enforcing while you’re experiencing a certain problem, and the same goes away when you set it to permissive, you can be confident you’re looking at a SELinux permissions issue. - -### SELinux Contexts ### - -A SELinux context consists of an access control environment where decisions are made based on SELinux user, role, and type (and optionally a level): - -- A SELinux user complements a regular Linux user account by mapping it to a SELinux user account, which in turn is used in the SELinux context for processes in that session, in order to explicitly define their allowed roles and levels. -- The concept of role acts as an intermediary between domains and SELinux users in that it defines which process domains and file types can be accessed. This will shield your system against vulnerability to privilege escalation attacks. -- A type defines an SELinux file type or an SELinux process domain. Under normal circumstances, processes are prevented from accessing files that other processes use, and and from accessing other processes, thus access is only allowed if a specific SELinux policy rule exists that allows it. - -Let’s see how all of that works through the following examples. - -**EXAMPLE 1: Changing the default port for the sshd daemon** - -In [Securing SSH – Part 8][3] we explained that changing the default port where sshd listens on is one of the first security measures to secure your server against external attacks. Let’s edit the `/etc/ssh/sshd_config` file and set the port to 9999: - - Port 9999 - -Save the changes, and restart sshd: - - # systemctl restart sshd - # systemctl status sshd - -![Change SSH Port](http://www.tecmint.com/wp-content/uploads/2015/05/Change-SSH-Port.png) - -Restart SSH Service - -As you can see, sshd has failed to start. But what happened? - -A quick inspection of `/var/log/audit/audit.log` indicates that sshd has been denied permissions to start on port 9999 (SELinux log messages include the word “AVC” so that they might be easily identified from other messages) because that is a reserved port for the JBoss Management service: - - # cat /var/log/audit/audit.log | grep AVC | tail -1 - -![Inspect SSH Logs](http://www.tecmint.com/wp-content/uploads/2015/05/Inspect-SSH-Logs.png) - -Inspect SSH Logs - -At this point you could disable SELinux (but don’t!) as explained earlier and try to start sshd again, and it should work. However, the semanage utility can tell us what we need to change in order for us to be able to start sshd in whatever port we choose without issues. - -Run, - - # semanage port -l | grep ssh - -to get a list of the ports where SELinux allows sshd to listen on. - -![Semanage Tool](http://www.tecmint.com/wp-content/uploads/2015/05/SELinux-Permission.png) - -Semanage Tool - -So let’s change the port in /etc/ssh/sshd_config to Port 9998, add the port to the ssh_port_t context, and then restart the service: - - # semanage port -a -t ssh_port_t -p tcp 9998 - # systemctl restart sshd - # systemctl is-active sshd - -![Semanage Add Port](http://www.tecmint.com/wp-content/uploads/2015/05/Semenage-Add-Port.png) - -Semanage Add Port - -As you can see, the service was started successfully this time. This example illustrates the fact that SELinux controls the TCP port number to its own port type internal definitions. - -**EXAMPLE 2: Allowing httpd to send access sendmail** - -This is an example of SELinux managing a process accessing another process. If you were to implement mod_security and mod_evasive along with Apache in your RHEL 7 server, you need to allow httpd to access sendmail in order to send a mail notification in the wake of a (D)DoS attack. In the following command, omit the -P flag if you do not want the change to be persistent across reboots. - - # semanage boolean -1 | grep httpd_can_sendmail - # setsebool -P httpd_can_sendmail 1 - # semanage boolean -1 | grep httpd_can_sendmail - -![Allow Apache to Send Mails](http://www.tecmint.com/wp-content/uploads/2015/05/Allow-Apache-to-Send-Mails.png) - -Allow Apache to Send Mails - -As you can tell from the above example, SELinux boolean settings (or just booleans) are true / false rules embedded into SELinux policies. You can list all the booleans with `semanage boolean -l`, and alternatively pipe it to grep in order to filter the output. - -**EXAMPLE 3: Serving a static site from a directory other than the default one** - -Suppose you are serving a static website using a different directory than the default one (`/var/www/html`), say /websites (this could be the case if you’re storing your web files in a shared network drive, for example, and need to mount it at /websites). - -a). Create an index.html file inside /websites with the following contents: - - -

SELinux test

- - -If you do, - - # ls -lZ /websites/index.html - -you will see that the index.html file has been labeled with the default_t SELinux type, which Apache can’t access: - -![Check SELinux File Permission](http://www.tecmint.com/wp-content/uploads/2015/05/Check-File-Permssion.png) - -Check SELinux File Permission - -b). Change the DocumentRoot directive in `/etc/httpd/conf/httpd.conf` to /websites and don’t forget to update the corresponding Directory block. Then, restart Apache. - -c). Browse to `http://`, and you should get a 503 Forbidden HTTP response. - -d). Next, change the label of /websites, recursively, to the httpd_sys_content_t type in order to grant Apache read-only access to that directory and its contents: - - # semanage fcontext -a -t httpd_sys_content_t "/websites(/.*)?" - -e). Finally, apply the SELinux policy created in d): - - # restorecon -R -v /websites - -Now restart Apache and browse to `http://` again and you will see the html file displayed correctly: - -![Verify Apache Page](http://www.tecmint.com/wp-content/uploads/2015/05/08part13.png) - -Verify Apache Page - -### Summary ### - -In this article we have gone through the basics of SELinux. Note that due to the vastness of the subject, a full detailed explanation is not possible in a single article, but we believe that the principles outlined in this guide will help you to move on to more advanced topics should you wish to do so. - -If I may, let me recommend two essential resources to start with: the [NSA SELinux page][4] and the [RHEL 7 SELinux User’s and Administrator’s][5] guide. - -Don’t hesitate to let us know if you have any questions or comments. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/selinux-essentials-and-control-filesystem-access/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/rhcsa-exam-manage-users-and-groups -[2]:http://www.tecmint.com/rhcsa-exam-configure-acls-and-mount-nfs-samba-shares/ -[3]:http://www.tecmint.com/rhcsa-series-secure-ssh-set-hostname-enable-network-services-in-rhel-7/ -[4]:https://www.nsa.gov/research/selinux/index.shtml -[5]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/SELinux_Users_and_Administrators_Guide/part_I-SELinux.html \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 14--Setting Up LDAP-based Authentication in RHEL 7.md b/sources/tech/RHCSA Series/RHCSA Series--Part 14--Setting Up LDAP-based Authentication in RHEL 7.md deleted file mode 100644 index 36bf319b19..0000000000 --- a/sources/tech/RHCSA Series/RHCSA Series--Part 14--Setting Up LDAP-based Authentication in RHEL 7.md +++ /dev/null @@ -1,275 +0,0 @@ -RHCSA Series: Setting Up LDAP-based Authentication in RHEL 7 – Part 14 -================================================================================ -We will begin this article by outlining some LDAP basics (what it is, where it is used and why) and show how to set up a LDAP server and configure a client to authenticate against it using Red Hat Enterprise Linux 7 systems. - -![Setup LDAP Server and Client Authentication](http://www.tecmint.com/wp-content/uploads/2015/06/setup-ldap-server-and-configure-client-authentication.png) - -RHCSA Series: Setup LDAP Server and Client Authentication – Part 14 - -As we will see, there are several other possible application scenarios, but in this guide we will focus entirely on LDAP-based authentication. In addition, please keep in mind that due to the vastness of the subject, we will only cover its basics here, but you can refer to the documentation outlined in the summary for more in-depth details. - -For the same reason, you will note that I have decided to leave out several references to man pages of LDAP tools for the sake of brevity, but the corresponding explanations are at a fingertip’s distance (man ldapadd, for example). - -That said, let’s get started. - -**Our Testing Environment** - -Our test environment consists of two RHEL 7 boxes: - - Server: 192.168.0.18. FQDN: rhel7.mydomain.com - Client: 192.168.0.20. FQDN: ldapclient.mydomain.com - -If you want, you can use the machine installed in [Part 12: Automate RHEL 7 installations][1] using Kickstart as client. - -#### What is LDAP? #### - -LDAP stands for Lightweight Directory Access Protocol and consists in a set of protocols that allows a client to access, over a network, centrally stored information (such as a directory of login shells, absolute paths to home directories, and other typical system user information, for example) that should be accessible from different places or available to a large number of end users (another example would be a directory of home addresses and phone numbers of all employees in a company). - -Keeping such (and more) information centrally means it can be more easily maintained and accessed by everyone who has been granted permissions to use it. - -The following diagram offers a simplified diagram of LDAP, and is described below in greater detail: - -![LDAP Diagram](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Diagram.png) - -LDAP Diagram - -Explanation of above diagram in detail. - -- An entry in a LDAP directory represents a single unit or information and is uniquely identified by what is called a Distinguished Name. -- An attribute is a piece of information associated with an entry (for example, addresses, available contact phone numbers, and email addresses). -- Each attribute is assigned one or more values consisting in a space-separated list. A value that is unique per entry is called a Relative Distinguished Name. - -That being said, let’s proceed with the server and client installations. - -### Installing and Configuring a LDAP Server and Client ### - -In RHEL 7, LDAP is implemented by OpenLDAP. To install the server and client, use the following commands, respectively: - - # yum update && yum install openldap openldap-clients openldap-servers - # yum update && yum install openldap openldap-clients nss-pam-ldapd - -Once the installation is complete, there are some things we look at. The following steps should be performed on the server alone, unless explicitly noted: - -**1. Make sure SELinux does not get in the way by enabling the following booleans persistently, both on the server and the client:** - - # setsebool -P allow_ypbind=0 authlogin_nsswitch_use_ldap=0 - -Where allow_ypbind is required for LDAP-based authentication, and authlogin_nsswitch_use_ldap may be needed by some applications. - -**2. Enable and start the service:** - - # systemctl enable slapd.service - # systemctl start slapd.service - -Keep in mind that you can also disable, restart, or stop the service with [systemctl][2] as well: - - # systemctl disable slapd.service - # systemctl restart slapd.service - # systemctl stop slapd.service - -**3. Since the slapd service runs as the ldap user (which you can verify with ps -e -o pid,uname,comm | grep slapd), such user should own the /var/lib/ldap directory in order for the server to be able to modify entries created by administrative tools that can only be run as root (more on this in a minute).** - -Before changing the ownership of this directory recursively, copy the sample database configuration file for slapd into it: - - # cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG - # chown -R ldap:ldap /var/lib/ldap - -**4. Set up an OpenLDAP administrative user and assign a password:** - - # slappasswd - -as shown in the next image: - -![Set LDAP Admin Password](http://www.tecmint.com/wp-content/uploads/2015/06/Set-LDAP-Admin-Password.png) - -Set LDAP Admin Password - -and create an LDIF file (ldaprootpasswd.ldif) with the following contents: - - dn: olcDatabase={0}config,cn=config - changetype: modify - add: olcRootPW - olcRootPW: {SSHA}PASSWORD - -where: - -- PASSWORD is the hashed string obtained earlier. -- cn=config indicates global config options. -- olcDatabase indicates a specific database instance name and can be typically found inside /etc/openldap/slapd.d/cn=config. - -Referring to the theoretical background provided earlier, the `ldaprootpasswd.ldif` file will add an entry to the LDAP directory. In that entry, each line represents an attribute: value pair (where dn, changetype, add, and olcRootPW are the attributes and the strings to the right of each colon are their corresponding values). - -You may want to keep this in mind as we proceed further, and please note that we are using the same Common Names `(cn=)` throughout the rest of this article, where each step depends on the previous one. - -**5. Now, add the corresponding LDAP entry by specifying the URI referring to the ldap server, where only the protocol/host/port fields are allowed.** - - # ldapadd -H ldapi:/// -f ldaprootpasswd.ldif - -The output should be similar to: - -![LDAP Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Configuration.png) - -LDAP Configuration - -and import some basic LDAP definitions from the `/etc/openldap/schema` directory: - - # for def in cosine.ldif nis.ldif inetorgperson.ldif; do ldapadd -H ldapi:/// -f /etc/openldap/schema/$def; done - -![LDAP Definitions](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Definitions.png) - -LDAP Definitions - -**6. Have LDAP use your domain in its database.** - -Create another LDIF file, which we will call `ldapdomain.ldif`, with the following contents, replacing your domain (in the Domain Component dc=) and password as appropriate: - - dn: olcDatabase={1}monitor,cn=config - changetype: modify - replace: olcAccess - olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" - read by dn.base="cn=Manager,dc=mydomain,dc=com" read by * none - - dn: olcDatabase={2}hdb,cn=config - changetype: modify - replace: olcSuffix - olcSuffix: dc=mydomain,dc=com - - dn: olcDatabase={2}hdb,cn=config - changetype: modify - replace: olcRootDN - olcRootDN: cn=Manager,dc=mydomain,dc=com - - dn: olcDatabase={2}hdb,cn=config - changetype: modify - add: olcRootPW - olcRootPW: {SSHA}PASSWORD - - dn: olcDatabase={2}hdb,cn=config - changetype: modify - add: olcAccess - olcAccess: {0}to attrs=userPassword,shadowLastChange by - dn="cn=Manager,dc=mydomain,dc=com" write by anonymous auth by self write by * none - olcAccess: {1}to dn.base="" by * read - olcAccess: {2}to * by dn="cn=Manager,dc=mydomain,dc=com" write by * read - -Then load it as follows: - - # ldapmodify -H ldapi:/// -f ldapdomain.ldif - -![LDAP Domain Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Domain-Configuration.png) - -LDAP Domain Configuration - -**7. Now it’s time to add some entries to our LDAP directory. Attributes and values are separated by a colon `(:)` in the following file, which we’ll name `baseldapdomain.ldif`:** - - dn: dc=mydomain,dc=com - objectClass: top - objectClass: dcObject - objectclass: organization - o: mydomain com - dc: mydomain - - dn: cn=Manager,dc=mydomain,dc=com - objectClass: organizationalRole - cn: Manager - description: Directory Manager - - dn: ou=People,dc=mydomain,dc=com - objectClass: organizationalUnit - ou: People - - dn: ou=Group,dc=mydomain,dc=com - objectClass: organizationalUnit - ou: Group - -Add the entries to the LDAP directory: - - # ldapadd -x -D cn=Manager,dc=mydomain,dc=com -W -f baseldapdomain.ldif - -![Add LDAP Domain Attributes and Values](http://www.tecmint.com/wp-content/uploads/2015/06/Add-LDAP-Domain-Configuration.png) - -Add LDAP Domain Attributes and Values - -**8. Create a LDAP user called ldapuser (adduser ldapuser), then create the definitions for a LDAP group in `ldapgroup.ldif`.** - - # adduser ldapuser - # vi ldapgroup.ldif - -Add following content. - - dn: cn=Manager,ou=Group,dc=mydomain,dc=com - objectClass: top - objectClass: posixGroup - gidNumber: 1004 - -where gidNumber is the GID in /etc/group for ldapuser) and load it: - - # ldapadd -x -W -D "cn=Manager,dc=mydomain,dc=com" -f ldapgroup.ldif - -**9. Add a LDIF file with the definitions for user ldapuser (`ldapuser.ldif`):** - - dn: uid=ldapuser,ou=People,dc=mydomain,dc=com - objectClass: top - objectClass: account - objectClass: posixAccount - objectClass: shadowAccount - cn: ldapuser - uid: ldapuser - uidNumber: 1004 - gidNumber: 1004 - homeDirectory: /home/ldapuser - userPassword: {SSHA}fiN0YqzbDuDI0Fpqq9UudWmjZQY28S3M - loginShell: /bin/bash - gecos: ldapuser - shadowLastChange: 0 - shadowMax: 0 - shadowWarning: 0 - -and load it: - - # ldapadd -x -D cn=Manager,dc=mydomain,dc=com -W -f ldapuser.ldif - -![LDAP User Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-User-Configuration.png) - -LDAP User Configuration - -Likewise, you can delete the user entry you just created: - - # ldapdelete -x -W -D cn=Manager,dc=mydomain,dc=com "uid=ldapuser,ou=People,dc=mydomain,dc=com" - -**10. Allow communication through the firewall:** - - # firewall-cmd --add-service=ldap - -**11. Last, but not least, enable the client to authenticate using LDAP.** - -To help us in this final step, we will use the authconfig utility (an interface for configuring system authentication resources). - -Using the following command, the home directory for the requested user is created if it doesn’t exist after the authentication against the LDAP server succeeds: - - # authconfig --enableldap --enableldapauth --ldapserver=rhel7.mydomain.com --ldapbasedn="dc=mydomain,dc=com" --enablemkhomedir --update - -![LDAP Client Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Client-Configuration.png) - -LDAP Client Configuration - -### Summary ### - -In this article we have explained how to set up basic authentication against a LDAP server. To further configure the setup described in the present guide, please refer to [Chapter 13 – LDAP Configuration][3] in the RHEL 7 System administrator’s guide, paying special attention to the security settings using TLS. - -Feel free to leave any questions you may have using the comment form below. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/setup-ldap-server-and-configure-client-authentication/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/automatic-rhel-installations-using-kickstart/ -[2]:http://www.tecmint.com/manage-services-using-systemd-and-systemctl-in-linux/ -[3]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Directory_Servers.html \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 15--Essentials of Virtualization and Guest Administration with KVM.md b/sources/tech/RHCSA Series/RHCSA Series--Part 15--Essentials of Virtualization and Guest Administration with KVM.md deleted file mode 100644 index d9e06bd876..0000000000 --- a/sources/tech/RHCSA Series/RHCSA Series--Part 15--Essentials of Virtualization and Guest Administration with KVM.md +++ /dev/null @@ -1,188 +0,0 @@ -RHCSA Series: Essentials of Virtualization and Guest Administration with KVM – Part 15 -================================================================================ -If you look up the word virtualize in a dictionary, you will find that it means “to create a virtual (rather than actual) version of something”. In computing, the term virtualization refers to the possibility of running multiple operating systems simultaneously and isolated one from another, on top of the same physical (hardware) system, known in the virtualization schema as host. - -![KVM Virtualization Basics and KVM Guest Administration](http://www.tecmint.com/wp-content/uploads/2015/06/RHCSA-Part15.png) - -RHCSA Series: Essentials of Virtualization and Guest Administration with KVM – Part 15 - -Through the use of the virtual machine monitor (also known as hypervisor), virtual machines (referred to as guests) are provided virtual resources (i.e. CPU, RAM, storage, network interfaces, to name a few) from the underlying hardware. - -With that in mind, it is plain to see that one of the main advantages of virtualization is cost savings (in equipment and network infrastructure and in terms of maintenance effort) and a substantial reduction in the physical space required to accommodate all the necessary hardware. - -Since this brief how-to cannot cover all virtualization methods, I encourage you to refer to the documentation listed in the summary for further details on the subject. - -Please keep in mind that the present article is intended to be a starting point to learn the basics of virtualization in RHEL 7 using [KVM][1] (Kernel-based Virtual Machine) with command-line utilities, and not an in-depth discussion of the topic. - -### Verifying Hardware Requirements and Installing Packages ### - -In order to set up virtualization, your CPU must support it. You can verify whether your system meets the requirements with the following command: - - # grep -E 'svm|vmx' /proc/cpuinfo - -In the following screenshot we can see that the current system (with an AMD microprocessor) supports virtualization, as indicated by svm. If we had an Intel-based processor, we would see vmx instead in the results of the above command. - -![Check KVM Support](http://www.tecmint.com/wp-content/uploads/2015/06/Check-KVM-Support.png) - -Check KVM Support - -In addition, you will need to have virtualization capabilities enabled in the firmware of your host (BIOS or UEFI). - -Now install the necessary packages: - -- qemu-kvm is an open source virtualizer that provides hardware emulation for the KVM hypervisor whereas qemu-img provides a command line tool for manipulating disk images. -- libvirt includes the tools to interact with the virtualization capabilities of the operating system. -- libvirt-python contains a module that permits applications written in Python to use the interface supplied by libvirt. -- libguestfs-tools: miscellaneous system administrator command line tools for virtual machines. -- virt-install: other command-line utilities for virtual machine administration. - - # yum update && yum install qemu-kvm qemu-img libvirt libvirt-python libguestfs-tools virt-install - -Once the installation completes, make sure you start and enable the libvirtd service: - - # systemctl start libvirtd.service - # systemctl enable libvirtd.service - -By default, each virtual machine will only be able to communicate with the rest in the same physical server and with the host itself. To allow the guests to reach other machines inside our LAN and also the Internet, we need to set up a bridge interface in our host (say br0, for example) by, - -1. adding the following line to our main NIC configuration (most likely `/etc/sysconfig/network-scripts/ifcfg-enp0s3`): - - BRIDGE=br0 - -2. creating the configuration file for br0 (/etc/sysconfig/network-scripts/ifcfg-br0) with these contents (note that you may have to change the IP address, gateway address, and DNS information): - - DEVICE=br0 - TYPE=Bridge - BOOTPROTO=static - IPADDR=192.168.0.18 - NETMASK=255.255.255.0 - GATEWAY=192.168.0.1 - NM_CONTROLLED=no - DEFROUTE=yes - PEERDNS=yes - PEERROUTES=yes - IPV4_FAILURE_FATAL=no - IPV6INIT=yes - IPV6_AUTOCONF=yes - IPV6_DEFROUTE=yes - IPV6_PEERDNS=yes - IPV6_PEERROUTES=yes - IPV6_FAILURE_FATAL=no - NAME=br0 - ONBOOT=yes - DNS1=8.8.8.8 - DNS2=8.8.4.4 - -3. finally, enabling packet forwarding by making, in `/etc/sysctl.conf`, - - net.ipv4.ip_forward = 1 - -and loading the changes to the current kernel configuration: - - # sysctl -p - -Note that you may also need to tell firewalld that this kind of traffic should be allowed. Remember that you can refer to the article on that topic in this same series ([Part 11: Network Traffic Control Using FirewallD and Iptables][2]) if you need help to do that. - -### Creating VM Images ### - -By default, VM images will be created to `/var/lib/libvirt/images` and you are strongly advised to not change this unless you really need to, know what you’re doing, and want to handle SELinux settings yourself (such topic is out of the scope of this tutorial but you can refer to Part 13 of the RHCSA series: [Mandatory Access Control Essentials with SELinux][3] if you want to refresh your memory). - -This means that you need to make sure that you have allocated the necessary space in that filesystem to accommodate your virtual machines. - -The following command will create a virtual machine named `tecmint-virt01` with 1 virtual CPU, 1 GB (=1024 MB) of RAM, and 20 GB of disk space (represented by `/var/lib/libvirt/images/tecmint-virt01.img`) using the rhel-server-7.0-x86_64-dvd.iso image located inside /home/gacanepa/ISOs as installation media and the br0 as network bridge: - - # virt-install \ - --network bridge=br0 - --name tecmint-virt01 \ - --ram=1024 \ - --vcpus=1 \ - --disk path=/var/lib/libvirt/images/tecmint-virt01.img,size=20 \ - --graphics none \ - --cdrom /home/gacanepa/ISOs/rhel-server-7.0-x86_64-dvd.iso - --extra-args="console=tty0 console=ttyS0,115200" - -If the installation file was located in a HTTP server instead of an image stored in your disk, you will have to replace the –cdrom flag with –location and indicate the address of the online repository. - -As for the –graphics none option, it tells the installer to perform the installation in text-mode exclusively. You can omit that flag if you are using a GUI interface and a VNC window to access the main VM console. Finally, with –extra-args we are passing kernel boot parameters to the installer that set up a serial VM console. - -The installation should now proceed as a regular (real) server now. If not, please review the steps listed above. - -### Managing Virtual Machines ### - -These are some typical administration tasks that you, as a system administrator, will need to perform on your virtual machines. Note that all of the following commands need to be run from your host: - -**1. List all VMs:** - - # virsh list --all - -From the output of the above command you will have to note the Id for the virtual machine (although it will also return its name and current status) because you will need it for most administration tasks related to a particular VM. - -**2. Display information about a guest:** - - # virsh dominfo [VM Id] - -**3. Start, restart, or stop a guest operating system:** - - # virsh start | reboot | shutdown [VM Id] - -**4. Access a VM’s serial console if networking is not available and no X server is running on the host:** - - # virsh console [VM Id] - -**Note** that this will require that you add the serial console configuration information to the `/etc/grub.conf` file (refer to the argument passed to the –extra-args option when the VM was created). - -**5. Modify assigned memory or virtual CPUs:** - -First, shutdown the guest: - - # virsh shutdown [VM Id] - -Edit the VM configuration for RAM: - - # virsh edit [VM Id] - -Then modify - - [Memory size here without brackets] - -Restart the VM with the new settings: - - # virsh create /etc/libvirt/qemu/tecmint-virt01.xml - -Finally, change the memory dynamically: - - # virsh setmem [VM Id] [Memory size here without brackets] - -For CPU: - - # virsh edit [VM Id] - -Then modify - - [Number of CPUs here without brackets] - -For further commands and details, please refer to table 26.1 in Chapter 26 of the RHEL 5 Virtualization guide (that guide, though a bit old, includes an exhaustive list of virsh commands used for guest administration). - -### SUMMARY ### - -In this article we have covered some basic aspects of virtualization with KVM in RHEL 7, which is both a vast and a fascinating topic, and I hope it will be helpful as a starting guide for you to later explore more advanced subjects found in the official [RHEL virtualization][4] getting started and [deployment / administration guides][5]. - -In addition, you can refer to the preceding articles in [this KVM series][6] in order to clarify or expand some of the concepts explained here. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/kvm-virtualization-basics-and-guest-administration/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.linux-kvm.org/page/Main_Page -[2]:http://www.tecmint.com/firewalld-vs-iptables-and-control-network-traffic-in-firewall/ -[3]:http://www.tecmint.com/selinux-essentials-and-control-filesystem-access/ -[4]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Getting_Started_Guide/index.html -[5]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/index.html -[6]:http://www.tecmint.com/install-and-configure-kvm-in-linux/ \ No newline at end of file diff --git a/translated/share/20150826 Five Super Cool Open Source Games.md b/translated/share/20150826 Five Super Cool Open Source Games.md deleted file mode 100644 index 30ca09e171..0000000000 --- a/translated/share/20150826 Five Super Cool Open Source Games.md +++ /dev/null @@ -1,66 +0,0 @@ -Translated by H-mudcup -五大超酷的开源游戏 -================================================================================ -在2014年和2015年,Linux 成了一堆流行商业品牌的家,例如备受欢迎的 Borderlands、Witcher、Dead Island 和 CS系列游戏。虽然这是令人激动的消息,但这跟玩家的预算有什么关系?商业品牌很好,但更好的是由了解玩家喜好的开发者开发的免费的替代品。 - -前段时间,我偶然看到了一个三年前发布的 YouTube 视频,标题非常的有正能量[5个不算糟糕的开源游戏][1]。虽然视频表扬了一些开源游戏,我还是更喜欢用一个更加热情的方式来切入这个话题,至少如标题所说。所以,下面是我的一份五大超酷开源游戏的清单。 - -### Tux Racer ### - -![Tux Racer](http://fossforce.com/wp-content/uploads/2015/08/tuxracer-550x413.jpg) - -Tux Racer - -[《Tux Racer》][2]是这份清单上的第一个游戏,因为我对这个游戏很熟悉。我和兄弟与[电脑上的孩子们][4]项目在[最近一次去墨西哥的路途中][3] Tux Racer 是孩子和教师都喜欢玩的游戏之一。在这个游戏中,玩家使用 Linux 吉祥物,企鹅 Tux,在下山雪道上以计时赛的方式进行比赛。玩家们不断挑战他们自己的最佳纪录。目前还没有多玩家版本,但这是有可能改变的。适用于 Linux、OS X、Windows 和 Android。 - -### Warsow ### - -![Warsow](http://fossforce.com/wp-content/uploads/2015/08/warsow-550x413.jpg) - -Warsow - -[《Warsow》][5]网站解释道:“设定是有未来感的卡通世界,Warsow 是个完全开放的适用于 Windows、Linux 和 Mac OS X平台的快节奏第一人称射击游戏(FPS)。Warsow 是尊重的艺术和网络中的体育精神。(Warsow is the Art of Respect and Sportsmanship Over the Web.大写字母组成Warsow。)” 我很不情愿的把 FPS 类放到了这个列表中,因为很多人玩过这类的游戏,但是我的确被 Warsow 打动了。它对很多动作进行了优先级排序,游戏节奏很快,一开始就有八个武器。卡通化的风格让玩的过程变得没有那么严肃,更加的休闲,非常适合可以和亲友一同玩。然而,他却以充满竞争的游戏自居,并且当我体验这个游戏时,我发现周围确实有一些专家级的玩家。适用于 Linux、Windows 和 OS X。 - -### M.A.R.S——一个荒诞的射击游戏 ### - -![M.A.R.S. - A ridiculous shooter](http://fossforce.com/wp-content/uploads/2015/08/MARS-screenshot-550x344.jpg) - -M.A.R.S.——一个荒诞的射击游戏 - -[《M.A.R.S——一个荒诞的射击游戏》][6]之所以吸引人是因为他充满活力的色彩和画风。支持两个玩家使用同一个键盘,而一个在线多玩家版本目前正在开发中——这意味着想要和朋友们一起玩暂时还要等等。不论如何,它是个可以使用几个不同飞船和武器的有趣的太空射击游戏。飞船的形状不同,从普通的枪、激光、散射枪到更有趣的武器(随机出来的飞船中有一个会对敌人发射泡泡,这为这款混乱的游戏增添了很多乐趣)。游戏几种模式,比如标准模式和对方进行殊死搏斗以获得高分或先达到某个分数线,还有其他的模式,空间球(Spaceball)、坟坑(Grave-itation Pit)和保加农炮(Cannon Keep)。适用于 Linux、Windows 和 OS X。 - -### Valyria Tear ### - -![Valyria Tear](http://fossforce.com/wp-content/uploads/2015/08/bronnan-jump-to-enemy-550x413.jpg) - -Valyria Tear - -[Valyria Tear][7] 类似几年来拥有众多粉丝的角色扮演游戏(RPG)。故事设定在梦幻游戏的通用年代,充满了骑士、王国和魔法,以及主要角色 Bronann。设计团队做的非常棒,在设计这个世界和实现玩家对这类游戏所有的期望:隐藏的宝藏、偶遇的怪物、非玩家操纵角色(NPC)的互动以及所有 RPG 不可或缺的:在低级别的怪物上刷经验直到可以面对大 BOSS。我在试玩的时候,时间不允许我太过深入到这个游戏故事中,但是感兴趣的人可以看 YouTube 上由 Yohann Ferriera 用户发的‘[Let’s Play][8]’系列视频。适用于 Linux、Windows 和 OS X。 - -### SuperTuxKart ### - -![SuperTuxKart](http://fossforce.com/wp-content/uploads/2015/08/hacienda_tux_antarctica-550x293.jpg) - -SuperTuxKart - -最后一个同样好玩的游戏是 [SuperTuxKart][9],一个效仿 Mario Kart(马里奥卡丁车)但丝毫不必原作差的好游戏。它在2000年-2004年间开始以 Tux Kart 开发,但是在成品中有错误,结果开发就停止了几年。从2006年开始重新开发时起,它就一直在改进,直到四个月前0.9版首次发布。在游戏里,我们的老朋友 Tux 与马里奥和其他一些开源吉祥物一同开始。其中一个熟悉的面孔是 Suzanne,Blender 的那只吉祥物猴子。画面很给力,游戏很流畅。虽然在线游戏还在计划阶段,但是分屏多玩家游戏是可以的。一个电脑最多可以四个玩家同时玩。适用于 Linux、Windows、OS X、AmigaOS 4、AROS 和 MorphOS。 - --------------------------------------------------------------------------------- - -via: http://fossforce.com/2015/08/five-super-cool-open-source-games/ - -作者:Hunter Banks -译者:[H-mudcup](https://github.com/H-mudcup) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[1]:https://www.youtube.com/watch?v=BEKVl-XtOP8 -[2]:http://tuxracer.sourceforge.net/download.html -[3]:http://fossforce.com/2015/07/banks-family-values-texas-linux-fest/ -[4]:http://www.kidsoncomputers.org/an-amazing-week-in-oaxaca -[5]:https://www.warsow.net/download -[6]:http://mars-game.sourceforge.net/ -[7]:http://valyriatear.blogspot.com/ -[8]:https://www.youtube.com/channel/UCQ5KrSk9EqcT_JixWY2RyMA -[9]:http://supertuxkart.sourceforge.net/ diff --git a/translated/talk/20141223 Defending the Free Linux World.md b/translated/talk/20141223 Defending the Free Linux World.md deleted file mode 100644 index cabc8af041..0000000000 --- a/translated/talk/20141223 Defending the Free Linux World.md +++ /dev/null @@ -1,127 +0,0 @@ -Translating by H-mudcup - -守卫自由的Linux世界 -================================================================================ -![](http://www.linuxinsider.com/ai/908455/open-invention-network.jpg) - -**"合作是开源的一部分。OIN的CEO Keith Bergelt解释说,开放创新网络(Open Invention Network)模式允许众多企业和公司决定它们该在哪较量,在哪合作。随着开源的演变,“我们需要为合作创造渠道。否则我们将会有几百个团体把数十亿美元花费到同样的技术上。”** - -[开放创新网络(Open Invention Network)][1],既OIN,正在全球范围内开展让 Linux 远离专利诉讼的伤害的活动。它的努力得到了一千多个公司的热烈回应,它们的加入让这股力量成为了历史上最大的反专利管理组织。 - -开放创新网络以白帽子组织的身份创建于2005年,目的是保护 Linux 免受来自许可证方面的困扰。包括Google、 IBM、 NEC、 Novell、 Philips、 [Red Hat][2] 和 Sony这些成员的董事会给予了它可观的经济支持。世界范围内的多个组织通过签署自由 OIN 协议加入了这个社区。 - -创立开放创新网络的组织成员把它当作利用知识产权保护 Linux 的大胆尝试。它的商业模式非常的难以理解。它要求它的成员持无专利证并永远放弃由于 Linux 相关知识产权起诉其他成员的机会。 - -然而,从 Linux 收购风波——想想服务器和云平台——那时起,保护 Linux 知识产权的策略就变得越加的迫切。 - -在过去的几年里,Linux 的版图曾经历了一场变革。OIN 不必再向人们解释这个组织的定义,也不必再解释为什么 Linux 需要保护。据 OIN 的 CEO Keith Bergelt 说,现在 Linux 的重要性得到了全世界的关注。 - -“我们已经见到了一场人们了解到OIN如何让合作受益的文化变革,”他对 LinuxInsider 说。 - -### 如何运作 ### - -开放创新网络使用专利权的方式创建了一个协作环境。这种方法有助于确保创新的延续。这已经使很多软件商贩、顾客、新型市场和投资者受益。 - -开放创新网络的专利证可以让任何公司、公共机构或个人免版权使用。这些权利的获得建立在签署者同意不会专为了维护专利而攻击 Linux 系统的基础上。 - -OIN 确保 Linux 的源代码保持开放的状态。这让编程人员、设备出售人员、独立软件开发者和公共机构在投资和使用 Linux 时不用过多的担心知识产权的问题。这让对 Linux 进行重新装配、嵌入和使用的公司省了不少钱。 - -“随着版权许可证越来越广泛的使用,对 OIN 许可证的需求也变得更加的迫切。现在,人们正在寻找更加简单或更功利的解决方法”,Bergelt 说。 - -OIN 法律防御援助对成员是免费的。成员必须承诺不对 OIN 名单带上的软件发起专利诉讼。为了保护该软件,他们也同意提供他们自己的专利。最终,这些保证将导致几十万的交叉许可通过网络连接,Bergelt 如此解释道。 - -### 填补法律漏洞 ### - -“OIN 正在做的事情是非常必要的。它提供额另一层 IP 保护,”[休斯顿法律中心大学][3]的副教授 Greg R. Vetter 这样说道。 - -他回答 LinuxInsider 说,某些人设想的第二版 GPL 许可证会隐含的提供专利许可,但是律师们更喜欢明确的许可。 - -OIN 所提供的许可填补了这个空白。它还明确的覆盖了 Linux 核心。据 Vetter 说,明确的专利许可并不是 GPLv2 中的必要部分,但是这个部分曾在 GPLv3 中。 - -拿一个在 GPLv3 中写了10000行代码的代码编写者来说。随着时间推移,其他的代码编写者会贡献更多行的代码到 IP 中。GPLv3 中的软件专利许可条款将保护所有基于参与其中的贡献者的专利的全部代码的使用,Vetter 如此说道。 - -### 并不完全一样 ### - -专利权和许可证在法律结构上层层叠叠互相覆盖。弄清两者对开源软件的作用就像是穿越雷区。 - -Vetter 说“许可证是授予通常是建立在专利和版权法律上的额外权利的法律结构。许可证被认为是给予了人们做一些的可能会侵犯到其他人的 IP 权利的事的许可。” - -Vetter 指出,很多自由开源许可证(例如 Mozilla 公共许可、GNU、GPLv3 以及 Apache 软件许可)融合了某些互惠专利权的形式。Vetter 指出,像 BSD 和 MIT 这样旧的许可证不会提到专利。 - -一个软件的许可证让其他人可以在某种程度上使用这个编程人员创造的代码。版权对所属权的建立是自动的,只要某个人写或者画了某个原创的东西。然而,版权只覆盖了个别的表达方式和衍生的作品。他并没有涵盖代码的功能性或可用的想法。 - -专利涵盖了功能性。专利权还可以成为许可证。版权可能无法保护某人如何独立的对另一个人的代码的实现的开发,但是专利填补了这个小瑕疵,Vetter 解释道。 - -### 寻找安全通道 ### - -许可证和专利混合的法律性质可能会对开源开发者产生威胁。据 [Chaotic Moon Studios][4] 的创办者之一、 [IEEE][5] 计算机协会成员 William Hurley 说,对于某些人来说即使是 GPL 也会成为威胁。 - -"在很久以前,开源是个完全不同的世界。被彼此间的尊重和把代码视为艺术而非资产的观点所驱动,那时的程序和代码比现在更加的开放。我相信很多为最好的意图所做的努力几乎最后总是背负着意外的结果,"Hurley 这样告诉 LinuxInsider。 - -他暗示说,成员人数超越了1000人可能带来了一个关于知识产权保护重要性的混乱信息。这可能会继续搅混开源生态系统这滩浑水。 - -“最终,这些显现出了围绕着知识产权的常见的一些错误概念。拥有几千个开发者并不会减少风险——而是增加。给专利许可的开发者越多,它们看起来就越值钱,”Hurley 说。“它们看起来越值钱,有着类似专利的或者其他知识产权的人就越可能试图利用并从中榨取他们自己的经济利益。” - -### 共享与竞争共存 ### - -竞合策略是开源的一部分。OIN 模型让各个公司能够决定他们将在哪竞争以及在哪合作,Bergelt 解释道。 - -“开源演化中的许多改变已经把我们移到了另一个方向上。我们必须为合作创造渠道。否则我们将会有几百个团体把数十亿美元花费到同样的技术上,”他说。 - -手机产业的革新就是个很好的例子。各个公司放出了不同的标准。没有共享,没有合作,Bergelt 解释道。 - -他说:“这让我们在美国接触技术的能力落后了七到五年。我们接触设备的经验远远落后于世界其他地方的人。在我们等待 CDMA (Code Division Multiple Access 码分多址访问通信技术)时自满于 GSM (Global System for Mobile Communications 全球移动通信系统)。” - -### 改变格局 ### - -OIN 在去年经历了增长了400个新许可的浪潮。这意味着着开源有了新趋势。 - -Bergelt 说:“市场到达了一个临界点,组织内的人们终于意识到直白地合作和竞争的需要。结果是两件事同时进行。这可能会变得复杂、费力。” - -然而,这个由人们开始考虑合作和竞争的文化革新所驱动的转换过程是可以忍受的。他解释说,这也是人们在以把开源作为开源社区的最重要的工程的方式拥抱开源——尤其是 Linux——的转变。 - -还有一个迹象是,最具意义的新工程都没有在 GPLv3 许可下开发。 - -### 二个总比一个好 ### - -“GPL 极为重要,但是事实是有一堆的许可模型正被使用着。在Eclipse、Apache 和 Berkeley 许可中,专利问题的相对可解决性通常远远低于在 GPLv3 中的。”Bergelt 说。 - -GPLv3 对于解决专利问题是个自然的补充——但是 GPL 自身不足以独自解决围绕专利使用的潜在冲突。所以 OIN 的设计是以能够补充版权许可为目的的,他补充道。 - -然而,层层叠叠的专利和许可也许并没有带来多少好处。到最后,专利在几乎所有的案例中都被用于攻击目的——而不是防御目的,Bergelt 暗示说。 - -“如果你不准备对其他人采取法律行动,那么对于你的知识财产来说专利可能并不是最佳的法律保护方式”,他说。“我们现在生活在一个对软件——开放和专有——误会重重的世界里。这些软件还被错误并过时的专利系统所捆绑。我们每天在工业化的被窒息的创新中挣扎”,他说。 - -### 法院是最后的手段### - -想到 OIN 的出现抑制了诉讼的泛滥就感到十分欣慰,Bergelt 说,或者至少可以说 OIN 的出现扼制了特定的某些威胁。 - -“可以说我们让人们放下它们了的武器。同时我们正在创建一种新的文化规范。一旦你入股这个模型中的非侵略专利,所产生的相关影响就是对合作的鼓励”,他说。 - -如果你愿意承诺合作,你的第一反应就会趋向于不急着起诉。相反的,你会想如何让我们允许你使用我们所拥有的东西并让它为你赚钱,而同时我们也能使用你所拥有的东西,Bergelt 解释道。 - -“OIN 是个多面的解决方式。他鼓励签署者创造双赢协议”,他说。“这让起诉成为最逼不得已的行为。那才是它的位置。” - -### 底线### - -Bergelt 坚信,OIN 的运作是为了阻止 Linux 受到专利伤害。在 Linux 的世界里没有诉讼的地方。 - -唯一临近的是和微软的移动大战,这主要关系到堆栈中高的元素。那些来自法律的挑战可能是为了提高包括使用 Linux 产品的所属权的成本,Bergelt 说。 - -尽管如此“这些并不是有关 Linux 诉讼”,他说。“他们的重点并不在于 Linux 的核心。他们关注的是 Linux 系统里都有些什么。” - --------------------------------------------------------------------------------- - -via: http://www.linuxinsider.com/story/Defending-the-Free-Linux-World-81512.html - -作者:Jack M. Germain -译者:[H-mudcup](https://github.com/H-mudcup) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://www.openinventionnetwork.com/ -[2]:http://www.redhat.com/ -[3]:http://www.law.uh.edu/ -[4]:http://www.chaoticmoon.com/ -[5]:http://www.ieee.org/ diff --git a/translated/talk/20150818 Debian GNU or Linux Birthday-- A 22 Years of Journey and Still Counting.md b/translated/talk/20150818 Debian GNU or Linux Birthday-- A 22 Years of Journey and Still Counting.md deleted file mode 100644 index 1c92079b57..0000000000 --- a/translated/talk/20150818 Debian GNU or Linux Birthday-- A 22 Years of Journey and Still Counting.md +++ /dev/null @@ -1,109 +0,0 @@ -Debian GNU/Linux 生日: 22年未完的美妙旅程. -================================================================================ -在2015年8月16日, Debian项目组庆祝了 Debian 的22周年纪念日; 这也是开源世界历史最悠久, 热门的发行版之一. Debian项目于1993年由Ian Murdock创立. 彼时, Slackware 作为最早的 Linux 发行版已经名声在外. - -![Happy 22nd Birthday to Debian](http://www.tecmint.com/wp-content/uploads/2014/08/Debian-22nd-Birthday.png) - -22岁生日快乐! Debian Linux! - -Ian Ashly Murdock, 一个美国职业软件工程师, 在他还是普渡大学的学生时构想出了 Debia n项目的计划. 他把这个项目命名为 Debian 是由于这个名字组合了他彼时女友的名字, Debra Lynn, 和他自己的名字(译者: Ian). 他之后和Lynn顺利结婚并在2008年1月离婚. - -![Ian Murdock](http://www.tecmint.com/wp-content/uploads/2014/08/Ian-Murdock.jpeg) - -Debian 创始人:Ian Murdock - -Ian 目前是 ExactTarget 下 Platform and Development Community 的副总裁. - -Debian (如同Slackware一样) 都是由于当时缺乏满足作者标准的发行版才应运而生的. Ian 在一次采访中说:"免费提供一流的产品会是Debian项目的唯一使命. 尽管过去的 Linux 发行版均不尽然可靠抑或是优秀. 我印象里...比如在不同的文件系统间移动文件, 处理大型文件经常会导致内核出错. 但是 Linux 其实是很可靠的, 免费的源代码让这个项目本质上很有前途. - -"我记得过去我也像其他人一样想解决问题, 想在家里运营一个像 UNIX 的东西. 但那是不可能的, 无论是经济上还是法律上或是别的什么角度. 然后我就听闻了GNU内核开发项目, 以及这个项目是如何没有任何法律纷争", Ian 补充到. 他早年在开发 Debian 时曾被自由软件基金会(FSF)资助, 这份资助帮助 Debian 向前迈了一大步; 尽管一年后由于学业原因 Ian 退出了 FSF 转而去完成他的学位. - -### Debian开发历史 ### - -- **Debian 0.01 – 0.09** : 发布于 1993 八月 – 1993 十二月. -- **Debian 0.91 ** – 发布于 1994 一月. 有了原始的包管理系统, 没有依赖管理机制. -- **Debian 0.93 rc5** : 发布于 1995 三月. "现代"意义的 Debian 的第一次发布, dpkg 会在系统安装后被用作安装以及管理其他软件包. -- **Debian 0.93 rc6**: 发布于1995 十一月. 最后一次a.out发布, deselect机制第一次出现, 有60位开发者在彼时维护着软件包. -- **Debian 1.1**: 发布于1996 六月. 项目代号 – Buzz, 软件包数量 – 474, 包管理器 dpkg, 内核版本 2.0, ELF. -- **Debian 1.2**: 发布于1996 十二月. 项目代号 – Rex, 软件包数量 – 848, 开发者数量 – 120. -- **Debian 1.3**: 发布于1997 七月. 项目代号 – Bo, 软件包数量 974, 开发者数量 – 200. -- **Debian 2.0**: 发布于1998 七月. 项目代号 - Hamm, 支持构架 – Intel i386 以及 Motorola 68000 系列, 软件包数量: 1500+, 开发者数量: 400+, 内置了 glibc. -- **Debian 2.1**: 发布于1999 三月九日. 项目代号 – slink, 支持构架 - Alpha 和 Sparc, apt 包管理器开始成型, 软件包数量 – 2250. -- **Debian 2.2**: 发布于2000 八月十五日. 项目代号 – Potato, 支持构架 – Intel i386, Motorola 68000 系列, Alpha, SUN Sparc, PowerPC 以及 ARM 构架. 软件包数量: 3900+ (二进制) 以及 2600+ (源代码), 开发者数量 – 450. 有一群人在那时研究并发表了一篇论文, 论文展示了自由软件是如何在被各种问题包围的情况下依然逐步成长为优秀的现代操作系统的. -- **Debian 3.0**: 发布于2002 七月十九日. 项目代号 – woody, 支持构架新增– HP, PA_RISC, IA-64, MIPS 以及 IBM, 首次以DVD的形式发布, 软件包数量 – 8500+, 开发者数量 – 900+, 支持加密. -- **Debian 3.1**: 发布于2005 六月六日. 项目代号 – sarge, 支持构架 – 不变基础上新增 AMD64 – 非官方渠道发布, 内核 – 2.4 以及 2.6 系列, 软件包数量: 15000+, 开发者数量 : 1500+, 增加了诸如 – OpenOffice 套件, Firefox 浏览器, Thunderbird, Gnome 2.8, 内核版本 3.3 先进地支持了: RAID, XFS, LVM, Modular Installer. -- **Debian 4.0**: 发布于2007 四月八日. 项目代号 – etch, 支持构架 – 不变基础上新增 AMD64. 软件包数量: 18,200+ 开发者数量 : 1030+, 图形化安装器. -- **Debian 5.0**: Released on February 14th, 发布于2009. 项目代号 – lenny, 支持构架 – 保不变基础上新增 ARM. 软件包数量: 23000+, 开发者数量: 1010+. -- **Debian 6.0**: 发布于2009 七月二十九日. 项目代号 – squeeze, 包含的软件包: 内核 2.6.32, Gnome 2.3. Xorg 7.5, 同时包含了 DKMS, 基于依赖包支持. 支持构架 : 不变基础上新增 kfreebsd-i386 以及 kfreebsd-amd64, 基于依赖管理的启动过程. -- **Debian 7.0**: 发布于2013 五月四日. 项目代号: wheezy, 支持 Multiarch, 私人云工具, 升级了安装器, 移除了第三方软件依赖, 万能的多媒体套件-codec, 内核版本 3.2, Xen Hypervisor 4.1.4 软件包数量: 37400+. -- **Debian 8.0**: 发布于2015 五月二十五日. 项目代号: Jessie, 将 Systemd 作为默认的启动加载器, 内核版本 3.16, 增加了快速启动(fast booting), service进程所依赖的 cgroups 使隔离部分 service 进程成为可能, 43000+ packages. Sysvinit 初始化工具首次在 Jessie 中可用. - -**注意**: Linux的内核第一次是在1991 十月五日被发布, 而 Debian 的首次发布则在1993 九月十三日. 所以 Debian 已经在只有24岁的 Linux 内核上运行了整整22年了. - -### 有关 Debian 的小知识 ### - -1994年被用来管理和重整 Debian 项目以使得其他开发者能更好地加入. 所以在那一年并没有面向用户的更新被发布, 当然, 内部版本肯定是有的. - -Debian 1.0 从来就没有被发布过. 一家 CD-ROM 的生产商错误地把某个未发布的版本标注为了 1.0, 为了避免产生混乱, 原本的 Debian 1.0 以1.1的面貌发布了. 从那以后才有了所谓的官方CD-ROM的概念. - -每个 Debian 新版本的代号都是玩具总动员里某个角色的名字哦. - -Debian 有四种可用版本: 旧稳定版(old stable), 稳定版, 测试版 以及 试验版(experimental). 始终如此. - -Debian 项目组一直致力于开发写一代发行版的不稳定版本, 这个不稳定版本始终被叫做Sid(玩具总动员里那个邪恶的臭小孩). Sid是unstable版本的永久名称, 同时Sid也取自'Still In Development"(译者:还在开发中)的首字母. Sid 将会成为下一个稳定版, 此时的下一个稳定版本代号为 jessie. - -Debian 的官方发行版只包含开源并且免费的软件, 绝无其他东西. 不过contrib 和 不免费的软件包使得安装那些本身免费但是依赖的软件包不免费的软件成为了可能. 那些依赖包本身的证书可能不属于自由/免费软件. - -Debian 是一堆Linux 发行版的母亲. 举几个例子: - -- Damn Small Linux -- KNOPPIX -- Linux Advanced -- MEPIS -- Ubuntu -- 64studio (不再活跃开发) -- LMDE - -Debian 是世界上最大的非商业Linux 发行版.他主要是由C书写的(32.1%), 一并的还有其他70多种语言. - -![Debian 开发语言贡献表](http://www.tecmint.com/wp-content/uploads/2014/08/Debian-Programming.png) - -Debian Contribution - -图片来源: [Xmodulo][1] - -Debian 项目包含6,850万行代码, 以及, 450万行空格和注释. - -国际空间站放弃了 Windows 和红帽子, 进而换成了Debian - 在上面的宇航员使用落后一个版本的稳定发行版, 目前是squeeze; 这么做是为了稳定程度以及来自 Debian 社区的雄厚帮助支持. - -感谢上帝! 我们差点就听到来自国际空间宇航员面对 Windows Metro 界面的尖叫了 :P - -#### 黑色星期三 #### - -2002 十一月而是日, Twente 大学的 Network Operation Center 着火 (NOC). 当地消防部门放弃了服务器区域. NOC维护了satie.debian.org的网站服务器, 这个网站包含了安全, 非美国相关的存档, 新维护者资料, 数量报告, 数据库; 这一切都化为了灰烬. 之后这些服务被使用 Debian 重新实现了. - -#### 未来版本 #### - -下一个待发布版本是 Debian 9, 项目代号 – Stretch, 它会带来什么还是个未知数. 满心期待吧! - -有很多发行版在 Linux 发行版的历史上出现过一瞬然后很快消失了. 在多数情况下, 维护一个日渐庞大的项目是开发者们面临的挑战. 但这对 Debian 来说不是问题. Debian 项目有全世界成百上千的开发者, 维护者. 它在 Linux 诞生的之初起便一直存在. - -Debian 在 Linux 生态环境中的贡献是难以用语言描述的. 如果 Debian 没有出现过, 那么 Linux 世界将不会像现在这样丰富, 用户友好. Debian 是为数不多可以被认为安全可靠又稳定, 是作为网络服务器完美选择的发行版. - -这仅仅是 Debian 的一个开始. 它从远古时代一路走到今天, 并将一直走下去. 未来即是现在! 世界近在眼前! 如果你到现在还从来没有使用过 Debian, 我只想问, 你还再等什么? 快去下载一份镜像试试吧, 我们会在此守候遇到任何问题的你. - -- [Debian 主页][2] - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/happy-birthday-to-debian-gnu-linux/ - -作者:[Avishek Kumar][a] -译者:[jerryling315](http://moelf.xyz) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://xmodulo.com/2013/08/interesting-facts-about-debian-linux.html -[2]:https://www.debian.org/ diff --git a/translated/talk/The history of Android/18 - The history of Android.md b/translated/talk/The history of Android/18 - The history of Android.md new file mode 100644 index 0000000000..f4781cc621 --- /dev/null +++ b/translated/talk/The history of Android/18 - The history of Android.md @@ -0,0 +1,83 @@ +安卓编年史 +================================================================================ +![安卓市场的新设计试水“卡片式”界面,这将成为谷歌的主要风格。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/play-store.png) +安卓市场的新设计试水“卡片式”界面,这将成为谷歌的主要风格。 +Ron Amadeo 供图 + +安卓推向市场已经有两年半时间了,安卓市场放出了它的第四版设计。这个新设计十分重要,因为它已经很接近谷歌的“卡片式”界面了。通过在小方块中显示应用或其他内容,谷歌可以使其设计在不同尺寸屏幕下无缝过渡而不受影响。内容可以像一个相册应用里的照片一样显示——给布局渲染填充一个内容块列表,加上屏幕包装,就完成了。更大的屏幕一次可以看到更多的内容块,小点的屏幕一次看到的内容就少。内容用了不一样的方式显示,谷歌还在右边新增了一个“分类”板块,顶部还有个巨大的热门应用滚动显示。 + +虽然设计上为更容易配置界面准备好准备好了,但功能上还没有。最初发布的市场版本锁定为横屏模式,而且还是蜂巢独占的。 + +![应用详情页和“我的应用”界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/device-2014-02-12-190002.png) +应用详情页和“我的应用”界面。 +Ron Amadeo 供图 + +新的市场不仅出售应用,还加入了书籍和电影租借。谷歌从2010年开始出售图书;之前只通过网站出售。新的市场将谷歌所有的内容销售聚合到了一处,进一步向苹果 iTunes 的主宰展开较量。虽然在“安卓市场”出售这些东西有点品牌混乱,因为大部分内容都不依赖于安卓才能使用。 + +![浏览器看起来非常像 Chrome,联系人使用了双面板界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/browsercontactst.png) +浏览器看起来非常像 Chrome,联系人使用了双面板界面。 +Ron Amadeo 供图 + +新浏览器界面顶部添加了标签页栏。尽管这个浏览器并不是 Chrome ,它模仿了许多 Chrome 的设计和特性。除了这个探索性的顶部标签页界面,浏览器还加入了隐身标签,在浏览网页时不保存历史记录和自动补全记录。它还有个选项可以让你拥有一个 Chrome 风格的新标签页,页面上包含你最经常访问的网页略缩图。 + +新浏览器甚至还能和 Chrome 同步。在浏览器登录后,它会下载你的 Chrome 书签并且自动登录你的谷歌账户。收藏一个页面只需点击地址栏的星形标志即可,和谷歌地图一样,浏览器抛弃了缩放按钮,完全改用手势控制。 + +联系人应用最终从电话应用中移除,并且独立为一个应用。之前的联系人/拨号混合式设计相对于人们使用现代智能手机的方式来说,过于以电话为中心了。联系人中存有电子邮件,IM,短信,地址,生日,以及社交网络等信息,所以将它们捆绑在电话应用里的意义和将它们放进谷歌地图里差不多。抛开了电话通讯功能,联系人能够简化成没有标签页的联系人列表。蜂巢采用了双面板视图,在左侧显示完整的联系人列表,右侧是联系人详情。应用利用了 Fragments API,通过它应用可以在同一屏显示多个面板界面。 + +蜂巢版本的联系人应用是第一个拥有快速滚动功能的版本。当按住左侧滚动条的时候,你可以快速上下拖动,应用会显示列表当前位置的首字母预览。 + +![新 Youtube 应用看起来像是来自黑客帝国。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/youtubes.png) +新 Youtube 应用看起来像是来自黑客帝国。 +Ron Amadeo 供图 + +谢天谢地 Youtube 终于抛弃了自安卓 2.3 以来的谷歌给予这个视频服务的“独特”设计,新界面设计与系统更加一体化。主界面是一个水平滚动的曲面墙,上面显示着最热门或者(登录之后)个人关注的视频。虽然谷歌从来没有将这个设计带到手机上,但它可以被认为是一个易于重新配置的卡片界面。操作栏在这里是个可配置的工具栏。没有登录时,操作栏由一个搜索栏填满。当你登录后,搜索缩小为一个按钮,“首页”,“浏览”和“你的频道”标签将会显示出来。 + +![蜂巢用一个蓝色框架的电脑界面来驱动主屏。电影工作室完全采用橙色电子风格主题。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/other2.png) +蜂巢用一个蓝色框架的电脑界面来驱动主屏。电影工作室完全采用橙色电子风格主题。 +Ron Amadeo 供图 + +蜂巢新增的应用“电影工作室”,这不是一个不言自明的应用,而且没有任何的解释或说明。就我们所知,你可以导入视频,剪切它们,添加文本和场景过渡。编辑视频——电脑上你可以做的最耗时,困难,以及处理器密集型任务之一——在平板上完成感觉有点野心过大了,谷歌在之后的版本里将其完全移除了。电影工作室里我们最喜欢的部分是它完全的电子风格主题。虽然系统的其它部分使用蓝色高亮,在这里是橙色的。(电影工作室是个邪恶的程序!) + +![小部件!](http://cdn.arstechnica.net/wp-content/uploads/2014/02/device-2014-02-12-202224.png) +小部件! +Ron Amadeo 供图 + +蜂巢带来了新的部件框架,允许部件滚动,Gmail,Email 以及日历部件都升级了以支持改功能。Youtube 和书籍使用了新的部件,内容卡片可以自动滚动切换。在小部件上轻轻向上或向下滑动可以切换卡片。我们不确定你的书籍中哪些书会被显示出来,但如果你想要的话它就在那儿。尽管所有的这些小部件在10英寸屏幕上运行良好,谷歌从未将它们重新设计给手机,这让它们在安卓最流行的规格上几乎毫无用处。所有的小部件有个大块的标识标题栏,而且通常占据大半屏幕只显示很少的内容。 + +![安卓3.1中可滚动的最近应用以及可自定义大小的小部件。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/31new.jpg) +安卓3.1中可滚动的最近应用以及可自定义大小的小部件。 +Ron Amadeo 供图 + +蜂巢后续的版本修复了3.0早期的一些问题。安卓3.1在蜂巢的第一个版本之后三个月放出,并带来了一些改进。小部件自定义大小是添加的最大特性之一。长按小部件之后,一个带有拖拽按钮的蓝色外框会显示出来,拖动按钮可以改变小部件尺寸。最近应用界面现在可以垂直滚动并且承载更多应用。这个版本唯一缺失的功能是滑动关闭应用。 + +在今天,一个0.1版本的升级是个主要更新,但是在蜂巢,那只是个小更新。除了一些界面调整,3.1添加了对游戏手柄,键盘,鼠标以及其它USB和蓝牙输入设备的支持。它还提供了更多的开发者API。 + +![安卓3.2的兼容性缩放和一个安卓平板上典型的展开视图应用。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/device-2014-02-14-131132.jpg) +安卓3.2的兼容性缩放和一个安卓平板上典型的展开视图应用。 +Ron Amadeo 供图 + +安卓3.2在3.1发布后两个月放出,添加了七到八英寸的小尺寸平板支持。3.2终于启用了SD卡支持,Xoom 在生命最初的五个月像是抱着个不完整的肢体一样。 + +蜂巢匆匆问世是为了成为一个生态系统建设者。如果应用没有平板版本,没人会想要一个安卓平板的,所以谷歌知道需要尽快将东西送到开发者手中。在这个安卓平板生态的早期阶段,应用还没有到齐。这是拥有 Xoom 的人们所面临的最大的问题。 + +3.2添加了“兼容缩放”,给了用户一个新选项,可以将应用拉伸适应屏幕(如右侧图片显示的那样)或缩放成正常的应用布局来适应屏幕。这些选项都不是很理想,没有应用生态来支持平板,蜂巢设备销售状况惨淡。但谷歌的平板决策最终还是会得到回报。今天,安卓平板已经[取代 iOS 占据了最大的市场份额][1]。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/18/ + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://techcrunch.com/2014/03/03/gartner-195m-tablets-sold-in-2013-android-grabs-top-spot-from-ipad-with-62-share/ +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/talk/The history of Android/19 - The history of Android.md b/translated/talk/The history of Android/19 - The history of Android.md new file mode 100644 index 0000000000..2ea47bc778 --- /dev/null +++ b/translated/talk/The history of Android/19 - The history of Android.md @@ -0,0 +1,71 @@ +安卓编年史 +================================================================================ +![姜饼上的 Google Music Beta。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/device-2014-03-31-110613.png) +姜饼上的 Google Music Beta。 +Ron Amadeo 供图 + +### Google Music Beta —— 取代内容商店的云存储 ### + +尽管蜂巢改进了 Google Music 的界面,但是音乐应用的设计并没有从蜂巢直接进化到冰淇淋三明治。2011年5月,谷歌发布了“[Google Music Beta][1]”,和新的 Google Music 应用一同到来的在线音乐存储。 + +新 Google Music 为安卓2.2及以上版本设计,借鉴了 Cooliris 相册的设计语言,但也有改变之处,背景使用了模糊处理的图片。几乎所有东西都是透明的:弹出菜单,顶部标签页,还有底部的正在播放栏。可以下载单独的歌曲或整个播放列表到设备上离线播放,这让 Google Music 成为一个让音乐同步到你所有设备的好途径。除了移动应用外,Google Music 还有一个 Web 应用,让它可以在任何一台桌面电脑上使用。 + +谷歌和唱片公司关于内容的合约还没有谈妥,音乐商店还没准备好,所以它的权宜之计是允许用户存储音乐到线上并下载到设备上。如今谷歌除了音乐存储服务外,还有单曲购买和订阅模式。 + +### Android 4.0, 冰淇淋三明治 —— 摩登时代 ### + +![三星 Galaxy Nexus,安卓4.0的首发设备。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/samsung-i9250-galaxy-nexus-51.jpg) +三星 Galaxy Nexus,安卓4.0的首发设备。 + +安卓4.0,冰淇淋三明治,在2011年10月发布,系统发布回到正轨,带来定期发布的手机和平板,并且安卓再次开源。这是自姜饼以来手机设备的第一个更新,意味着最主要的安卓用户群体近乎一年没有见到更新了。4.0随处可见缩小版的蜂巢设计,还将虚拟按键,操作栏(Action Bar),全新的设计语言带到了手机上。 + +冰淇淋三明治在三星 Galaxy Nexus 上首次亮相,也是最早带有720p显示屏的安卓手机之一。随着分辨率的提高,Galaxy Nexus 使用了更大的4.65英寸显示屏——几乎比最初的 Nexus One 大了一整英寸。这被许多批评者认为“太大了”,但如今的安卓设备甚至更大。(5英寸现在是“正常”的。)冰淇淋三明治比姜饼的性能要求更高,Galaxy Nexus 配备了一颗双核,1.2Ghz 德州仪器 OMAP 处理器和1GB的内存。 + +在美国,Galaxy Nexus 在 Verizon 首发并且支持 LTE。不像之前的 Nexus 设备,最流行的型号——Verizon版——是在运营商的控制之下,谷歌的软件和更新在手机得到更新之前要经过 Verizon 的核准。这导致了更新的延迟以及 Verizon 不喜欢的应用被移除,即便是 Google Wallet 也不例外。 + +多亏了冰淇淋三明治的软件改进,谷歌终于达成了移除手机上按钮的目标。有了虚拟导航键,实体电容按钮就可以移除了,最终 Galaxy Nexus 仅有电源和音量是实体按键。 + +![安卓4.0将很多蜂巢的设计缩小了。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/2home.png) +安卓4.0将很多蜂巢的设计缩小了。 +Ron Amadeo 供图 + +电子质感的审美在蜂巢中显得有点多。于是在冰淇淋三明治中,谷歌开始减少科幻风的设计。科幻风的时钟字体从半透明折叠风格转变成纤细,优雅,看起来更加正常的字体。解锁环的水面波纹效果被去除了,蜂巢中的外星风格时钟小部件也被极简设计所取代。系统按钮也经过了重新设计,原先的蓝色轮廓,偶尔的厚边框变成了细的,设置带有白色轮廓。默认壁纸从蜂巢的蓝色太空船内部变成条纹状,破碎的彩虹,给默认布局增添了不少迟来的色彩。 + +蜂巢的系统栏在手机上一分为二。在顶上是传统的状态栏,底部是新的系统栏,放着三个系统按钮:后退,主屏幕,最近应用。一个固定的搜索栏放置在了主屏幕顶部。该栏以和底栏一样的方式固定在屏幕上,所以在五个主屏上,它总共占据了20个图标大小的位置。在蜂巢的锁屏上,内部的小圆圈可以向大圆圈外的任意位置滑动来解锁设备。在冰淇淋三明治,你得把小圆圈移动到解锁图标上。这个新准确度要求允许谷歌向锁屏添加新的选项:一个相机快捷方式。将小圆圈拖向相机图标会直接启动相机,跳过了主屏幕。 + +![一个手机系统意味着更多的应用,通知面板重新回到了全屏界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/appsandnotic40.png) +一个手机系统意味着更多的应用,通知面板重新回到了全屏界面。 +Ron Amadeo 供图 + +应用抽屉还是标签页式的,但是蜂巢中的“我的应用”标签被“部件”标签页替代,这是个简单的2×3部件略缩图视图。像蜂巢里的那样,这个应用抽屉是分页的,需要水平滑动换页。(如今安卓仍在使用这个应用抽屉设计。)应用抽屉里新增的是 Google+ 应用,后来独立存在。还有一个“Messenger”快捷方式,是 Google+ 的私密信息服务。(不要混淆 “Messenger” 和已有的 “Messaging” 短信应用。) + +因为我们现在回到了手机上,所以短信,新闻和天气,电话,以及语音拨号都回来了,以及Cordy,一个平板的游戏,被移除了。尽管不是 Nexus 设备,我们的截图还是来自 Verizon 版的设备,可以从图上看到有像 “My Verizon Mobile” 和 “VZ Backup Assistant” 这样没用的应用。为了和冰淇淋三明治的去电子风格主题一致,日历和相机图标现在看起来更像是来自地球的东西而不是来自外星球。时钟,下载,电话,以及安卓市场同样得到了新图标,联系人“Contacts”获得了新图标,还有新名字“People”。 + +通知面板进行了大改造,特别是和[之前姜饼中的设计][2]相比而言。面板头部有个日期,一个设置的快捷方式,以及“清除所有”按钮。虽然蜂巢的第一个版本就允许用户通过通知右边的“X”消除单个通知,但是冰淇淋三明治的实现更加优雅:只要从左向右滑动通知即可。蜂巢有着蓝色高亮,但是蓝色色调到处都是。冰淇淋三明治几乎把所有地方的蓝色统一成一个(如果你想知道确定的值,hex码是#33B5E5)。通知面板的背景是透明的,底部的“把手”变为一个简单的小蓝圈,带着不透明的黑色背景。 + +![安卓市场的主页背景变成了黑色。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/market.png) +安卓市场的主页背景变成了黑色。 +Ron Amadeo 供图 + +市场获得了又一个新设计。它终于再次支持纵向模式,并且添加了音乐到商店中,你可以从中购买音乐。新的市场拓展了从蜂巢中引入的卡片概念,它还是第一个同时使用在手机和平板上的版本。主页上的卡片通常不是链接到应用的,而是指向特别的促销页面,像是“编辑精选”或季度促销。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/19/ + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://arstechnica.com/gadgets/2011/05/hands-on-grooving-on-the-go-with-impressive-google-music-beta/ +[2]:http://cdn.arstechnica.net/wp-content/uploads/2014/02/32.png +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/talk/The history of Android/20 - The history of Android.md b/translated/talk/The history of Android/20 - The history of Android.md new file mode 100644 index 0000000000..9ef34f1f63 --- /dev/null +++ b/translated/talk/The history of Android/20 - The history of Android.md @@ -0,0 +1,93 @@ +安卓编年史 +================================================================================ +![和之前完全不同的市场设计。以上是分类,特色,热门应用以及应用详情页面。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/market-pages.png) +和之前完全不同的市场设计。以上是分类,特色,热门应用以及应用详情页面。 +Ron Amadeo 供图 + +这些截图给了我们冰淇淋三明治中新版操作栏的第一印象。几乎所有的应用顶部都有一条栏,带有应用图标,当前界面标题,一些功能按钮,右边还有一个菜单按钮。这个右对齐的菜单按钮被称为“更多操作”,因为里面存放着无法放置到主操作栏的项目。不过更多操作菜单并不是固定不变的,它给了操作栏节省了更多的屏幕空间——比如在横屏模式或在平板上时,更多操作菜单的项目会像通常的按钮一样显示在操作栏上。 + +冰淇凌三明治中新增了“滑动标签页”设计,替换掉了谷歌之前推行的2×3方阵导航屏幕。一个标签页栏放置在了操作栏下方,位于中间的标签显示的是当前页面,左右侧的两个标签显示的是对应的当前页面的左右侧页面。向左右滑动可以切换标签页,或者你可以点击指定页面的标签跳转过去。 + +应用详情页面有个很赞的设计,在应用截图后,会根据你关于那个应用的历史动态地重新布局页面。如果你从来没有安装过该应用,应用描述会优先显示。如果你曾安装过这个应用,第一部分将会是评价栏,它会邀请你评价该应用或者提醒你上次你安装该应用时的评价是什么。之前使用过的应用页面第二部分是“新特性”,因为一个老用户最关心的应该是应用有什么变化。 + +![最近应用和浏览器和蜂巢中的类似,但是是小号的](http://cdn.arstechnica.net/wp-content/uploads/2014/03/recentbrowser.png) +最近应用和浏览器和蜂巢中的类似,但是是小号的。 +Ron Amadeo 供图 + +最近应用的电子风格外观被移除了。略缩图周围的蓝色的轮廓线被去除了,同时去除的还有背景怪异的,不均匀的蓝色光晕。它现在看起来是个中立型的界面,在任何时候看起来都很舒适。 + +浏览器尽了最大的努力把标签页体验带到手机上来。多标签浏览受到了关注,操作栏上引入的一个标签页按钮会打开一个类似最近应用的界面,显示你打开的标签页,而不是浪费宝贵的屏幕空间引入一个标签条。从功能上来说,这个和之前的浏览器中的“窗口”视图没什么差别。浏览器最佳的改进是菜单中的“请求桌面版站点”选项,这让你可以从默认的移动站点视图切换到正常站点。浏览器展示了谷歌的操作栏设计的灵活性,尽管这里没有左上角的应用图标,功能上来说和其他的顶栏设计相似。 + +![Gmail 和 Google Talk —— 它们和蜂巢中的相似,但是更小!](http://cdn.arstechnica.net/wp-content/uploads/2014/03/gmail2.png) +Gmail 和 Google Talk —— 它们和蜂巢中的相似,但是更小! +Ron Amadeo 供图 + +Gmail 和 Google Talk 看起来都像是之前蜂巢中的设计的缩小版,但是有些小调整让它们在小屏幕上表现更佳。Gmail 以双操作栏为特色——一个在屏幕顶部,一个在底部。顶部操作栏显示当前文件夹,账户,以及未读消息数目,点击顶栏可以打开一个导航菜单。底部操作栏有你期望出现在更多操作中的选项。使用双操作栏布局是为了在界面显示更多的按钮,但是在横屏模式下纵向空间有限,双操作栏就是合并成一个顶部操作栏。 + +在邮件视图下,往下滚动屏幕时蓝色栏有“粘性”。它会固定在屏幕顶部,所以你一直可以看到该邮件是谁写的,回复它,或者给它加星标。一旦处于邮件消息界面,底部细长的,深灰色栏会显示你当前在收件箱(或你所在的某个列表)的位置,并且你可以向左或向右滑动来切换到其他邮件。 + +Google Talk 允许你像在 Gmail 中那样左右滑动来切换聊天窗口,但是这里显示栏是在顶部。 + +![新的拨号和来电界面,都是姜饼以来我们还没见过的。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/inc-calls.png) +新的拨号和来电界面,都是姜饼以来我们还没见过的。 +Ron Amadeo 供图 + +因为蜂巢只给平板使用,所以一些界面设计直接超前于姜饼。冰淇淋三明治的新拨号界面就是如此,黑色和蓝色相间,并且使用了可滑动切换的小标签。尽管冰淇淋三明治终于做了对的事情并将电话主体和联系人独立开来,但电话应用还是有它自己的联系人标签。现在有两个地方可以看到你的联系人列表——一个有着暗色主题,另一个有着亮色主题。由于实体搜索按钮不再是硬性要求,底部的按钮栏的语音信息快捷方式被替换为了搜索图标。 + +谷歌几乎就是把来电界面做成了锁屏界面的镜像,这意味着冰淇淋三明治有着一个环状解锁设计。除了通常的接受和挂断选项,圆环的顶部还添加了一个按钮,让你可以挂断来电并给对方发送一条预先定义好的信息。向上滑动并选择一条信息如“现在无法接听,一会回电”,相比于一直响个不停的手机而言这样做的信息交流更加丰富。 + +![蜂巢没有文件夹和信息应用,所以这里是冰淇淋三明治和姜饼的对比。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/thenonmessedupversion.png) +蜂巢没有文件夹和信息应用,所以这里是冰淇淋三明治和姜饼的对比。 +Ron Amadeo 供图 + +现在创建文件夹更加方便了。在姜饼中,你得长按屏幕,选择“文件夹”选项,再点击“新文件夹”。在冰淇淋三明治中,你只要将一个图标拖拽到另一个图标上面,就会自动创建一个文件夹,并包含这两个图标。这简直不能更简单了,比寻找隐藏的长按命令容易多了。 + +设计上也有很大的改进。姜饼使用了一个通用的米黄色文件夹图标,但冰淇淋三明治直接显示出了文件夹中的头三个应用,把它们的图标叠在一起,在外侧画一个圆圈,并将其设置为文件夹图标。打开文件夹容器将自动调整大小以适应文件夹中的应用图标数目,而不是显示一个全屏的,大部分都是空的对话框。这看起来好得多得多。 + +![Youtube 转换到一个更加现代的白色主题,使用了列表视图替换疯狂的 3D 滚动视图。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/youtubes.png) +Youtube 转换到一个更加现代的白色主题,使用了列表视图替换疯狂的 3D 滚动视图。 +Ron Amadeo 供图 + +Youtube 经过了完全的重新设计,看起来没那么像是来自黑客帝国的产物,更像是,嗯,Youtube。它现在就是一个简单的垂直滚动的白色视频列表,就像网站的那样。在你手机上制作视频受到了重视,操作栏的第一个按钮专用于拍摄视频。奇怪的是,不同的界面左上角使用了不同的 Youtube 标志,在水平的 Youtube 标志和方形标志之间切换。 + +Youtube 几乎在所有地方都使用了滑动标签页。它们被放置在主页面以在浏览和账户间切换,放置在视频页面以在评论,介绍和相关视频之间切换。4.0 版本的应用显示出 Google+ Youtube 集成的第一个信号,通常的评分按钮旁边放置了 “+1” 图标。最终 Google+ 会完全占据 Youtube,将评论和作者页面变成 Google+ 活动。 + +![冰淇淋三明治试着让事情对所有人都更加简单。这里是数据使用量追踪,打开许多数据的新开发者选项,以及使用向导。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/data.png) +冰淇淋三明治试着让事情对所有人都更加简单。这里是数据使用量追踪,打开许多数据的新开发者选项,以及使用向导。 +Ron Amadeo 供图 + +数据使用量允许用户更轻松地追踪和控制他们的数据使用。主页面显示一个月度使用量图表,用户可以设置数据使用警告值或者硬性使用限制以避免超量使用产生费用。所有的这些只需简单地拖动橙色和红色水平限制线在图表上的位置即可。纵向的白色把手允许用户选择图表上的一段指定时间段。在页面底部,选定时间段内的数据使用量又细分到每个应用,所以用户可以选择一个数据使用高峰并轻松地查看哪个应用在消耗大量流量。当流量紧张的时候,更多操作按钮中有个限制所有后台流量的选项。设置之后只用在前台运行的程序有权连接互联网。 + +开发者选项通常只有一点点设置选项,但是在冰淇淋三明治中,这部分有非常多选项。谷歌添加了所有类型的屏幕诊断显示浮层来帮助开发者理解他们的应用中发生了什么。你可以看到 CPU 使用率,触摸点位置,还有视图界面更新。还有些选项可以更改系统功能,比如控制动画速度,后台处理,以及 GPU 渲染。 + +安卓和 iOS 之间最大的区别之一就是应用抽屉界面。在冰淇淋三明治对更加用户友好的追求下,设备第一次初始化启动会启动一个小教程,向用户展示应用抽屉的位置以及如何将应用图标从应用抽屉拖拽到主屏幕。随着实体菜单按键的移除和像这样的改变,安卓 4.0 做了很大的努力变得对新智能手机用户和转换过来的用户更有吸引力。 + +![“触摸分享”NFC 支持,Google Earth,以及应用信息,让你可以禁用垃圾软件。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/2014-03-06-03.57.png) +“触摸分享”NFC 支持,Google Earth,以及应用信息,让你可以禁用垃圾软件。 + +冰淇淋三明治内置对 [NFC][1] 的完整支持。尽管之前的设备,比如 Nexus S 也拥有 NFC,得到的支持是有限的并且系统并不能利用芯片做太多事情。4.0 添加了一个“Android Beam”功能,两台拥有 NFC 的安卓 4.0 设备可以借此在设备间来回传输数据。NFC 会传输关于此事屏幕显示的数据,因此在手机显示一个网页的时候使用该功能会将该页面传送给另一部手机。你还可以发送联系人信息,方向导航,以及 Youtube 链接。当两台手机放在一起时,屏幕显示会缩小,点击缩小的界面会发送相关信息。 + +I在安卓中,用户不允许删除系统应用,以保证系统完整性。运营商和 OEM 利用该特性并开始将垃圾软件放入系统分区,经常有一些没用的应用存在系统中。安卓 4.0 允许用户禁用任何不能被卸载的应用,意味着该应用还存在于系统中但是不显示在应用抽屉里并且不能运行。如果用户愿意深究设置项,这给了他们一个简单的途径来拿回手机的控制权。 + +安卓 4.0 可以看做是现代安卓时代的开始。大部分这时发布的谷歌应用只能在安卓 4.0 及以上版本运行。4.0 还有许多谷歌想要好好利用的新 API——至少最初想要——对 4.0 以下的版本的支持就有限了。在冰淇淋三明治和蜂巢之后,谷歌真的开始认真对待软件设计。在2012年1月,谷歌[最终发布了][2] *Android Design*,一个教安卓开发者如何创建符合安卓外观和感觉的应用的设计指南站点。这是 iOS 在有第三方应用支持开始就在做的事情,苹果还严肃地对待应用的设计,不符合指南的应用都被 App Store 拒之门外。安卓三年以来谷歌没有给出任何公共设计规范文档的事实,足以说明事情有多糟糕。但随着在 Duarte 掌控下的安卓设计革命,谷歌终于发布了基本设计需求。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/20/ + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://arstechnica.com/gadgets/2011/02/near-field-communications-a-technology-primer/ +[2]:http://arstechnica.com/business/2012/01/google-launches-style-guide-for-android-developers/ +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/talk/The history of Android/21 - The history of Android.md b/translated/talk/The history of Android/21 - The history of Android.md new file mode 100644 index 0000000000..48cd8880be --- /dev/null +++ b/translated/talk/The history of Android/21 - The history of Android.md @@ -0,0 +1,104 @@ +安卓编年史 +================================================================================ +![](http://cdn.arstechnica.net/wp-content/uploads/2014/03/playicons2.png) +Ron Amadeo 供图 + +### Google Play 和直接面向消费者出售设备的回归 ### + +2012年3月6日,谷歌将旗下提供的所有内容统一到 “Google Play”。安卓市场变为了 Google Play 商店,Google Books 变为 Google Play Books,Google Music 变为 Google Play Music,还有 Android Market Movies 变为 Google Play Movies & TV。尽管应用界面的变化不是很大,这四个内容应用都获得了新的名称和图标。在 Play 商店购买的内容会下载到对应的应用中,Play 商店和 Play 内容应用一道给用户提供了易管理的内容体验。 + +Google Play 更新是谷歌第一个大的更新周期外更新。四个自带应用都没有通过系统更新获得升级,它们都是直接通过安卓市场/ Play商店更新的。对单独的应用启用周期外更新是谷歌的重大关注点之一,而能够实现这样的更新,是自姜饼时代开始的工程努力的顶峰。谷歌一直致力于对应用从系统“解耦”,从而让它们能够通过安卓市场/ Play 商店进行分发。 + +尽管一两个应用(主要是地图和 Gmail)之前就在安卓市场上,从这里开始你会看到许多更重大的更新,而其和系统发布无关。系统更新需要 OEM 厂商和运营商的合作,所以很难保证推送到每个用户手上。而 Play 商店更新则完全掌握在谷歌手上,给了谷歌一条直接到达用户设备的途径。因为 Google Play 的发布,安卓市场对自身升级到了 Google Play Store,在那之后,图书,音乐以及电影应用都下发了 Google Play 式的更新。 + +Google Play 系列应用的设计仍然不尽相同。每个应用的外观和功能各有差异,但暂且来说,一个统一的品牌标识是个好的开始。从品牌标识中去除“安卓”字样是很有必要的,因为很多服务是在浏览器中提供的,不需要安卓设备也能使用。 + +2012年4月,谷歌[再次开始通过 Play 商店销售设备][1],恢复在 Nexus One 发布时尝试的直接面向消费者销售的方式。尽管距 Nexus One 销售结束仅有两年,但往上购物现在更加寻常,在接触到物品之前就购买它并不像在2010年时听起来那么疯狂。 + +谷歌也看到了价格敏感的用户在面对 Nexus One 530美元的价格时的反应。第一部销售的设备是无锁的,GSM 版本的 Galaxy Nexus,价格399美元。在那之后,价格变得更低。350美元成为了最近两台 Nexus 设备的入门价,7英寸 Nexus 平板的价格更是只有200美元到220美元。 + +今天,Play 商店销售八款不同的安卓设备,四款 Chromebook,一款自动调温器,以及许多配件,设备商店已经是谷歌新产品发布的实际地点了。新产品发布总是如此受欢迎,站点往往无法承载如此大的流量,新 Nexus 手机也在几小时内售空。 + +### 安卓 4.1,果冻豆——Google Now指明未来 + +![华硕制造的 Nexus 7,安卓 4.1 的首发设备。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/ASUS_Google_Nexus_7_4_11.jpg) +华硕制造的 Nexus 7,安卓 4.1 的首发设备。 + +随着2012年7月安卓 4.1 果冻豆的发布,谷歌的安卓发布节奏进入每六个月一发布的轨道。平台已经成熟,三个月的发布周期就没那么必要了,更长的发布周期也给了 OEM 厂商足够的时间跟上谷歌的节奏。和蜂巢不同,小数点后的更新发布现在是主要更新,4.1 带来了主要的界面更新和框架变化。 + +果冻豆最大的变化之一,并且你在截图中看不到的是“黄油计划”,谷歌工程师齐心努力让安卓的动画顺畅地跑在 30FPS 上。还有一些核心变化,像垂直同步和三重缓冲,每个动画都经过优化以流畅地绘制。动画和顺滑滚动一直是安卓和 iOS 相比之下的弱点。经过在核心动画框架和单独的应用上的努力,果冻豆让安卓的流畅度大幅接近 iOS。 + +和果冻豆一起到来的还有 [Nexus][2] 7,由华硕生产的7英寸平板。不像之前主要是横屏模式的 Xoom,Nexus 7 主要以竖屏模式使用,像个大一号的手机。Nexus 7 展现了经过一年半的生态建设,谷歌已经准备好了给平板市场带来一部旗舰设备。和 Nexus One 和 GSM Galaxy Nexus 一样,Nexus 7 直接由谷歌在线销售。尽管那些早先的设备对习惯于运营商补贴的消费者来说拥有惊人的高价,Nexus 7 以仅仅 200 美元的价格推向大众市场。这个价格给你带来一部7英寸,1280x800 英寸显示屏,四核 1.2GHz Tegra 3 处理器,1GB 内存,8GB 内置存储的设备。Nexus 7 的性价比如此之高,许多人都想知道谷歌到底有没有在其旗舰平板上赚到钱。 + +更小,更轻,7英寸,这些因素促成了谷歌巨大的成功,并且将谷歌带向了引领行业潮流的位置。一开始制造10英寸 iPad 的苹果,最终也不得不推出和 Nexus 7 相似的 iPad Mini 来应对。 + +![4.1 的新锁屏设计,壁纸,以及系统按钮新的点击高亮。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/picture.png) +4.1 的新锁屏设计,壁纸,以及系统按钮新的点击高亮。 +Ron Amadeo 供图 + +蜂巢引入的电子风格在冰淇淋三明治中有所减少,果冻豆在此之上走得更远。它开始从系统中大范围地移除蓝色。迹象就是系统按钮的点击高亮从蓝色变为了灰色。 + +![新应用阵容合成图以及新的消息可展开通知面板。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/jb-apps-and-notications.png) +新应用阵容合成图以及新的消息可展开通知面板。 +Ron Amadeo 供图 + +通知中心面板完全重制了,这个设计一直沿用到今天的奇巧巧克力(KitKat)。新面板扩展到了屏幕顶部,并且覆盖了状态栏图标,这意味着通知面板打开的时候不再能看到状态栏。时间突出显示在左上角,旁边是日期和设置按钮。清除所有通知按钮,冰淇淋三明治中显示为一个“X”按钮,现在变为阶梯状的按钮,象征着清除所有通知的时候消息交错滑动的动画效果。底部的面板把手从一个小圆换成了一条直线,和面板等宽。所有的排版都发生了变化——通知面板的所有项现在都使用了更大,更细的字体。通知面板是另一个从冰淇淋三明治和蜂巢中引入的蓝色元素被移除的屏幕。除了触摸高亮之外整个通知面板都是灰色的。 + +通知面板也引入了新功能。相较于之前的两行设计,现在的通知消息可以展开以显示更多信息。通知消息可以显示最多8行文本,甚至还能在消息底部显示按钮。屏幕截图通知消息底部有个分享按钮,你也可以直接从未接来电通知拨号,或者将一个正在响铃的闹钟小睡,这些都可以在通知面板完成。新通知消息默认展开,但当它们堆叠到一起时会恢复原来的尺寸。在通知消息上双指向下滑动可以展开消息。 + +![新谷歌搜索应用,带有 Google Now 卡片,语音搜索,以及文字搜索。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/googlenow.png) +新谷歌搜索应用,带有 Google Now 卡片,语音搜索,以及文字搜索。 +Ron Amadeo 供图 + +果冻豆中不止对安卓而言,也是对谷歌来说最大的特性,是新版谷歌搜索应用。它带来了“Google Now”,一个预测性搜索功能。Google Now 在搜索框下面显示为几张卡片,它会提供谷歌认为你所关心的事物的搜索结果。就比如谷歌地图搜索你最近在桌面电脑查找的地点或日历的约会地点,天气,以及旅行时回家的时间。 + +新版谷歌搜索应用自然可以从谷歌图标启动,但它还可以在任意屏幕从系统栏上滑访问。长按系统栏会唤出一个类似锁屏解锁的环。卡片部分纵向滚动,如果你不想看到它们,可以滑动消除它们。语音搜索是更新的一个大部分。提问不是无脑地输入进谷歌,如果谷歌知道答案,它还会用文本语音转换引擎回答你。传统的文字搜索当然也受支持。只需点击搜索栏然后开始输入即可。 + +谷歌经常将 Google Now 称作“谷歌搜索的未来”。告诉谷歌你想要什么这还不够好。谷歌想要在你之前知道你想要什么。Google Now 用谷歌所有的数据挖掘关于你的知识为你服务,这也是谷歌对抗搜索引擎竞争对手,比如必应,最大的优势所在。智能手机比你拥有的其它设备更了解你,所以该服务在安卓上首次亮相。但谷歌慢慢也将 Google Now 加入 Chrome,最终似乎会到达 Google.com。 + +尽管功能很重要,但同时 Google Now 是谷歌产品有史以来最重要的设计工作也是毋庸置疑的。谷歌搜索应用引入的白色卡片审美将会成为几乎所有谷歌产品设计的基础。今天,卡片风格被用在 Google Play 商店以及所有的 Play 内容应用,Youtube,谷歌地图,Drive,Keep,Gmail,Google+以及其它产品。同时也不限于安卓应用。不少谷歌的桌面站点和 iOS 应用也以此设计为灵感。设计是谷歌历史中的弱项之一,但 Google Now 开始谷歌最终在设计上采取了行动,带来一个统一的,全公司范围的设计语言。 + +![又一个 Youtube 重新设计,信息密度有所下降。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/yotuube.png) +又一个 Youtube 的重新设计,信息密度有所下降。 +Ron Amadeo 供图 + +又一个版本,又一个 Youtube 的重新设计。这次列表视图主要基于略缩图,大大的图片占据了屏幕的大部分。信息密度在新列表设计中有所下降。之前 Youtube 每屏大约能显示6个项目,现在只能显示3个。 + +Youtube 是首批在应用左侧加入滑动抽屉的应用之一,该特性会成为谷歌应用的标准设计风格。抽屉中有你的账户的链接和订阅频道,这让谷歌可以去除页面顶部标签页设计。 + +![Google Play 服务的职责以及安卓的剩余部分职责。](http://cdn.arstechnica.net/wp-content/uploads/2013/08/playservicesdiagram2.png) +Google Play 服务的职责以及安卓的剩余部分职责。 +Ron Amadeo 供图 + +### Google Play Services—fragmentation and making OS versions (nearly) obsolete ### +### Google Play 服务——碎片化和让系统版本(几乎)过时 ### + +碎片化那时候看起来这并不是个大问题,但2012年12月,Google Play 服务 1.0 面向所有安卓2.2及以上版本的手机推出。它添加了一些 Google+ API 和对 OAuth 2.0 的支持。 + +尽管这个升级听起来很无聊,但 Google Play 服务最终会成长为安卓整体的一部分。Google Play 服务扮演着正常应用和安卓系统的中间角色,使得谷歌可以升级或替换一些核心组件,并在不发布新安卓版本的前提下添加 API。 + +有了 Play 服务,谷歌有了直接接触安卓手机核心部分的能力,而不用通过 OEM 更新一集运营商批准的过程。谷歌使用 Play 服务添加了全新的位置系统,恶意软件扫描,远程擦除功能,以及新的谷歌地图 API,所有的这一切都不用通过发布一个系统更新实现。正如我们在姜饼部分的结尾提到的,感谢 Play 服务里这些“可移植的”API 实现,姜饼仍然能够下载现代版本的 Play 商店和许多其他的谷歌应用。 + +另一个巨大的益处是安卓用户基础的兼容性。最新版本的安卓系统要经过很长时间到达大多数用户手中,这意味着最新版本系统绑定的 API 在大多数用户升级之前对开发者来说没有任何意义。Google Play 服务兼容冻酸奶及以上版本,换句话说就是99%的活跃设备,并且更新可以直接通过 Play 商店直接推送到手机上。通过将 API 包含在 Google Play 服务中而不是安卓中,谷歌可以在一周内将新 API 推送到几乎所有用户手中。这对许多版本碎片化引起的问题来说是个[伟大的解决方案][3]。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/21/ + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://arstechnica.com/gadgets/2012/04/unlocked-samsung-galaxy-nexus-can-now-be-purchased-from-google/ +[2]:http://arstechnica.com/gadgets/2012/07/divine-intervention-googles-nexus-7-is-a-fantastic-200-tablet/ +[3]:http://arstechnica.com/gadgets/2013/09/balky-carriers-and-slow-oems-step-aside-google-is-defragging-android/ +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/talk/The history of Android/22 - The history of Android.md b/translated/talk/The history of Android/22 - The history of Android.md new file mode 100644 index 0000000000..aabe79cfa1 --- /dev/null +++ b/translated/talk/The history of Android/22 - The history of Android.md @@ -0,0 +1,84 @@ +安卓编年史 +================================================================================ +### Android 4.2,果冻豆——全新 Nexus 设备,全新平板界面 ### + +安卓平台成熟的脚步越来越快,谷歌也将越来越多的应用托管到 Play 商店,需要通过系统更新来更新的应用越来越少。但是不间断的更新还是要继续的,2012 年 11 月,安卓 4.2 发布。4.2 还是叫做“果冻豆”,这个版本主要是一些少量变动。 + +![LG 生产的 Nexus 4 和三星生产的 Nexus 10。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/unnamed.jpg) +LG 生产的 Nexus 4 和三星生产的 Nexus 10。 +Google/Ron Amadeo 供图 + +和安卓 4.2 一同发布的还有两部旗舰设备,Nexus 4 和 Nexus 10,都由谷歌直接在 Play 商店出售。Nexus 4 使用了 Nexus 7 的策略,令人惊讶的低价和高质量,并且无锁设备售价 300 美元。Nexus 4 有一个 4 核 1.5GHz 骁龙 S4 Pro 处理器,2GB 内存以及 1280×768 分辨率 4.7 英寸 LCD 显示屏。谷歌的新旗舰手机由 LG 生产,并和制造商一起将关注点转向了材料和质量。Nexus 4 有着正反两面双面玻璃,这会让你爱不释手,他是有史以来触感最佳的安卓手机之一。Nexus 4 最大的缺点是没有 LTE 支持,那时候大部分手机,包括 Version Galaxy Nexus 都有更快的基带。但 Nexus 4 的需求仍大大超出了谷歌的预料——发布当日大量的流量拖垮了 Play 商店网站。手机在一小时之内销售一空。 + +Nexus 10 是谷歌的第一部 10 英寸 Nexus 平板。该设备的亮点是 2560×1600 分辨率的显示屏,在其等级上是分辨率最高的。这背后是双核 1.7GHz Cortex A15 处理器和 2GB 内存的强力支持。随着时间一个月一个月地流逝,Nexus 10 似乎逐渐成为了第一部也是最后一部 10 英寸 Nexus 平板。通常这些设备每年都升级,但 Nexus 10 至今面世 16 个月了,可预见的未来还没有新设备的迹象。谷歌在小尺寸的 7 英寸平板上做得很出色,它似乎更倾向于让[像三星][1]这样的合作伙伴探索更大的平板家族。 + +![新的锁屏,壁纸,以及时钟小部件设计。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/JBvsjb.jpg) +新的锁屏,壁纸,以及时钟小部件设计。 +Ron Amadeo 供图 + +4.2 为锁屏带来了很多变化。文字居中,并且对小时使用了较大的字重,对分钟使用了较细的字体。锁屏现在是分页的,可以自定义小部件。锁屏不仅仅是一个简单的时钟,用户还可以将其替换成其它小部件或者添加额外的页面和更多的小部件。 + +![锁屏的添加小部件页面,小部件列表,锁屏上的 Gmail 部件,以及滑动到相机。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/locksc2reen.jpg) +锁屏的添加小部件页面,小部件列表,锁屏上的 Gmail 部件,以及滑动到相机。 +Ron Amadeo 供图 + +锁屏现在就像是一个精简版的主屏幕。页面轮廓会显示在锁屏的左右两侧来提示用户可以滑动到有其他小部件的页面。向左滑动页面会显示一个中间带有加号的简单空白页面,点击加号会打开兼容锁屏的小部件列表。锁屏每个页面限制一个小部件,将小部件向上或向下拖动可以展开或收起。最右侧的页面保留给了相机——一个简单的滑动就能打开相机界面,但是你没办法滑动回来。 + +![新的快速设置面板以及内置应用集合。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/42fix.png) +新的快速设置面板以及内置应用集合。 +Ron Amadeo 供图 + +4.2 最大的新增特性之一就是“快速设置”面板。安卓 3.0 为平板引入了快速改变电源设置的途径,4.2 终于将这种能力带给了手机。通知中心右上角加入了一枚新图标,可以在正常的通知列表和新的快速设置之间切换。快速设置提供了对屏幕亮度,网络连接,电池以及数据用量更加快捷的访问,而不用打开完整的设置界面。安卓 4.1 中顶部的设置按钮移除掉了,快速设置中添加了一个按钮来替代它。 + +应用抽屉和 4.2 中的应用阵容有很多改变。得益于 Nexus 4 更宽的屏幕横纵比(5:3,Galaxy Nexus 是 16:9),应用抽屉可以显示一行五个应用图标的方阵。4.2 将自带的浏览器替换为了 Google Chrome,自带的日历换成了 Google Calendar,他们都带来了新的图标设计。时钟和相机应用在 4.2 中经过了重制,新的图标也是其中的一部分。“Google Settings”是个新应用,用于提供对系统范围内所有存在的谷歌账户设置的快捷方式,它有着和 Google Search 和 Google+ 图标一致的风格。谷歌地图拥有了新图标,谷歌纵横,以往是谷歌地图的一部分,作为对 Google+ location 的支持在这个版本退役。 + +![浏览器替换为 Chrome,带有全屏取景器的新相机界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/chroemcam.jpg) +浏览器替换为 Chrome,带有全屏取景器的新相机界面。 +Ron Amadeo 供图 + +原自带浏览器在一段时间内对 Chrome 的模仿上下了不少功夫——它引入了许多 Chrome 的界面元素,许多 Chrome 的特性,甚至还使用了 Chrome 的 javascript 引擎——但安卓 4.2 来临的时候,谷歌认为安卓版的 Chrome 已经准备好替代这个模仿者了。表面上看起来没有多大不同;界面看起来不一样,而且早期版本的 Chrome 安卓版滚动起来没有原浏览器顺畅。不过深层次来说,一切都不一样。安卓的主浏览器开发现在由 Google Chrome 团队负责,而不是作为安卓团队的子项目存在。安卓的默认浏览器从绑定安卓版本发布停滞不前的应用变成了不断更新的 Play 商店应用。现在甚至还有一个每个月接收一些更新的 beta 通道。 + +相机界面经过了重新设计。它现在完全是个全屏应用,显示摄像头的实时图像并且在上面显示控制选项。布局审美和安卓 1.5 的[相机设计][2]有很多共同之处:带对焦的最小化的控制放置在取景器显示之上。中间的控制环在你长按屏幕或点击右下角圆形按钮的时候显示。你的手指保持在屏幕上时,你可以滑动来选择环上的选项,通常是展开进入一个子菜单。在高亮的选项上释放手指选中它。这灵感很明显来自于安卓 4.0 浏览器中的快速控制,但是将选项安排在一个环上意味着你的手指几乎总会挡住一部分界面。 + +![时钟应用,从一个只有两个界面的应用变成功能强大,实用的应用。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/clock-1.jpg) +时钟应用,从一个只有两个界面的应用变成功能强大,实用的应用。 +Ron Amadeo 供图 + +时钟应用经过了完整的改造,从一个简单的两个界面的闹钟,到一个世界时钟,闹钟,定时器,以及秒表俱全。时钟应用的设计和谷歌之前引入的完全不同,有着极简审美和红色高亮。它看起来像是谷歌的一个试验。甚至是几个版本之后,这个设计语言似乎也仅限于这个应用。 + +时钟的时间选择器是经过特别精心设计的。它显示一个简单的数字盘,会智能地禁用会导致无效时间的数字。设置闹钟时间也不可能没有隐式选择选择的 AM 和 PM,永远地解决了不小心将 9am 的闹钟设置成 9pm 的问题。 + +![平板的新系统界面使用了延展版的手机界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/tablet2.jpg) +平板的新系统界面使用了延展版的手机界面。 +Ron Amadeo 供图 + +安卓 4.2 中最有争议的改变是平板界面,从单独一个统一的底部系统栏变成带有顶部状态栏和底部系统栏的双栏设计。新设计统一了手机和平板的界面,但批评人士说将手机界面延展到 10 英寸的横向平板上是浪费空间。因为导航按键现在拥有了整个底栏,所以他们像手机界面那样被居中。 + +![平板上的多用户,以及新的手势键盘。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/2014-03-06-14.55.png) +平板上的多用户,以及新的手势键盘。 +Ron Amadeo 供图 + +在平板上,安卓 4.2 带来了多用户支持。在设置里,新增了“用户”部分,你可以在这里管理一台设备上的用户。设置在每个用户账户内完成,安卓会给每个用户保存单独的设置,主屏幕,应用以及应用数据。 + +4.2 还添加了有滑动输入能力的键盘。用户可以将手指一直保持在屏幕上,按顺序在字母按键上滑动来输入,而不用像以前那样一个一个字母单独地输入。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/22/ + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://arstechnica.com/gadgets/2014/01/hands-on-with-samsungs-notepro-and-tabpro-new-screen-sizes-and-magazine-ui/ +[2]:http://cdn.arstechnica.net/wp-content/uploads/2013/12/device-2013-12-26-11016071.png +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/talk/The history of Android/23 - The history of Android.md b/translated/talk/The history of Android/23 - The history of Android.md new file mode 100644 index 0000000000..a6693ee6ec --- /dev/null +++ b/translated/talk/The history of Android/23 - The history of Android.md @@ -0,0 +1,57 @@ +安卓编年史 +================================================================================ +![Play 商店又一次重新设计!这一版非常接近现在的设计,卡片结构让改变布局变得易如反掌。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/get-em-Kirill.jpg) +Play 商店又一次重新设计!这一版非常接近现在的设计,卡片结构让改变布局变得易如反掌。 +Ron Amadeo 供图 + +### 周期外更新——谁需要一个新系统? ### + +在安卓 4.2 和安卓 4.3 之间,谷歌进行了一次周期外更新,显示了有多少安卓可以不经过费力的 OTA 更新而得到改进。得益于[谷歌 Play 商店和 Play 服务][1],这些更新可以在不更新任何系统核心组件的前提下送达。 + +2013 年 4 月,谷歌发布了谷歌 Play 商店的一个主要设计改动。就如同在这之后的大多数重新设计,新的 Play 商店完全接受了 Google Now 审美,即在灰色背景上的白色卡片。操作栏基于当前页面内容部分更改颜色,由于首屏内容以商店的各部分为主,操作栏颜色是中性的灰色。导航至内容部分的按钮指向热门付费,在那下面通常是一块促销内容或一组推荐应用。 + +![独立的内容部分有漂亮的颜色。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/content-rainbow.jpg) +独立的内容部分有漂亮的颜色。 +Ron Amadeo 供图 + +新的 Play 商店展现了谷歌卡片设计语言的真正力量,在所有的屏幕尺寸上能够拥有响应式布局。一张大的卡片能够和若干小卡片组合,大屏幕设备能够显示更多的卡片,而且相对于拉伸来适应横屏模式,可以通过在一行显示更多卡片来适应。Play 商店的内容编辑们也可以自由地使用卡片布局;需要关注的大更新可以获得更大的卡片。这个设计最终会慢慢渗透向其它谷歌 Play 内容应用,最后拥有一个统一的设计。 + +![Hangouts 取代了 Google Talk,现在仍由 Google+ 团队继续开发。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/talkvhangouts2.jpg) +Hangouts 取代了 Google Talk,现在仍由 Google+ 团队继续开发。 +Ron Amadeo 供图 + +Google I/O,谷歌的年度开发者会议,通常会宣布一个新的安卓版本。但是 2013 年的会议,谷歌只是发布了一些改进而没有系统更新。 + +谷歌宣布的大事件之一是 Google Talk 的更新,谷歌的即时消息平台。在很长一段时间里,谷歌随安卓附四个文本交流应用:Google Talk,Google+ Messenger,信息(短信应用),Google Voice。拥有四个应用来完成相同的任务——给某人发送文本消息——对用户来说很混乱。在 I/O 上,谷歌结束了 Google Talk 并且从头开始创建全新的消息产品 [Google Hangouts][2]。虽然最初只是想替代 Google Talk,Hangouts 的计划是统一所有谷歌的不同的消息应用到统一的界面下。 + +Hangouts 的用户界面布局真的和 Google Talk 没什么大的差别。主页面包含你的聊天会话,点击某一项就能进入聊天页面。界面设计上有所更新,聊天页面现在使用了卡片风格来显示每个段落,并且聊天列表是个“抽屉”风格的界面,这意味着你可以通过水平滑动打开它。Hangouts 有已读回执和输入状态指示,并且群聊现在是个主要特性。 + +Google+ 是 Hangouts 的中心,所以产品的全名实际上是“Google+ Hangouts”。Hangouts 完全整合到了 Google+ 桌面站点。身份和头像直接从 Google+ 拉取,点击头像会打开用户的 Google+ 资料。和将浏览器换为 Google Chrome 类似,核心安卓功能交给了一个单独的团队——Google+ 团队——作为对应用成为繁忙的安卓工程师的副产品的反对。随着 Google+ 团队的接手,安卓的主要即时通讯客户端现在成为一个持续开发的应用。它被放进了 Play 商店并且有稳定的更新频率。 + +![新导航抽屉界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/navigation_drawer_overview1.png) +新导航抽屉界面。 +图片来自 [developer.android.com][3] + +谷歌还给操作栏引入了新的设计元素:导航抽屉。这个抽屉显示为在左上角应用图标旁的三道横线。点击或从屏幕左边缘向右滑动,会出现一个侧边菜单目录。就像名字所指明的,这个是用来应用内导航的,它会显示若干应用内的顶层位置。这使得应用首屏可以用来显示内容,也给了用户一致的,易于访问的导航元素。导航抽屉基本上就是个大号的菜单,可以滚动并且固定在左侧。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/23/ + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://arstechnica.com/gadgets/2013/09/balky-carriers-and-slow-oems-step-aside-google-is-defragging-android/ +[2]:http://arstechnica.com/information-technology/2013/05/hands-on-with-hangouts-googles-new-text-and-video-chat-architecture/ +[3]:https://developer.android.com/design/patterns/navigation-drawer.html +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/talk/The history of Android/24 - The history of Android.md b/translated/talk/The history of Android/24 - The history of Android.md new file mode 100644 index 0000000000..71d1736a12 --- /dev/null +++ b/translated/talk/The history of Android/24 - The history of Android.md @@ -0,0 +1,83 @@ +安卓编年史 +================================================================================ +![漂亮的新 Google Play Music 应用,从电子风格转向完美契合 Play 商店的风格。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/Goooogleplaymusic.jpg) +漂亮的新 Google Play Music 应用,从电子风格转向完美契合 Play 商店的风格。 +Ron Amadeo 供图 + +在 I/O 大会推出的另一个应用更新是 Google Music 应用。音乐应用经过了完全的重新设计,最终摆脱了蜂巢中引入的蓝底蓝色调的设计。Play Music 的设计和几个月前发布的 Play 商店一致,有着响应式的白色卡片布局。Music 同时还是最早采用新抽屉导航样式的主要应用之一。谷歌还随新应用发布了 Google Play Music All Access,每月 10 美元的包月音乐订阅服务。Google Music 现在拥有订阅计划,音乐购买,以及云端音乐存储空间。这个版本还引入了“Instant Mix”,谷歌会在云端给相似的歌曲计算出一份歌单。 + +![一个展示对 Google Play Games 支持的游戏。上面是 Play 商店游戏特性描述,登陆游戏触发的权限对话框,Play Games 通知,以及成就界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/gooooogleplaygames.jpg) +一个展示对 Google Play Games 支持的游戏。上面是 Play 商店游戏特性描述,登陆游戏触发的权限对话框,Play Games 通知,以及成就界面。 +Ron Amadeo 供图 + +谷歌还引入了“Google Play Games”,一个后端服务,开发者可以将其附加到游戏中。这项服务简单说就是安卓版的 Xbox Live 或苹果的 Game Center。开发者可以给游戏添加 Play Games 支持,这样就能通过使用谷歌的后端服务,更简单地集成成就,多人游戏,游戏匹配,用户账户以及云端存档到游戏中。 + +Play Games 是谷歌在游戏方面推进的开始。就像单独的 GPS 设备,翻盖手机,以及 MP3 播放器,智能手机的生产者希望游戏设备能够变成智能手机的一个功能点。当你有部智能手机的时候你为什么还有买个任天堂 DS 或 PS Vita 呢?一个易于使用的多人游戏服务是这项计划的重要部分,我们仍能看到这个决定最后的成果。在今天,坊间都在传言谷歌和苹果有关于客厅游戏设备的计划。 + +![Google Keep,谷歌自 Google Notebook 以来第一个笔记服务。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/goooglekeep.jpg) +Google Keep,谷歌自 Google Notebook 以来第一个笔记服务。 +Ron Amadeo 供图 + +毫无疑问一些产品为了赶上 Google I/O 大会的发布准时开发完成了,[但是三个半小时内的主题][1]已经够多了,一些产品在大会的发布上忽略了。Google I/O 大会的三天后一切都清楚了,谷歌带来了 Google Keep,一个用于安卓和在线的笔记应用。Keep 看起来很简单,就是一个用上了响应式 Google-Now 风格设计的笔记应用。用户可以改变卡片的尺寸,从多栏布局改为单列视图。笔记可以由文本,清单,自动转文本的语音或者图片组成。笔记卡片可以拖动并在主界面重新组织,你甚至可以给笔记换个颜色。 + +![Gmail 4.5,换上了新的导航抽屉设计,去掉了几个按钮并将操作栏合并到了抽屉里。](http://cdn.arstechnica.net/wp-content/uploads/2014/05/gmail.png) +Gmail 4.5,换上了新的导航抽屉设计,去掉了几个按钮并将操作栏合并到了抽屉里。 +Ron Amadeo 供图 + +在 I/O 大会之后,没有哪些应用不在谷歌的周期外更新里。2013 年 6 月,谷歌发布了新版设计的 Gmail。最显眼的变化就是一个月前 Google I/O 大会引入的新导航抽屉界面。最吸引眼球的变化是用上了 Google+ 资料图片来取代复选框。虽然复选框看起来被去掉了,它们其实还在那,点击邮件左边的图片就是了。 + +![新谷歌地图,换上了全白的 Google-Now 风格主题。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/newmaps11.png) +新谷歌地图,换上了全白的 Google-Now 风格主题。 +Ron Amadeo 供图 + +一个月后,谷歌在 Play 商店发布了全新的谷歌地图。这是谷歌地图自冰淇淋三明治以来第一个经过细致地重新设计的版本。新版本完全适配了 Google Now 白色卡片审美,还大大减少了屏幕上显示的元素。新版谷歌地图似乎设计时有意使地图总是显示在屏幕上,你很难找到除了设置页面之外还能完全覆盖地图显示的选项。 + +这个版本的谷歌地图看起来活在它自己的小小设计世界中。白色的搜索栏“浮动”在地图之上,地图显示部分在它旁边和上面都有。这和传统的操作栏设计有所不同。一般在应用左上角的导航抽屉,在这里是在左下角。这里的主界面没有向上按钮,应用图标,也没有浮动按钮。 + +![新谷歌地图轻量化了许多,在一屏内能够显示更多的信息。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/newmaps21.png) +新谷歌地图轻量化了许多,在一屏内能够显示更多的信息。 +Ron Amadeo 供图 + +左边的图片显示的是点击了搜索栏后的效果(带键盘,这里关闭了)。过去谷歌在空搜索栏下面显示一个空页面,但在地图中,谷歌利用这些空间链接到新的“本地”页面。搜索结果页显示一般信息的结果,比如餐馆,加油站,以及景点。在结果页的底部是个列表,显示你的搜索历史和手动缓存部分地图的选项。 + +右侧图片显示的是地点页面。上面地图 7.0 的截图里显示的地图不是略缩图,它是完整的地图视图。在新版的谷歌地图中,地点作为卡片浮动显示在主地图之上,地图重新居中显示该地点。向上滑动可以让卡片覆盖地图,向下滑动可以显示带有底部一小条结果的完整地图。如果该地点是搜索结果列表中的一个,左右滑动可以在结果之间切换。 + +地点页面重新设计以显示更有用的信息概览。在第一页,新版添加了重要信息,比如地图上的位置,点评得分,以及点评数目。因为这是个手机,所以软件内可以直接拨打电话,电话号码的显示被认为是毫无意义的,被去掉了。旧版地点显示到那里的距离,新版谷歌地图显示到那里的时间,基于交通状况和偏好的交通方式——一个更加实用的衡量方式。新版还在中间放了个分享按钮,这使得通过即时通讯或短信协调的时候更加方便。 + +### Android 4.3,果冻豆——早早支持可穿戴设备 ### + +如果谷歌没有在安卓 4.3 和安卓 4.2 之间通过 Play 商店发布更新的话,安卓 4.3 会是个不可思议的更新。如果新版 Play 商店,Gmail,地图,书籍,音乐,Hangouts 环聊,以及 Play Games 打包作为新版安卓的一部分,它将会作为有史以来最大的发布受到欢呼。虽然谷歌没必要延后新功能的发布。有了 Play 服务框架,只剩很少的部分需要系统更新,2013 年 7 月底谷歌发布了看似无关紧要的“安卓 4.3”。 + +![安卓 4.3 通知访问权限界面的可穿戴设备选项。 +](http://cdn.arstechnica.net/wp-content/uploads/2014/03/2014-03-28-12.231.jpg) +安卓 4.3 通知访问权限界面的可穿戴设备选项。 +Ron Amadeo 供图 + +谷歌也毫无疑问地认为 4.3 的重要性不高,将新版也叫做“果冻豆”(第三个叫果冻豆的版本了)。安卓 4.3 的新功能列表像是谷歌无法通过 Play 商店或谷歌 Play 服务更新的部分的细目清单,大部分包含了为开发者作出的底层架构改动。 + +但许多新增功能似乎只为了一个目的——安卓 4.3 是谷歌对可穿戴计算支持的特洛伊木马。4.3 加入了低功耗蓝牙支持,使用很少的能耗将安卓和其它设备连接到一起并传输数据——可穿戴设备的必要特性。安卓 4.3 还添加了“通知访问权限”API,允许应用完全复制和控制通知面板。应用可以显示通知文本以及和用户操作一样地和通知交互——也就是点击操作按钮和消除通知。当你有个通知面板时从本机应用做这个操作没什么意义,但是在一个独立于你手机的设备上,复制通知面板的消息就显得很有用了。为数不多的接入的应用是 “Android Wear Preview(安卓可穿戴预览)”,使用了通知 API 驱动大部分的 Android Wear 界面。 + +“4.3 是给可穿戴设备准备的”这个理论解释了 4.3 相对较少的新特性:它的推出是为了给 OEM 厂商时间去升级设备,为 [Android Wear][2] 的发布做准备。这个计划看起来起作用了。Android Wear 要求 安卓 4.3 及以上版本,安卓 4.3 已经发布很长时间了,大部分主要的旗舰设备都已经升级了。 + +安卓并没有那么激动人心,但安卓从现在起的新版也不需要那么激动人心了。一切都变得那么模块化了,谷歌可以通过 Google Play 在它们完成时随时推送更新,不用再作为一个大系统更新来更新这么多组件。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/24/ + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://live.arstechnica.com/liveblog-google-io-2013-keynote/ +[2]:http://arstechnica.com/gadgets/2014/03/in-depth-with-android-wear-googles-quantum-leap-of-a-smartwatch-os/ +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/talk/The history of Android/25 - The history of Android.md b/translated/talk/The history of Android/25 - The history of Android.md new file mode 100644 index 0000000000..01b93c71a9 --- /dev/null +++ b/translated/talk/The history of Android/25 - The history of Android.md @@ -0,0 +1,71 @@ +安卓编年史 +================================================================================ +![LG 制造的 Nexus 5,奇巧(KitKat)的首发设备。 +](http://cdn.arstechnica.net/wp-content/uploads/2014/03/nexus56.jpg) +LG 制造的 Nexus 5,奇巧(KitKat)的首发设备。 + +Android 4.4,奇巧——更完美;更少的内存占用 + +谷歌安卓 4.4 的发布确实很讨巧。谷歌和[雀巢公司合作][1],新版系统的代号是“奇巧(KitKat)”,并且它是在 2013 年 10 月 31 日发布的,也就是万圣节。雀巢公司推出了限量版带安卓机器人的奇巧巧克力,它的包装也帮助新版系统推广,消费者有机会赢取一台 Nexus 7。 + +一部新的 Nexus 设备也随奇巧一同发布,就是 Nexus 5。新旗舰拥有迄今最大的显示屏:一块五英寸,1920x1080 分辨率的 LCD 显示屏。除了更大尺寸的屏幕,LG——Nexus 5 的制造商——还将 Nexus 5 的机器大小控制得和 Galaxy Nexus 或 Nexus 4 差不多。 + +Nexus 5 相对同时期的高端手机配置算是标准了,拥有 2.3Ghz 骁龙 800 处理器和 2GB 内存。手机再次在 Play 商店销售无锁版,相同配置的大多数手机价格都在 600 到 700 美元之间,但 Nexus 5 的售价仅为 350 美元。 + +奇巧最重要的改进之一你并不能看到:显著减少的内存占用。对奇巧而言,谷歌齐心协力开始了降低系统和预装应用内存占用的努力,称作“Project Svelte”。经过了无数的优化工作和通过一个“低内存模式”(禁用图形开销大的特效),安卓现在可以在 340MB 内存下运行。低内存需求是件了不起的事,因为在发展中国家的设备——智能手机增长最快的市场——许多设备的内存仅有 512MB。冰淇淋三明治更高级的 UI 显著提高了对安卓设备的系统配置要求,这使得很多低端设备——甚至是新发布的低端设备——的安卓版本停留在姜饼。奇巧更低的配置需求意味着这些廉价设备能够跟上脚步。有了奇巧,谷歌希望完全消灭姜饼(写下本文时姜饼的市场占有率还在 20% 左右)。为了防止更低的系统需求还不够有效,甚至有报道称谷歌将[不再授权][2]谷歌应用给姜饼设备。 + +除了给低端设备带来更现代版本的系统,Project Svelte 更低的内存需求同样对可穿戴设备也是个好消息。Google Glass [宣布][3]它会切换到这个更精简的系统,[Android Wear][4] 同样也运行在奇巧之上。安卓 4.4 带来的更低的内存需求以及 4.3 中的通知消息 API 和低功耗蓝牙支持给了可穿戴计算漂亮的支持。 + +奇巧的亮点还有无数精心打磨过的核心系统界面,它们无法通过 Play 商店升级。系统界面,拨号盘,时钟还有设置都能看到升级。 + +![奇巧在 Google Now 启动器下的透明系统栏。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/1homescreenz.png) +奇巧在 Google Now 启动器下的透明系统栏。 +Ron Amadeo 供图 + +奇巧不仅去掉了讨人厌的锁屏左右屏的线框——它还默认完全禁用了锁屏小部件!谷歌明显感觉到了多屏锁屏和锁屏主屏对新用户来说有点复杂,所以锁屏小部件现在需要从设置里启用。锁屏和时钟里不平衡的时间字体换成了一个对称的字重,看起来好看多了。 + +在奇巧中,应用拥有将系统栏和状态栏透明的能力,显著地改变了系统的外观。系统栏和状态栏现在混合到壁纸和启用透明栏的应用中去了。这些栏还能通过新功能“沉浸”模式完全被应用隐藏。 + +奇巧是“电子”科幻风格棺材上的最后一颗钉子,几乎完全移除了系统的蓝色痕迹。状态栏图标由蓝色变成中性的白色。主屏的状态栏和系统栏并不是完全透明的;它们有深色的渐变,这样在使用浅色壁纸的时候白色的图标还能轻易地识别出来。 + +![Google Now 和文件夹的调整。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/nowfolders.png) +Google Now 和文件夹的调整。 +Ron Amadeo 供图 + +在 Nexus 5 上随奇巧到来的主屏实际上由 Nexus 5 独占了几个月,但现在任何 Nexus 设备都能拥有它了。新的主屏叫做“Google Now Launcher”,它实际上是[谷歌搜索应用][5]。是的,谷歌搜索从一个简单的搜索框成长到了整个主屏幕,并且在奇巧中,它涉及了壁纸,图标,应用抽屉,小部件,主屏设置,Google Now,当然,还有搜索框。由于搜索现在运行在整个主屏幕,任何时候只要打开了主屏并且屏幕是点亮的,就可以通过说“OK Google”激活语音命令。在搜索栏有引导用户说出“OK Google”的文本,在几次使用后这个介绍会隐去。 + +Google Now 的集成度现在更高了。除了通常的系统栏上滑激活,Google Now 还占据了最左侧的主屏。新版还引入了一些设计上的调整。谷歌的 logo 移到了搜索栏内,整个顶部区域更紧凑了。显示更多卡片的设计被去除了,新添加的一组底部按钮指向备忘录,自定义选项,以及一个更多操作按钮,里面由设置,反馈,以及帮助。因为 Google Now 是主屏幕的一部分,所以它也拥有透明 的系统栏和状态栏。 + +透明以及让系统的特定部分“更明亮”是奇巧的设计主题。黑色调通过透明化从状态栏和系统栏移除了,文件夹的黑色背景也换为了白色。 + +![新的,更加干净的应用列表,以及完整的应用阵容。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/apps.png) +新的,更加清爽的应用列表,以及完整的应用阵容。 +Ron Amadeo 供图 + +奇巧的图标阵容相对 4.3 有显著的变化。更戏剧化地说,这是一场大屠杀,谷歌从 4.3 的配置中移除了七个图标。谷歌 Hangouts 现在能够处理短信,所以信息应用被去除了。Hangouts 同时还接手了 Google Messenger 的职责,所以它的图标也不见了。Google Currents 不再作为默认应用预装,因为它不久后就会被终结——和它一起的还有 Google Play Magazines(Play 杂志),取代它们的是 Google Play Newsstand(Play 报刊亭)。谷歌地图被打回一个图标,这意味着本地和导航的快捷方式被去掉了。难以理解的 Movie Studio 也被去除了——谷歌肯定已经意识到了没人想在手机上剪辑电影。有了主屏的“OK Google”关键词检测,语音搜索图标的呈现就显得多余了,因而将其移除。令人沮丧的是,没人用的新闻和天气应用还在。 + +有个新应用“Photos(相片)”——实际上是 Google+ 的一部分——接手了图片管理的工作。在 Nexus 5 上,相册和 Google+ 相片十分相似,但在 Google Play 版设备上更新版的奇巧中,相册已经完全被 Google+ 相片所取代。Play Games 是谷歌的后端多用户游戏服务——谷歌版的 Xbox Live 或苹果的 Game Center。Google Drive,已经在 Play 商店存在数年的应用,终于成为了内置应用。谷歌 2012 年 6 月收购的 Quickoffice 也进入了内置应用阵容。Drive 可以打开 Google 文档,Quickoffice 可以打开微软 Office 文档。如果细细追究起来,在大多数奇巧中包含了两个文档编辑应用和两个相片编辑应用。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/25/ + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://arstechnica.com/gadgets/2013/09/official-the-next-edition-of-android-is-kitkat-version-4-4/ +[2]:http://www.androidpolice.com/2014/02/10/rumor-google-to-begin-forcing-oems-to-certify-android-devices-with-a-recent-os-version-if-they-want-google-apps/ +[3]:http://www.androidpolice.com/2014/03/01/glass-xe14-delayed-until-its-ready-promises-big-changes-and-a-move-to-kitkat/ +[4]:http://arstechnica.com/gadgets/2014/03/in-depth-with-android-wear-googles-quantum-leap-of-a-smartwatch-os/ +[5]:http://arstechnica.com/gadgets/2013/11/google-just-pulled-a-facebook-home-kitkats-primary-interface-is-google-search/ +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/talk/The history of Android/26 - The history of Android.md b/translated/talk/The history of Android/26 - The history of Android.md new file mode 100644 index 0000000000..2abd7a9a70 --- /dev/null +++ b/translated/talk/The history of Android/26 - The history of Android.md @@ -0,0 +1,87 @@ +安卓编年史 +================================================================================ +![新的“添加到主屏幕”界面无疑受到了蜂巢的启发。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/homesetupthrowback.png) +新的“添加到主屏幕”界面无疑受到了蜂巢的启发。 +Ron Amadeo 供图 + +奇巧的主屏幕配置界面漂亮地对蜂巢进行了复古。在有巨大的 10 英寸屏幕的蜂巢平板上(上方右侧图片),长按主屏背景会向你展现一个所有主屏幕的缩放视图。可以从下面的小部件抽屉里将它们拖放到任意主屏上——这很方便。在将蜂巢的界面带到手机上时,从安卓 4.0 直到 4.3,谷歌都跳过了这个设计,把它留给了大屏幕设备,在手机上长按后只显示一个选项列表(中间的图片)。 + +但在奇巧上,谷歌最终给出了解决方案。在长按后,4.4 呈现一个略微缩放的视图——你可以看到当前主屏以及它左右侧的屏幕。点击“小部件”按钮会打开一个小部件略缩图的完整列表,但是长按一个小部件后,你会回到缩放视图,并且你可以在主屏页面之间滚动,将图标放在你想要的位置。将图标或者小部件拖动过最右侧的主屏页面,你可以创建一个新的主屏页面。 + +![联系人和去掉所有蓝色痕迹的键盘。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/RIP33B5E5.png) +联系人和去掉所有蓝色痕迹的键盘。 +Ron Amadeo 供图 + +奇巧是电子风格设计的完结。在系统的大多数部分,剩下的蓝色高亮都被换成了灰色。在联系人应用中,头部和联系人列表字母分割线的蓝色都移除掉了。图片的位置换了一侧,底栏变成了浅灰色以和顶部相称。几乎将蓝色渗透进每个应用的键盘,现在是灰底灰色灰高亮。这可不是件坏事。应用应该允许有它们自己的配色方案——在键盘上强迫存在潜在的颜色冲突可不是个好设计。 + +![前三张是奇巧的拨号盘,最后一张是 4.3 的。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/phone.png) +前三张是奇巧的拨号盘,最后一张是 4.3 的。 +Ron Amadeo 供图 + +谷歌完全重制了奇巧中的拨号,创造了一个疯狂的设计,改变了用户对手机的思考方式。实际上新版拨号中的数字都被尽可能地隐藏了——在首屏上甚至没有拨号盘。打电话的主要界面现在是个搜索栏!如果你想给你的联系人打电话,只要在搜索栏输入他的名字;如果你想给一个公司打电话,只要输入公司的名字,拨号会通过谷歌地图庞大的数据库找到号码。它工作得令人难以置信的好,这是只有谷歌才能完成的事情。 + +如果搜索不是你的菜的话,应用还会智能地显示通话记录列表,最常联系人,还有指向所有联系人的链接。底部的链接指向你的通话记录,传统的拨号盘,以及常规的更多操作按钮,包含一个设置页面。 + +![Office 相关:新的内置应用 Google Drive,以及打印支持。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/googledrive-and-printing.png) +Office 相关:新的内置应用 Google Drive,以及打印支持。 +Ron Amadeo 供图 + +在奇巧中 Google Drive 终于作为内置应用包含了进来,令人惊奇的是这居然用了这么长时间。Drive 允许用户创建和编辑 Google Docs 表格和文档,用相机扫描文档并作为 PDF 上传,或者查看(不能编辑)演示文稿。Drive 的设计十分现代,侧面拥有滑出式导航抽屉,并且是 Google Now 风格卡片式设计。 + +为了有更多的移动办公乐趣,奇巧包含了系统级打印框架。在设置的底部有“打印”设置界面,任何打印机 OEM 厂商都可以为它写个插件。谷歌云打印自然是首批支持者之一。只要你的打印机和云打印相连接,无论是本地或通过一台装有 Chrome 浏览器的电脑,你都可以借助网络进行打印。应用同样也需要支持打印框架。点击 Google Drive 里的“i”按钮会显示文档信息,并且给你打印的选项。就像桌面系统那样,会弹出一个设置对话框,有打印份数,纸张尺寸,以及页面选择等选项。 + +![Google+ 应用的“相片”部分,它取代了相册。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/that-is-one-dead-gallery.png) +Google+ 应用的“相片”部分,它取代了相册。 +Ron Amadeo 供图 + +Google+ 相片和相册最初都在 Nexus 5 上随附,但在 Google Play 设备稍晚版本的奇巧上,相册被砍掉了,Google+ 完全接手了相片管理。新应用的主题从深色变成了浅色,Google+ 相片还带来了现代的导航抽屉设计。 + +安卓一直以来都有即时上传功能,它会自动备份所有图片到谷歌的云存储,开始是 Picasa 后来是 Google+。G+ 相片相比相册最大的好处是它可以管理那些云端存储的图片。图片右下角的云图标指示备份状态,它会从右到左地填满来指示正在上传。G+ 相片带来了它自己的照片编辑器,还有许多其它的 Google+ 图片功能,比如高亮,自动美化,当然,还有分享到 Google+。 + +![时钟应用的调整,添加了一个闹钟页面并修改了时间输入框。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/clocks.png) +时钟应用的调整,添加了一个闹钟页面并修改了时间输入框。 +Ron Amadeo 供图 + +谷歌将 4.2 引入的优秀时间选择器换成了一个奇怪的时钟界面,操作起来比旧界面更慢了也更不精确了。首先是个可以选择小时的单指针时钟,然后显示的是另一个选择分钟的单指针时钟。选择的时候要转动分针或点击数字,这让用用户很难选择不是整五分钟的时间增量。不像之前的时间选择器需要选择一个时间段,这里默认时间段是 AM(重复一下,这样设置的时候容易不小心偏差 12 小时)。 + +### 今日安卓无处不在 ### + +![](http://cdn.arstechnica.net/wp-content/uploads/2014/05/android-everywhere2.png) +图片来自 Google/Sony/Motorola/Ron Amadeo + +一开始从一家搜索引擎公司的古怪的黑莓复制品,一步一步到如今科技界巨头之一在世界上最流行的系统。安卓已经成为谷歌的实际消费者操作系统,它驱动着手机,平板,Google Glass,Google TV,甚至更多。[它的一部分][1]甚至还用到了 Chromecast 中。在未来,谷歌还会将 [Android Wear][2] 带到手表和可穿戴设备上,[开放汽车联盟][3] 要将安卓带到汽车上。不久后会谷歌再次承诺对客厅的计划,带上 [Android TV][4]。这个系统对谷歌是如此重要的支柱,原本应该覆盖全公司产品的大会活动,比如 Google I/O,俨然成为了安卓发布派对。 + +![上排:谷歌 Play 内容商店。下排:谷歌 Play 应用。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/2014-03-30-03.08.jpg) +上排:谷歌 Play 内容商店。下排:谷歌 Play 应用。 +Ron Amadeo 供图 + +移动产业曾经的的丑小鸭脱胎换骨,它的用户界面还[赢得了设计奖项][5]。像 Google Now 一样的设计风格影响了整个公司的产品,甚至连像搜索,Google+,Youtube,以及地图这样的桌面站点都加入了卡片式设计中。设计也在不断地演进。谷歌下一步[统一设计][6]的计划不仅是面对安卓,也包括了所有的产品。谷歌的目标是让你不管在安卓,还是桌面浏览器,或是一个手表上,使用像 Gmail 这样的服务时都能有一样的体验。 + +谷歌将很多安卓的组件转移到 Play 商店,这样版本发布就越来越不重要了。谷歌决定了解决运营商和 OEM 厂商更新问题的最佳途径,就是完全绕开这些绊脚石。从这里开始,在一个安卓更新里除了核心底层变动外就没什么内容了——但是更多的 API 被加入了谷歌 Play 服务。如果你只看版本更新的话,相对安卓高峰期 2.5 个月的发布周期来说开发已经放缓了。但实际情况是谷歌现在可以持续将改进推送到 Play 商店,从周期发布变成了永无止境,有些微妙的更新流。 + +每天 150 万台设备激活,安卓除了增长就是增长。在未来,安卓会是手机和平板到汽车和手表的领军者,奇巧更低的系统配置要求也会让发展中国家的手机价格更低。结果呢?越来越多的人会来到线上。对那里的大多数人来说,安卓不止是他们的手机,也是他们首要的计算设备。随着安卓为谷歌领导掌管众多领域,从一个小收购而来的系统逐渐成长为了谷歌最重要的产品。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/26/ + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://blog.gtvhacker.com/2013/chromecast-exploiting-the-newest-device-by-google/ +[2]:http://arstechnica.com/gadgets/2014/03/in-depth-with-android-wear-googles-quantum-leap-of-a-smartwatch-os/ +[3]:http://arstechnica.com/information-technology/2014/01/open-automotive-alliance-aims-to-bring-android-inside-the-car/ +[4]:http://arstechnica.com/gadgets/2014/04/documents-point-to-android-tv-googles-latest-bid-for-the-living-room/ +[5]:http://userexperienceawards.com/uxa2012/ +[6]:http://arstechnica.com/gadgets/2014/04/googles-next-design-challenge-unify-app-design-across-platforms/ +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/talk/my-open-source-story/20160415 A four year, action-packed experience with Wikipedia.md b/translated/talk/my-open-source-story/20160415 A four year, action-packed experience with Wikipedia.md new file mode 100644 index 0000000000..b2be6a7a01 --- /dev/null +++ b/translated/talk/my-open-source-story/20160415 A four year, action-packed experience with Wikipedia.md @@ -0,0 +1,74 @@ +在维基激动人心的四年 +======================================================= + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/wikipedia_checkuser_lead.jpg?itok=4lVDjSSM) + + +我自认为自己是个奥迪亚的维基人。我通过写文章和纠正错误的文章贡献[奥迪亚][1]知识(在印度的[奥里萨邦][2]的主要的语言 )给很多维基项目,像维基百科和维基文库,我也为用印地语和英语写的维基文章做贡献。 + +![](https://opensource.com/sites/default/files/resize/1st_day_at_odia_wikipedia_workshop_image_source_facebook-200x133.jpg) + +我对维基的爱从我第 10 次考试(像在美国的 10 年级学生的年级考试)之后看到的英文维基文章[孟加拉解放战争][3]开始。一不小心我打开了印度维基文章的链接,,并且开始阅读它. 在文章左边有用奥迪亚语写的东西, 所以我点击了一下, 打开了一篇在奥迪亚维基上的 [????/Bhārat][4] 文章. 发现了用母语写的维基让我很激动! + +![](https://opensource.com/sites/default/files/resize/introducing_wikipedia_at_google_io_image_by_gdg_bhubaneswar-251x166.png) + +一个邀请读者参加 2014 年 4 月 1 日第二次布巴内斯瓦尔的研讨会的标语引起了我的好奇。我过去从来没有为维基做过贡献, 只用它搜索过, 我并不熟悉开源和社区贡献流程。加上,我只有 15 岁。我注册了。在研讨会上有很多语言爱好者,我是中间最年轻的一个。尽管我害怕我父亲还是鼓励我去参与。他起了非常重要的作用—他不是一个维基媒体人,和我不一样,但是他的鼓励给了我改变奥迪亚维基的动力和参加社区活动的勇气。 + +我相信奥迪亚语言和文学需要改进很多错误的想法和知识缺口所以,我帮助组织关于奥迪亚维基的活动和和研讨会,我完成了如下列表: + +* 发起3次主要的 edit-a-thons 在奥迪亚维基:2015 年妇女节,2016年妇女节, abd [Nabakalebara edit-a-thon 2015][5] +* 在全印度发起了征集[檀车节][6]图片的比赛 +* 在谷歌的两大事件([谷歌I/O大会扩展][7]和谷歌开发节)中代表奥迪亚维基 +* 在2015[Perception][8]和第一次[Open Access India][9]会议 + +![](https://opensource.com/sites/default/files/resize/bengali_wikipedia_10th_anniversary_cc-by-sa4.0_biswaroop_ganguly-251x166.jpg) + +我只编辑维基项目到了去年,在 2015 年一月,当我出席[孟加拉语维基百科的十周年会议][10]和[毗瑟挐][11]活动时,[互联网和社会中心][12]主任,邀请我参加[培训培训师][13] 计划。我的灵感始于扩展奥迪亚维基,为[华丽][14]的活动举办的聚会和培训新的维基人。这些经验告诉我作为一个贡献者该如何为社区工作。 + +[Ravi][15],在当时维基的主任,在我的旅程也发挥了重要作用。他非常相信我让我参与到了[Wiki Loves Food][16],维基共享中的公共摄影比赛,组织方是[2016 印度维基会议][17]。在2015的 Loves Food 活动期间,我的团队在维基共享中加入了 10,000+ 有 CC BY-SA 协议的图片。Ravi 进一步巩固了我的承诺,和我分享很多关于维基媒体运动的信息,和他自己在 [奥迪亚维基百科13周年][18]的经历。 + +不到一年后,在 2015 年十二月,我成为了网络与社会中心的[获取知识的程序][19]的项目助理( CIS-A2K 运动)。我自豪的时刻之一是在普里的研讨会,我们从印度带了 20 个新的维基人来编辑奥迪亚维基媒体社区。现在,我的指导者在一个普里非正式聚会被叫作[WikiTungi][20]。我和这个小组一起工作,把 wikiquotes 变成一个真实的计划项目。在奥迪亚维基我也致力于缩小性别差距。[八个女编辑][21]也正帮助组织聚会和研讨会,参加 [Women's History month edit-a-thon][22]。 + +在我四年短暂而令人激动的旅行之中,我也参与到 [维基百科的教育项目][23],[通讯团队][24],两个全球的 edit-a-thons: [Art and Feminsim][25] 和 [Menu Challenge][26]。我期待着更多的到来! + +我还要感谢 [Sameer][27] 和 [Anna][28](都是之前维基百科教育计划的成员)。 + +------------------------------------------------------------------------------ + +via: https://opensource.com/life/16/4/my-open-source-story-sailesh-patnaik + +作者:[Sailesh Patnaik][a] +译者:[译者ID](https://github.com/hkurj) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/saileshpat +[1]: https://en.wikipedia.org/wiki/Odia_language +[2]: https://en.wikipedia.org/wiki/Odisha +[3]: https://en.wikipedia.org/wiki/Bangladesh_Liberation_War +[4]: https://or.wikipedia.org/s/d2 +[5]: https://or.wikipedia.org/s/toq +[6]: https://commons.wikimedia.org/wiki/Commons:The_Rathyatra_Challenge +[7]: http://cis-india.org/openness/blog-old/odia-wikipedia-meets-google-developer-group +[8]: http://perception.cetb.in/events/odia-wikipedia-event/ +[9]: https://opencon2015kolkata.sched.org/speaker/sailesh.patnaik007 +[10]: https://meta.wikimedia.org/wiki/Bengali_Wikipedia_10th_Anniversary_Celebration_Kolkata +[11]: https://www.facebook.com/vishnu.vardhan.50746?fref=ts +[12]: http://cis-india.org/ +[13]: https://meta.wikimedia.org/wiki/CIS-A2K/Events/Train_the_Trainer_Program/2015 +[14]: https://en.wikipedia.org/wiki/Wikipedia:GLAM +[15]: https://www.facebook.com/ravidreams?fref=ts +[16]: https://commons.wikimedia.org/wiki/Commons:Wiki_Loves_Food +[17]: https://meta.wikimedia.org/wiki/WikiConference_India_2016 +[18]: https://or.wikipedia.org/s/sml +[19]: https://meta.wikimedia.org/wiki/CIS-A2K +[20]: https://or.wikipedia.org/s/xgx +[21]: https://or.wikipedia.org/s/ysg +[22]: https://or.wikipedia.org/s/ynj +[23]: https://outreach.wikimedia.org/wiki/Education +[24]: https://outreach.wikimedia.org/wiki/Talk:Education/News#Call_for_volunteers +[25]: https://en.wikipedia.org/wiki/User_talk:Saileshpat#Barnstar_for_Art_.26_Feminism_Challenge +[26]: https://opensource.com/life/15/11/tasty-translations-the-open-source-way +[27]: https://www.facebook.com/samirsharbaty?fref=ts +[28]: https://www.facebook.com/anna.koval.737?fref=ts diff --git a/translated/talk/my-open-source-story/20160429 Why and how I became a software engineer.md b/translated/talk/my-open-source-story/20160429 Why and how I became a software engineer.md new file mode 100644 index 0000000000..2e024c33bf --- /dev/null +++ b/translated/talk/my-open-source-story/20160429 Why and how I became a software engineer.md @@ -0,0 +1,101 @@ +我成为一名软件工程师的原因和经历 +========================================== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/myopensourcestory.png?itok=6TXlAkFi) + +1989 年乌干达首都,坎帕拉。 + +赞美我的父母,他们机智的把我送到叔叔的办公室,去学着用电脑,而非将我留在家里添麻烦。几日后,我和另外六、七个小孩,还有一台放置在与讲台相垂直课桌子上的崭新电脑,一起置身于 21 层楼高的狭小房间中。很明显我们还不够格去碰那家伙。在长达三周无趣的 DOS 命令学习后,终于迎来了这美妙的时光。终于轮到我来输 **copy doc.txt d:** 了。 + +那奇怪的声音其实是将一个简单文件写入五英寸软盘的声音,但听起来却像音乐般美妙。那段时间,这块软盘简直成为了我的至宝。我把所有我可以拷贝的东西都放在上面了。然而,1989 年的乌干达,人们的生活十分正经,相较而言捣鼓电脑,拷贝文件还有格式化磁盘就称不上正经。我不得不专注于自己的学业,这让我离开了计算机科学走入了建筑工程学。 + +在这些年里,我和同龄人一样,干过很多份工作也学到了许多技能。我教过幼儿园的小朋友,也教过大人如何使用软件,在服装店工作过,还在教堂中担任过付费招待。在我获取堪萨斯大学的学位时,我正在技术高管的手下做技术助理,其实也就听上去比较洋气,也就是搞搞学生数据库而已。 + +当我 2007 年毕业时,这些技术已经变得不可或缺。建筑工程学的方方面面都与计算机科学深深的交织在一起,所以我们也都在不经意间也都学了些简单的编程知识。我对于这方面一直很着迷。但由于我不得不成为一位正经的工程师,所以我发展了一项私人爱好:写科幻小说。 + +在我的故事中,我以我笔下的女英雄的形式存在。她们都是编程能力出众的科学家,总是在冒险的途中用自己的技术发明战胜那些渣渣们,有时发明要在战斗中进行。我想出的这些“新技术”,一般基于真实世界中的发明。也有些是从买来的科幻小说中读到的。这就意味着我需要了解这些技术的原理,而且我的研究使我有意无意的关注了许多有趣的 subreddit 和电子杂志 + +### 开源:巨大的宝库 + +在我的经历中,那几周花在 DOS 命令上的时间仍然记忆犹新,在一些偏门的项目上耗费心血,并占据了宝贵的学习时间。Geocities 一向所有 Yahoo! 用户开放,我就创建了一个网站,用于发布一些由我用小型数码相机拍摄的个人图片。这个网站是我随性而为的,用来帮助家人和朋友,解决一些他们所遇到的电脑问题。同时也为教堂搭建了一个图书馆数据库。 + +这意味着,我需要一直研究并尝试获取更多的信息,使它们变得更棒。上帝保佑,让互联网和开源砸在了我的面前。然后,30 天试用和 license 限制对我而言就变成了过去式。我可以完全不受这些限制,持续的使用 GIMP、Inkscape 和 OpenOffice。 + +### 是时候正经了 + +我很幸运,有商业伙伴看出了我故事中的奇妙。她也是个想象力丰富的人,对更高效、更便捷的互联这个世界,充满了各种美好的想法。我们根据我们以往成功道路中经历的痛点制定了解决方案,但执行却成了一个问题。我们都缺乏那种将产品带入生活的能力,每当我们试图将想法带到投资人面前时,都表现的尤为突出。 + +我们需要学习编程。所以在 2015 年的夏末,我们踏上了征途,来到了 Holberton 学校的阶前。那是一所座落于旧金山由社区推进,基于项目教学的学校。 + +我的商业伙伴一天早上找到我,并开始了一段充满她方式的对话,每当她有疯狂想法想要拉我入伙时。 + +**Zee**: Gloria,我想和你说点事,在拒绝前能先听我说完吗? + +**Me**: 不行。 + +**Zee**: 我们想要申请一所学校的全栈工程师。 + +**Me**: 什么? + +**Zee**: 就是这,看!就是这所学校,我们要申请这所学校学习编程。 + +**Me**: 我不明白。我们不是正在网上学 Python 和… + +**Zee**: 这不一样。相信我。 + +**Me**: 那… + +**Zee**: 还不相信吗? + +**Me**: 好吧…我看看。 + +### 抛开偏见 + +我看到的和我们在网上听说的几乎差不多。这简直太棒了,以至于让人觉得不太真实,但我们还是决定尝试一下,双脚起跳,看看结果如何。 + +要成为学生,我们需要经历四个步骤,仅仅是针对才能和态度,无关学历和编程经历的筛选。筛选便是课程的开始,通过它我们开始学习与合作。 + +根据我和我合作伙伴的经验,相比 Holberton 学校的申请流程,其他的申请流程实在是太无聊了。就像场游戏。如果你完成了一项挑战,你就能通往下一关,在那里有别的有趣的挑战正等着你。我们创建了 Twitter 账号,在 Medium 上写博客,为了创建网站而学习 HTML 和 CSS, 打造了一个充满活力的社区,虽然在此之前我们并不知晓有谁会来。 + +在线社区最吸引人的就是我们使用电脑的经验是多种多样的,而我们的背景和性别并非创始人(我们私下里称他为“The Trinity(三位一体)”)做出选择的因素。大家只是喜欢聚在一块交流。我们都是通过学习编程来提升自己计算机技术的聪明人。 + +相较于其他的的申请流程,我们不需要泄露很多的身份信息。就像我的商业伙伴,她的名字里看不出她的性别和种族。直到最后一个步骤,在视频聊天的时候, The Trinity 才知道她是一位有色人种女性。迄今为止,促使她达到这个程度的只是她的热情和才华。肤色和性别,并没有妨碍或者帮助到她。还有比这更酷的吗? + +那个我们获得录取通知书的晚上,我们知道我们的命运已经改变,我们获得了原先梦寐以求的生活。2016 年 1 月 22 日,我们来到北至巴特瑞大街 98 号,去见我们的小伙伴 [Hippokampoiers][2],这是我们的初次见面。很明显,在见面之前,“The Trinity”就已经开始做一些令人激动的事了。他们已经聚集了一批形形色色的人,他们都专注于成为全栈工程师,并为之乐此不疲。 + +这所大学有种与众不同的体验。感觉每天都是向编程的一次竭力的冲锋。我们着手的工程,并不会有很多指导,我们需要使用一切我们可以使用的资源找出解决方案。[Holberton 学校][1] 的办学宗旨便是向学员提供,相较于我们已知而言,更为多样的信息渠道。MOOCs(大型开放式课程)、教程、可用的开源软件和项目,以及线上社区层出不穷,将我们完成项目所需要的知识全都衔接了起来。加之宝贵的导师团队来指导我们制定解决方案,这所学校变得并不仅仅是一所学校;我们已经成为了求学者的社区。任何对软件工程感兴趣并对这种学习方法感兴趣的人,我都十分推荐这所学校。下次开课在 2016 年 10 月,并且会接受新的申请。虽然会让人有些悲喜交加,但是那真的很值得。 + +### 开源问题 + +我最早使用的开源系统是 [Fedora][3],一个 [Red Hat][4] 赞助的项目。在与 IRC 中一名成员一番惊慌失措的交流后,她推荐了这款免费的系统。 虽然在此之前,我还未独自安装过操作系统,但是这激起了我对开源的兴趣和日常使用计算机时对开源软件的依赖性。我们提倡为开源贡献代码,创造并使用开源的项目。我们的项目就在 Github 上,任何人都可以使用或是向它贡献出自己的力量。我们也会使用或以自己的方式为一些既存的开源项目做出贡献。在学校里,我们使用的大部分工具是开源的,例如 Fedora、[Vagrant][5]、[VirtualBox][6]、[GCC][7] 和 [Discourse][8],仅举几例。 + +重回软件工程师之路以后,我始终憧憬着有这样一个时刻——能为开源社区做出一份贡献,能与他人分享我所掌握的知识。 + +### Diversity Matters + +站在教室里,在着 29 双明亮的眼睛关注下交流心得,真是令人陶醉。学员中有 40% 是女性,有 44% 的有色人种。当你是一位有色人种且为女性,并身处于这个以缺乏多样而著名的领域时,这些数字就变得非常重要了。那是高科技圣地麦加上的绿洲。我知道我做到了。 + +想要成为一个全栈的工程师是十分困难的,你甚至很难了解这意味着什么。这是一条充满挑战的路途,道路四周布满了对收获的未知。科技推动着未来飞速发展,而你也是美好未来很重要的一部分。虽然媒体在持续的关注解决科技公司的多样化的问题,但是如果能认清自己,了解自己,知道自己为什么想成为一名全栈工程师,这样你便能觅得一处生根发芽。 + +不过可能最重要的是,提醒人们女性在计算机的发展史上扮演着多么重要的角色,以帮助更多的女性回归到科技界,并使她们充满期待,而非对自己的性别与能力感到犹豫。她们的才能将会描绘出不仅仅是科技的未来,而是整个世界的未来。 + + +------------------------------------------------------------------------------ + +via: https://opensource.com/life/16/4/my-open-source-story-gloria-bwandungi + +作者:[Gloria Bwandungi][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/nappybrain +[1]: https://www.holbertonschool.com/ +[2]: https://twitter.com/hippokampoiers +[3]: https://en.wikipedia.org/wiki/Fedora_(operating_system) +[4]: https://www.redhat.com/ +[5]: https://www.vagrantup.com/ +[6]: https://www.virtualbox.org/ +[7]: https://gcc.gnu.org/ +[8]: https://www.discourse.org/ diff --git a/translated/talk/my-open-source-story/20160505 A daughter of Silicon Valley shares her 'nerd' story.md b/translated/talk/my-open-source-story/20160505 A daughter of Silicon Valley shares her 'nerd' story.md new file mode 100644 index 0000000000..279a7fd843 --- /dev/null +++ b/translated/talk/my-open-source-story/20160505 A daughter of Silicon Valley shares her 'nerd' story.md @@ -0,0 +1,82 @@ +”硅谷的女儿“的天才故事 +======================================================= + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/myopensourcestory.png?itok=6TXlAkFi) + +在 2014 年,为了对网上一些关于女性在科技行业的缺失的评论作出回应,我的同事 [Crystal Beasley][1] 建立了一个能让在科技/信息安全方面工作的女性在网络上分享自己的“天才之路”。这篇文章就是我的故事。我把我的故事与你们分享是因为我相信榜样的力量,我也相信有一个人有很多的方式进入一个让自己满意的有挑战性的工作和一个实现了所有目标的人生。 + +### 和电脑相伴的童年 + +我,在其他的光环之下,是硅谷的女儿。我的故事不是一个观众变成舞台的主角的故事。也不是从小就为这份事业做贡献的故事。这个故事更多的是关于环境如何塑造你 — 通过它的那种已然存在的文化来改变你,如果你想要被改变的话。这不是从小就看是努力并为一个明确的目标而奋斗的故事,我知道这是关于特权的故事。 + +我出生在曼哈顿,但是我在新泽西州长大,因为我的爸爸作为一个退伍军人在那里的罗格斯大学攻读计算机科学的博士学位。当我四岁时,学校里有人问我我的爸爸干什么谋生时,我说,“他就是看电视和捕捉小虫子,但是我从没有见过那些小虫子”(译者注:小虫子,bug)。他在家里有一台哑终端,这大概与他在博尔特-贝拉尼克-纽曼公司的工作有关,他会通过早期的互联网来进行它在人工智能方面的工作。我就在旁边看着。 + +我没能玩上父亲的会抓小虫子的电视,但是我很早就接触到了技术领域,我很珍惜这个礼物。提早的熏陶对于一个未来的天才是十分必要的 — 所以,请花时间和你的小孩谈谈他以后要做什么! + +![](https://opensource.com/sites/default/files/resize/moss-520x433.png) + +>我父亲的终端和这个很类似——如果不是这个的话 CC BY-SA 4.0 + +当我六岁时,我们搬到了加州。父亲在施乐的研究中心找到了一个工作。我记得那时我认为这个城市一定有很多熊,因为在它的旗帜上都有一个熊。在1979年,帕洛阿尔托还是一个大学城,还有果园和开阔地带。 + +在帕洛阿尔托的公立学校待了一年之后,我的姐姐和我被送到了“半岛学校”,这个“模范学校”对我造成了深刻的影响。在那里,好奇心和创新意识是被推崇的,教育也是有学生自己决定的。我们很少在学校看到能叫做电脑的东西,但是在家就不同了。 + +在父亲从施乐辞职之后,他就去了苹果,在那里他帮助研发——以及带回家让我玩的第一批电脑就是:Apple II 和 LISA。我的父亲在原先的 LISA 的研发团队。我直到现在还深刻的记得他让我们一次又一次的“玩鼠标”场景,因为他想让我的 3 岁大的妹妹对这个东西感到舒服——她也确实那样。 + +![](https://opensource.com/sites/default/files/resize/600px-apple_lisa-520x520.jpg) + +>我们的 LISA 看起来就像这样,看到鼠标了吗?CC BY-SA 4.0 + +在学校,我的数学的概念学得不错,但是基本计算却惨不忍睹。我的第一个学校的老师告诉我的家长,还有我,说我的数学很差以及我很“笨”。虽然我在“常规的”数学项目中表现出色,能理解一个 7 岁的孩子能理解的逻辑谜题,但是我不能完成我们每天早上都要做的“练习”。她说我傻,这事我不会忘记。在那之后的十年我都没能相信自己的逻辑能力和算法的水平。不要 低估你给孩子的说的话的力量。 + +在我玩了几年爸爸的电脑之后,他从苹果跳到了 EA 又跳到了 SGI,我又体验了他带回来的新玩意。这让我们认为我们家的房子是镇里最酷的,因为我们在车库里有一个能玩 Doom 的 SGI 的机器。我不会太多的编程,但是现在我发现,在那些年里我对尝试新的科技不再恐惧。同时,我的学文学和教育的母亲,成为了一个科技行业的作家,她向我证实了一个人的职业可以改变以及科技行业的人也可以做母亲。我不是说这对她来说很简单,但是她让我认为这件是看起来很简单。你可能回想这些早期的熏陶能把我带到科技行业,但是它没有。 + +### 本科时光 + +我想我要成为一个小学教师,我就读米尔斯学院就是想要做这个。但是后来我开始研究女性,后来有研究神学,我这样做仅仅是由于我自己的一个渴求:我希望能理解人类的意志以及为更好的世界而努力。 + +同时,我也感受到了互联网的巨大力量。在 1991 年,拥有你自己的 UNIX 的账户是很令人高兴的事,这件事值得你向全世界的人吹嘘。我仅仅从在互联网中“玩”就学到了不少,从那些愿意回答我提出的问题的人那里学到的就更多了。这些学习对我的职业生涯的影响不亚于我在学校教育部之中学到的知识。没有没有用的信息。我在一个女子学院度过了影响我一生的关键时期,然后那个女子学院的一个辉煌的女人跑进了计算机院,我不忍为这是一个事故。在那个老师的权力不算太大的学院,我们不止是被允许,甚至是被鼓励去尝试很多的道路(我们能接触到很多很多的科技,还能有聪明人来供我们求助),我也确实那样做了。我十分感激当年的教育。在那个学院,我也了解了什么是极客文化。 + +之后我去了研究生院去学习 女权主义神学,但是技术行业的气息已经渗入我的灵魂。当我知道我不能成为一个教授或者一个专家时,我离开了学术圈,带着债务和很多点子回到了家。 + +### 新的开端 + +在 1995 年,我被我看见的万维网连接 人们以及分享想法和信息的能力所震惊(直到现在仍是如此)。我想要进入这个行业。看起来我好像要“女承父业”,但是我不知道我会用什么方式来这样做。我开始在硅谷做临时工,在我在太阳微系统公司得到我的第一个“技术”职位前做一些事情(为数据写最基础的数据库,技术手册印发钱的事务,备份工资单的存跟)。这些事很让人激动。(毕竟,我们是“点 com”的那个”点“)。 + +在 Sun ,我努力学习,尽可能多的尝试我新事物。我的第一个工作是网页化(啥?这是一个单独的词汇)论文以及为测试中的 Solaris 修改一些基础的服务工具(大多数是Perl写的)。在那里最终在 Open Solaris 的测试版运行时我感受到了开源的力量。 + +在那里我学到了一个很重要的事情。我发现在同样重视工程和教育的地方有一种气氛,在那里我的问题不再显得“傻”。我很庆幸我选对了导师和朋友。在决定为第二个孩子的出生产假之前,我上每一堂我能上的课程,读每一本我能读的书,尝试自学我在学校没有学习过的技术,商业以及项目管理方面的技能。 + +### 重回工作 + +当我准备重新工作时,Sun 已经不是一个值得回去的地方。所以,我收集了很多人的信息(网络是你的朋友),利用我的沟通技能最终建立了一个互联网门户(2005 年时,一切皆门户),并且开始了解 CRM,发布产品的方式,本地化,网络等知识。我这么做是基于我过去的尝试以及失败的经历所得出的教训,也是这个教训让我成功。我也认为我们需要这个方面的榜样。 + +从很多方面来看,我的职业生涯的第一部分是 我的技术上的自我教育。这事发生的时间和地点都和现在不一样——我在帮助女性和其他弱势群体的组织工作,但是我之后成为一个技术行业的女性。当时我无疑,没有看到这个行业的缺陷,现在这个行业更加的厌恶女性,而不是更加喜欢她们。 + +在这些事情之后,我还没有把自己当作一个榜样,或者一个高级技术人员。当我的一个在父母的圈子里认识极客朋友鼓励我申请一个看起来定位十分模糊且技术性很强的开源的非盈利基础设施商店(互联网系统协会,BIND,一个广泛部署的开源服务器的开发商,13 台 DNS 根域名服务器之一的运营商)的项目经理时,我很震惊。有很长一段时间,我都不知道他们为什么要雇佣我!我对 DNS ,基础设备,以及协议的开发知之甚少,但是我再次遇到了老师,并再度开始飞速发展。我花时间旅行,在关键流程攻关,搞清楚如何与高度国际化的团队合作,解决麻烦的问题,最重要的是,拥抱支持我们的开源和充满活力的社区。我几乎重新学了一切,通过试错的方式。我学习如何构思一个产品。如何通过建设开源社区,领导那些有这特定才能,技能和耐心的人,是他们给了产品价值。 + +### 成为别人的导师 + +当我在 ISC 工作时,我通过 [TechWomen 项目][2] (一个让来自中东和北非的技术行业的女性带到硅谷来接受教育的计划),我开始喜欢教学生以及支持那些女性,特别是在开源行业中奋斗的。这也就是我开始相信自己的能力的开端。我还需要学很多。 + +当我第一次读 TechWomen 的广告时,我认为那些导师甚至都不会想要和我说话!我有冒名顶替综合征。当他们邀请我成为第一批导师(以及以后 6 年的导师)时,我很震惊,但是现在我学会了相信这些都是我努力得到的待遇。冒名顶替综合征是真实的,但是它能被时间冲淡。 + +### 现在 + +最后,我不得不离开我在 ISC 的工作。幸运的是,我的工作以及我的价值让我进入了 Mozilla ,在这里我的努力和我的幸运让我在这里有着重要的作用。现在,我是一名支持多样性的包容的高级项目经理。我致力于构建一个更多样化,更有包容性的 Mozilla ,站在之前的做同样事情的巨人的肩膀上,与最聪明友善的人们一起工作。我用我的激情来让人们找到贡献一个世界需要的互联网的有意义的方式:这让我兴奋了很久。我能看见,我做到了! + +通过对组织和个人行为的干预来用一种新的方法来改变一种文化这件事情和我的人生有着十分奇怪的联系 —— 从我的早期的学术生涯,到职业生涯再到现在。每天都是一个新的挑战,我想我最喜欢的就是在科技行业的工作,尤其是在开放互联网的工作。互联网天然的多元性是它最开始吸引我的原因,也是我还在寻求的——一个所有人都有获取的资源可能性,无论背景如何。榜样,导师,资源,以及最重要的,对不断发展的技术和开源文化的尊重能实现我相信它能实现的事 —— 包括给任何的平等的接入权和机会。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/16/5/my-open-source-story-larissa-shapiro + +作者:[Larissa Shapiro][a] +译者:[name1e5s](https://github.com/name1e5s) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/larissa-shapiro +[1]: http://skinnywhitegirl.com/blog/my-nerd-story/1101/ +[2]: https://www.techwomen.org/mentorship/why-i-keep-coming-back-to-mentor-with-techwomen diff --git a/translated/talk/yearbook2015/20151208 5 great Raspberry Pi projects for the classroom.md b/translated/talk/yearbook2015/20151208 5 great Raspberry Pi projects for the classroom.md new file mode 100644 index 0000000000..06191d551c --- /dev/null +++ b/translated/talk/yearbook2015/20151208 5 great Raspberry Pi projects for the classroom.md @@ -0,0 +1,98 @@ +5 个适合课堂教学的树莓派项目 +================================================================================ +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/osdc-open-source-yearbook-lead3.png) + +图片来源 : opensource.com + +### 1. Minecraft Pi ### + +![](https://opensource.com/sites/default/files/lava.png) + +上图由树莓派基金会提供。遵循 [CC BY-SA 4.0.][1] 协议。 + +Minecraft(我的世界)几乎是世界上每个青少年都极其喜爱的游戏 —— 在吸引年轻人注意力方面,它也是最具创意的游戏之一。伴随着每一个树莓派的游戏版本不仅仅是一个关于创造性思维的建筑游戏,它还带有一个编程接口,允许使用者通过 Python 代码来与 Minecraft 世界进行互动。 + +对于教师来说,Minecraft: Pi 版本是一个鼓励学生们解决遇到的问题以及通过书写代码来执行特定任务的极好方式。你可以使用 Python API + 来建造一所房子,让它跟随你到任何地方;或在你所到之处修建一座桥梁;又或者是下一场岩溶雨;或在天空中显示温度;以及其他任何你能想像到的事物。 + +可在 "[Minecraft Pi 入门][2]" 中了解更多相关内容。 + +### 2. 反应游戏和交通指示灯 ### + +![](https://opensource.com/sites/default/files/pi_traffic_installed_yellow_led_on.jpg) + +上图由 [Low Voltage Labs][3] 提供。遵循 [CC BY-SA 4.0][1] 协议。 + +在树莓派上进行物理计算是非常容易的 —— 只需将 LED 灯 和按钮连接到 GPIO 针脚上,再加上少量的代码,你就可以点亮 LED 灯并通过按按钮来控制物体。一旦你知道来执行基本操作的代码,下一步就可以随你的想像那样去做了! + +假如你知道如何让一盏灯闪烁,你就可以让三盏灯闪烁。选出三盏交通灯颜色的 LED 灯,你就可以编程出交通灯闪烁序列。假如你知道如何使用一个按钮来触发一个事件,然后你就有一个人行横道了!同时,你还可以找到诸如 [PI-TRAFFIC][4]、[PI-STOP][5]、[Traffic HAT][6] 等预先构建好的交通灯插件。 + +这不总是关于代码的 —— 它还可以被用来作为一个的练习,用以理解真实世界中的系统是如何被设计出来的。计算思维在生活中的各种情景中都是一个有用的技能。 + +![](https://opensource.com/sites/default/files/reaction-game.png) + +上图由树莓派基金会提供。遵循 [CC BY-SA 4.0][1] 协议。 + +下面尝试将两个按钮和一个 LED 灯连接起来,来制作一个二人制反应游戏 —— 让灯在一段随机的时间中点亮,然后看谁能够先按到按钮! + +想了解更多的话,请查看 [GPIO 新手指南][7]。你所需要的尽在 [CamJam EduKit 1][8]。 + +### 3. Sense HAT 像素宠物 ### + +Astro Pi— 一个增强版的树莓派 —将于今年 12 月(注:应该是去年的事了。)问世,但你并没有错过让你的手玩弄硬件的机会。Sense HAT 是一个用在 Astro Pi 任务中的感应器主板插件,且任何人都可以买到。你可以用它来做数据收集、科学实验、游戏或者更多。 观看下面这个由树莓派的 Carrie Anne 带来的 Gurl Geek Diaries 录像来开始一段美妙的旅程吧 —— 通过在 Sense HAT 的显示器上展现出你自己设计的一个动物像素宠物: + +注:youtube 视频 + + +在 "[探索 Sense HAT][9]" 中可以学到更多。 + +### 4. 红外鸟箱 ### + +![](https://opensource.com/sites/default/files/ir-bird-box.png) +上图由 [Low Voltage Labs][3] 提供。遵循 [CC BY-SA 4.0][1] 协议。 + +让全班所有同学都能够参与进来的一个好的练习是 —— 在一个鸟箱中沿着某些红外线放置一个树莓派和 NoIR 照相模块,这样你就可以在黑暗中观看,然后通过网络或在网络中你可以从树莓派那里获取到视频流。等鸟进入笼子,然后你就可以在不打扰到它们的情况下观察它们。 + +在这期间,你可以学习到所有关于红外和光谱的知识,以及如何用软件来调整摄像头的焦距和控制它。 + +在 "[制作一个红外鸟箱][10]" 中你可以学到更多。 + +### 5. 机器人 ### + +![](https://opensource.com/sites/default/files/edukit3_1500-alex-eames-sm.jpg) + +上图由 Low Voltage Labs 提供。遵循 [CC BY-SA 4.0][1] 协议。 + +拥有一个树莓派,一些感应器和一个感应器控制电路板,你就可以构建你自己的机器人。你可以制作各种类型的机器人,从用透明胶带和自制底盘组合在一起的简易四驱车,一直到由游戏控制器驱动的具有自我意识,带有传感器和摄像头的金属马儿。 + +学习如何直接去控制单个的发动机,例如通过 RTK Motor Controller Board (£8/$12),或者尝试新的 CamJam robotics kit (£17/$25) ,它带有发动机、轮胎和一系列的感应器 — 这些都很有价值并很有学习的潜力。 + +另外,如何你喜欢更为骨灰级别的东西,可以尝试 PiBorg 的 [4Borg][11] (£99/$150) 或 [DiddyBorg][12] (£180/$273) 或者一干到底,享受他们的 DoodleBorg 金属版 (£250/$380) — 并构建一个他们声名远扬的 [DoodleBorg tank][13](很不幸的时,这个没有卖的) 的迷你版。 + +另外请参考 [CamJam robotics kit worksheets][14]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/education/15/12/5-great-raspberry-pi-projects-classroom + +作者:[Ben Nuttall][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/bennuttall +[1]:https://creativecommons.org/licenses/by-sa/4.0/ +[2]:https://opensource.com/life/15/5/getting-started-minecraft-pi +[3]:http://lowvoltagelabs.com/ +[4]:http://lowvoltagelabs.com/products/pi-traffic/ +[5]:http://4tronix.co.uk/store/index.php?rt=product/product&product_id=390 +[6]:https://ryanteck.uk/hats/1-traffichat-0635648607122.html +[7]:http://pythonhosted.org/gpiozero/recipes/ +[8]:http://camjam.me/?page_id=236 +[9]:https://opensource.com/life/15/10/exploring-raspberry-pi-sense-hat +[10]:https://www.raspberrypi.org/learning/infrared-bird-box/ +[11]:https://www.piborg.org/4borg +[12]:https://www.piborg.org/diddyborg +[13]:https://www.piborg.org/doodleborg +[14]:http://camjam.me/?page_id=1035#worksheets diff --git a/translated/talk/yearbook2015/20151208 6 creative ways to use ownCloud.md b/translated/talk/yearbook2015/20151208 6 creative ways to use ownCloud.md new file mode 100644 index 0000000000..5d81ed9cdf --- /dev/null +++ b/translated/talk/yearbook2015/20151208 6 creative ways to use ownCloud.md @@ -0,0 +1,95 @@ +GHLandy Translated + +使用 ownCloud 的六个创意方法 +================================================================================ +![Yearbook cover 2015](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/osdc-open-source-yearbook-lead1-inc0335020sw-201511-01.png) + +图片来源:Opensource.com + +[ownCloud][1] 是一个自我托管且开源的文件同步和共享服务上。就像 "big boys" Dropbox、Google Drive、Box 和其他的同类服务一样,ownCloud 可以让你访问自己的文件、日历、联系人和其他数据。你可以在自己设备之间进行任意数据(包括它自身的一部分)同步以及给其他人分享文件。然而,ownCloud 并非只能运行在它自己的开发商之中,试试[将 ownCloud 运行在其他服务器上][2] + +现在,一起来看看在 ownCloud 上的六件创意事件。其中一些是由于 ownCloud 的开源才得以完成,而另外的则是 ownCloud 自身特有的功能。 + +### 1. 可扩展的 ownCloud 派集群 ### + +由于 ownCloud 是开源的,你可以选择将它运行在自己的服务器中,或者从你信任的服务器提供商那里获取空间——没必要将你的文件存储在大公司的服务器中,谁知他们将你的文件存储到哪里去。[点击此处查看部分 ownCloud 服务商][3],或者下载该服务软件到你的虚拟主机中[搭建自己的服务器][4]. + +![](https://opensource.com/sites/default/files/images/life-uploads/banana-pi-owncloud-cluster.jpg) + +拍摄: Jörn Friedrich Dreyer. [CC BY-SA 4.0.][5] + +我们见过最具创意的事情就是组建 [香蕉派集群][6] 和 [树莓派集群][7]。ownCloud 的扩展性通常是成千上万的用户来完成的,这些人则将它往不同方向发展,通过大量的小型系统集群在一起,就可以创建出运行速度非常快的 ownCloud。酷毙了! + +### 2. 密码同步 ### + +为了让 ownCloud 更容易扩展,我们需要将它模块化,并拥有 [ownCloud app store][8]。然后你就可以在里边搜索音乐、视频播放器、日历、联系人、生产应用、游戏、应用框架等。 + +仅从 200 多个可用应用中挑选一个是一件非常困难的事,但密码管理则是一个很好的特性。ownCloud app store 里边至少有三款这种应用:[Passwords][9]、[Secure Container][10] 和 [Passman][11]。 + +![](https://opensource.com/sites/default/files/images/life-uploads/password.png) + +### 3. 随心所欲地存储文件 ### + +外部存储允许你通过接口将现有数据联系到 ownCloud,让你轻松访问存储在FTP、WebDAV、Amazon S3,甚至 Dropbox 和Google Drive。 + +注:youtube 视频 + + +DropBox 喜欢创建自己的 “围墙式花园”,只有注册用户之间才可以进行协作;假如你通过Google Drive 来分享文件,你的同伴也必须要有一个 Google 账号才可以访问的分享。通过 ownCloud 的外部存储功能,你可以轻松打破这些规则障碍。 + +最有创意的就是把 Google Drive 和 Dropbox 添加为外部存储。这样你就可以无缝的使用它们,并使用不需要账户地链接把文件分享给和你协作的人。 + +### 4. 下载以上传的文件 ### + +由于 ownCloud 的开源,人们可以不受公司需求限制地向它共享代码,增加新特性。共献者关注的往往是安全和隐私,所以 ownCloud 引入的特性常常比别人的要早,比如通过密码保护的公共链接和[设置失效期限][12]。 + +现在,ownCloud 可以配置分享链接的读写权限了,这就是说链接的访问者可以无缝的编辑你分享给他们的文件(不管是否有密码保护),或者在不提供他们的私人数据来登录其他服务的情况下将文件上传到服务器。 + +注:youtube 视频 + + +对于有人想给你分享大体积的文件时,这个特性就非常有用了。相比于上传到第三方站点、然后给你发送一个连接、你再去下载文件(通常需要登录),ownCloud 仅需要上传文件到你提供的分享文件夹、你就可以买上获取到文件了。 + +### 5. 免费却又安全的存储空间 ### + +之前就强调过,我们的代码贡献者最关注的就是安全和隐私,这就是 ownCloud 中有用于加密和解密存储数据的应用的原因。 + +通过使用 ownCloud 将你的文件存储到 Dropbox 或者 Google Drive,则会违背控制数据以及保持数据隐私的原则。但是加密应用则刚好可以满足安全及隐私问题。在发送数据给这些提供商前进行数据加密,并在取回数据的时候进行解密,你的数据就会变得很安全。 + +### 6. 在你的可控范围内分享文件 ### + +作为开源项目,ownCloud 没有必要自建 “围墙式花园”。进入联邦云共享:[developed and published by ownCloud][13] 协议使不同的文件同步和共享服务器可以彼此之间进行通信,并能够安全地传输文件。联邦云共享本身有一个有趣的故事:[22 所德国大学][14] 想要为自身的 500,000 学生建立一个庞大的云服务,但是每个大学都想控制自己学生数据。于是乎,我们需要一个可行性解决方案:也就是联邦云服务。该解决方案让让学生保持连接,使得他们可以无缝的协同工作。同时,每个大学的系统管理员保持着对自己学生创建的文件的控制权,如限制存储或者限制什么人、什么文件以及如何共享。 + +注:youtube 视频 + + +并且,这项令人崇敬的技术并没有限制于德国的大学之间,而是每个 ownCloud 用户都能在自己的用户设置中找到自己的 [联邦云 ID][15],并将之分享给同伴。 + +现在你明白了吧。仅六个方法,ownCloud 就能让人们完成特殊和特别的事。而是这一切成为可能的,就是 ownCloud 的开源 —— 设计用来释放你数据。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/15/12/6-creative-ways-use-owncloud + +作者:[Jos Poortvliet][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jospoortvliet +[1]:https://owncloud.com/ +[2]:https://blogs.fsfe.org/mk/new-stickers-and-leaflets-no-cloud-and-e-mail-self-defense/ +[3]:https://owncloud.org/providers +[4]:https://owncloud.org/install/#instructions-server +[5]:https://creativecommons.org/licenses/by-sa/4.0/ +[6]:http://www.owncluster.de/ +[7]:https://christopherjcoleman.wordpress.com/2013/01/05/host-your-owncloud-on-a-raspberry-pi-cluster/ +[8]:https://apps.owncloud.com/ +[9]:https://apps.owncloud.com/content/show.php/Passwords?content=170480 +[10]:https://apps.owncloud.com/content/show.php/Secure+Container?content=167268 +[11]:https://apps.owncloud.com/content/show.php/Passman?content=166285 +[12]:https://owncloud.com/owncloud45-community/ +[13]:http://karlitschek.de/2015/08/announcing-the-draft-federated-cloud-sharing-api/ +[14]:https://owncloud.com/customer/sciebo/ +[15]:https://owncloud.org/federation/ diff --git a/translated/talk/yearbook2015/20160306 5 Favorite Open Source Django Packages.md b/translated/talk/yearbook2015/20160306 5 Favorite Open Source Django Packages.md new file mode 100644 index 0000000000..81e999fd80 --- /dev/null +++ b/translated/talk/yearbook2015/20160306 5 Favorite Open Source Django Packages.md @@ -0,0 +1,164 @@ +5个最受喜爱的开源Django包 +================================================================================ +![Yearbook cover 2015](https://opensource.com/sites/default/files/styles/image-full-size/public/u23316/osdc-open-source-yearbook-lead8.png?itok=0_5-hdFE) + +图片来源:Opensource.com + +_Jacob Kaplan-Moss和Frank Wiles也参与了本文的写作。_ + +Django围绕“[可重用应用][1]”观点建立:自我包含了提供可重复使用特性的包。你可以将这些可重用应用组装起来,在加上适用于你的网站的特定代码,来搭建你自己的网站。Django具有一个丰富多样的、由可供你使用的可重用应用组建起来的生态系统——PyPI列出了[超过8000个 Django 应用][2]——可你该如何知道哪些是最好的呢? + +为了节省你的时间,我们总结了五个最受喜爱的 Django 应用。它们是: +- [Cookiecutter][3]: 建立 Django 网站的最佳方式。 +- [Whitenoise][4]: 最棒的静态资源服务器。 +- [Django Rest Framework][5]: 使用 Django 开发 REST API 的最佳方式。 +- [Wagtail][6]: 基于 Django 的最佳内容管理系统。 +- [django-allauth][7]: 提供社交账户登录的最佳应用(如 Twitter, Facebook, GitHub 等)。 + +我们同样推荐你查看 [Django Packages][8],一个可重用 Django 应用的目录。Django Packages 将 Django 应用组织成“表格”,你可以在功能相似的不同应用之间进行比较并做出选择。你可以查看每个包中提供的特性,和使用统计情况。(比如:这是[ REST 工具的表格][9],也许可以帮助你理解我们为何推荐 Django REST Framework. + +## 为什么你应该相信我们? + +我们使用 Django 的时间比几乎其他人都长。在 Django 发布之前,我们当中的两个人(Frank 和 Jacob)在 [Lawrence Journal-World][10] (Django 的发源地)工作(事实上他们两人推动了 Django 开源发布的进程)。我们在过去的八年当中运行着一个咨询公司,来建议公司使用 Django 去将事情做到最好。 + +所以,我们见证了Django项目和社群的完整历史,我们见证了流行软件包的兴起和没落。在我们三个中,我们可能私下试用了8000个应用中的一半以上,或者我们知道谁试用过这些。我们对如何使应用变得坚实可靠有着深刻的理解,并且我们对给予这些应用持久力量的来源也有不错的理解。 + +## 建立Django网站的最佳方式:[Cookiecutter][3] + +建立一个新项目或应用总是有些痛苦。你可以用Django内建的 `startproject`。不过,如果你像我们一样,你可能会对你的办事方式很挑剔。Cookiecutter 为你提供了一个快捷简单的方式来构建易于使用的项目或应用模板,从而解决了这个问题。一个简单的例子:键入 `pip install cookiecutter`,然后在命令行中运行以下命令: + +```bash +$ cookiecutter https://github.com/marcofucci/cookiecutter-simple-django +``` + +接下来你需要回答几个简单的问题,比如你的项目名称、目录、作者名字、E-Mail和其他几个关于配置的小问题。这些能够帮你补充项目相关的细节。我们使用最最原始的 "_foo_" 作为我们的目录名称。所以 cokkiecutter 在子目录 "_foo_" 下建立了一个简单的 Django 项目。 + +如果你在"_foo_"项目中闲逛,你会看见你刚刚选择的其它设置已通过模板,连同子目录一同嵌入到文件当中。这个“模板”在我们刚刚在执行 `cookiecutter` 命令时输入的 Github 仓库 URL 中定义。这个样例工程使用了一个 Github 远程仓库作为模板;不过你也可以使用本地的模板,这在建立非重用项目时非常有用。 + +我们认为 cookiecutter 是一个极棒的 Django 包,但是,事实上其实它在面对纯 Python 甚至非 Python 相关需求时也极为有用。你能够将所有文件依你所愿精确摆放在任何位置上,使得 cookiecutter 成为了一个简化工作流程的极佳工具。 + +## 最棒的静态资源服务器:[Whitenoise][4] + +多年来,托管网站的静态资源——图片、Javascript、CSS——都是一件很痛苦的事情。Django 内建的 [django.views.static.serve][11] 视图,就像Django文章所述的那样,“在生产环境中不可靠,所以只应为开发环境的提供辅助功能。”但使用一个“真正的” Web 服务器,如 NGINX 或者借助 CDN 来托管媒体资源,配置起来会相当困难。 + +Whitenoice 很简洁地解决了这个问题。它可以像在开发环境那样轻易地在生产环境中设置静态服务器,并且针对生产环境进行了加固和优化。它的设置方法极为简单: + +1. 确保你在使用 Django 的 [contrib.staticfiles][12] 应用,并确认你在配置文件中正确设置了 `STATIC_ROOT` 变量。 + +2. 在 `wsgi.py` 文件中启用 Whitenoise: + + ```python + from django.core.wsgi import get_wsgi_application + from whitenoise.django import DjangoWhiteNoise + + application = get_wsgi_application() + application = DjangoWhiteNoise(application) + ``` + +配置它真的就这么简单!对于大型应用,你可能想要使用一个专用的媒体服务器和/或一个 CDN,但对于大多数小型或中型 Django 网站,Whitenoise 已经足够强大。 + +如需查看更多关于 Whitenoise 的信息,[请查看文档][13]。 + +## 开发REST API的最佳工具:[Django REST Framework][5] + +REST API 正在迅速成为现代 Web 应用的标准功能。与一个 API 进行简短的会话,你只需使用 JSON 而不是 HTML,当然你可以只用 Django 做到这些。你可以制作自己的视图,设置合适的 `Content-Type`, 然后返回 JSON 而不是渲染后的 HTML 响应。这是在像 [Django Rest Framework][14](下称DRF)这样的API框架发布之前,大多数人所做的。 + +如果你对 Django 的视图类很熟悉,你会觉得使用DRF构建REST API与使用它们很相似,不过 DRF 只针对特定 API 使用场景而设计。在一般 API 设计中,你会用到它的不少代码,所以我们强调了一些 DRF 的特性来使你更快地接受它,而不是去看一份让你兴奋的示例代码: + +* 可自动预览的 API 可以使你的开发和人工测试轻而易举。你可以查看 DRF 的[示例代码][15]。你可以查看 API 响应,并且它支持 POST/PUT/DELETE 类型的操作,不需要你做任何事。 + + +* 认证方式易于迁移,如OAuth, Basic Auth, 或API Tokens. +* 内建请求速度限制。 +* 当与 [django-rest-swagger][16] 结合时,API文档几乎可以自动生成。 +* 第三方库拥有广泛的生态。 + +当然你可以不依赖 DRF 来构建 API,但我们无法推测你不开始使用 DRF 的原因。就算你不使用 DRF 的全部特性,使用一个成熟的视图库来构建你自己的 API 也会使你的 API 更加一致、完全,更能提高你的开发速度。如果你还没有开始使用 DRF, 你应该找点时间去体验一下。 + +## 以 Django 为基础的最佳 CMS:[Wagtail][6] + +Wagtail是当下Django CMS(内容管理系统)世界中最受人青睐的应用,并且它的热门有足够的理由。就想大多数的 CMS 一样,它具有极佳的灵活性,可以通过简单的 Django 模型来定义不同类型的页面及其内容。使用它,你可以从零开始,在几个小时而不是几天之内来和建造一个基本可以运行的内容管理系统。举一个小例子,为你公司的员工定义一个页面类型可以像下面一样简单: + +```python +from wagtail.wagtailcore.models import Page +from wagtail.wagtailcore.fields import RichTextField +from wagtail.wagtailadmin.edit_handlers import FieldPanel, MultiFieldPanel +from wagtail.wagtailimages.edit_handlers import ImageChooserPanel + +class StaffPage(Page): + name = models.CharField(max_length=100) + hire_date = models.DateField() + bio = models.RichTextField() + email = models.EmailField() + headshot = models.ForeignKey('wagtailimages.Image', null=True, blank=True) + content_panels = Page.content_panels + [ + FieldPanel('name'), + FieldPanel('hire_date'), + FieldPanel('email'), + FieldPanel('bio',classname="full"), + ImageChoosePanel('headshot'), + ] +``` + +然而,Wagtail 真正出彩的地方在于它的灵活性及其易于使用的现代化管理页面。你可以控制不同类型的页面在哪网站的哪些区域可以访问,为页面添加复杂的附加逻辑,还可以极为方便地取得标准的适应/审批工作流。在大多数 CMS 系统中,你会在开发时在某些点上遇到困难。而使用 Wagtail 时,我们经过不懈努力找到了一个突破口,使得让我们轻易地开发出一套简洁稳定的系统,使得程序完全依照我们的想法运行。如果你对此感兴趣,我们写了一篇[深入理解 Wagtail][17]. + +## 提供社交账户登录的最佳工具:[django-allauth][7] + +django-allauth 是一个能够解决你的注册和认证需求的、可重用的Django应用。无论你需要构建本地注册系统还是社交账户注册系统,django-allauth 都能够帮你做到。 + +这个应用支持多种认证体系,比如用户名或电子邮件。一旦用户注册成功,它可以提供从零到电子邮件认证的多种账户验证的策略。同时,它也支持多种社交账户和电子邮件账户关联。它还支持可插拔的注册表单,可让用户在注册时回答一些附加问题。 + +django-allauth 支持多于 20 种认证提供者,包括 Facebook, Github, Google 和 Twitter。如果你发现了一个它不支持的社交网站,那很有可能有一款第三方插件提供该网站的接入支持。这个项目还支持自定义后台开发,可以支持自定义的认证方式。 + +django-allauth 易于配置,且有[完善的文档][18]。该项目通过了很多测试,所以你可以相信它的所有部件都会正常运作。 + +你有最喜爱的 Django 包吗?请在评论中告诉我们。 + +## 关于作者 + +![Photo](https://opensource.com/sites/default/files/styles/profile_pictures/public/pictures/main-one-i-use-everywhere.png?itok=66GC-D1q) + +Jeff Triplett + +劳伦斯,堪萨斯州 + + +我在 2007 年搬到了堪萨斯州的劳伦斯,在 Django 的发源地—— Lawrence Journal-World 工作。我现在在劳伦斯市的 [Revolution Systems (Revsys)][19] 工作,做一位开发者兼顾问。 + +我是[北美 Django 运动基金会(DEFNA)][20]的联合创始人,2015 和 2016 年 [DjangoCon US][21] 的会议主席,而且我在 Django 的发源地劳伦斯参与组织了 [Django Birthday][22] 来庆祝 Django 的 10 岁生日。 + +我是当地越野跑小组的成员,我喜欢篮球,我还喜欢梦见自己随着一道气流游遍美国。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/business/15/12/5-favorite-open-source-django-packages + +作者:[Jeff Triplett][a] +译者:[StdioA](https://github.com/StdioA) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jefftriplett +[1]:https://docs.djangoproject.com/en/1.8/intro/reusable-apps/ +[2]:https://pypi.python.org/pypi?:action=browse&c=523 +[3]:https://github.com/audreyr/cookiecutter +[4]:http://whitenoise.evans.io/en/latest/base.html +[5]:http://www.django-rest-framework.org/ +[6]:https://wagtail.io/ +[7]:http://www.intenct.nl/projects/django-allauth/ +[8]:https://www.djangopackages.com/ +[9]:https://www.djangopackages.com/grids/g/rest/ +[10]:http://www2.ljworld.com/news/2015/jul/09/happy-birthday-django/ +[11]:https://docs.djangoproject.com/en/1.8/ref/views/#django.views.static.serve +[12]:https://docs.djangoproject.com/en/1.8/ref/contrib/staticfiles/ +[13]:http://whitenoise.evans.io/en/latest/index.html +[14]:http://www.django-rest-framework.org/ +[15]:http://restframework.herokuapp.com/ +[16]:http://django-rest-swagger.readthedocs.org/en/latest/index.html +[17]:https://opensource.com/business/15/5/wagtail-cms +[18]:http://django-allauth.readthedocs.org/en/latest/ +[19]:http://www.revsys.com/ +[20]:http://defna.org/ +[21]:https://2015.djangocon.us/ +[22]:https://djangobirthday.com/ diff --git a/translated/tech/20150623 Shilpa Nair Shares Her Interview Experience on RedHat Linux Package Management.md b/translated/tech/20150623 Shilpa Nair Shares Her Interview Experience on RedHat Linux Package Management.md deleted file mode 100644 index f095a31c65..0000000000 --- a/translated/tech/20150623 Shilpa Nair Shares Her Interview Experience on RedHat Linux Package Management.md +++ /dev/null @@ -1,348 +0,0 @@ -Shilpa Nair 分享了她面试 RedHat Linux 包管理方面的经验 -======================================================================== -**Shilpa Nair 刚于2015年毕业。她之后去了一家位于 Noida,Delhi 的国家新闻电视台,应聘实习生的岗位。在她去年毕业季的时候,常逛 Tecmint 寻求作业上的帮助。从那时开始,她就常去 Tecmint。** - -![Linux Interview Questions on RPM](http://www.tecmint.com/wp-content/uploads/2015/06/Linux-Interview-Questions-on-RPM.jpeg) - -有关 RPM 方面的 Linux 面试题 - -所有的问题和回答都是 Shilpa Nair 根据回忆重写的。 - -> “大家好!我是来自 Delhi 的Shilpa Nair。我不久前才顺利毕业,正寻找一个实习的机会。在大学早期的时候,我就对 UNIX 十分喜爱,所以我也希望这个机会能适合我,满足我的兴趣。我被提问了很多问题,大部分都是关于 RedHat 包管理的基础问题。” - -下面就是我被问到的问题,和对应的回答。我仅贴出了与 RedHat GNU/Linux 包管理相关的,也是主要被提问的。 - -### 1,里如何查找一个包安装与否?假设你需要确认 ‘nano’ 有没有安装,你怎么做? ### - -> **回答**:为了确认 nano 软件包有没有安装,我们可以使用 rpm 命令,配合 -q 和 -a 选项来查询所有已安装的包 -> -> # rpm -qa nano -> OR -> # rpm -qa | grep -i nano -> -> nano-2.3.1-10.el7.x86_64 -> -> 同时包的名字必须是完成的,不完整的包名返回提示,不打印任何东西,就是说这包(包名字不全)未安装。下面的例子会更好理解些: -> -> 我们通常使用 vim 替代 vi 命令。当时如果我们查找安装包 vi/vim 的时候,我们就会看到标准输出上没有任何结果。 -> -> # vi -> # vim -> -> 尽管如此,我们仍然可以通过使用 vi/vim 命令来清楚地知道包有没有安装。Here is ... name(这句不知道)。如果我们不确切知道完整的文件名,我们可以使用通配符: -> -> # rpm -qa vim* -> -> vim-minimal-7.4.160-1.el7.x86_64 -> -> 通过这种方式,我们可以获得任何软件包的信息,安装与否。 - -### 2. 你如何使用 rpm 命令安装 XYZ 软件包? ### - -> **回答**:我们可以使用 rpm 命令安装任何的软件包(*.rpm),像下面这样,选项 -i(install),-v(冗余或者显示额外的信息)和 -h(打印#号显示进度,在安装过程中)。 -> -> # rpm -ivh peazip-1.11-1.el6.rf.x86_64.rpm -> -> Preparing... ################################# [100%] -> Updating / installing... -> 1:peazip-1.11-1.el6.rf ################################# [100%] -> -> 如果要升级一个早期版本的包,应加上 -U 选项,选项 -v 和 -h 可以确保我们得到用 # 号表示的冗余输出,这增加了可读性。 - -### 3. 你已经安装了一个软件包(假设是 httpd),现在你想看看软件包创建并安装的所有文件和目录,你会怎么做? ### - -> **回答**:使用选项 -l(列出所有文件)和 -q(查询)列出 httpd 软件包安装的所有文件(Linux哲学:所有的都是文件,包括目录)。 -> -> # rpm -ql httpd -> -> /etc/httpd -> /etc/httpd/conf -> /etc/httpd/conf.d -> ... - -### 4. 假如你要移除一个软件包,叫 postfix。你会怎么做? ### - -> **回答**:首先我们需要知道什么包安装了 postfix。查找安装 postfix 的包名后,使用 -e(擦除/卸载软件包)和 -v(冗余输出)两个选项来实现。 -> -> # rpm -qa postfix* -> -> postfix-2.10.1-6.el7.x86_64 -> -> 然后移除 postfix,如下: -> -> # rpm -ev postfix-2.10.1-6.el7.x86_64 -> -> Preparing packages... -> postfix-2:3.0.1-2.fc22.x86_64 - -### 5. 获得一个已安装包的具体信息,如版本,发行号,安装日期,大小,总结和一个间短的描述。 ### - -> **回答**:我们通过使用 rpm 的选项 -qi,后面接包名,可以获得关于一个已安装包的具体信息。 -> -> 举个例子,为了获得 openssh 包的具体信息,我需要做的就是: -> -> # rpm -qi openssh -> -> [root@tecmint tecmint]# rpm -qi openssh -> Name : openssh -> Version : 6.8p1 -> Release : 5.fc22 -> Architecture: x86_64 -> Install Date: Thursday 28 May 2015 12:34:50 PM IST -> Group : Applications/Internet -> Size : 1542057 -> License : BSD -> .... - -### 6. 假如你不确定一个指定包的配置文件在哪,比如 httpd。你如何找到所有 httpd 提供的配置文件列表和位置。 ### - -> **回答**: 我们需要用选项 -c 接包名,这会列出所有配置文件的名字和他们的位置。 -> -> # rpm -qc httpd -> -> /etc/httpd/conf.d/autoindex.conf -> /etc/httpd/conf.d/userdir.conf -> /etc/httpd/conf.d/welcome.conf -> /etc/httpd/conf.modules.d/00-base.conf -> /etc/httpd/conf/httpd.conf -> /etc/sysconfig/httpd -> -> 相似地,我们可以列出所有相关的文档文件,如下: -> -> # rpm -qd httpd -> -> /usr/share/doc/httpd/ABOUT_APACHE -> /usr/share/doc/httpd/CHANGES -> /usr/share/doc/httpd/LICENSE -> ... -> -> 我们也可以列出所有相关的证书文件,如下: -> -> # rpm -qL openssh -> -> /usr/share/licenses/openssh/LICENCE -> -> 忘了说明上面的选项 -d 和 -L 分别表示 “文档” 和 “证书”,抱歉。 - -### 7. 你进入了一个配置文件,位于‘/usr/share/alsa/cards/AACI.conf’,现在你不确定该文件属于哪个包。你如何查找出包的名字? ### - -> **回答**:当一个包被安装后,相关的信息就存储在了数据库里。所以使用选项 -qf(-f 查询包拥有的文件)很容易追踪谁提供了上述的包。 -> -> # rpm -qf /usr/share/alsa/cards/AACI.conf -> alsa-lib-1.0.28-2.el7.x86_64 -> -> 类似地,我们可以查找(谁提供的)关于任何子包,文档和证书文件的信息。 - -### 8. 你如何使用 rpm 查找最近安装的软件列表? ### - -> **回答**:如刚刚说的,每一样被安装的文件都记录在了数据库里。所以这并不难,通过查询 rpm 的数据库,找到最近安装软件的列表。 -> -> 我们通过运行下面的命令,使用选项 -last(打印出最近安装的软件)达到目的。 -> -> # rpm -qa --last -> -> 上面的命令会打印出所有安装的软件,最近一次安装的软件在列表的顶部。 -> -> 如果我们关心的是找出特定的包,我们可以使用 grep 命令从列表中匹配包(假设是 sqlite ),简单如下: -> -> # rpm -qa --last | grep -i sqlite -> -> sqlite-3.8.10.2-1.fc22.x86_64 Thursday 18 June 2015 05:05:43 PM IST -> -> 我们也可以获得10个最近安装的软件列表,简单如下: -> -> # rpm -qa --last | head -> -> 我们可以重定义一下,输出想要的结果,简单如下: -> -> # rpm -qa --last | head -n 2 -> -> 上面的命令中,-n 代表数目,后面接一个常数值。该命令是打印2个最近安装的软件的列表。 - -### 9. 安装一个包之前,你如果要检查其依赖。你会怎么做? ### - -> **回答**:检查一个 rpm 包(XYZ.rpm)的依赖,我们可以使用选项 -q(查询包),-p(指定包名)和 -R(查询/列出该包依赖的包,嗯,就是依赖)。 -> -> # rpm -qpR gedit-3.16.1-1.fc22.i686.rpm -> -> /bin/sh -> /usr/bin/env -> glib2(x86-32) >= 2.40.0 -> gsettings-desktop-schemas -> gtk3(x86-32) >= 3.16 -> gtksourceview3(x86-32) >= 3.16 -> gvfs -> libX11.so.6 -> ... - -### 10. rpm 是不是一个前端的包管理工具呢? ### - -> **回答**:不是!rpm 是一个后端管理工具,适用于基于 Linux 发行版的 RPM (此处指 Redhat Package Management)。 -> -> [YUM][1],全称 Yellowdog Updater Modified,是一个 RPM 的前端工具。YUM 命令自动完成所有工作,包括解决依赖和其他一切事务。 -> -> 最近,[DNF][2](YUM命令升级版)在Fedora 22发行版中取代了 YUM。尽管 YUM 仍然可以在 RHEL 和 CentOS 平台使用,我们也可以安装 dnf,与 YUM 命令共存使用。据说 DNF 较于 YUM 有很多提高。 -> -> 知道更多总是好的,保持自我更新。现在我们移步到前端部分来谈谈。 - -### 11. 你如何列出一个系统上面所有可用的仓库列表。 ### - -> **回答**:简单地使用下面的命令,我们就可以列出一个系统上所有可用的仓库列表。 -> -> # yum repolist -> 或 -> # dnf repolist -> -> Last metadata expiration check performed 0:30:03 ago on Mon Jun 22 16:50:00 2015. -> repo id repo name status -> *fedora Fedora 22 - x86_64 44,762 -> ozonos Repository for Ozon OS 61 -> *updates Fedora 22 - x86_64 - Updates -> -> 上面的命令仅会列出可用的仓库。如果你需要列出所有的仓库,不管可用与否,可以这样做。 -> -> # yum repolist all -> or -> # dnf repolist all -> -> Last metadata expiration check performed 0:29:45 ago on Mon Jun 22 16:50:00 2015. -> repo id repo name status -> *fedora Fedora 22 - x86_64 enabled: 44,762 -> fedora-debuginfo Fedora 22 - x86_64 - Debug disabled -> fedora-source Fedora 22 - Source disabled -> ozonos Repository for Ozon OS enabled: 61 -> *updates Fedora 22 - x86_64 - Updates enabled: 5,018 -> updates-debuginfo Fedora 22 - x86_64 - Updates - Debug - -### 12. 你如何列出一个系统上所有可用并且安装了的包? ### - -> **回答**:列出一个系统上所有可用的包,我们可以这样做: -> -> # yum list available -> 或 -> # dnf list available -> -> ast metadata expiration check performed 0:34:09 ago on Mon Jun 22 16:50:00 2015. -> Available Packages -> 0ad.x86_64 0.0.18-1.fc22 fedora -> 0ad-data.noarch 0.0.18-1.fc22 fedora -> 0install.x86_64 2.6.1-2.fc21 fedora -> 0xFFFF.x86_64 0.3.9-11.fc22 fedora -> 2048-cli.x86_64 0.9-4.git20141214.723738c.fc22 fedora -> 2048-cli-nocurses.x86_64 0.9-4.git20141214.723738c.fc22 fedora -> .... -> -> 而列出一个系统上所有已安装的包,我们可以这样做。 -> -> # yum list installed -> or -> # dnf list installed -> -> Last metadata expiration check performed 0:34:30 ago on Mon Jun 22 16:50:00 2015. -> Installed Packages -> GeoIP.x86_64 1.6.5-1.fc22 @System -> GeoIP-GeoLite-data.noarch 2015.05-1.fc22 @System -> NetworkManager.x86_64 1:1.0.2-1.fc22 @System -> NetworkManager-libnm.x86_64 1:1.0.2-1.fc22 @System -> aajohan-comfortaa-fonts.noarch 2.004-4.fc22 @System -> .... -> -> 而要同时满足两个要求的时候,我们可以这样做。 -> -> # yum list -> 或 -> # dnf list -> -> Last metadata expiration check performed 0:32:56 ago on Mon Jun 22 16:50:00 2015. -> Installed Packages -> GeoIP.x86_64 1.6.5-1.fc22 @System -> GeoIP-GeoLite-data.noarch 2015.05-1.fc22 @System -> NetworkManager.x86_64 1:1.0.2-1.fc22 @System -> NetworkManager-libnm.x86_64 1:1.0.2-1.fc22 @System -> aajohan-comfortaa-fonts.noarch 2.004-4.fc22 @System -> acl.x86_64 2.2.52-7.fc22 @System -> .... - -### 13. 你会怎么分别安装和升级一个包与一组包,在一个系统上面使用 YUM/DNF? ### - -> **回答**:安装一个包(假设是 nano),我们可以这样做, -> -> # yum install nano -> -> 而安装一组包(假设是 Haskell),我们可以这样做, -> -> # yum groupinstall 'haskell' -> -> 升级一个包(还是 nano),我们可以这样做, -> -> # yum update nano -> -> 而为了升级一组包(还是 haskell),我们可以这样做, -> -> # yum groupupdate 'haskell' - -### 14. 你会如何同步一个系统上面的所有安装软件到稳定发行版? ### - -> **回答**:我们可以一个系统上(假设是 CentOS 或者 Fedora)的所有包到稳定发行版,如下, -> -> # yum distro-sync [On CentOS/ RHEL] -> 或 -> # dnf distro-sync [On Fedora 20之后版本] - -似乎来面试之前你做了相当不多的功课,很好!在进一步交谈前,我还想问一两个问题。 - -### 15. 你对 YUM 本地仓库熟悉吗?你尝试过建立一个本地 YUM 仓库吗?让我们简单看看你会怎么建立一个本地 YUM 仓库。 ### - -> **回答**:首先,感谢你的夸奖。回到问题,我必须承认我对本地 YUM 仓库十分熟悉,并且在我的本地主机上也部署过,作为测试用。 -> -> 1. 为了建立本地 YUM 仓库,我们需要安装下面三个包: -> -> # yum install deltarpm python-deltarpm createrepo -> -> 2. 新建一个目录(假设 /home/$USER/rpm),然后复制 RedHat/CentOS DVD 上的 RPM 包到这个文件夹下 -> -> # mkdir /home/$USER/rpm -> # cp /path/to/rpm/on/DVD/*.rpm /home/$USER/rpm -> -> 3. 新建基本的库头文件如下。 -> -> # createrepo -v /home/$USER/rpm -> -> 4. 在路径 /etc/yum.repo.d 下创建一个 .repo 文件(如 abc.repo): -> -> cd /etc/yum.repos.d && cat << EOF > abc.repo -> [local-installation]name=yum-local -> baseurl=file:///home/$USER/rpm -> enabled=1 -> gpgcheck=0 -> EOF - -**重要**:用你的用户名替换掉 $USER。 - -以上就是创建一个本地 YUM 仓库所要做的全部工作。我们现在可以从这里安装软件了,相对快一些,安全一些,并且最重要的是不需要 Internet 连接。 - -好了!面试过程很愉快。我已经问完了。我会将你推荐给 HR。你是一个年轻且十分聪明的候选者,我们很愿意你加入进来。如果你有任何问题,你可以问我。 - -**我**:谢谢,这确实是一次愉快的面试,我感到非常幸运今天,然后这次面试就毁了。。。 - -显然,不会在这里结束。我问了很多问题,比如他们正在做的项目。我会担任什么角色,负责什么,,,balabalabala - -小伙伴们,3天以前 HR 轮的所有问题到时候也会被写成文档。希望我当时表现不错。感谢你们所有的祝福。 - -谢谢伙伴们和 Tecmint,花时间来编辑我的面试经历。我相信 Tecmint 好伙伴们做了很大的努力,必要要赞一个。当我们与他人分享我们的经历的时候,其他人从我们这里知道了更多,而我们自己则发现了自己的不足。 - -这增加了我们的信心。如果你最近也有任何类似的面试经历,别自己蔵着。分享出来!让我们所有人都知道。你可以使用如下的格式来与我们分享你的经历。 - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/linux-rpm-package-management-interview-questions/ - -作者:[Avishek Kumar][a] -译者:[wi-cuckoo](https://github.com/wi-cuckoo) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ -[2]:http://www.tecmint.com/dnf-commands-for-fedora-rpm-package-management/ diff --git a/translated/tech/20150728 Process of the Linux kernel building.md b/translated/tech/20150728 Process of the Linux kernel building.md deleted file mode 100644 index b8ded80179..0000000000 --- a/translated/tech/20150728 Process of the Linux kernel building.md +++ /dev/null @@ -1,674 +0,0 @@ -如何构建Linux 内核 -================================================================================ -介绍 --------------------------------------------------------------------------------- - -我不会告诉你怎么在自己的电脑上去构建、安装一个定制化的Linux 内核,这样的[资料](https://encrypted.google.com/search?q=building+linux+kernel#q=building+linux+kernel+from+source+code) 太多了,它们会对你有帮助。本文会告诉你当你在内核源码路径里敲下`make` 时会发生什么。当我刚刚开始学习内核代码时,[Makefile](https://github.com/torvalds/linux/blob/master/Makefile) 是我打开的第一个文件,这个文件看起来真令人害怕 :)。那时候这个[Makefile](https://en.wikipedia.org/wiki/Make_%28software%29) 还只包含了`1591` 行代码,当我开始写本文是,这个[Makefile](https://github.com/torvalds/linux/commit/52721d9d3334c1cb1f76219a161084094ec634dc) 已经是第三个候选版本了。 - -这个makefile 是Linux 内核代码的根makefile ,内核构建就始于此处。是的,它的内容很多,但是如果你已经读过内核源代码,你就会发现每个包含代码的目录都有一个自己的makefile。当然了,我们不会去描述每个代码文件是怎么编译链接的。所以我们将只会挑选一些通用的例子来说明问题,而你不会在这里找到构建内核的文档、如何整洁内核代码、[tags](https://en.wikipedia.org/wiki/Ctags) 的生成和[交叉编译](https://en.wikipedia.org/wiki/Cross_compiler) 相关的说明,等等。我们将从`make` 开始,使用标准的内核配置文件,到生成了内核镜像[bzImage](https://en.wikipedia.org/wiki/Vmlinux#bzImage) 结束。 - -如果你已经很了解[make](https://en.wikipedia.org/wiki/Make_%28software%29) 工具那是最好,但是我也会描述本文出现的相关代码。 - -让我们开始吧 - - -编译内核前的准备 ---------------------------------------------------------------------------------- - -在开始编译前要进行很多准备工作。最主要的就是找到并配置好配置文件,`make` 命令要使用到的参数都需要从这些配置文件获取。现在就让我们深入内核的根`makefile` 吧 - -内核的根`Makefile` 负责构建两个主要的文件:[vmlinux](https://en.wikipedia.org/wiki/Vmlinux) (内核镜像可执行文件)和模块文件。内核的 [Makefile](https://github.com/torvalds/linux/blob/master/Makefile) 从此处开始: - -```Makefile -VERSION = 4 -PATCHLEVEL = 2 -SUBLEVEL = 0 -EXTRAVERSION = -rc3 -NAME = Hurr durr I'ma sheep -``` - -这些变量决定了当前内核的版本,并且被使用在很多不同的地方,比如`KERNELVERSION` : - -```Makefile -KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) -``` - -接下来我们会看到很多`ifeq` 条件判断语句,它们负责检查传给`make` 的参数。内核的`Makefile` 提供了一个特殊的编译选项`make help` ,这个选项可以生成所有的可用目标和一些能传给`make` 的有效的命令行参数。举个例子,`make V=1` 会在构建过程中输出详细的编译信息,第一个`ifeq` 就是检查传递给make的`V=n` 选项。 - -```Makefile -ifeq ("$(origin V)", "command line") - KBUILD_VERBOSE = $(V) -endif -ifndef KBUILD_VERBOSE - KBUILD_VERBOSE = 0 -endif - -ifeq ($(KBUILD_VERBOSE),1) - quiet = - Q = -else - quiet=quiet_ - Q = @ -endif - -export quiet Q KBUILD_VERBOSE -``` - -如果`V=n` 这个选项传给了`make` ,系统就会给变量`KBUILD_VERBOSE` 选项附上`V` 的值,否则的话`KBUILD_VERBOSE` 就会为`0`。然后系统会检查`KBUILD_VERBOSE` 的值,以此来决定`quiet` 和`Q` 的值。符号`@` 控制命令的输出,如果它被放在一个命令之前,这条命令的执行将会是`CC scripts/mod/empty.o`,而不是`Compiling .... scripts/mod/empty.o`(注:CC 在makefile 中一般都是编译命令)。最后系统仅仅导出所有的变量。下一个`ifeq` 语句检查的是传递给`make` 的选项`O=/dir`,这个选项允许在指定的目录`dir` 输出所有的结果文件: - -```Makefile -ifeq ($(KBUILD_SRC),) - -ifeq ("$(origin O)", "command line") - KBUILD_OUTPUT := $(O) -endif - -ifneq ($(KBUILD_OUTPUT),) -saved-output := $(KBUILD_OUTPUT) -KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ - && /bin/pwd) -$(if $(KBUILD_OUTPUT),, \ - $(error failed to create output directory "$(saved-output)")) - -sub-make: FORCE - $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \ - -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) - -skip-makefile := 1 -endif # ifneq ($(KBUILD_OUTPUT),) -endif # ifeq ($(KBUILD_SRC),) -``` - -系统会检查变量`KBUILD_SRC`,如果他是空的(第一次执行makefile 时总是空的),并且变量`KBUILD_OUTPUT` 被设成了选项`O` 的值(如果这个选项被传进来了),那么这个值就会用来代表内核源码的顶层目录。下一步会检查变量`KBUILD_OUTPUT` ,如果之前设置过这个变量,那么接下来会做以下几件事: - -* 将变量`KBUILD_OUTPUT` 的值保存到临时变量`saved-output`; -* 尝试创建输出目录; -* 检查创建的输出目录,如果失败了就打印错误; -* 如果成功创建了输出目录,那么就在新目录重新执行`make` 命令(参见选项`-C`)。 - -下一个`ifeq` 语句会检查传递给make 的选项`C` 和`M`: - -```Makefile -ifeq ("$(origin C)", "command line") - KBUILD_CHECKSRC = $(C) -endif -ifndef KBUILD_CHECKSRC - KBUILD_CHECKSRC = 0 -endif - -ifeq ("$(origin M)", "command line") - KBUILD_EXTMOD := $(M) -endif -``` - -第一个选项`C` 会告诉`makefile` 需要使用环境变量`$CHECK` 提供的工具来检查全部`c` 代码,默认情况下会使用[sparse](https://en.wikipedia.org/wiki/Sparse)。第二个选项`M` 会用来编译外部模块(本文不做讨论)。因为设置了这两个变量,系统还会检查变量`KBUILD_SRC`,如果`KBUILD_SRC` 没有被设置,系统会设置变量`srctree` 为`.`: - -```Makefile -ifeq ($(KBUILD_SRC),) - srctree := . -endif - -objtree := . -src := $(srctree) -obj := $(objtree) - -export srctree objtree VPATH -``` - -这将会告诉`Makefile` 内核的源码树就在执行make 命令的目录。然后要设置`objtree` 和其他变量为执行make 命令的目录,并且将这些变量导出。接着就是要获取`SUBARCH` 的值,这个变量代表了当前的系统架构(注:一般都指CPU 架构): - -```Makefile -SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ - -e s/sun4u/sparc64/ \ - -e s/arm.*/arm/ -e s/sa110/arm/ \ - -e s/s390x/s390/ -e s/parisc64/parisc/ \ - -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ - -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) -``` - -如你所见,系统执行[uname](https://en.wikipedia.org/wiki/Uname) 得到机器、操作系统和架构的信息。因为我们得到的是`uname` 的输出,所以我们需要做一些处理在赋给变量`SUBARCH` 。获得`SUBARCH` 之后就要设置`SRCARCH` 和`hfr-arch`,`SRCARCH`提供了硬件架构相关代码的目录,`hfr-arch` 提供了相关头文件的目录: - -```Makefile -ifeq ($(ARCH),i386) - SRCARCH := x86 -endif -ifeq ($(ARCH),x86_64) - SRCARCH := x86 -endif - -hdr-arch := $(SRCARCH) -``` - -注意:`ARCH` 是`SUBARCH` 的别名。如果没有设置过代表内核配置文件路径的变量`KCONFIG_CONFIG`,下一步系统会设置它,默认情况下就是`.config` : - -```Makefile -KCONFIG_CONFIG ?= .config -export KCONFIG_CONFIG -``` -以及编译内核过程中要用到的[shell](https://en.wikipedia.org/wiki/Shell_%28computing%29) - -```Makefile -CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ - else if [ -x /bin/bash ]; then echo /bin/bash; \ - else echo sh; fi ; fi) -``` - -接下来就要设置一组和编译内核的编译器相关的变量。我们会设置主机的`C` 和`C++` 的编译器及相关配置项: - -```Makefile -HOSTCC = gcc -HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -HOSTCXXFLAGS = -O2 -``` - -下一步会去适配代表编译器的变量`CC`,那为什么还要`HOST*` 这些选项呢?这是因为`CC` 是编译内核过程中要使用的目标架构的编译器,但是`HOSTCC` 是要被用来编译一组`host` 程序的(下面我们就会看到)。然后我们就看看变量`KBUILD_MODULES` 和`KBUILD_BUILTIN` 的定义,这两个变量决定了我们要编译什么东西(内核、模块还是其他): - -```Makefile -KBUILD_MODULES := -KBUILD_BUILTIN := 1 - -ifeq ($(MAKECMDGOALS),modules) - KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) -endif -``` - -在这我们可以看到这些变量的定义,并且,如果们仅仅传递了`modules` 给`make`,变量`KBUILD_BUILTIN` 会依赖于内核配置选项`CONFIG_MODVERSIONS`。下一步操作是引入下面的文件: - -```Makefile -include scripts/Kbuild.include -``` - -文件`kbuild` ,[Kbuild](https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kbuild.txt) 或者又叫做 `Kernel Build System`是一个用来管理构建内核和模块的特殊框架。`kbuild` 文件的语法与makefile 一样。文件[scripts/Kbuild.include](https://github.com/torvalds/linux/blob/master/scripts/Kbuild.include) 为`kbuild` 系统同提供了一些原生的定义。因为我们包含了这个`kbuild` 文件,我们可以看到和不同工具关联的这些变量的定义,这些工具会在内核和模块编译过程中被使用(比如链接器、编译器、二进制工具包[binutils](http://www.gnu.org/software/binutils/),等等): - -```Makefile -AS = $(CROSS_COMPILE)as -LD = $(CROSS_COMPILE)ld -CC = $(CROSS_COMPILE)gcc -CPP = $(CC) -E -AR = $(CROSS_COMPILE)ar -NM = $(CROSS_COMPILE)nm -STRIP = $(CROSS_COMPILE)strip -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump -AWK = awk -... -... -... -``` - -在这些定义好的变量后面,我们又定义了两个变量:`USERINCLUDE` 和`LINUXINCLUDE`。他们包含了头文件的路径(第一个是给用户用的,第二个是给内核用的): - -```Makefile -USERINCLUDE := \ - -I$(srctree)/arch/$(hdr-arch)/include/uapi \ - -Iarch/$(hdr-arch)/include/generated/uapi \ - -I$(srctree)/include/uapi \ - -Iinclude/generated/uapi \ - -include $(srctree)/include/linux/kconfig.h - -LINUXINCLUDE := \ - -I$(srctree)/arch/$(hdr-arch)/include \ - ... -``` - -以及标准的C 编译器标志: -```Makefile -KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ - -fno-strict-aliasing -fno-common \ - -Werror-implicit-function-declaration \ - -Wno-format-security \ - -std=gnu89 -``` - -这并不是最终确定的编译器标志,他们还可以在其他makefile 里面更新(比如`arch/` 里面的kbuild)。变量定义完之后,全部会被导出供其他makefile 使用。下面的两个变量`RCS_FIND_IGNORE` 和 `RCS_TAR_IGNORE` 包含了被版本控制系统忽略的文件: - -```Makefile -export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ - -name CVS -o -name .pc -o -name .hg -o -name .git \) \ - -prune -o -export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \ - --exclude CVS --exclude .pc --exclude .hg --exclude .git -``` - -这就是全部了,我们已经完成了所有的准备工作,下一个点就是如果构建`vmlinux`. - -直面构建内核 --------------------------------------------------------------------------------- - -现在我们已经完成了所有的准备工作,根makefile(注:内核根目录下的makefile)的下一步工作就是和编译内核相关的了。在我们执行`make` 命令之前,我们不会在终端看到任何东西。但是现在编译的第一步开始了,这里我们需要从内核根makefile的的[598](https://github.com/torvalds/linux/blob/master/Makefile#L598) 行开始,这里可以看到目标`vmlinux`: - -```Makefile -all: vmlinux - include arch/$(SRCARCH)/Makefile -``` - -不要操心我们略过的从`export RCS_FIND_IGNORE.....` 到`all: vmlinux.....` 这一部分makefile 代码,他们只是负责根据各种配置文件生成不同目标内核的,因为之前我就说了这一部分我们只讨论构建内核的通用途径。 - -目标`all:` 是在命令行如果不指定具体目标时默认使用的目标。你可以看到这里包含了架构相关的makefile(在这里就指的是[arch/x86/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/Makefile))。从这一时刻起,我们会从这个makefile 继续进行下去。如我们所见,目标`all` 依赖于根makefile 后面声明的`vmlinux`: - -```Makefile -vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) FORCE -``` - -`vmlinux` 是linux 内核的静态链接可执行文件格式。脚本[scripts/link-vmlinux.sh](https://github.com/torvalds/linux/blob/master/scripts/link-vmlinux.sh) 把不同的编译好的子模块链接到一起形成了vmlinux。第二个目标是`vmlinux-deps`,它的定义如下: - -```Makefile -vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) -``` - -它是由内核代码下的每个顶级目录的`built-in.o` 组成的。之后我们还会检查内核所有的目录,`kbuild` 会编译各个目录下所有的对应`$obj-y` 的源文件。接着调用`$(LD) -r` 把这些文件合并到一个`build-in.o` 文件里。此时我们还没有`vmloinux-deps`, 所以目标`vmlinux` 现在还不会被构建。对我而言`vmlinux-deps` 包含下面的文件 - -``` -arch/x86/kernel/vmlinux.lds arch/x86/kernel/head_64.o -arch/x86/kernel/head64.o arch/x86/kernel/head.o -init/built-in.o usr/built-in.o -arch/x86/built-in.o kernel/built-in.o -mm/built-in.o fs/built-in.o -ipc/built-in.o security/built-in.o -crypto/built-in.o block/built-in.o -lib/lib.a arch/x86/lib/lib.a -lib/built-in.o arch/x86/lib/built-in.o -drivers/built-in.o sound/built-in.o -firmware/built-in.o arch/x86/pci/built-in.o -arch/x86/power/built-in.o arch/x86/video/built-in.o -net/built-in.o -``` - -下一个可以被执行的目标如下: - -```Makefile -$(sort $(vmlinux-deps)): $(vmlinux-dirs) ; -$(vmlinux-dirs): prepare scripts - $(Q)$(MAKE) $(build)=$@ -``` - -就像我们看到的,`vmlinux-dir` 依赖于两部分:`prepare` 和`scripts`。第一个`prepare` 定义在内核的根`makefile` ,准备工作分成三个阶段: - -```Makefile -prepare: prepare0 -prepare0: archprepare FORCE - $(Q)$(MAKE) $(build)=. -archprepare: archheaders archscripts prepare1 scripts_basic - -prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ - include/config/auto.conf - $(cmd_crmodverdir) -prepare2: prepare3 outputmakefile asm-generic -``` - -第一个`prepare0` 展开到`archprepare` ,后者又展开到`archheader` 和`archscripts`,这两个变量定义在`x86_64` 相关的[Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/Makefile)。让我们看看这个文件。`x86_64` 特定的makefile从变量定义开始,这些变量都是和特定架构的配置文件 ([defconfig](https://github.com/torvalds/linux/tree/master/arch/x86/configs),等等)有关联。变量定义之后,这个makefile 定义了编译[16-bit](https://en.wikipedia.org/wiki/Real_mode)代码的编译选项,根据变量`BITS` 的值,如果是`32`, 汇编代码、链接器、以及其它很多东西(全部的定义都可以在[arch/x86/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/Makefile)找到)对应的参数就是`i386`,而`64`就对应的是`x86_84`。生成的系统调用列表(syscall table)的makefile 里第一个目标就是`archheaders` : - -```Makefile -archheaders: - $(Q)$(MAKE) $(build)=arch/x86/entry/syscalls all -``` - -这个makefile 里第二个目标就是`archscripts`: - -```Makefile -archscripts: scripts_basic - $(Q)$(MAKE) $(build)=arch/x86/tools relocs -``` - - 我们可以看到`archscripts` 是依赖于根[Makefile](https://github.com/torvalds/linux/blob/master/Makefile)里的`scripts_basic` 。首先我们可以看出`scripts_basic` 是按照[scripts/basic](https://github.com/torvalds/linux/blob/master/scripts/basic/Makefile) 的mekefile 执行make 的: - -```Maklefile -scripts_basic: - $(Q)$(MAKE) $(build)=scripts/basic -``` - -`scripts/basic/Makefile`包含了编译两个主机程序`fixdep` 和`bin2` 的目标: - -```Makefile -hostprogs-y := fixdep -hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c -always := $(hostprogs-y) - -$(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep -``` - -第一个工具是`fixdep`:用来优化[gcc](https://gcc.gnu.org/) 生成的依赖列表,然后在重新编译源文件的时候告诉make。第二个工具是`bin2c`,他依赖于内核配置选项`CONFIG_BUILD_BIN2C`,并且它是一个用来将标准输入接口(注:即stdin)收到的二进制流通过标准输出接口(即:stdout)转换成C 头文件的非常小的C 程序。你可以注意到这里有些奇怪的标志,如`hostprogs-y`等。这些标志使用在所有的`kbuild` 文件,更多的信息你可以从[documentation](https://github.com/torvalds/linux/blob/master/Documentation/kbuild/makefiles.txt) 获得。在我们的用例`hostprogs-y` 中,他告诉`kbuild` 这里有个名为`fixed` 的程序,这个程序会通过和`Makefile` 相同目录的`fixdep.c` 编译而来。执行make 之后,终端的第一个输出就是`kbuild` 的结果: - -``` -$ make - HOSTCC scripts/basic/fixdep -``` - -当目标`script_basic` 被执行,目标`archscripts` 就会make [arch/x86/tools](https://github.com/torvalds/linux/blob/master/arch/x86/tools/Makefile) 下的makefile 和目标`relocs`: - -```Makefile -$(Q)$(MAKE) $(build)=arch/x86/tools relocs -``` - -代码`relocs_32.c` 和`relocs_64.c` 包含了[重定位](https://en.wikipedia.org/wiki/Relocation_%28computing%29) 的信息,将会被编译,者可以在`make` 的输出中看到: - -```Makefile - HOSTCC arch/x86/tools/relocs_32.o - HOSTCC arch/x86/tools/relocs_64.o - HOSTCC arch/x86/tools/relocs_common.o - HOSTLD arch/x86/tools/relocs -``` - -在编译完`relocs.c` 之后会检查`version.h`: - -```Makefile -$(version_h): $(srctree)/Makefile FORCE - $(call filechk,version.h) - $(Q)rm -f $(old_version_h) -``` - -我们可以在输出看到它: - -``` -CHK include/config/kernel.release -``` - -以及在内核根Makefiel 使用`arch/x86/include/generated/asm`的目标`asm-generic` 来构建`generic` 汇编头文件。在目标`asm-generic` 之后,`archprepare` 就会被完成,所以目标`prepare0` 会接着被执行,如我上面所写: - -```Makefile -prepare0: archprepare FORCE - $(Q)$(MAKE) $(build)=. -``` - -注意`build`,它是定义在文件[scripts/Kbuild.include](https://github.com/torvalds/linux/blob/master/scripts/Kbuild.include),内容是这样的: - -```Makefile -build := -f $(srctree)/scripts/Makefile.build obj -``` - -或者在我们的例子中,他就是当前源码目录路径——`.`: -```Makefile -$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.build obj=. -``` - -参数`obj` 会告诉脚本[scripts/Makefile.build](https://github.com/torvalds/linux/blob/master/scripts/Makefile.build) 那些目录包含`kbuild` 文件,脚本以此来寻找各个`kbuild` 文件: - -```Makefile -include $(kbuild-file) -``` - -然后根据这个构建目标。我们这里`.` 包含了[Kbuild](https://github.com/torvalds/linux/blob/master/Kbuild),就用这个文件来生成`kernel/bounds.s` 和`arch/x86/kernel/asm-offsets.s`。这样目标`prepare` 就完成了它的工作。`vmlinux-dirs` 也依赖于第二个目标——`scripts` ,`scripts`会编译接下来的几个程序:`filealias`,`mk_elfconfig`,`modpost`等等。`scripts/host-programs` 编译完之后,我们的目标`vmlinux-dirs` 就可以开始编译了。第一步,我们先来理解一下`vmlinux-dirs` 都包含了那些东西。在我们的例子中它包含了接下来要使用的内核目录的路径: - -``` -init usr arch/x86 kernel mm fs ipc security crypto block -drivers sound firmware arch/x86/pci arch/x86/power -arch/x86/video net lib arch/x86/lib -``` - -我们可以在内核的根[Makefile](https://github.com/torvalds/linux/blob/master/Makefile) 里找到`vmlinux-dirs` 的定义: - -```Makefile -vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ - $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ - $(net-y) $(net-m) $(libs-y) $(libs-m))) - -init-y := init/ -drivers-y := drivers/ sound/ firmware/ -net-y := net/ -libs-y := lib/ -... -... -... -``` - -这里我们借助函数`patsubst` 和`filter`去掉了每个目录路径里的符号`/`,并且把结果放到`vmlinux-dirs` 里。所以我们就有了`vmlinux-dirs` 里的目录的列表,以及下面的代码: - -```Makefile -$(vmlinux-dirs): prepare scripts - $(Q)$(MAKE) $(build)=$@ -``` - -符号`$@` 在这里代表了`vmlinux-dirs`,这就表明程序会递归遍历从`vmlinux-dirs` 以及它内部的全部目录(依赖于配置),并且在对应的目录下执行`make` 命令。我们可以在输出看到结果: - -``` - CC init/main.o - CHK include/generated/compile.h - CC init/version.o - CC init/do_mounts.o - ... - CC arch/x86/crypto/glue_helper.o - AS arch/x86/crypto/aes-x86_64-asm_64.o - CC arch/x86/crypto/aes_glue.o - ... - AS arch/x86/entry/entry_64.o - AS arch/x86/entry/thunk_64.o - CC arch/x86/entry/syscall_64.o -``` - -每个目录下的源代码将会被编译并且链接到`built-io.o` 里: - -``` -$ find . -name built-in.o -./arch/x86/crypto/built-in.o -./arch/x86/crypto/sha-mb/built-in.o -./arch/x86/net/built-in.o -./init/built-in.o -./usr/built-in.o -... -... -``` - -好了,所有的`built-in.o` 都构建完了,现在我们回到目标`vmlinux` 上。你应该还记得,目标`vmlinux` 是在内核的根makefile 里。在链接`vmlinux` 之前,系统会构建[samples](https://github.com/torvalds/linux/tree/master/samples), [Documentation](https://github.com/torvalds/linux/tree/master/Documentation)等等,但是如上文所述,我不会在本文描述这些。 - -```Makefile -vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) FORCE - ... - ... - +$(call if_changed,link-vmlinux) -``` - -你可以看到,`vmlinux` 的调用脚本[scripts/link-vmlinux.sh](https://github.com/torvalds/linux/blob/master/scripts/link-vmlinux.sh) 的主要目的是把所有的`built-in.o` 链接成一个静态可执行文件、生成[System.map](https://en.wikipedia.org/wiki/System.map)。 最后我们来看看下面的输出: - -``` - LINK vmlinux - LD vmlinux.o - MODPOST vmlinux.o - GEN .version - CHK include/generated/compile.h - UPD include/generated/compile.h - CC init/version.o - LD init/built-in.o - KSYM .tmp_kallsyms1.o - KSYM .tmp_kallsyms2.o - LD vmlinux - SORTEX vmlinux - SYSMAP System.map -``` - -以及内核源码树根目录下的`vmlinux` 和`System.map` - -``` -$ ls vmlinux System.map -System.map vmlinux -``` - -这就是全部了,`vmlinux` 构建好了,下一步就是创建[bzImage](https://en.wikipedia.org/wiki/Vmlinux#bzImage). - -制作bzImage --------------------------------------------------------------------------------- - -`bzImage` 就是压缩了的linux 内核镜像。我们可以在构建了`vmlinux` 之后通过执行`make bzImage` 获得`bzImage`。同时我们可以仅仅执行`make` 而不带任何参数也可以生成`bzImage` ,因为它是在[arch/x86/kernel/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/Makefile) 里预定义的、默认生成的镜像: - -```Makefile -all: bzImage -``` - -让我们看看这个目标,他能帮助我们理解这个镜像是怎么构建的。我已经说过了`bzImage` 师被定义在[arch/x86/kernel/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/Makefile),定义如下: - -```Makefile -bzImage: vmlinux - $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) - $(Q)mkdir -p $(objtree)/arch/$(UTS_MACHINE)/boot - $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/$(UTS_MACHINE)/boot/$@ -``` - -在这里我们可以看到第一次为boot 目录执行`make`,在我们的例子里是这样的: - -```Makefile -boot := arch/x86/boot -``` - -现在的主要目标是编译目录`arch/x86/boot` 和`arch/x86/boot/compressed` 的代码,构建`setup.bin` 和`vmlinux.bin`,然后用这两个文件生成`bzImage`。第一个目标是定义在[arch/x86/boot/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/boot/Makefile) 的`$(obj)/setup.elf`: - -```Makefile -$(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE - $(call if_changed,ld) -``` - -我们已经在目录`arch/x86/boot`有了链接脚本`setup.ld`,并且将变量`SETUP_OBJS` 扩展到`boot` 目录下的全部源代码。我们可以看看第一个输出: - -```Makefile - AS arch/x86/boot/bioscall.o - CC arch/x86/boot/cmdline.o - AS arch/x86/boot/copy.o - HOSTCC arch/x86/boot/mkcpustr - CPUSTR arch/x86/boot/cpustr.h - CC arch/x86/boot/cpu.o - CC arch/x86/boot/cpuflags.o - CC arch/x86/boot/cpucheck.o - CC arch/x86/boot/early_serial_console.o - CC arch/x86/boot/edd.o -``` - -下一个源码文件是[arch/x86/boot/header.S](https://github.com/torvalds/linux/blob/master/arch/x86/boot/header.S),但是我们不能现在就编译它,因为这个目标依赖于下面两个头文件: - -```Makefile -$(obj)/header.o: $(obj)/voffset.h $(obj)/zoffset.h -``` - -第一个头文件`voffset.h` 是使用`sed` 脚本生成的,包含用`nm` 工具从`vmlinux` 获取的两个地址: - -```C -#define VO__end 0xffffffff82ab0000 -#define VO__text 0xffffffff81000000 -``` - -这两个地址是内核的起始和结束地址。第二个头文件`zoffset.h` 在[arch/x86/boot/compressed/Makefile](https://github.com/torvalds/linux/blob/master/arch/x86/boot/compressed/Makefile) 可以看出是依赖于目标`vmlinux`的: - -```Makefile -$(obj)/zoffset.h: $(obj)/compressed/vmlinux FORCE - $(call if_changed,zoffset) -``` - -目标`$(obj)/compressed/vmlinux` 依赖于变量`vmlinux-objs-y` —— 说明需要编译目录[arch/x86/boot/compressed](https://github.com/torvalds/linux/tree/master/arch/x86/boot/compressed) 下的源代码,然后生成`vmlinux.bin`, `vmlinux.bin.bz2`, 和编译工具 - `mkpiggy`。我们可以在下面的输出看出来: - -```Makefile - LDS arch/x86/boot/compressed/vmlinux.lds - AS arch/x86/boot/compressed/head_64.o - CC arch/x86/boot/compressed/misc.o - CC arch/x86/boot/compressed/string.o - CC arch/x86/boot/compressed/cmdline.o - OBJCOPY arch/x86/boot/compressed/vmlinux.bin - BZIP2 arch/x86/boot/compressed/vmlinux.bin.bz2 - HOSTCC arch/x86/boot/compressed/mkpiggy -``` - -`vmlinux.bin` 是去掉了调试信息和注释的`vmlinux` 二进制文件,加上了占用了`u32` (注:即4-Byte)的长度信息的`vmlinux.bin.all` 压缩后就是`vmlinux.bin.bz2`。其中`vmlinux.bin.all` 包含了`vmlinux.bin` 和`vmlinux.relocs`(注:vmlinux 的重定位信息),其中`vmlinux.relocs` 是`vmlinux` 经过程序`relocs` 处理之后的`vmlinux` 镜像(见上文所述)。我们现在已经获取到了这些文件,汇编文件`piggy.S` 将会被`mkpiggy` 生成、然后编译: - -```Makefile - MKPIGGY arch/x86/boot/compressed/piggy.S - AS arch/x86/boot/compressed/piggy.o -``` - -这个汇编文件会包含经过计算得来的、压缩内核的偏移信息。处理完这个汇编文件,我们就可以看到`zoffset` 生成了: - -```Makefile - ZOFFSET arch/x86/boot/zoffset.h -``` - -现在`zoffset.h` 和`voffset.h` 已经生成了,[arch/x86/boot](https://github.com/torvalds/linux/tree/master/arch/x86/boot/) 里的源文件可以继续编译: - -```Makefile - AS arch/x86/boot/header.o - CC arch/x86/boot/main.o - CC arch/x86/boot/mca.o - CC arch/x86/boot/memory.o - CC arch/x86/boot/pm.o - AS arch/x86/boot/pmjump.o - CC arch/x86/boot/printf.o - CC arch/x86/boot/regs.o - CC arch/x86/boot/string.o - CC arch/x86/boot/tty.o - CC arch/x86/boot/video.o - CC arch/x86/boot/video-mode.o - CC arch/x86/boot/video-vga.o - CC arch/x86/boot/video-vesa.o - CC arch/x86/boot/video-bios.o -``` - -所有的源代码会被编译,他们最终会被链接到`setup.elf` : - -```Makefile - LD arch/x86/boot/setup.elf -``` - - -或者: - -``` -ld -m elf_x86_64 -T arch/x86/boot/setup.ld arch/x86/boot/a20.o arch/x86/boot/bioscall.o arch/x86/boot/cmdline.o arch/x86/boot/copy.o arch/x86/boot/cpu.o arch/x86/boot/cpuflags.o arch/x86/boot/cpucheck.o arch/x86/boot/early_serial_console.o arch/x86/boot/edd.o arch/x86/boot/header.o arch/x86/boot/main.o arch/x86/boot/mca.o arch/x86/boot/memory.o arch/x86/boot/pm.o arch/x86/boot/pmjump.o arch/x86/boot/printf.o arch/x86/boot/regs.o arch/x86/boot/string.o arch/x86/boot/tty.o arch/x86/boot/video.o arch/x86/boot/video-mode.o arch/x86/boot/version.o arch/x86/boot/video-vga.o arch/x86/boot/video-vesa.o arch/x86/boot/video-bios.o -o arch/x86/boot/setup.elf -``` - -最后两件事是创建包含目录`arch/x86/boot/*` 下的编译过的代码的`setup.bin`: - -``` -objcopy -O binary arch/x86/boot/setup.elf arch/x86/boot/setup.bin -``` - -以及从`vmlinux` 生成`vmlinux.bin` : - -``` -objcopy -O binary -R .note -R .comment -S arch/x86/boot/compressed/vmlinux arch/x86/boot/vmlinux.bin -``` - -最后,我们编译主机程序[arch/x86/boot/tools/build.c](https://github.com/torvalds/linux/blob/master/arch/x86/boot/tools/build.c),它将会用来把`setup.bin` 和`vmlinux.bin` 打包成`bzImage`: - -``` -arch/x86/boot/tools/build arch/x86/boot/setup.bin arch/x86/boot/vmlinux.bin arch/x86/boot/zoffset.h arch/x86/boot/bzImage -``` - -实际上`bzImage` 就是把`setup.bin` 和`vmlinux.bin` 连接到一起。最终我们会看到输出结果,就和那些用源码编译过内核的同行的结果一样: - -``` -Setup is 16268 bytes (padded to 16384 bytes). -System is 4704 kB -CRC 94a88f9a -Kernel: arch/x86/boot/bzImage is ready (#5) -``` - - -全部结束。 - -结论 -================================================================================ - -这就是本文的最后一节。本文我们了解了编译内核的全部步骤:从执行`make` 命令开始,到最后生成`bzImage`。我知道,linux 内核的makefiles 和构建linux 的过程第一眼看起来可能比较迷惑,但是这并不是很难。希望本文可以帮助你理解构建linux 内核的整个流程。 - - -链接 -================================================================================ - -* [GNU make util](https://en.wikipedia.org/wiki/Make_%28software%29) -* [Linux kernel top Makefile](https://github.com/torvalds/linux/blob/master/Makefile) -* [cross-compilation](https://en.wikipedia.org/wiki/Cross_compiler) -* [Ctags](https://en.wikipedia.org/wiki/Ctags) -* [sparse](https://en.wikipedia.org/wiki/Sparse) -* [bzImage](https://en.wikipedia.org/wiki/Vmlinux#bzImage) -* [uname](https://en.wikipedia.org/wiki/Uname) -* [shell](https://en.wikipedia.org/wiki/Shell_%28computing%29) -* [Kbuild](https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kbuild.txt) -* [binutils](http://www.gnu.org/software/binutils/) -* [gcc](https://gcc.gnu.org/) -* [Documentation](https://github.com/torvalds/linux/blob/master/Documentation/kbuild/makefiles.txt) -* [System.map](https://en.wikipedia.org/wiki/System.map) -* [Relocation](https://en.wikipedia.org/wiki/Relocation_%28computing%29) - --------------------------------------------------------------------------------- - -via: https://github.com/0xAX/linux-insides/blob/master/Misc/how_kernel_compiled.md - -译者:[译者ID](https://github.com/oska874) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150824 Mhddfs--Combine Several Smaller Partition into One Large Virtual Storage.md b/translated/tech/20150824 Mhddfs--Combine Several Smaller Partition into One Large Virtual Storage.md deleted file mode 100644 index 04d9f18eb9..0000000000 --- a/translated/tech/20150824 Mhddfs--Combine Several Smaller Partition into One Large Virtual Storage.md +++ /dev/null @@ -1,183 +0,0 @@ -Mhddfs——将多个小分区合并成一个大的虚拟存储 -================================================================================ - -让我们假定你有30GB的电影,并且你有3个驱动器,每个的大小为20GB。那么,你会怎么来存放东西呢? - -很明显,你可以将你的视频分割成2个或者3个不同的卷,并将它们手工存储到驱动器上。这当然不是一个好主意,它成了一项费力的工作,它需要你手工干预,而且花费你大量时间。 - -另外一个解决方案是创建一个[RAID磁盘阵列][1]。然而,RAID在缺乏存储可靠性,磁盘空间可用性差等方面声名狼藉。另外一个解决方案,就是mhddfs。 - -![Combine Multiple Partitions in Linux](http://www.tecmint.com/wp-content/uploads/2015/08/Combine-Multiple-Partitions-in-Linux.png) -Mhddfs——在Linux中合并多个分区 - -mhddfs是一个用于Linux的驱动,它可以将多个挂载点合并到一个虚拟磁盘中。它是一个基于FUSE的驱动,提供了一个用于大数据存储的简单解决方案。它将所有小文件系统合并,以创建一个单一的大虚拟文件系统,该文件系统包含其成员文件系统的所有颗粒,包括文件和空闲空间。 - -#### 你为什么需要Mhddfs? #### - -你所有存储设备创建了一个单一的虚拟池,它可以在启动时被挂载。这个小工具可以智能地照看并处理哪个驱动器满了,哪个驱动器空着,将数据写到哪个驱动器中。当你成功创建虚拟驱动器后,你可以使用[SAMBA][2]来共享你的虚拟文件系统。你的客户端将在任何时候都看到一个巨大的驱动器和大量的空闲空间。 - -#### Mhddfs特性 #### - -- 获取文件系统属性和系统信息。 -- 设置文件系统属性。 -- 创建、读取、移除和写入目录和文件。 -- 支持文件锁和单一设备上的硬链接。 - -注:表格 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mhddfs的优点mhddfs的缺点
 适合家庭用户mhddfs驱动没有内建在Linux内核中
 运行简单 运行时需要大量处理能力
 没有明显的数据丢失 没有冗余解决方案
 不分割文件 不支持移动硬链接
 添加新文件到合并的虚拟文件系统 
 管理文件保存的位置 
  扩展文件属性 
- -### Linux中安装Mhddfs ### - -在Debian及其类似的移植系统中,你可以使用下面的命令来安装mhddfs包。 - - # apt-get update && apt-get install mhddfs - -![Install Mhddfs on Debian based Systems](http://www.tecmint.com/wp-content/uploads/2015/08/Install-Mhddfs-on-Ubuntu.png) -安装Mhddfs到基于Debian的系统中 - -在RHEL/CentOS Linux系统中,你需要开启[epel仓库][3],然后执行下面的命令来安装mhddfs包。 - - # yum install mhddfs - -在Fedora 22及以上系统中,你可以通过dnf包管理来获得它,就像下面这样。 - - # dnf install mhddfs - -![Install Mhddfs on Fedora](http://www.tecmint.com/wp-content/uploads/2015/08/Install-Mhddfs-on-Fedora.png) -安装Mhddfs到Fedora - -如果万一mhddfs包不能从epel仓库获取到,那么你需要解决下面的依赖,然后像下面这样来编译源码并安装。 - -- FUSE头文件 -- GCC -- libc6头文件 -- uthash头文件 -- libattr1头文件(可选) - -接下来,只需从下面建议的地址下载最新的源码包,然后编译。 - - # wget http://mhddfs.uvw.ru/downloads/mhddfs_0.1.39.tar.gz - # tar -zxvf mhddfs*.tar.gz - # cd mhddfs-0.1.39/ - # make - -你应该可以在当前目录中看到mhddfs的二进制文件,以root身份将它移动到/usr/bin/和/usr/local/bin/中。 - - # cp mhddfs /usr/bin/ - # cp mhddfs /usr/local/bin/ - -一切搞定,mhddfs已经可以用了。 - -### 我怎么使用Mhddfs? ### - -1.让我们看看当前所有挂载到我们系统中的硬盘。 - - - $ df -h - -![Check Mounted Devices](http://www.tecmint.com/wp-content/uploads/2015/08/Check-Mounted-Devices.gif) -**样例输出** - - Filesystem Size Used Avail Use% Mounted on - - /dev/sda1 511M 132K 511M 1% /boot/efi - /dev/sda2 451G 92G 336G 22% / - /dev/sdb1 1.9T 161G 1.7T 9% /media/avi/BD9B-5FCE - /dev/sdc1 555M 555M 0 100% /media/avi/Debian 8.1.0 M-A 1 - -注意这里的‘挂载点’名称,我们后面会使用到它们。 - -2.创建目录‘/mnt/virtual_hdd’,在这里,所有这些文件系统将被组成组。 - - - # mkdir /mnt/virtual_hdd - -3.然后,挂载所有文件系统。你可以通过root或者FUSE组中的某个成员来完成。 - - - # mhddfs /boot/efi, /, /media/avi/BD9B-5FCE/, /media/avi/Debian\ 8.1.0\ M-A\ 1/ /mnt/virtual_hdd -o allow_other - -![Mount All File System in Linux](http://www.tecmint.com/wp-content/uploads/2015/08/Mount-All-File-System-in-Linux.png) -在Linux中挂载所有文件系统 - -**注意**:这里我们使用了所有硬盘的挂载点名称,很明显,你的挂载点名称会有所不同。也请注意“-o allow_other”选项可以让这个虚拟文件系统让其它所有人可见,而不仅仅是创建它的人。 - -4.现在,运行“df -h”来看看所有文件系统。它应该包含了你刚才创建的那个。 - - - $ df -h - -![Verify Virtual File System Mount](http://www.tecmint.com/wp-content/uploads/2015/08/Verify-Virtual-File-System.png) -验证虚拟文件系统挂载 - -你可以像对已挂在的驱动器那样给虚拟文件系统部署所有的选项。 - -5.要在每次系统启动创建这个虚拟文件系统,你应该以root身份添加下面的这行代码(在你那里会有点不同,取决于你的挂载点)到/etc/fstab文件的末尾。 - - mhddfs# /boot/efi, /, /media/avi/BD9B-5FCE/, /media/avi/Debian\ 8.1.0\ M-A\ 1/ /mnt/virtual_hdd fuse defaults,allow_other 0 0 - -6.如果在任何时候你想要添加/移除一个新的驱动器到/从虚拟硬盘,你可以挂载一个新的驱动器,拷贝/mnt/vritual_hdd的内容,卸载卷,弹出你要移除的的驱动器并/或挂载你要包含的新驱动器。使用mhddfs命令挂载全部文件系统到Virtual_hdd下,这样就全部搞定了。 -#### 我怎么卸载Virtual_hdd? #### - -卸载virtual_hdd相当简单,就像下面这样 - - # umount /mnt/virtual_hdd - -![Unmount Virtual Filesystem](http://www.tecmint.com/wp-content/uploads/2015/08/Unmount-Virtual-Filesystem.png) -卸载虚拟文件系统 - -注意,是umount,而不是unmount,很多用户都输错了。 - -到现在为止全部结束了。我正在写另外一篇文章,你们一定喜欢读的。到那时,请保持连线到Tecmint。请在下面的评论中给我们提供有用的反馈吧。请为我们点赞并分享,帮助我们扩散。 - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/combine-partitions-into-one-in-linux-using-mhddfs/ - -作者:[Avishek Kumar][a] -译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/understanding-raid-setup-in-linux/ -[2]:http://www.tecmint.com/mount-filesystem-in-linux/ -[3]:http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/ diff --git a/translated/tech/20150901 How to Defragment Linux Systems.md b/translated/tech/20150901 How to Defragment Linux Systems.md deleted file mode 100644 index 49d16a8f18..0000000000 --- a/translated/tech/20150901 How to Defragment Linux Systems.md +++ /dev/null @@ -1,125 +0,0 @@ -如何在Linux中整理磁盘碎片 -================================================================================ -![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-featured.png) - -有一神话是linux的磁盘从来不需要整理碎片。在大多数情况下这是真的,大多数因为是使用的是优秀的日志系统(ext2、3、4等等)来处理文件系统。然而,在一些特殊情况下,碎片仍旧会产生。如果正巧发生在你身上,解决方法很简单。 - -### 什么是磁盘碎片 ### - -碎片发生在不同的小块中更新文件时,但是这些快没有形成连续完整的文件而是分布在磁盘的各个角落中。这对于FAT和FAT32文件系统而言是这样的。这在NTFS中有所减轻,在Linux(extX)中几乎不会发生。下面是原因。 - -在像FAT和FAT32这类文件系统中,文件紧挨着写入到磁盘中。文件之间没有空间来用于增长或者更新: - -![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-fragmented.png) - -NTFS中在文件之间保留了一些空间,因此有空间进行增长。因为块之间的空间是有限的,碎片也会随着时间出现。 - -![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-ntfs.png) - -Linux的日志文件系统采用了一个不同的方案。与文件之间挨着不同,每个文件分布在磁盘的各处,每个文件之间留下了大量的剩余空间。这里有很大的空间用于更新和增长,并且碎片很少会发生。 - -![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-journal.png) - -此外,碎片一旦出现了,大多数Linux文件系统会尝试将文件和块重新连续起来。 - -### Linux中的磁盘整理 ### - -除非你用的是一个很小的硬盘或者空间不够了,不然Linux很少会需要磁盘整理。一些可能需要磁盘整理的情况包括: - -- 如果你编辑的是大型视频文件或者原生照片,但磁盘空间有限 -- if you use older hardware like an old laptop, and you have a small hard drive -- 如果你的磁盘开始满了(大约使用了85%) -- 如果你的家目录中有许多小分区 - -最好的解决方案是购买一个大硬盘。如果不可能,磁盘碎片整理就很有用了。 - -### 如何检查碎片 ### - -`fsck`命令会为你做这个 -也就是说如果你可以在liveCD中运行它,那么就可以**卸载所有的分区**。 - -这一点很重要:**在已经挂载的分区中运行fsck将会严重危害到你的数据和磁盘**。 - -你已经被警告过了。开始之前,先做一个完整的备份。 - -**免责声明**: 本文的作者与Make Tech Easier将不会对您的文件、数据、系统或者其他损害负责。你需要自己承担风险。如果你继续,你需要接收并了解这点。 - -你应该启动到一个live会话中(如安装磁盘,系统救援CD等)并运行`fsck`卸载分区。要检查是否有任何问题,请在运行root权限下面的命令: - - fsck -fn [/path/to/your/partition] - -您可以检查一下运行中的分区的路径 - - sudo fdisk -l - -有一个(相对)安全地在已挂载的分区中运行`fsck`的方法是使用‘-n’开关。这会让分区处在只读模式而不能创建任何文件。当然,这里并不能保证安全,你应该在创建备份之后进行。在ext2中,运行 - - sudo fsck.ext2 -fn /path/to/your/partition - -会产生大量的输出-- 大多数错误信息的原因是分区已经挂载了。最后会给出一个碎片相关的信息。 - -![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-fsck.png) - -如果碎片大于20%了,那么你应该开始整理你的磁盘碎片了。 - -### 如何简单地在Linux中整理碎片 ### - -你要做的是备份你**所有**的文件和数据到另外一块硬盘中(手动**复制**他们)。格式化分区然后重新复制回去(不要使用备份软件)。日志系统会把它们作为新的文件,并将它们整齐地放置到磁盘中而不产生碎片。 - -要备份你的文件,运行 - - cp -afv [/path/to/source/partition]/* [/path/to/destination/folder] - -记住星号(*)是很重要的。 - -注意:通常认为复制大文件或者大量文件,使用dd或许是最好的。这是一个非常底层的操作,它会复制一切,包含空闲的空间甚至是留下的垃圾。这不是我们想要的,因此这里最好使用`cp`。 - -现在你只需要删除源文件。 - - sudo rm -rf [/path/to/source/partition]/* - -**可选**:你可以将空闲空间置零。你也可以用格式化来达到这点,但是例子中你并没有复制整个分区而仅仅是大文件(这很可能会造成碎片)。这恐怕不能成为一个选项。 - - sudo dd if=/dev/zero of=[/path/to/source/partition]/temp-zero.txt - -等待它结束。你可以用`pv`来监测进程。 - - sudo apt-get install pv - sudo pv -tpreb | of=[/path/to/source/partition]/temp-zero.txt - -![](https://www.maketecheasier.com/assets/uploads/2015/07/defragment-linux-dd.png) - -这就完成了,只要删除临时文件就行。 - - sudo rm [/path/to/source/partition]/temp-zero.txt - -待你清零了空闲空间(或者跳过了这步)。重新复制回文件,将第一个cp命令翻转一下: - - cp -afv [/path/to/original/destination/folder]/* [/path/to/original/source/partition] - -### 使用 e4defrag ### - -如果你想要简单的方法,安装`e2fsprogs`, - - sudo apt-get install e2fsprogs - -用root权限在分区中运行 `e4defrag`。如果你不想卸载分区,你可以使用它的挂载点而不是路径。要整理整个系统的碎片,运行: - - sudo e4defrag / - -在挂载的情况下不保证成功(你也应该保证在它运行时停止使用你的系统),但是它比服务全部文件再重新复制回来简单多了。 - -### 总结 ### - -linux系统中很少会出现碎片因为它的文件系统有效的数据处理。如果你因任何原因产生了碎片,简单的方法是重新分配你的磁盘如复制所有文件并复制回来,或者使用`e4defrag`。然而重要的是保证你数据的安全,因此在进行任何可能影响你全部或者大多数文件的操作之前,确保你的文件已经被备份到了另外一个安全的地方去了。 - --------------------------------------------------------------------------------- - -via: https://www.maketecheasier.com/defragment-linux/ - -作者:[Attila Orosz][a] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.maketecheasier.com/author/attilaorosz/ diff --git a/translated/tech/20151202 A new Mindcraft moment.md b/translated/tech/20151202 A new Mindcraft moment.md new file mode 100644 index 0000000000..808124dec2 --- /dev/null +++ b/translated/tech/20151202 A new Mindcraft moment.md @@ -0,0 +1,43 @@ +又一次 Mindcraft 事件? +======================= + +感谢:Jonathan Corbet + +Linux 内核开发很少吸引像华盛顿邮报这样主流媒体的关注,内核社区在安全方面进展的冗长功能列表就更少人看了。所以当这样一个功能发布到网上,就吸引了很多人的注意。关于这篇文章有不同的反应,很多人认为这是对 Linux 直接的攻击。文章背后的动机很难知道,但是从历史经验来看,它也可以看作对我们早就该前进的方向的一次非常必要的推动。 + +回顾一次在昏暗遥远过去的事件 - 确切地说是 1999 年 4 月。一家叫 Mindcraft 的分析公司发布了一份报告显示 Windows NT 在服务器开销方面完胜 Red Hat Linux 5.2 加 Apache。Linux 社区,包括当时还很年轻的 LWN,的反应很迅速而且强烈。这份报告是微软资助的 FUD 的一部分,用来消除那些全球垄断计划的新兴威胁。报告指出,Linux 系统有意配置成低性能,Linux 不支持当时的很多硬件,等等。 + +在大家稍微冷静一点后,尽管如此,事实很明显:Mindcraft 的人,不管什么动机,说的也有道理。当时 Linux 确实在性能方面存在一些已经被充分认识到的问题。然后社区做了最正确的事情:我们坐下来解决问题。比如,单独唤醒的调度器可以终结接受连接请求时的惊群问题。其他很多小问题也都解决了。在差不多一年里,内核在这类开销方面的性能已经有了非常大的改善。 + +这份 Mindcraft 的报告,某种意义上来说,往 Linux 背后踢了很有必要的一脚,推动整个社区去处理一些当时被忽略的事情。 + +华盛顿邮报的文章明显在鄙视 Linux 内核以及它的贡献者。它随意地混淆了内核问题和其他根本不是内核脆弱性引起的问题(比如,AshleyMadison.com 被黑)。不过供应商没什么兴趣为他们的客户提供安全补丁的事实,就像一头巨象在房间里跳舞一样明显。还有谣言说这篇文章后面的黑暗势力希望打击一下 Linux 的势头。这些也许都是真的,但是也不能掩盖一个简单的事实,就是文章说的确实是真的。 + +我们会合理地测试并解决问题。而问题,不管是不是安全相关,能很快得到修复,然后再通过稳定更新的机制将这些补丁发布给内核用户。比起外面很多应用程序(免费的和付费的),内核的支持非常好。但是指责我们解决问题的能力时却遗漏了关键的一点:解决安全问题最终是一个打鼹鼠游戏。总是会出来更多的鼹鼠,其中有一些在攻击者发现并利用后很长时间我们都还不知道(所以没法使劲打下去)。尽管商业 Linux 已经非常努力地在将补丁传递给用户,这种问题还是会让我们的用户很受伤 - 只是这并不是故意的。 + +关键是只是解决问题并不够,一些关心安全性的开发者也已经开始尝试。我们必须认识到,问题永远都解不完,所以要让问题更难被发现和利用。意思就是限制访问内核信息,绝对不允许内核执行用户空间内存的指令,指示内核侦测整数溢出,以及 Kee Cook 在十月底内核峰会的讲话中所提出的其他所有事情。其中许多技术被其他操作系统深刻理解并采用了;它们的创新也有我们的功劳。但是,如果我们想充分保护我们的用户免受攻击,这些改变是必须要做的。 + +为什么内核还没有引入这些技术?华盛顿邮报的文章坚定地指责开发社区,特别是 Linus Torvalds。内核社区的传统就是相对安全性更侧重于性能和功能,在需要牺牲性能来改善内核安全性时并不愿意折中处理。这些指责一定程度上是对的;好的一面是,因为问题的范围变得清晰,态度看上去有点改善。Kee 的演讲都听进去了,而且很明显让开发者开始思考和讨论这些问题。 + +而被忽略的一点是,并不仅仅是 Linus 在拒绝有用的安全补丁。而是就没有多少这种补丁在内核社区里流传。特别是,在这个领域工作的开发者就那么些人,而且从没有认真地尝试把自己的工作合并到上游。要合并任何大的侵入性补丁,需要和内核社区一起工作,为改动编写用例,将改动分割成方便审核的碎片,处理审核意见,等等。整个过程可能会有点无聊而且让人沮丧,但这却是内核维护的运作方式,而且很明显只有这样才能在长时间的开发中形成更有用更可维护的内核。 + +几乎没有人会走这个流程来将最新的安全技术引入内核。对于这类补丁可能收到的不利反应,有人觉得也许会导致“寒蝉效应”,但是这个说法并不充分:不管最初的反应有多麻烦,多年以来开发者已经合并了大量的改动。而少数安全开发者连试都没试过。 + +他们为什么不愿意尝试?一个比较明显的答案是,几乎没有人会因此拿到报酬。几乎所有引入内核的工作都由付费开发者完成,而且已经持续多年。公司能看到利润的领域在内核里都有大量的工作以及很好的进展。而公司觉得和它们没关系的领域就不会这样了。为实时开发找到赞助支持的困难就是很明显的例子。其他领域,比如文档,也在慢慢萧条。安全性很明显也属于这类领域。可能有很多原因导致 Linux 落后于防御式安全技术,但是其中最关键的一条是,靠 Linux 赚钱的公司没有重视这些技术的开发和应用。 + +有迹象显示局面已有所转变。越来越多的开发人员开始关注安全相关问题,尽管对他们工作的商业支持还仍然不够。对于安全相关的改变已经没有之前那样的下意识反应了。像内核自我保护项目这样,已经开始把现存的安全技术集成进入内核了。 + +我们还有很长的路要走,但是,如果能有一些支持以及正确的思想,短期内能有很大的进展。内核社区在确定了自己的想法后可以做到很让人惊叹的事情。幸运的是,华盛顿邮报的文章将有助于提供形成这种想法的必要动力。在历史的角度上,我们很可能会把这次事件看作一个转折点,我们最终被倒逼着去完成之前很明确需要做的事情。Linux 不应该再继续讲述这个安全不合格的故事了。 + +--------------------------- + +via: https://lwn.net/Articles/663474/ + +作者:Jonathan Corbet + +译者:[zpl1025](https://github.com/zpl1025) + +校对:[校对者ID](https://github.com/校对者ID) + + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20151210 Getting started with Docker by Dockerizing this Blog.md.md b/translated/tech/20151210 Getting started with Docker by Dockerizing this Blog.md.md new file mode 100644 index 0000000000..a74af87b6f --- /dev/null +++ b/translated/tech/20151210 Getting started with Docker by Dockerizing this Blog.md.md @@ -0,0 +1,464 @@ +通过Dockerize这篇博客来开启我们的Docker之旅 +=== +>这篇文章将包含Docker的基本概念,以及如何通过创建一个定制的Dockerfile来Dockerize一个应用 +>作者:Benjamin Cane,2015-12-01 10:00:00 + +Docker是2年前从某个idea中孕育而生的有趣技术,世界各地的公司组织都积极使用它来部署应用。在今天的文章中,我将教你如何通过"Dockerize"一个现有的应用,来开始我们的Docker运用。问题中的应用指的就是这篇博客! + +## 什么是Docker? + +当我们开始学习Docker基本概念时,让我们先去搞清楚什么是Docker以及它为什么这么流行。Docker是一个操作系统容器管理工具,它通过将应用打包在操作系统容器中,来方便我们管理和部署应用。 + +### 容器 vs. 虚拟机 + +容器虽和虚拟机并不完全相似,但它也是一种提供**操作系统虚拟化**的方式。但是,它和标准的虚拟机还是有不同之处的。 + +标准虚拟机一般会包括一个完整的操作系统,操作系统包,最后还有一至两个应用。这都得益于为虚拟机提供硬件虚拟化的管理程序。这样一来,一个单一的服务器就可以将许多独立的操作系统作为虚拟客户机运行了。 + +容器和虚拟机很相似,它们都支持在单一的服务器上运行多个操作环境,只是,在容器中,这些环境并不是一个个完整的操作系统。容器一般只包含必要的操作系统包和一些应用。它们通常不会包含一个完整的操作系统或者硬件虚拟化程序。这也意味着容器比传统的虚拟机开销更少。 + +容器和虚拟机常被误认为是两种抵触的技术。虚拟机采用同一个物理服务器,来提供全功能的操作环境,该环境会和其余虚拟机一起共享这些物理资源。容器一般用来隔离运行中的应用进程,运行进程将在单独的主机中运行,以保证隔离后的进程之间不能相互影响。事实上,容器和**BSD Jails**以及`chroot`进程的相似度,超过了和完整虚拟机的相似度。 + +### Docker在容器的上层提供了什么 + +Docker不是一个容器运行环境,事实上,只是一个容器技术,并不包含那些帮助Docker支持[Solaris Zones](https://blog.docker.com/2015/08/docker-oracle-solaris-zones/)和[BSD Jails](https://wiki.freebsd.org/Docker)的技术。Docker提供管理,打包和部署容器的方式。虽然一定程度上,虚拟机多多少少拥有这些类似的功能,但虚拟机并没有完整拥有绝大多数的容器功能,即使拥有,这些功能用起来都并没有Docker来的方便。 + +现在,我们应该知道Docker是什么了,然后,我们将从安装Docker,并部署一个公共的预构建好的容器开始,学习Docker是如何工作的。 + +## 从安装开始 + +默认情况下,Docker并不会自动被安装在您的计算机中,所以,第一步就是安装Docker包;我们的教学机器系统是Ubuntu 14.0.4,所以,我们将使用Apt包管理器,来执行安装操作。 + +``` +# apt-get install docker.io +Reading package lists... Done +Building dependency tree +Reading state information... Done +The following extra packages will be installed: + aufs-tools cgroup-lite git git-man liberror-perl +Suggested packages: + btrfs-tools debootstrap lxc rinse git-daemon-run git-daemon-sysvinit git-doc + git-el git-email git-gui gitk gitweb git-arch git-bzr git-cvs git-mediawiki + git-svn +The following NEW packages will be installed: + aufs-tools cgroup-lite docker.io git git-man liberror-perl +0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded. +Need to get 7,553 kB of archives. +After this operation, 46.6 MB of additional disk space will be used. +Do you want to continue? [Y/n] y +``` + +为了检查当前是否有容器运行,我们可以执行`docker`命令,加上`ps`选项 + +``` +# docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +``` + +`docker`命令中的`ps`功能类似于Linux的`ps`命令。它将显示可找到的Docker容器以及各自的状态。由于我们并没有开启任何Docker容器,所以命令没有显示任何正在运行的容器。 + +## 部署一个预构建好的nginx Docker容器 + +我比较喜欢的Docker特性之一就是Docker部署预先构建好的容器的方式,就像`yum`和`apt-get`部署包一样。为了更好地解释,我们来部署一个运行着nginx web服务器的预构建容器。我们可以继续使用`docker`命令,这次选择`run`选项。 + +``` +# docker run -d nginx +Unable to find image 'nginx' locally +Pulling repository nginx +5c82215b03d1: Download complete +e2a4fb18da48: Download complete +58016a5acc80: Download complete +657abfa43d82: Download complete +dcb2fe003d16: Download complete +c79a417d7c6f: Download complete +abb90243122c: Download complete +d6137c9e2964: Download complete +85e566ddc7ef: Download complete +69f100eb42b5: Download complete +cd720b803060: Download complete +7cc81e9a118a: Download complete +``` + +`docker`命令的`run`选项,用来通知Docker去寻找一个指定的Docker镜像,然后开启运行着该镜像的容器。默认情况下,Docker容器在前台运行,这意味着当你运行`docker run`命令的时候,你的shell会被绑定到容器的控制台以及运行在容器中的进程。为了能在后台运行该Docker容器,我们可以使用`-d` (**detach**)标志。 + +再次运行`docker ps`命令,可以看到nginx容器正在运行。 + +``` +# docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +f6d31ab01fc9 nginx:latest nginx -g 'daemon off 4 seconds ago Up 3 seconds 443/tcp, 80/tcp desperate_lalande +``` + +从上面的打印信息中,我们可以看到正在运行的名为`desperate_lalande`的容器,它是由`nginx:latest image`(译者注:nginx最新版本的镜像)构建而来得。 + +### Docker镜像 + +镜像是Docker的核心特征之一,类似于虚拟机镜像。和虚拟机镜像一样,Docker镜像是一个被保存并打包的容器。当然,Docker不只是创建镜像,它还可以通过Docker仓库发布这些镜像,Docker仓库和包仓库的概念差不多,它让Docker能够模仿`yum`部署包的方式来部署镜像。为了更好地理解这是怎么工作的,我们来回顾`docker run`执行后的输出。 + +``` +# docker run -d nginx +Unable to find image 'nginx' locally +``` + +我们可以看到第一条信息是,Docker不能在本地找到名叫nginx的镜像。这是因为当我们执行`docker run`命令时,告诉Docker运行一个基于nginx镜像的容器。既然Docker要启动一个基于特定镜像的容器,那么Docker首先需要知道那个指定镜像。在检查远程仓库之前,Docker首先检查本地是否存在指定名称的本地镜像。 + +因为系统是崭新的,不存在nginx镜像,Docker将选择从Docker仓库下载之。 + +``` +Pulling repository nginx +5c82215b03d1: Download complete +e2a4fb18da48: Download complete +58016a5acc80: Download complete +657abfa43d82: Download complete +dcb2fe003d16: Download complete +c79a417d7c6f: Download complete +abb90243122c: Download complete +d6137c9e2964: Download complete +85e566ddc7ef: Download complete +69f100eb42b5: Download complete +cd720b803060: Download complete +7cc81e9a118a: Download complete +``` + +这就是第二部分打印信息显示给我们的内容。默认,Docker会使用[Docker Hub](https://hub.docker.com/)仓库,该仓库由Docker公司维护。 + +和Github一样,在Docker Hub创建公共仓库是免费的,私人仓库就需要缴纳费用了。当然,部署你自己的Docker仓库也是可以实现的,事实上只需要简单地运行`docker run registry`命令就行了。但在这篇文章中,我们的重点将不是讲解如何部署一个定制的注册服务。 + +### 关闭并移除容器 + +在我们继续构建定制容器之前,我们先清理Docker环境,我们将关闭先前的容器,并移除它。 + +我们利用`docker`命令和`run`选项运行一个容器,所以,为了停止该相同的容器,我们简单地在执行`docker`命令时,使用`kill`选项,并指定容器名。 + +``` +# docker kill desperate_lalande +desperate_lalande +``` + +当我们再次执行`docker ps`,就不再有容器运行了 + +``` +# docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +``` + +但是,此时,我们这是停止了容器;虽然它不再运行,但仍然存在。默认情况下,`docker ps`只会显示正在运行的容器,如果我们附加`-a` (all) 标识,它会显示所有运行和未运行的容器。 + +``` +# docker ps -a +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +f6d31ab01fc9 5c82215b03d1 nginx -g 'daemon off 4 weeks ago Exited (-1) About a minute ago desperate_lalande +``` + +为了能完整地移除容器,我们在用`docker`命令时,附加`rm`选项。 + +``` +# docker rm desperate_lalande +desperate_lalande +``` + +虽然容器被移除了;但是我们仍拥有可用的**nginx**镜像(译者注:镜像缓存)。如果我们重新运行`docker run -d nginx`,Docker就无需再次拉取nginx镜像,即可启动容器。这是因为我们本地系统中已经保存了一个副本。 + +为了列出系统中所有的本地镜像,我们运行`docker`命令,附加`images`选项。 + +``` +# docker images +REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE +nginx latest 9fab4090484a 5 days ago 132.8 MB +``` + +## 构建我们自己的镜像 + +截至目前,我们已经使用了一些基础的Docker命令来开启,停止和移除一个预构建好的普通镜像。为了"Dockerize"这篇博客,我们需要构建我们自己的镜像,也就是创建一个**Dockerfile**。 + +在大多数虚拟机环境中,如果你想创建一个机器镜像,首先,你需要建立一个新的虚拟机,安装操作系统,安装应用,最后将其转换为一个模板或者镜像。但在Docker中,所有这些步骤都可以通过Dockerfile实现全自动。Dockerfile是向Docker提供构建指令去构建定制镜像的方式。在这一章节,我们将编写能用来部署这篇博客的定制Dockerfile。 + +### 理解应用 + +我们开始构建Dockerfile之前,第一步要搞明白,我们需要哪些东西来部署这篇博客。 + +博客本质上是由静态站点生成器生成的静态HTML页面,这个静态站点是我编写的,名为**hamerkop**。这个生成器很简单,它所做的就是生成该博客站点。所有的博客源码都被我放在了一个公共的[Github仓库](https://github.com/madflojo/blog)。为了部署这篇博客,我们要先从Github仓库把博客内容拉取下来,然后安装**Python**和一些**Python**模块,最后执行`hamerkop`应用。我们还需要安装**nginx**,来运行生成后的内容。 + +截止目前,这些还是一个简单的Dockerfile,但它却给我们展示了相当多的[Dockerfile语法]((https://docs.docker.com/v1.8/reference/builder/))。我们需要克隆Github仓库,然后使用你最喜欢的编辑器编写Dockerfile;我选择`vi` + +``` +# git clone https://github.com/madflojo/blog.git +Cloning into 'blog'... +remote: Counting objects: 622, done. +remote: Total 622 (delta 0), reused 0 (delta 0), pack-reused 622 +Receiving objects: 100% (622/622), 14.80 MiB | 1.06 MiB/s, done. +Resolving deltas: 100% (242/242), done. +Checking connectivity... done. +# cd blog/ +# vi Dockerfile +``` + +### FROM - 继承一个Docker镜像 + +第一条Dockerfile指令是`FROM`指令。这将指定一个现存的镜像作为我们的基础镜像。这也从根本上给我们提供了继承其他Docker镜像的途径。在本例中,我们还是从刚刚我们使用的**nginx**开始,如果我们想重新开始,我们可以通过指定`ubuntu:latest`来使用**Ubuntu** Docker镜像。 + +``` +## Dockerfile that generates an instance of http://bencane.com + +FROM nginx:latest +MAINTAINER Benjamin Cane +``` + +除了`FROM`指令,我还使用了`MAINTAINER`,它用来显示Dockerfile的作者。 + +Docker支持使用`#`作为注释,我将经常使用该语法,来解释Dockerfile的部分内容。 + +### 运行一次测试构建 + +因为我们继承了**nginx** Docker镜像,我们现在的Dockerfile也就包括了用来构建**nginx**镜像的[Dockerfile](https://github.com/nginxinc/docker-nginx/blob/08eeb0e3f0a5ee40cbc2bc01f0004c2aa5b78c15/Dockerfile)中所有指令。这意味着,此时我们可以从该Dockerfile中构建出一个Docker镜像,然后从该镜像中运行一个容器。虽然,最终的镜像和**nginx**镜像本质上是一样的,但是我们这次是通过构建Dockerfile的形式,然后我们将讲解Docker构建镜像的过程。 + +想要从Dockerfile构建镜像,我们只需要在运行`docker`命令的时候,加上**build**选项。 + +``` +# docker build -t blog /root/blog +Sending build context to Docker daemon 23.6 MB +Sending build context to Docker daemon +Step 0 : FROM nginx:latest + ---> 9fab4090484a +Step 1 : MAINTAINER Benjamin Cane + ---> Running in c97f36450343 + ---> 60a44f78d194 +Removing intermediate container c97f36450343 +Successfully built 60a44f78d194 +``` + +上面的例子,我们使用了`-t` (**tag**)标识给镜像添加"blog"的标签。本质上我们只是在给镜像命名,如果我们不指定标签,就只能通过Docker分配的**Image ID**来访问镜像了。本例中,从Docker构建成功的信息可以看出,**Image ID**值为`60a44f78d194`。 + +除了`-t`标识外,我还指定了目录`/root/blog`。该目录被称作"构建目录",它将包含Dockerfile,以及其他需要构建该容器的文件。 + +现在我们构建成功,下面我们开始定制该镜像。 + +### 使用RUN来执行apt-get + +用来生成HTML页面的静态站点生成器是用**Python**语言编写的,所以,在Dockerfile中需要做的第一件定制任务是安装Python。我们将使用Apt包管理器来安装Python包,这意味着在Dockerfile中我们要指定运行`apt-get update`和`apt-get install python-dev`;为了完成这一点,我们可以使用`RUN`指令。 + +``` +## Dockerfile that generates an instance of http://bencane.com + +FROM nginx:latest +MAINTAINER Benjamin Cane + +## Install python and pip +RUN apt-get update +RUN apt-get install -y python-dev python-pip +``` + +如上所示,我们只是简单地告知Docker构建镜像的时候,要去执行指定的`apt-get`命令。比较有趣的是,这些命令只会在该容器的上下文中执行。这意味着,即使容器中安装了`python-dev`和`python-pip`,但主机本身并没有安装这些。说的更简单点,`pip`命令将只在容器中执行,出了容器,`pip`命令不存在。 + +还有一点比较重要的是,Docker构建过程中不接受用户输入。这说明任何被`RUN`指令执行的命令必须在没有用户输入的时候完成。由于很多应用在安装的过程中需要用户的输入信息,所以这增加了一点难度。我们例子,`RUN`命令执行的命令都不需要用户输入。 + +### 安装Python模块 + +**Python**安装完毕后,我们现在需要安装Python模块。如果在Docker外做这些事,我们通常使用`pip`命令,然后参考博客Git仓库中名叫`requirements.txt`的文件。在之前的步骤中,我们已经使用`git`命令成功地将Github仓库"克隆"到了`/root/blog`目录;这个目录碰巧也是我们创建`Dockerfile`的目录。这很重要,因为这意味着Dokcer在构建过程中可以访问Git仓库中的内容。 + +当我们执行构建后,Docker将构建的上下文环境设置为指定的"构建目录"。这意味着目录中的所有文件都可以在构建过程中被使用,目录之外的文件(构建环境之外)是不能访问的。 + +为了能安装需要的Python模块,我们需要将`requirements.txt`从构建目录拷贝到容器中。我们可以在`Dockerfile`中使用`COPY`指令完成这一需求。 + +``` +## Dockerfile that generates an instance of http://bencane.com + +FROM nginx:latest +MAINTAINER Benjamin Cane + +## Install python and pip +RUN apt-get update +RUN apt-get install -y python-dev python-pip + +## Create a directory for required files +RUN mkdir -p /build/ + +## Add requirements file and run pip +COPY requirements.txt /build/ +RUN pip install -r /build/requirements.txt +``` + +在`Dockerfile`中,我们增加了3条指令。第一条指令使用`RUN`在容器中创建了`/build/`目录。该目录用来拷贝生成静态HTML页面需要的一切应用文件。第二条指令是`COPY`指令,它将`requirements.txt`从"构建目录"(`/root/blog`)拷贝到容器中的`/build/`目录。第三条使用`RUN`指令来执行`pip`命令;安装`requirements.txt`文件中指定的所有模块。 + +当构建定制镜像时,`COPY`是条重要的指令。如果在Dockerfile中不指定拷贝文件,Docker镜像将不会包含requirements.txt文件。在Docker容器中,所有东西都是隔离的,除非在Dockerfile中指定执行,否则容器中不会包括需要的依赖。 + +### 重新运行构建 + +现在,我们让Docker执行了一些定制任务,现在我们尝试另一次blog镜像的构建。 + +``` +# docker build -t blog /root/blog +Sending build context to Docker daemon 19.52 MB +Sending build context to Docker daemon +Step 0 : FROM nginx:latest + ---> 9fab4090484a +Step 1 : MAINTAINER Benjamin Cane + ---> Using cache + ---> 8e0f1899d1eb +Step 2 : RUN apt-get update + ---> Using cache + ---> 78b36ef1a1a2 +Step 3 : RUN apt-get install -y python-dev python-pip + ---> Using cache + ---> ef4f9382658a +Step 4 : RUN mkdir -p /build/ + ---> Running in bde05cf1e8fe + ---> f4b66e09fa61 +Removing intermediate container bde05cf1e8fe +Step 5 : COPY requirements.txt /build/ + ---> cef11c3fb97c +Removing intermediate container 9aa8ff43f4b0 +Step 6 : RUN pip install -r /build/requirements.txt + ---> Running in c50b15ddd8b1 +Downloading/unpacking jinja2 (from -r /build/requirements.txt (line 1)) +Downloading/unpacking PyYaml (from -r /build/requirements.txt (line 2)) + +Successfully installed jinja2 PyYaml mistune markdown MarkupSafe +Cleaning up... + ---> abab55c20962 +Removing intermediate container c50b15ddd8b1 +Successfully built abab55c20962 +``` + +上述输出所示,我们可以看到构建成功了,我们还可以看到另外一个有趣的信息` ---> Using cache`。这条信息告诉我们,Docker在构建该镜像时使用了它的构建缓存。 + +### Docker构建缓存 + +当Docker构建镜像时,它不仅仅构建一个单独的镜像;事实上,在构建过程中,它会构建许多镜像。从上面的输出信息可以看出,在每一"步"执行后,Docker都在创建新的镜像。 + +``` + Step 5 : COPY requirements.txt /build/ + ---> cef11c3fb97c +``` + +上面片段的最后一行可以看出,Docker在告诉我们它在创建一个新镜像,因为它打印了**Image ID**;`cef11c3fb97c`。这种方式有用之处在于,Docker能在随后构建**blog**镜像时将这些镜像作为缓存使用。这很有用处,因为这样,Docker就能加速同一个容器中新构建任务的构建流程。从上面的例子中,我们可以看出,Docker没有重新安装`python-dev`和`python-pip`包,Docker则使用了缓存镜像。但是由于Docker并没有找到执行`mkdir`命令的构建缓存,随后的步骤就被一一执行了。 + +Docker构建缓存一定程度上是福音,但有时也是噩梦。这是因为使用缓存或者重新运行指令的决定在一个很狭窄的范围内执行。比如,如果`requirements.txt`文件发生了修改,Docker会在构建时检测到该变化,然后Docker会重新执行该执行那个点往后的所有指令。这得益于Docker能查看`requirements.txt`的文件内容。但是,`apt-get`命令的执行就是另一回事了。如果提供Python包的**Apt** 仓库包含了一个更新的python-pip包;Docker不会检测到这个变化,转而去使用构建缓存。这会导致之前旧版本的包将被安装。虽然对`python-pip`来说,这不是主要的问题,但对使用了某个致命攻击缺陷的包缓存来说,这是个大问题。 + +出于这个原因,抛弃Docker缓存,定期地重新构建镜像是有好处的。这时,当我们执行Docker构建时,我简单地指定`--no-cache=True`即可。 + +## 部署博客的剩余部分 + +Python包和模块安装后,接下来我们将拷贝需要用到的应用文件,然后运行`hamerkop`应用。我们只需要使用更多的`COPY` and `RUN`指令就可完成。 + +``` +## Dockerfile that generates an instance of http://bencane.com + +FROM nginx:latest +MAINTAINER Benjamin Cane + +## Install python and pip +RUN apt-get update +RUN apt-get install -y python-dev python-pip + +## Create a directory for required files +RUN mkdir -p /build/ + +## Add requirements file and run pip +COPY requirements.txt /build/ +RUN pip install -r /build/requirements.txt + +## Add blog code nd required files +COPY static /build/static +COPY templates /build/templates +COPY hamerkop /build/ +COPY config.yml /build/ +COPY articles /build/articles + +## Run Generator +RUN /build/hamerkop -c /build/config.yml +``` + +现在我们已经写出了剩余的构建指令,我们再次运行另一次构建,并确保镜像构建成功。 + +``` +# docker build -t blog /root/blog/ +Sending build context to Docker daemon 19.52 MB +Sending build context to Docker daemon +Step 0 : FROM nginx:latest + ---> 9fab4090484a +Step 1 : MAINTAINER Benjamin Cane + ---> Using cache + ---> 8e0f1899d1eb +Step 2 : RUN apt-get update + ---> Using cache + ---> 78b36ef1a1a2 +Step 3 : RUN apt-get install -y python-dev python-pip + ---> Using cache + ---> ef4f9382658a +Step 4 : RUN mkdir -p /build/ + ---> Using cache + ---> f4b66e09fa61 +Step 5 : COPY requirements.txt /build/ + ---> Using cache + ---> cef11c3fb97c +Step 6 : RUN pip install -r /build/requirements.txt + ---> Using cache + ---> abab55c20962 +Step 7 : COPY static /build/static + ---> 15cb91531038 +Removing intermediate container d478b42b7906 +Step 8 : COPY templates /build/templates + ---> ecded5d1a52e +Removing intermediate container ac2390607e9f +Step 9 : COPY hamerkop /build/ + ---> 59efd1ca1771 +Removing intermediate container b5fbf7e817b7 +Step 10 : COPY config.yml /build/ + ---> bfa3db6c05b7 +Removing intermediate container 1aebef300933 +Step 11 : COPY articles /build/articles + ---> 6b61cc9dde27 +Removing intermediate container be78d0eb1213 +Step 12 : RUN /build/hamerkop -c /build/config.yml + ---> Running in fbc0b5e574c5 +Successfully created file /usr/share/nginx/html//2011/06/25/checking-the-number-of-lwp-threads-in-linux +Successfully created file /usr/share/nginx/html//2011/06/checking-the-number-of-lwp-threads-in-linux + +Successfully created file /usr/share/nginx/html//archive.html +Successfully created file /usr/share/nginx/html//sitemap.xml + ---> 3b25263113e1 +Removing intermediate container fbc0b5e574c5 +Successfully built 3b25263113e1 +``` + +### 运行定制的容器 + +成功的一次构建后,我们现在就可以通过运行`docker`命令和`run`选项来运行我们定制的容器,和之前我们启动nginx容器一样。 + +``` +# docker run -d -p 80:80 --name=blog blog +5f6c7a2217dcdc0da8af05225c4d1294e3e6bb28a41ea898a1c63fb821989ba1 +``` + +我们这次又使用了`-d` (**detach**)标识来让Docker在后台运行。但是,我们也可以看到两个新标识。第一个新标识是`--name`,这用来给容器指定一个用户名称。之前的例子,我们没有指定名称,因为Docker随机帮我们生成了一个。第二个新标识是`-p`,这个标识允许用户从主机映射一个端口到容器中的一个端口。 + +之前我们使用的基础**nginx**镜像分配了80端口给HTTP服务。默认情况下,容器内的端口通道并没有绑定到主机系统。为了让外部系统能访问容器内部端口,我们必须使用`-p`标识将主机端口映射到容器内部端口。上面的命令,我们通过`-p 8080:80`语法将主机80端口映射到容器内部的80端口。 + +经过上面的命令,我们的容器似乎成功启动了,我们可以通过执行`docker ps`核实。 + +``` +# docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +d264c7ef92bd blog:latest nginx -g 'daemon off 3 seconds ago Up 3 seconds 443/tcp, 0.0.0.0:80->80/tcp blog +``` + +## 总结 + +截止目前,我们拥有了正在运行的定制Docker容器。虽然在这篇文章中,我们只接触了一些Dockerfile指令用法,但是我们还是要讨论所有的指令。我们可以检查[Docker's reference page](https://docs.docker.com/v1.8/reference/builder/)来获取所有的Dockerfile指令用法,那里对指令的用法说明得很详细。 + +另一个比较好的资源是[Dockerfile Best Practices page](https://docs.docker.com/engine/articles/dockerfile_best-practices/),它有许多构建定制Dockerfile的最佳练习。有些技巧非常有用,比如战略性地组织好Dockerfile中的命令。上面的例子中,我们将`articles`目录的`COPY`指令作为Dockerfile中最后的`COPY`指令。这是因为`articles`目录会经常变动。所以,将那些经常变化的指令尽可能地放在最后面的位置,来最优化那些可以被缓存的步骤。 + +通过这篇文章,我们涉及了如何运行一个预构建的容器,以及如何构建,然后部署定制容器。虽然关于Docker你还有许多需要继续学习的地方,但我想这篇文章给了你如何继续开始的好建议。当然,如果你认为还有一些需要继续补充的内容,在下面评论即可。 + +-------------------------------------- +via:http://bencane.com/2015/12/01/getting-started-with-docker-by-dockerizing-this-blog/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+bencane%2FSAUo+%28Benjamin+Cane%29 + +作者:Benjamin Cane + +译者:[su-kaiyao](https://github.com/su-kaiyao) + +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + diff --git a/translated/tech/20151215 Linux or Unix Desktop Fun--Text Mode ASCII-art Box and Comment Drawing.md b/translated/tech/20151215 Linux or Unix Desktop Fun--Text Mode ASCII-art Box and Comment Drawing.md new file mode 100644 index 0000000000..ce9c76f324 --- /dev/null +++ b/translated/tech/20151215 Linux or Unix Desktop Fun--Text Mode ASCII-art Box and Comment Drawing.md @@ -0,0 +1,206 @@ + +Linux / Unix 桌面娱乐 : +文字模式的带有ASCII艺术的Box与评论绘制 + +================================================================================ +Boxes 命令不仅是一个文本过滤器,同时是一个很少人知道的可以为了乐趣或者需要在它的输入文本或者代码周围画各种ASCII艺术画的工具。你可以迅速创建邮件签名,或者使用各种编程语言创建局部评论。这个命令计划被vim文本编辑器使用,但是也可以被支持过滤的文本编辑器使用,同时从命令行作为一个单独的工具使用。 + + +### 任务: 安装 boxes ### + +使用 [apt-get command][1] 在 Debian / Ubuntu Linux中安装 boxes : + + $ sudo apt-get install boxes + +输出示例 : + + Reading package lists... Done + Building dependency tree + Reading state information... Done + The following NEW packages will be installed: + boxes + 0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded. + Need to get 0 B/59.8 kB of archives. + After this operation, 205 kB of additional disk space will be used. + Selecting previously deselected package boxes. + (Reading database ... 224284 files and directories currently installed.) + Unpacking boxes (from .../boxes_1.0.1a-2.3_amd64.deb) ... + Processing triggers for man-db ... + Setting up boxes (1.0.1a-2.3) ... + +RHEL / CentOS / Fedora Linux 用户, 使用 [yum command to install boxes][2] (首先 [enable EPEL repo as described here][3]): + + # yum install boxes + +输出示例 : + + Loaded plugins: rhnplugin + Setting up Install Process + Resolving Dependencies + There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them. + --> Running transaction check + ---> Package boxes.x86_64 0:1.1-8.el6 will be installed + --> Finished Dependency Resolution + Dependencies Resolved + ========================================================================== + Package Arch Version Repository Size + ========================================================================== + Installing: + boxes x86_64 1.1-8.el6 epel 64 k + Transaction Summary + ========================================================================== + Install 1 Package(s) + Total download size: 64 k + Installed size: 151 k + Is this ok [y/N]: y + Downloading Packages: + boxes-1.1-8.el6.x86_64.rpm | 64 kB 00:00 + Running rpm_check_debug + Running Transaction Test + Transaction Test Succeeded + Running Transaction + Installing : boxes-1.1-8.el6.x86_64 1/1 + Installed: + boxes.x86_64 0:1.1-8.el6 + Complete! + +FreeBSD 用户可以按如下来使用 : + + cd /usr/ports/misc/boxes/ && make install clean + +或者,使用 pkg_add 命令来增加包: + + # pkg_add -r boxes + +### 在一些给定文本周围画出任何种类的box ### + +输入下列命令 : + + echo "This is a test" | boxes + +或者,通过设置要使用的设计的名字来使用 : + + echo -e "\n\tVivek Gite\n\tvivek@nixcraft.com\n\twww.cyberciti.biz" | boxes -d dog + +输出示例 : + +![Unix / Linux: Boxes Command To Draw Various Designs](http://s0.cyberciti.org/uploads/l/tips/2012/06/unix-linux-boxes-draw-dog-design.png) + +Fig.01: Unix / Linux: Boxes 命令来画出各式各样的设计 + +#### 怎么样输出所有的设计 #### + +语法如下: + + boxes option + pipe | boxes options + echo "text" | boxes -d foo + boxes -l + +设计 -d 选项设置要使用的设计的名字 . 语法如下: + + + echo "Text" | boxes -d design + pipe | boxes -d desig + +-l 选项列出所有设计 . 它显示在配置文件中的所有的box设计图,同时也显示关于其创作者的信息。 + + + boxes -l + boxes -l | more + boxes -l | less + +输出示例: + + 43 Available Styles in "/etc/boxes/boxes-config": + ------------------------------------------------- + ada-box (Neil Bird ): + --------------- + -- -- + -- -- + --------------- + ada-cmt (Neil Bird ): + -- + -- regular Ada + -- comments + -- + boy (Joan G. Stark ): + .-"""-. + / .===. \ + \/ 6 6 \/ + ( \___/ ) + _________ooo__\_____/______________ + / \ + | joan stark spunk1111@juno.com | + | VISIT MY ASCII ART GALLERY: | + | http://www.geocities.com/SoHo/7373/ | + \_______________________ooo_________/ jgs + | | | + |_ | _| + | | | + |__|__| + /-'Y'-\ + (__/ \__) + .... + ... + output truncated + .. + +### 在使用vi/vim文本编辑器时如何通过boxes过滤文本? ### + +你可以使用vi或vim支持的任何附加命令,在这个例子中, [insert current date and time][4], 输入: + + !!date + +或者 + + :r !date +你需要在vim中输入以上命令来读取数据命令的输出,这将在当前行后面加入日期和时分秒: + + Tue Jun 12 00:05:38 IST 2012 + +你可以用boxes命令做到同样的. 创建一个作为样本的shell脚本或者如下的一个c程序: + + + #!/bin/bash + Purpose: Backup mysql database to remote server. + Author: Vivek Gite + Last updated on: Tue Jun, 12 2012 + +现在输入如下 (将光标移到第二行,也就是以"Purpose: ..."开头的行) + + 3!!boxes + +瞧,你就会看到如下的输出 : + + #!/bin/bash + /****************************************************/ + /* Purpose: Backup mysql database to remote server. */ + /* Author: Vivek Gite */ + /* Last updated on: Tue Jun, 12 2012 */ + /****************************************************/ +这个短片将会给你介绍boxes命令: + +注:youtube 视频 + + +(Video:01: boxes command in action. BTW, this is my first video so go easy on me and let me know what you think.) + +另见 + +- boxes man 手册 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/tips/unix-linux-draw-any-kind-of-boxes-around-text-editor.html + +作者:Vivek Gite +译者:[zky001](https://github.com/zky001) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html +[2]:http://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/ +[3]:http://www.cyberciti.biz/faq/fedora-sl-centos-redhat6-enable-epel-repo/ +[4]:http://www.cyberciti.biz/faq/vim-inserting-current-date-time-under-linux-unix-osx/ diff --git a/translated/tech/20151220 GCC-Inline-Assembly-HOWTO.md b/translated/tech/20151220 GCC-Inline-Assembly-HOWTO.md new file mode 100644 index 0000000000..e0e1fc6d50 --- /dev/null +++ b/translated/tech/20151220 GCC-Inline-Assembly-HOWTO.md @@ -0,0 +1,632 @@ +* * * + +# GCC 内联汇编 HOWTO + +v0.1, 01 March 2003. +* * * + +_本 HOWTO 文档将讲解 GCC 提供的内联汇编特性的用途和用法。对于阅读这篇文章,这里只有两个前提要求,很明显,就是 x86 汇编语言和 C 语言的基本认识。_ + +* * * + +## 1. 简介 + +## 1.1 版权许可 + +Copyright (C)2003 Sandeep S. + +本文档自由共享;你可以重新发布它,并且/或者在遵循自由软件基金会发布的 GNU 通用公共许可证下修改它;或者该许可证的版本 2 ,或者(按照你的需求)更晚的版本。 + +发布这篇文档是希望它能够帮助别人,但是没有任何保证;甚至不包括可售性和适用于任何特定目的的保证。关于更详细的信息,可以查看 GNU 通用许可证。 + +## 1.2 反馈校正 + +请将反馈和批评一起提交给 [Sandeep.S](mailto:busybox@sancharnet.in) 。我将感谢任何一个指出本文档中错误和不准确之处的人;一被告知,我会马上改正它们。 + +## 1.3 致谢 + +我对提供如此棒的特性的 GNU 人们表示真诚的感谢。感谢 Mr.Pramode C E 所做的所有帮助。感谢在 Govt Engineering College 和 Trichur 的朋友们的精神支持和合作,尤其是 Nisha Kurur 和 Sakeeb S 。 感谢在 Gvot Engineering College 和 Trichur 的老师们的合作。 + +另外,感谢 Phillip , Brennan Underwood 和 colin@nyx.net ;这里的许多东西都厚颜地直接取自他们的工作成果。 + +* * * + +## 2. 概览 + +在这里,我们将学习 GCC 内联汇编。这内联表示的是什么呢? + +我们可以要求编译器将一个函数的代码插入到调用者代码中函数被实际调用的地方。这样的函数就是内联函数。这听起来和宏差不多?这两者确实有相似之处。 + +内联函数的优点是什么呢? + +这种内联方法可以减少函数调用开销。同时如果所有实参的值为常量,它们的已知值可以在编译期允许简化,因此并非所有的内联函数代码都需要被包含。代码大小的影响是不可预测的,这取决于特定的情况。为了声明一个内联函数,我们必须在函数声明中使用 `inline` 关键字。 + +现在我们正处于一个猜测内联汇编到底是什么的点上。它只不过是一些写为内联函数的汇编程序。在系统编程上,它们方便、快速并且极其有用。我们主要集中学习(GCC)内联汇编函数的基本格式和用法。为了声明内联汇编函数,我们使用 `asm` 关键词。 + +内联汇编之所以重要,主要是因为它可以操作并且使其输出通过 C 变量显示出来。正是因为此能力, "asm" 可以用作汇编指令和包含它的 C 程序之间的接口。 + +* * * + +## 3. GCC 汇编语法 + +GCC , Linux上的 GNU C 编译器,使用 **AT&T** / **UNIX** 汇编语法。在这里,我们将使用 AT&T 语法 进行汇编编码。如果你对 AT&T 语法不熟悉的话,请不要紧张,我会教你的。AT&T 语法和 Intel 语法的差别很大。我会给出主要的区别。 + +1. 源操作数和目的操作数顺序 + + AT&T 语法的操作数方向和 Intel 语法的刚好相反。在Intel 语法中,第一操作数为目的操作数,第二操作数为源操作数,然而在 AT&T 语法中,第一操作数为源操作数,第二操作数为目的操作数。也就是说, + + Intel 语法中的 "Op-code dst src" 变为 + + AT&T 语法中的 "Op-code src dst"。 + +2. 寄存器命名 + + 寄存器名称有 % 前缀,即如果必须使用 eax,它应该用作 %eax。 + +3. 立即数 + + AT&T 立即数以 ’$’ 为前缀。静态 "C" 变量 也使用 ’$’ 前缀。在 Intel 语法中,十六进制常量以 ’h’ 为后缀,然而AT&T不使用这种语法,这里我们给常量添加前缀 ’0x’。所以,对于十六进制,我们首先看到一个 ’$’,然后是 ’0x’,最后才是常量。 + +4. 操作数大小 + + 在 AT&T 语法中,存储器操作数的大小取决于操作码名字的最后一个字符。操作码后缀 ’b’ 、’w’、’l’分别指明了字节(byte)(8位)、字(word)(16位)、长型(long)(32位)存储器引用。Intel 语法通过给存储器操作数添加’byte ptr’、 ’word ptr’ 和 ’dword ptr’前缀来实现这一功能。 + + 因此,Intel的 "mov al, byte ptr foo" 在 AT&T 语法中为 "movb foo, %al"。 + +5. 存储器操作数 + + 在 Intel 语法中,基址寄存器包含在 ’[’ 和 ’]’ 中,然而在 AT&T 中,它们变为 ’(’ 和 ’)’。另外,在 Intel 语法中, 间接内存引用为 + + section:[base + index*scale + disp], 在 AT&T中变为 + + section:disp(base, index, scale)。 + + 需要牢记的一点是,当一个常量用于 disp 或 scale,不能添加’$’前缀。 + +现在我们看到了 Intel 语法和 AT&T 语法之间的一些主要差别。我仅仅写了它们差别的一部分而已。关于更完整的信息,请参考 GNU 汇编文档。现在为了更好地理解,我们可以看一些示例。 + +> ` +> +>
+------------------------------+------------------------------------+
+> |       Intel Code             |      AT&T Code                     |
+> +------------------------------+------------------------------------+
+> | mov     eax,1                |  movl    $1,%eax                   |   
+> | mov     ebx,0ffh             |  movl    $0xff,%ebx                |   
+> | int     80h                  |  int     $0x80                     |   
+> | mov     ebx, eax             |  movl    %eax, %ebx                |
+> | mov     eax,[ecx]            |  movl    (%ecx),%eax               |
+> | mov     eax,[ebx+3]          |  movl    3(%ebx),%eax              | 
+> | mov     eax,[ebx+20h]        |  movl    0x20(%ebx),%eax           |
+> | add     eax,[ebx+ecx*2h]     |  addl    (%ebx,%ecx,0x2),%eax      |
+> | lea     eax,[ebx+ecx]        |  leal    (%ebx,%ecx),%eax          |
+> | sub     eax,[ebx+ecx*4h-20h] |  subl    -0x20(%ebx,%ecx,0x4),%eax |
+> +------------------------------+------------------------------------+
+> 
+> +> ` + +* * * + +## 4. 基本内联 + +基本内联汇编的格式非常直接了当。它的基本格式为 + +`asm("汇编代码");` + +示例 + +> ` +> +> * * * +> +>
asm("movl %ecx %eax"); /* 将 ecx 寄存器的内容移至 eax  */
+> __asm__("movb %bh (%eax)"); /* 将 bh 的一个字节数据 移至 eax 寄存器指向的内存 */
+> 
+> +> * * * +> +> ` + +你可能注意到了这里我使用了 `asm ` 和 `__asm__`。这两者都是有效的。如果关键词 `asm` 和我们程序的一些标识符冲突了,我们可以使用 `__asm__`。如果我们的指令多余一条,我们可以写成一行,并用括号括起,也可以为每条指令添加 ’\n’ 和 ’\t’ 后缀。这是因为gcc将每一条当作字符串发送给 **as**(GAS)( GAS 即 GNU 汇编器 ——译者注),并且通过使用换行符/制表符发送正确地格式化行给汇编器。 + +示例 + +> ` +> +> * * * +> +>
 __asm__ ("movl %eax, %ebx\n\t"
+>           "movl $56, %esi\n\t"
+>           "movl %ecx, $label(%edx,%ebx,$4)\n\t"
+>           "movb %ah, (%ebx)");
+> 
+> +> * * * +> +> ` + +如果在代码中,我们涉及到一些寄存器(即改变其内容),但在没有固定这些变化的情况下从汇编中返回,这将会导致一些不好的事情。这是因为 GCC 并不知道寄存器内容的变化,这会导致问题,特别是当编译器做了某些优化。在没有告知 GCC 的情况下,它将会假设一些寄存器存储了我们可能已经改变的变量的值,它会像什么事都没发生一样继续运行(什么事都没发生一样是指GCC不会假设寄存器装入的值是有效的,当退出改变了寄存器值的内联汇编后,寄存器的值不会保存到相应的变量或内存空间 ——译者注)。我们所可以做的是使用这些没有副作用的指令,或者当我们退出时固定这些寄存器,或者等待程序崩溃。这是为什么我们需要一些扩展功能。扩展汇编正好给我们提供了那样的功能。 + +* * * + +## 5. 扩展汇编 + +在基本内联汇编中,我们只有指令。然而在扩展汇编中,我们可以同时指定操作数。它允许我们指定输入寄存器、输出寄存器以及修饰寄存器列表。GCC 不强制用户必须指定使用的寄存器。我们可以把头疼的事留给 GCC ,这可能可以更好地适应 GCC 的优化。不管怎樣,基本格式为: + +> ` +> +> * * * +> +>
       asm ( 汇编程序模板 
+>            : 输出操作数					/* 可选的 */
+>            : 输入操作数                   /* 可选的 */
+>            : 修饰寄存器列表			    /* 可选的 */
+>            );
+> 
+> +> * * * +> +> ` + +汇编程序模板由汇编指令组成.每一个操作数由一个操作数约束字符串所描述,其后紧接一个括弧括起的 C 表达式。冒号用于将汇编程序模板和第一个输出操作数分开,另一个(冒号)用于将最后一个输出操作数和第一个输入操作数分开,如果存在的话。逗号用于分离每一个组内的操作数。总操作数的数目限制在10个,或者机器描述中的任何指令格式中的最大操作数数目,以较大者为准。 + +如果没有输出操作数但存在输入操作数,你必须将两个连续的冒号放置于输出操作数原本会放置的地方周围。 + +示例: + +> ` +> +> * * * +> +>
        asm ("cld\n\t"
+>              "rep\n\t"
+>              "stosl"
+>              : /* 无输出寄存器 */
+>              : "c" (count), "a" (fill_value), "D" (dest)
+>              : "%ecx", "%edi" 
+>              );
+> 
+> +> * * * +> +> ` + +现在,这段代码是干什么的?以上的内联汇编是将 `fill_value` 值 连续 `count` 次 拷贝到 寄存器 `edi` 所指位置(每执行stosl一次,寄存器 edi 的值会递增或递减,这取决于是否设置了 direction 标志,因此以上代码实则初始化一个内存块 ——译者注)。 它也告诉 gcc 寄存器 `ecx` 和 `edi` 一直无效(原文为 eax ,但代码修饰寄存器列表中为 ecx,因此这可能为作者的纰漏 ——译者注)。为了使扩展汇编更加清晰,让我们再看一个示例。 + +> ` +> +> * * * +> +>
        
+>         int a=10, b;
+>         asm ("movl %1, %%eax; 
+>               movl %%eax, %0;"
+>              :"=r"(b)        /* 输出 */
+>              :"r"(a)         /* 输入 */
+>              :"%eax"         /* 修饰寄存器 */
+>              );       
+> 
+> +> * * * +> +> ` + +这里我们所做的是使用汇编指令使 ’b’ 变量的值等于 ’a’ 变量的值。一些有意思的地方是: + +* "b" 为输出操作数,用 %0 引用,并且 "a" 为输入操作数,用 %1 引用。 +* "r" 为操作数约束。之后我们会更详细地了解约束(字符串)。目前,"r" 告诉 GCC 可以使用任一寄存器存储操作数。输出操作数约束应该有一个约束修饰符 "=" 。这修饰符表明它是一个只读的输出操作数。 +* 寄存器名字以两个%为前缀。这有利于 GCC 区分操作数和寄存器。操作数以一个 % 为前缀。 +* 第三个冒号之后的修饰寄存器 %eax 告诉 GCC %eax的值将会在 "asm" 内部被修改,所以 GCC 将不会使用此寄存器存储任何其他值。 + +当 "asm" 执行完毕, "b" 变量会映射到更新的值,因为它被指定为输出操作数。换句话说, "asm" 内 "b" 变量的修改 应该会被映射到 "asm" 外部。 + +现在,我们可以更详细地看看每一个域。 + +## 5.1 汇编程序模板 + +汇编程序模板包含了被插入到 C 程序的汇编指令集。其格式为:每条指令用双引号圈起,或者整个指令组用双引号圈起。同时每条指令应以分界符结尾。有效的分界符有换行符(\n)和逗号(;)。’\n’ 可以紧随一个制表符(\t)。我们应该都明白使用换行符或制表符的原因了吧?和 C 表达式对应的操作数使用 %0、%1 ... 等等表示。 + +## 5.2 操作数 + +C 表达式用作 "asm" 内的汇编指令操作数。作为第一双引号内的操作数约束,写下每一操作数。对于输出操作数,在引号内还有一个约束修饰符,其后紧随一个用于表示操作数的 C 表达式。即, + +"约束字符串"(C 表达式),它是一个通用格式。对于输出操作数,还有一个额外的修饰符。约束字符串主要用于决定操作数的寻找方式,同时也用于指定使用的寄存器。 + +如果我们使用的操作数多于一个,那么每一个操作数用逗号隔开。 + +在汇编程序模板,每个操作数用数字引用。编号方式如下。如果总共有 n 个操作数(包括输入和输出操作数),那么第一个输出操作数编号为 0 ,逐项递增,并且最后一个输入操作数编号为 n - 1 。操作数的最大数目为前一节我们所看到的那样。 + +输出操作数表达式必须为左值。输入操作数的要求不像这样严格。它们可以为表达式。扩展汇编特性常常用于编译器自己不知道其存在的机器指令 ;-)。如果输出表达式无法直接寻址(例如,它是一个位域),我们的约束字符串必须给定一个寄存器。在这种情况下,GCC 将会使用该寄存器作为汇编的输出,然后存储该寄存器的内容到输出。 + +正如前面所陈述的一样,普通的输出操作数必须为只写的; GCC 将会假设指令前的操作数值是死的,并且不需要被(提前)生成。扩展汇编也支持输入-输出或者读-写操作数。 + +所以现在我们来关注一些示例。我们想要求一个数的5次方结果。为了计算该值,我们使用 `lea` 指令。 + +> ` +> +> * * * +> +>
        asm ("leal (%1,%1,4), %0"
+>              : "=r" (five_times_x)
+>              : "r" (x) 
+>              );
+> 
+> +> * * * +> +> ` + +这里我们的输入为x。我们不指定使用的寄存器。 GCC 将会选择一些输入寄存器,一个输出寄存器,并且做我们期望的事。如果我们想要输入和输出存在于同一个寄存器里,我们可以要求 GCC 这样做。这里我们使用那些读-写操作数类型。这里我们通过指定合适的约束来实现它。 + +> ` +> +> * * * +> +>
        asm ("leal (%0,%0,4), %0"
+>              : "=r" (five_times_x)
+>              : "0" (x) 
+>              );
+> 
+> +> * * * +> +> ` + +现在输出和输出操作数位于同一个寄存器。但是我们无法得知是哪一个寄存器。现在假如我们也想要指定操作数所在的寄存器,这里有一种方法。 + +> ` +> +> * * * +> +>
        asm ("leal (%%ecx,%%ecx,4), %%ecx"
+>              : "=c" (x)
+>              : "c" (x) 
+>              );
+> 
+> +> * * * +> +> ` + +在以上三个示例中,我们并没有添加任何寄存器到修饰寄存器里,为什么?在头两个示例, GCC 决定了寄存器并且它知道发生了什么改变。在最后一个示例,我们不必将 'ecx' 添加到修饰寄存器列表(原文修饰寄存器列表拼写有错,这里已修正 ——译者注), gcc 知道它表示x。因此,因为它可以知道 `ecx` 的值,它就不被当作修饰的(寄存器)了。 + +## 5.3 修饰寄存器列表 + +一些指令会破坏一些硬件寄存器。我们不得不在修饰寄存器中列出这些寄存器,即汇编函数内第三个 ’**:**’ 之后的域。这可以通知 gcc 我们将会自己使用和修改这些寄存器。所以 gcc 将不会假设存入这些寄存器的值是有效的。我们不用在这个列表里列出输入输出寄存器。因为 gcc 知道 "asm" 使用了它们(因为它们被显式地指定为约束了)。如果指令隐式或显式地使用了任何其他寄存器,(并且寄存器不能出现在输出或者输出约束列表里),那么不得不在修饰寄存器列表中指定这些寄存器。 + +如果我们的指令可以修改状态寄存器,我们必须将 "cc" 添加进修饰寄存器列表。 + +如果我们的指令以不可预测的方式修改了内存,那么需要将 "memory" 添加进修饰寄存器列表。这可以使 GCC 不会在汇编指令间保持缓存于寄存器的内存值。如果被影响的内存不在汇编的输入或输出列表中,我们也必须添加 **volatile** 关键词。 + +我们可以按我们的需求多次读写修饰寄存器。考虑一个模板内的多指令示例;它假设子例程 _foo 接受寄存器 `eax` 和 `ecx` 里的参数。 + +> ` +> +> * * * +> +>
        asm ("movl %0,%%eax;
+>               movl %1,%%ecx;
+>               call _foo"
+>              : /* no outputs */
+>              : "g" (from), "g" (to)
+>              : "eax", "ecx"
+>              );
+> 
+> +> * * * +> +> ` + +## 5.4 Volatile ...? + +如果你熟悉内核源码或者其他像内核源码一样漂亮的代码,你一定见过许多声明为 `volatile` 或者 `__volatile__`的函数,其跟着一个 `asm` 或者 `__asm__`。我之前提过关键词 `asm` 和 `__asm__`。那么什么是 `volatile`呢? + +如果我们的汇编语句必须在我们放置它的地方执行(即,不能作为一种优化被移出循环语句),将关键词 `volatile` 放置在 asm 后面,()的前面。因为为了防止它被移动、删除或者其他操作,我们将其声明为 + +`asm volatile ( ... : ... : ... : ...);` + +当我们必须非常谨慎时,请使用 `__volatile__`。 + +如果我们的汇编只是用于一些计算并且没有任何副作用,不使用 `volatile` 关键词会更好。不使用 `volatile` 可以帮助 gcc 优化代码并使代码更漂亮。 + + +在 `Some Useful Recipes` 一节中,我提供了多个内联汇编函数的例子。这儿我们详细查看修饰寄存器列表。 + +* * * + +## 6. 更多关于约束 + +到这个时候,你可能已经了解到约束和内联汇编有很大的关联。但我们很少说到约束。约束用于表明一个操作数是否可以位于寄存器和位于哪个寄存器;是否操作数可以为一个内存引用和哪种地址;是否操作数可以为一个立即数和为哪一个可能的值(即值的范围)。它可以有...等等。 + +## 6.1 常用约束 + +在许多约束中,只有小部分是常用的。我们将看看这些约束。 + +1. **寄存器操作数约束(r)** + + 当使用这种约束指定操作数时,它们存储在通用寄存器(GPR)中。请看下面示例: + + `asm ("movl %%eax, %0\n" :"=r"(myval));` + + 这里,变量 myval 保存在寄存器中,寄存器 eax 的值被复制到该寄存器中,并且myval的值从寄存器更新到了内存。当指定 "r" 约束时, gcc 可以将变量保存在任何可用的 GPR 中。为了指定寄存器,你必须使用特定寄存器约束直接地指定寄存器的名字。它们为: + + > ` + > + >
+---+--------------------+
+    > | r |    Register(s)     |
+    > +---+--------------------+
+    > | a |   %eax, %ax, %al   |
+    > | b |   %ebx, %bx, %bl   |
+    > | c |   %ecx, %cx, %cl   |
+    > | d |   %edx, %dx, %dl   |
+    > | S |   %esi, %si        |
+    > | D |   %edi, %di        |
+    > +---+--------------------+
+    > 
+ > + > ` + +2. **内存操作数约束(m)** + + 当操作数位于内存时,任何对它们的操作将直接发生在内存位置,这与寄存器约束相反,后者首先将值存储在要修改的寄存器中,然后将它写回到内存位置。但寄存器约束通常用于一个指令必须使用它们或者它们可以大大提高进程速度的地方。当需要在 "asm" 内更新一个 C 变量,而又不想使用寄存器去保存它的只,使用内存最为有效。例如, idtr 的值存储于内存位置: + + `asm("sidt %0\n" : :"m"(loc));` + +3. **匹配(数字)约束** + + 在某些情况下,一个变量可能既充当输入操作数,也充当输出操作数。可以通过使用匹配约束在 "asm" 中指定这种情况。 + + `asm ("incl %0" :"=a"(var):"0"(var));` + + 在操作数子节中,我们也看到了一些类似的示例。在这个匹配约束的示例中,寄存器 "%eax" 既用作输入变量,也用作输出变量。 var 输入被读进 %eax ,并且更新的 %eax 再次被存储进 var。这里的 "0" 用于指定与第0个输出变量相同的约束。也就是,它指定 var 输出实例应只被存储在 "%eax" 中。该约束可用于: + + * 在输入从变量读取或变量修改后,修改被写回同一变量的情况 + * 在不需要将输入操作数实例和输出操作数实例分开的情况 + + 使用匹配约束最重要的意义在于它们可以导致有效地使用可用寄存器。 + +其他一些约束: + +1. "m" : 允许一个内存操作数使用机器普遍支持的任一种地址。 +2. "o" : 允许一个内存操作数,但只有当地址是可偏移的。即,该地址加上一个小的偏移量可以得到一个地址。 +3. "V" : A memory operand that is not offsettable. In other words, anything that would fit the `m’ constraint but not the `o’constraint. +4. "i" : 允许一个(带有常量)的立即整形操作数。这包括其值仅在汇编时期知道的符号常量。 +5. "n" : 允许一个带有已知数字的立即整形操作数。许多系统不支持汇编时期的常量,因为操作数少于一个字宽。对于此种操作数,约束应该使用 'n' 而不是'i'。 +6. "g" : 允许任一寄存器、内存或者立即整形操作数,不包括通用寄存器之外的寄存器。 + + +以下约束为x86特有。 + +1. "r" : 寄存器操作数约束,查看上面给定的表格。 +2. "q" : 寄存器 a、b、c 或者 d。 +3. "I" : 范围从 0 到 31 的常量(对于 32 位移位)。 +4. "J" : 范围从 0 到 63 的常量(对于 64 位移位)。 +5. "K" : 0xff。 +6. "L" : 0xffff。 +7. "M" : 0, 1, 2, or 3 (lea 指令的移位)。 +8. "N" : 范围从 0 到 255 的常量(对于 out 指令)。 +9. "f" : 浮点寄存器 +10. "t" : 第一个(栈顶)浮点寄存器 +11. "u" : 第二个浮点寄存器 +12. "A" : 指定 `a` 或 `d` 寄存器。这主要用于想要返回 64 位整形数,使用 `d` 寄存器保存最高有效位和 `a` 寄存器保存最低有效位。 + +## 6.2 约束修饰符 + +当使用约束时,对于更精确的控制超越了约束作用的需求,GCC 给我们提供了约束修饰符。最常用的约束修饰符为: + +1. "=" : 意味着对于这条指令,操作数为只写的;旧值会被忽略并被输出数据所替换。 +2. "&" : 意味着这个操作数为一个早期的改动操作数,其在该指令完成前通过使用输入操作数被修改了。因此,这个操作数不可以位于一个被用作输出操作数或任何内存地址部分的寄存器。如果在旧值被写入之前它仅用作输入而已,一个输入操作数可以为一个早期改动操作数。 + + 约束的列表和解释是决不完整的。示例可以给我们一个关于内联汇编的用途和用法的更好的理解。在下一节,我们会看到一些示例,在那里我们会发现更多关于修饰寄存器列表的东西。 + +* * * + +## 7. 一些实用的诀窍 + +现在我们已经介绍了关于 GCC 内联汇编的基础理论,现在我们将专注于一些简单的例子。将内联汇编函数写成宏的形式总是非常方便的。我们可以在内核代码里看到许多汇编函数。(usr/src/linux/include/asm/*.h)。 + +1. 首先我们从一个简单的例子入手。我们将写一个两个数相加的程序。 + + > ` + > + > * * * + > + >
int main(void)
+    > {
+    >         int foo = 10, bar = 15;
+    >         __asm__ __volatile__("addl  %%ebx,%%eax"
+    >                              :"=a"(foo)
+    >                              :"a"(foo), "b"(bar)
+    >                              );
+    >         printf("foo+bar=%d\n", foo);
+    >         return 0;
+    > }
+    > 
+ > + > * * * + > + > ` + + 这里我们要求 GCC 将 foo 存放于 %eax,将 bar 存放于 %ebx,同时我们也想要在 %eax 中存放结果。'=' 符号表示它是一个输出寄存器。现在我们可以以其他方式将一个整数加到一个变量。 + + > ` + > + > * * * + > + >
 __asm__ __volatile__(
+    >                       "   lock       ;\n"
+    >                       "   addl %1,%0 ;\n"
+    >                       : "=m"  (my_var)
+    >                       : "ir"  (my_int), "m" (my_var)
+    >                       :                                 /* 无修饰寄存器列表 */
+    >                       );
+    > 
+ > + > * * * + > + > ` + + 这是一个原子加法。为了移除原子性,我们可以移除指令 'lock'。在输出域中,"=m" 表明 my_var 是一个输出且位于内存。类似地,"ir" 表明 my_int 是一个整型,并应该存在于其他寄存器(回想我们上面看到的表格)。没有寄存器位于修饰寄存器列表中。 + +2. 现在我们将在一些寄存器/变量上展示一些操作,并比较值。 + + > ` + > + > * * * + > + >
 __asm__ __volatile__(  "decl %0; sete %1"
+    >                       : "=m" (my_var), "=q" (cond)
+    >                       : "m" (my_var) 
+    >                       : "memory"
+    >                       );
+    > 
+ > + > * * * + > + > ` + + 这里,my_var 的值减 1 ,并且如果结果的值为 0,则变量 cond 置 1。我们可以通过添加指令 "lock;\n\t" 作为汇编模板的第一条指令来添加原子性。 + + 以类似的方式,为了增加 my_var,我们可以使用 "incl %0" 而不是 "decl %0"。 + + 这里需要注意的点为(i)my_var 是一个存储于内存的变量。(ii)cond 位于任何一个寄存器 eax、ebx、ecx、edx。约束 "=q" 保证这一点。(iii)同时我们可以看到 memory 位于修饰寄存器列表中。也就是说,代码将改变内存中的内容。 + +3. 如何置1或清0寄存器中的一个比特位。作为下一个诀窍,我们将会看到它。 + + > ` + > + > * * * + > + >
__asm__ __volatile__(   "btsl %1,%0"
+    >                       : "=m" (ADDR)
+    >                       : "Ir" (pos)
+    >                       : "cc"
+    >                       );
+    > 
+ > + > * * * + > + > ` + + 这里,ADDR 变量(一个内存变量)的 'pos' 位置上的比特被设置为 1。我们可以使用 'btrl' 来清楚由 'btsl' 设置的比特位。pos 的约束 "Ir" 表明 pos 位于寄存器并且它的值为 0-31(x86 相关约束)。也就是说,我们可以设置/清除 ADDR 变量上第 0 到 31 位的任一比特位。因为条件码会被改变,所以我们将 "cc" 添加进修饰寄存器列表。 + +4. 现在我们看看一些更为复杂而有用的函数。字符串拷贝。 + + > ` + > + > * * * + > + >
static inline char * strcpy(char * dest,const char *src)
+    > {
+    > int d0, d1, d2;
+    > __asm__ __volatile__(  "1:\tlodsb\n\t"
+    >                        "stosb\n\t"
+    >                        "testb %%al,%%al\n\t"
+    >                        "jne 1b"
+    >                      : "=&S" (d0), "=&D" (d1), "=&a" (d2)
+    >                      : "0" (src),"1" (dest) 
+    >                      : "memory");
+    > return dest;
+    > }
+    > 
+ > + > * * * + > + > ` + + 源地址存放于 esi,目标地址存放于 edi,同时开始拷贝,当我们到达 **0** 时,拷贝完成。约束 "&S"、"&D"、"&a" 表明寄存器 esi、edi和 eax 早期的修饰寄存器,也就是说,它们的内容在函数完成前会被改变。这里很明显可以知道为什么 "memory" 会放在修饰寄存器列表。 + + 我们可以看到一个类似的函数,它能移动双字块数据。注意函数被声明为一个宏。 + + > ` + > + > * * * + > + >
#define mov_blk(src, dest, numwords) \
+    > __asm__ __volatile__ (                                          \
+    >                        "cld\n\t"                                \
+    >                        "rep\n\t"                                \
+    >                        "movsl"                                  \
+    >                        :                                        \
+    >                        : "S" (src), "D" (dest), "c" (numwords)  \
+    >                        : "%ecx", "%esi", "%edi"                 \
+    >                        )
+    > 
+ > + > * * * + > + > ` + + 这里我们没有输出,所以寄存器 ecx、esi和 edi 的内容发生改变,这是块移动的副作用。因此我们必须将它们添加进修饰寄存器列表。 + +5. 在 Linux 中,系统调用使用 GCC 内联汇编实现。让我们看看如何实现一个系统调用。所有的系统调用被写成宏(linux/unistd.h)。例如,带有三个参数的系统调用被定义为如下所示的宏。 + + > ` + > + > * * * + > + > type name(type1 arg1,type2 arg2,type3 arg3) \ + > { \ + > long __res; \ + > __asm__ volatile ( "int $0x80" \ + > : "=a" (__res) \ + > : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + > "d" ((long)(arg3))); \ + > __syscall_return(type,__res); \ + > } + > + > + > * * * + > + > ` + + 无论何时调用带有三个参数的系统调用,以上展示的宏用于执行调用。系统调用号位于 eax 中,每个参数位于 ebx、ecx、edx 中。最后 "int 0x80" 是一条用于执行系统调用的指令。返回值被存储于 eax 中。 + + 每个系统调用都以类似的方式实现。Exit 是一个单一参数的系统调用,让我们看看它的代码看起来会是怎样。它如下所示。 + + > ` + > + > * * * + > + >
{
+    >         asm("movl $1,%%eax;         /* SYS_exit is 1 */
+    >              xorl %%ebx,%%ebx;      /* Argument is in ebx, it is 0 */
+    >              int  $0x80"            /* Enter kernel mode */
+    >              );
+    > }
+    > 
+ > + > * * * + > + > ` + + Exit 的系统调用号是 1 同时它的参数是 0。因此我们分配 eax 包含 1,ebx 包含 0,同时通过 `int $0x80` 执行 `exit(0)`。这就是 exit 的工作原理。 + +* * * + +## 8. 结束语 + +这篇文档已经将 GCC 内联汇编过了一遍。一旦你理解了基本概念,你便不难采取自己的行动。我们看了许多例子,它们有助于理解 GCC 内联汇编的常用特性。 + +GCC 内联是一个极大的主题,这篇文章是不完整的。更多关于我们讨论过的语法细节可以在 GNU 汇编器的官方文档上获取。类似地,对于一个完整的约束列表,可以参考 GCC 的官方文档。 + +当然,Linux 内核 大规模地使用 GCC 内联。因此我们可以在内核源码中发现许多各种各样的例子。它们可以帮助我们很多。 + +如果你发现任何的错别字,或者本文中的信息已经过时,请告诉我们。 + +* * * + +## 9. 参考 + +1. [Brennan’s Guide to Inline Assembly](http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html) +2. [Using Assembly Language in Linux](http://linuxassembly.org/articles/linasm.html) +3. [Using as, The GNU Assembler](http://www.gnu.org/manual/gas-2.9.1/html_mono/as.html) +4. [Using and Porting the GNU Compiler Collection (GCC)](http://gcc.gnu.org/onlinedocs/gcc_toc.html) +5. [Linux Kernel Source](http://ftp.kernel.org/) + +* * * +via: http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html + + 作者:[Sandeep.S](mailto:busybox@sancharnet.in) 译者:[cposture](https://github.com/cposture) 校对:[]() + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20160214 How to Install MariaDB 10 on CentOS 7 CPanel Server.md b/translated/tech/20160214 How to Install MariaDB 10 on CentOS 7 CPanel Server.md new file mode 100644 index 0000000000..8d452af0ad --- /dev/null +++ b/translated/tech/20160214 How to Install MariaDB 10 on CentOS 7 CPanel Server.md @@ -0,0 +1,326 @@ + +在 CentOS 7 CPanel 服务器上安装 MariaDB 10 +================================================================================ + +MariaDB 是一个增强版的,开源的并且可以直接替代 MySQL。它主要由 MariaDB 社区在维护,采用 GPL v2 授权许可。软件的安全性是 MariaDB 开发者的主要焦点。他们保持为 MariaDB 的每个版本发布安全补丁。当有任何安全问题被发现时,开发者会尽快修复并推出 MariaDB 的新版本。 + +### MariaDB 的优势 ### + +- 完全开源 +- 快速且透明的安全版本 +- 与 MySQL 高度兼容 +- 性能更好 +- 比 MySQL 的存储引擎多 + +在这篇文章中,我将谈论关于如何升级 MySQL5.5 到最新的 MariaDB 在CentOS7 CPanel 服务器上。在安装前先完成以下步骤。 + +### 先决条件: ### + +#### 1. 停止当前 MySQL 服务 #### + + root@server1 [/var/# mysql + Welcome to the MySQL monitor. Commands end with ; or \g. + Your MySQL connection id is 5859 + Server version: 5.5.47-cll MySQL Community Server (GPL) + + Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + + Oracle is a registered trademark of Oracle Corporation and/or its + affiliates. Other names may be trademarks of their respective + owners. + + Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + + root@server1 [~]# systemctl stop mysql + root@server1 [~]# systemctl status mysql + ● mysql.service - LSB: start and stop MySQL + Loaded: loaded (/etc/rc.d/init.d/mysql) + Active: failed (Result: exit-code) since Sun 2016-01-31 10:00:02 UTC; 1min 31s ago + Docs: man:systemd-sysv-generator(8) + Main PID: 23430 (code=exited, status=203/EXEC) + + Jan 31 10:00:02 server1.centos7-test.com systemd[1]: Started MySQL Server. + Jan 31 10:00:02 server1.centos7-test.com systemd[1]: Starting MySQL Server... + Jan 31 10:00:02 server1.centos7-test.com systemd[1]: mysql.service: main process exited, code=exited, status=203/EXEC + Jan 31 10:00:02 server1.centos7-test.com systemd[1]: Unit mysql.service entered failed state. + Jan 31 10:00:02 server1.centos7-test.com systemd[1]: mysql.service failed. + +#### 2. 在升级之前将所有配置文件和数据库转移 #### + +转移数据库的存储路径和 MySQL 的配置文件 + + root@server1 [~]# cp -Rf /var/lib/mysql /var/lib/mysql-old + + root@server1 [/var/lib/mysql]# cat /etc/my.cnf + [mysqld] + default-storage-engine=MyISAM + innodb_file_per_table=1 + max_allowed_packet=268435456 + open_files_limit=10000 + + root@server1 [~]#mv /etc/my.cnf /etc/my.cnf-old + +#### 3. 从服务器上删除和卸载 MySQL 所有的 RPM 包 #### + +运行以下命令来禁用 MySQL 的 RPM 的目标。通过运行此命令,cPanel 将不再处理 MySQL 的更新,并在系统上将卸载的标记为 rpm.versions。 + + /scripts/update_local_rpm_versions --edit target_settings.MySQL50 uninstalled + /scripts/update_local_rpm_versions --edit target_settings.MySQL51 uninstalled + /scripts/update_local_rpm_versions --edit target_settings.MySQL55 uninstalled + /scripts/update_local_rpm_versions --edit target_settings.MySQL56 uninstalled + +现在运行以下命令: + +/scripts/check_cpanel_rpms --fix --targets=MySQL50,MySQL51,MySQL55,MySQL56 +移除服务器上所有已存在的 MySQL rpms 来为 MariaDB 的安装清理环境。请看下面的输出: + + root@server1 [/var/lib/mysql]# /scripts/check_cpanel_rpms --fix --targets=MySQL50,MySQL51,MySQL55,MySQL56 + [2016-01-31 09:53:59 +0000] + [2016-01-31 09:53:59 +0000] Problems were detected with cPanel-provided files which are RPM controlled. + [2016-01-31 09:53:59 +0000] If you did not make these changes intentionally, you can correct them by running: + [2016-01-31 09:53:59 +0000] + [2016-01-31 09:53:59 +0000] > /usr/local/cpanel/scripts/check_cpanel_rpms --fix + [2016-01-31 09:53:59 +0000] + [2016-01-31 09:53:59 +0000] The following RPMs are unneeded on your system and should be uninstalled: + [2016-01-31 09:53:59 +0000] MySQL55-client-5.5.47-1.cp1148 + [2016-01-31 09:53:59 +0000] MySQL55-devel-5.5.47-1.cp1148 + [2016-01-31 09:53:59 +0000] MySQL55-server-5.5.47-1.cp1148 + [2016-01-31 09:53:59 +0000] MySQL55-shared-5.5.47-1.cp1148 + [2016-01-31 09:53:59 +0000] MySQL55-test-5.5.47-1.cp1148 + [2016-01-31 09:53:59 +0000] compat-MySQL50-shared-5.0.96-4.cp1136 + [2016-01-31 09:53:59 +0000] compat-MySQL51-shared-5.1.73-1.cp1150 + [2016-01-31 09:53:59 +0000] Removing 0 broken rpms: + [2016-01-31 09:53:59 +0000] rpm: no packages given for erase + [2016-01-31 09:53:59 +0000] No new RPMS needed for install + [2016-01-31 09:53:59 +0000] Disabling service monitoring. + [2016-01-31 09:54:01 +0000] Uninstalling unneeded rpms: MySQL55-test MySQL55-server MySQL55-client compat-MySQL51-shared compat-MySQL50-shared MySQL55-shared MySQL55-devel + [2016-01-31 09:54:04 +0000] Removed symlink /etc/systemd/system/multi-user.target.wants/mysql.service. + [2016-01-31 09:54:04 +0000] Restoring service monitoring. + +通过这些步骤,我们已经卸载了现有的 MySQL RPMs,并做了标记来防止 MySQL的更新,服务器的环境已经清理然后准备安装 MariaDB。 + +开始安装吧,我们需要在 CentOS 为 MariaDB 创建一个 yum 软件库。下面是我的做法! + +### 安装步骤: ### + +#### 第1步:创建 YUM 软件库。#### + + root@server1 [~]# vim /etc/yum.repos.d/MariaDB.repo + [mariadb] + name = MariaDB + baseurl = http://yum.mariadb.org/10.0/centos7-amd64/ + gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB + gpgcheck=1 + root@server1 [/etc/yum.repos.d]# cat /etc/yum.repos.d/MariaDB.repo + [mariadb] + name = MariaDB + baseurl = http://yum.mariadb.org/10.0/centos7-amd64/ + gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB + gpgcheck=1 + +#### 第2步:打开 /etc/yum.conf 并修改如下行: #### + +**Remove this line** exclude=courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* mysql* nsd* php* proftpd* pure-ftpd* spamassassin* squirrelmail* + +**And replace with this line** exclude=courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* nsd* proftpd* pure-ftpd* spamassassin* squirrelmail* + +**\*\*\* IMPORTANT \*\*\*** + +需要确保我们已经从 exclude 列表中移除了 MySQL 和 PHP。 + +#### 第3步:运行以下命令来安装 MariaDB 和相关的包。 #### + +**yum install MariaDB-server MariaDB-client MariaDB-devel php-mysql** + + root@server1 [~]#yum install MariaDB-server MariaDB-client MariaDB-devel php-mysql + + Dependencies Resolved + + =============================================================================================================================================== + Package Arch Version Repository Size + =============================================================================================================================================== + Installing: + MariaDB-client x86_64 10.0.23-1.el7.centos mariadb 10 M + MariaDB-devel x86_64 10.0.23-1.el7.centos mariadb 6.3 M + MariaDB-server x86_64 10.0.23-1.el7.centos mariadb 55 M + php-mysql x86_64 5.4.16-36.el7_1 base 99 k + Installing for dependencies: + MariaDB-common x86_64 10.0.23-1.el7.centos mariadb 43 k + MariaDB-shared x86_64 10.0.23-1.el7.centos mariadb 1.2 M + libzip x86_64 0.10.1-8.el7 base 48 k + php-common x86_64 5.4.16-36.el7_1 base 563 k + php-pdo x86_64 5.4.16-36.el7_1 base 97 k + + Transaction Summary + =============================================================================================================================================== + Install 4 Packages (+5 Dependent package) + +#### 第4步:重新启动,并确保 MySQL 服务已启动。#### + + root@server1 [~]# systemctl start mysql + root@server1 [~]# + root@server1 [~]# + root@server1 [~]# systemctl status mysql + ● mysql.service - LSB: start and stop MySQL + Loaded: loaded (/etc/rc.d/init.d/mysql) + Active: active (exited) since Sun 2016-01-31 10:01:46 UTC; 3s ago + Docs: man:systemd-sysv-generator(8) + Process: 23717 ExecStart=/etc/rc.d/init.d/mysql start (code=exited, status=0/SUCCESS) + Main PID: 23430 (code=exited, status=203/EXEC) + + Jan 31 10:01:46 server1.centos7-test.com systemd[1]: Starting LSB: start and stop MySQL... + Jan 31 10:01:46 server1.centos7-test.com mysql[23717]: Starting MySQL SUCCESS! + Jan 31 10:01:46 server1.centos7-test.com systemd[1]: Started LSB: start and stop MySQL. + +#### 第5步:运行 mysql_upgrade 命令。 #### + +它将检查所有数据库中的所有表与当前安装的版本是否兼容并在必要时会更新系统表采取新的特权或功能,可能会增加当前版本的性能。 + + + root@server1 [~]# mysql_upgrade + MySQL upgrade detected + Phase 1/6: Checking and upgrading mysql database + Processing databases + mysql + mysql.columns_priv OK + mysql.db OK + mysql.event OK + mysql.func OK + mysql.help_category OK + mysql.help_keyword OK + mysql.help_relation OK + mysql.help_topic OK + mysql.host OK + mysql.ndb_binlog_index OK + mysql.plugin OK + mysql.proc OK + mysql.procs_priv OK + mysql.proxies_priv OK + mysql.servers OK + mysql.tables_priv OK + mysql.time_zone OK + mysql.time_zone_leap_second OK + mysql.time_zone_name OK + mysql.time_zone_transition OK + mysql.time_zone_transition_type OK + mysql.user OK + Phase 2/6: Fixing views from mysql + Phase 3/6: Running 'mysql_fix_privilege_tables' + Phase 4/6: Fixing table and database names + Phase 5/6: Checking and upgrading tables + Processing databases + cphulkd + cphulkd.auths OK + cphulkd.blacklist OK + cphulkd.brutes OK + cphulkd.good_logins OK + cphulkd.ip_lists OK + cphulkd.known_netblocks OK + cphulkd.login_track OK + cphulkd.logins OK + cphulkd.report OK + cphulkd.whitelist OK + eximstats + eximstats.defers OK + eximstats.failures OK + eximstats.sends OK + eximstats.smtp OK + information_schema + leechprotect + leechprotect.hits OK + modsec + modsec.hits OK + performance_schema + roundcube + roundcube.cache OK + roundcube.cache_index OK + roundcube.cache_messages OK + roundcube.cache_shared OK + roundcube.cache_thread OK + roundcube.contactgroupmembers OK + roundcube.contactgroups OK + roundcube.contacts OK + roundcube.cp_schema_version OK + roundcube.dictionary OK + roundcube.identities OK + roundcube.searches OK + roundcube.session OK + roundcube.system OK + roundcube.users OK + saheetha_test + saheetha_test.authors OK + whmxfer + whmxfer.sessions OK + Phase 6/6: Running 'FLUSH PRIVILEGES' + OK + +#### 第6步:再次重新启动MySQL的服务,以确保一切都运行完好。 #### + + root@server1 [~]# systemctl restart mysql + root@server1 [~]# + root@server1 [~]# systemctl status mysql + ● mysql.service - LSB: start and stop MySQL + Loaded: loaded (/etc/rc.d/init.d/mysql) + Active: active (running) since Sun 2016-01-31 10:04:11 UTC; 9s ago + Docs: man:systemd-sysv-generator(8) + Process: 23831 ExecStop=/etc/rc.d/init.d/mysql stop (code=exited, status=0/SUCCESS) + Process: 23854 ExecStart=/etc/rc.d/init.d/mysql start (code=exited, status=0/SUCCESS) + Main PID: 23430 (code=exited, status=203/EXEC) + CGroup: /system.slice/mysql.service + ├─23861 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/server1.centos7-test.com.pid + └─23933 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/v... + + Jan 31 10:04:10 server1.centos7-test.com systemd[1]: Starting LSB: start and stop MySQL... + Jan 31 10:04:11 server1.centos7-test.com mysql[23854]: Starting MySQL. SUCCESS! + Jan 31 10:04:11 server1.centos7-test.com systemd[1]: Started LSB: start and stop MySQL. + +#### 第7步:运行 EasyApache 用 MariaDB 重建 Apache/PHP,并确保所有 PHP 的模块保持不变。#### + + root@server1 [~]#/scripts/easyapache --build + + ****IMPORTANT ***** + If you forget to rebuild Apache/PHP after the MariaDB installation, it will report the library error as below: + + root@server1 [/etc/my.cnf.d]# php -v + php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory + +#### 第8步:现在验证安装的数据库。 #### + + root@server1 [/var/lib/mysql]# mysql + Welcome to the MariaDB monitor. Commands end with ; or \g. + Your MariaDB connection id is 15 + Server version: 10.0.23-MariaDB MariaDB Server + + Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. + + Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + + MariaDB [(none)]> show storage engines; + +--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+ + | Engine | Support | Comment | Transactions | XA | Savepoints | + +--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+ + | CSV | YES | CSV storage engine | NO | NO | NO | + | MRG_MyISAM | YES | Collection of identical MyISAM tables | NO | NO | NO | + | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO | + | BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO | + | MyISAM | YES | MyISAM storage engine | NO | NO | NO | + | InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES | + | ARCHIVE | YES | Archive storage engine | NO | NO | NO | + | FEDERATED | YES | FederatedX pluggable storage engine | YES | NO | YES | + | PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO | + | Aria | YES | Crash-safe tables with MyISAM heritage | NO | NO | NO | + +--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+ + 10 rows in set (0.00 sec) + +就这样 :)。现在,我们该去欣赏 MariaDB 完善和高效的特点了。希望你喜欢阅读本文。希望留下您宝贵的建议和反馈! +-------------------------------------------------------------------------------- + +via: http://linoxide.com/how-tos/install-mariadb-10-centos-7-cpanel/ + +作者:[Saheetha Shameer][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/saheethas/ diff --git a/translated/tech/20160217 How to Enable Multiple PHP-FPM Instances with Nginx or Apache.md b/translated/tech/20160217 How to Enable Multiple PHP-FPM Instances with Nginx or Apache.md new file mode 100644 index 0000000000..befa31312f --- /dev/null +++ b/translated/tech/20160217 How to Enable Multiple PHP-FPM Instances with Nginx or Apache.md @@ -0,0 +1,119 @@ +启用Nginx/Apache的PHP-FPM多实例 +================================================================================ + +PHP-FPM作为FastCGI进程管理器而广为熟知,它是PHP FastCGI实现的改进,带有更为有用的功能,用于处理高负载的服务器和网站。下面列出其中一些功能: +### 新功能 ### + + - 拥有具有优雅启动/停止选项的高级进程管理能力。 + - 可以以监听不同端口以及使用不同PHP配置的不同用户身份/组身份来运行进程。 + - 错误日志记录。 + - 支持上传加速。 + - 用于在处理一些耗时任务时结束请求和清空所有数据的特别功能。 + - 同时支持动态和静态子进程重生。 + - 支持IP地址限制。 + +在本文中,我将要讨论的是,在运行EA3下CPanel 11.52的CentOS 7服务器上与Nginx和Apache一起安装PHP-FPM,以及如何来通过CPanel管理这些安装好的多个PHP-FPM实例。 +Before going to the installation procedures, let us take a look on the pre-requisites. + +### 先决条件 ### + + 1. 启用 Mod_proxy_fcgi模块 + 2. 启用 MPM_Event + +由于我们要将PHP-FPM安装到一台EA3服务器,我们需要运行EasyApache来编译Apache以启用这些模块。 + +你们可以参考我以前写的,关于如何在Apache服务器上安装Nginx作为反向代理的文档来确认Nginx的安装。 + +这里,我将再次简述那些安装步骤。具体细节,你可以参考我之前写的**(如何在CentOS 7/CPanel服务器上配置Nginx反向代理)**一文。 + + 步骤 1:安装Epel仓库 + 步骤 2:安装nDeploy RPM仓库,这是此次安装中最为**重要**的步骤。 + 步骤 3:使用yum从nDeploy仓库安装nDeploy和Nginx插件。 + 步骤 4:启用/配置Nginx为反向代理。 + +完成这些步骤后,下面为服务器中所有可用PHP版本安装PHP-FPM包,EA3使用remi仓库来安装这些包。你可以运行这个nDeploy脚本来下载所有的包。 + + root@server1 [~]# /opt/nDeploy/scripts/easy_php_setup.sh + Loaded plugins: fastestmirror, tsflags, universal-hooks + EA4 | 2.9 kB 00:00:00 + base | 3.6 kB 00:00:00 + epel/x86_64/metalink | 9.7 kB 00:00:00 + epel | 4.3 kB 00:00:00 + extras | 3.4 kB 00:00:00 + updates | 3.4 kB 00:00:00 + (1/2): epel/x86_64/updateinfo | 460 kB 00:00:00 + (2/2): epel/x86_64/primary_db + +运行该脚本将为PHP 54,PHP 55,PHP 56和PHP 70安装所有这些FPM包。 + + Installed Packages + php54-php-fpm.x86_64 5.4.45-3.el7.remi @remi + php55-php-fpm.x86_64 5.5.31-1.el7.remi @remi + php56-php-fpm.x86_64 5.6.17-1.el7.remi @remi + php70-php-fpm.x86_64 7.0.2-1.el7.remi @remi + +在以上安装完成后,你需要为Apache启用PHP-FPM SAPI。你可以运行下面这个脚本来启用PHP-FPM实例。 + + root@server1 [~]# /opt/nDeploy/scripts/apache_php-fpm_setup.sh enable + mod_proxy_fcgi.c + Please choose one default PHP version from the list below + PHP70 + PHP56 + PHP54 + PHP55 + Provide the exact desired version string here and press ENTER: PHP54 + ConfGen:: lxblogger + ConfGen:: blogr + ConfGen:: saheetha + ConfGen:: satest + which: no cagefsctl in (/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin) + info [rebuildhttpdconf] Missing owner for domain server1.centos7-test.com, force lookup to root + Built /usr/local/apache/conf/httpd.conf OK + Waiting for “httpd” to restart gracefully …waiting for “httpd” to initialize …… + …finished. + +它会问你需要运行哪个PHP版本作为服务器默认版本,你可以输入那些细节内容,然后继续配置并为现存的域生成虚拟主机文件。 + +我选择了PHP 54作为我服务器上的默认PHP-FPM版本。 + +![confirm-php-fpm](http://blog.linoxide.com/wp-content/uploads/2016/01/confirm-php-fpm-1024x525.png) + +虽然服务器配置了PHP-FPM 54,但是我们可以通过CPanel为各个独立的域修改PHP-FPM实例。 + +下面我将通过一些截图来为你们说明一下,怎样通过CPanel为各个独立域修改PHP-FPM实例。 + +Nginx插件的安装将为你的域的CPanel提供一个Nginx Webstack图标,你可以点击该图标来配置你的Web服务器。我已经登陆进了我其中的一个CPanel来配置相应的Web服务器。 + +请看这些截图。 + +![nginx webstack](http://blog.linoxide.com/wp-content/uploads/2016/01/nginx-webstack.png) + +![nginxicon1](http://blog.linoxide.com/wp-content/uploads/2016/01/nginxicon1-1024x253.png) + +现在,你可以根据需要为选中的主域配置web服务器(这里,我已经选择了主域saheetha.com)。我已经继续通过自动化配置选项来进行了,因为我不需要添加任何手动设置。 + +![nginx_auto_proxy](http://blog.linoxide.com/wp-content/uploads/2016/01/nginx_auto_proxy-1024x408.png) + +当Nginx配置完后,你可以在这里为你的域选择PHP-FPM实例。 + +![php-fpm1](http://blog.linoxide.com/wp-content/uploads/2016/01/php-fpm1-1024x408.png) + +![php54](http://blog.linoxide.com/wp-content/uploads/2016/01/php54-1024x169.png) + +![php55](http://blog.linoxide.com/wp-content/uploads/2016/01/php55.png) + +就像你在截图中所看到的,我服务器上的默认PHP-FPM是**PHP 54**,而我正要将我的域的PHP-FPM实例单独修改成**PHP 55**。当你为你的域修改PHP-FPM后,你可以通过访问**phpinfo**页面来确认。 + +谢谢你们参考本文,我相信这篇文章会给你提供不少信息和帮助。我会为你们推荐关于这个内容的有价值的评论 :)。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/enable-multiple-php-fpm-instances-nginx-apache/ + +作者:[Saheetha Shameer][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/saheethas/ diff --git a/translated/tech/20160218 7 Steps to Start Your Linux SysAdmin Career.md b/translated/tech/20160218 7 Steps to Start Your Linux SysAdmin Career.md new file mode 100644 index 0000000000..e6b4fa62ab --- /dev/null +++ b/translated/tech/20160218 7 Steps to Start Your Linux SysAdmin Career.md @@ -0,0 +1,67 @@ +七步开始你的 Linux 系统管理员生涯 +=============================================== + + +Linux 现在是个大热门。每个人都在寻求 Linux 才能。招聘人员对有 Linux 经验的人求贤若渴,还有无数的职位虚位以待。但是如果你是 Linux 新手,又想要赶上这波热潮,该从何开始下手呢? + +1. 安装 Linux + + 这应该是不言而喻的,但学习 Linux 的第一关键就是安装 Linux。LFS101x 和 LFS201 课程都包含第一次安装和配置 Linux 的详细内容。 + +2. 完成 LFS101x 课程 + + 如果你是 Linux 完完全全的新手,最佳的起点是免费的 Linux 课程 [LFS101x Introduction](https://www.edx.org/course/introduction-linux-linuxfoundationx-lfs101x-2)。这个在线课程在 edX.org,探索 Linux 系统管理员和终端用户常用的各种工具和技能以及日常 Linux 工作环境。该课程是为有一定经验但较少或没有接触过 Linux 的电脑用户设计的,不论他们是在个人还是企业环境中工作。这个课程会从图形界面和命令行教会你有用的 Linux 知识,让你能够了解主流的 Linux 发行版。 + +3. 看看 LFS201 课程 + + 在你完成 LFS101x 之后,你就准备好开始进入 Linux 更加复杂的任务了,这是成为一名专业的系统管理员所必须的。为了掌握这些技能,你应该看看 [LFS201 Essentials of Linux System Administration](http://training.linuxfoundation.org/linux-courses/system-administration-training/essentials-of-system-administration) 这个课程。该课程对每个话题进行了深度的解释和介绍,还有大量的练习和实验,帮助你获得相关主题实际的上手经验。 + + 如果你更愿意有个教练或者你的雇主对将你培养成 Linux 系统管理员有兴趣,你可能会对 LFS220 Linux System Administration 有兴趣。这个课程有 LFS201 中所有的主题,但是它是由专家专人教授的,帮助你进行实验以及解答你在课程主题中的问题。 + +4. 练习! + + 熟能生巧,和对任何乐器或运动适用一样,这对 Linux 来说也一样适用。在你安装 Linux 之后,经常使用它。一遍遍地练习关键任务,直到你不需要参考材料也能轻而易举地完成。练习命令行和图形界面的输入输出。这些练习能够保证你掌握成为成功的 Linux 系统管理员所必需的知识和技能。 + +5. 获得认证 + + 在你完成 LFS201 或 LFS220 并且充分练习之后,你现在已经准备好获得系统管理员的认证了。你需要这个证书,因为你需要向雇主证明你拥有一名专业 Linux 系统管理员必需的技能。 + + 现在有一些不同的 Linux 证书,它们有它们的独到之处。但是,它们里大部分不是在特定发行版(如红帽)上认证,就是纯粹的知识测试,没有演示 Linux 的实际技能。Linux 基金会认证系统管理员(Linux Foundation Certified System Administrator)证书对想要一个灵活的,有意义的初级证书的人来说是个优秀的替代。 + +6. 参与进来 + + 如果你所在的地方有本地 Linux 用户组(Linux Users Group,LUG)的话,这时候你可能还想要考虑加入他们。这些组织通常由各种年龄和经验水平的人组成,所以不管你的 Linux 经验水平如何,你都能找到和你类似技能水平的人互助,或是更高水平的 Linux 用户来解答你的问题以及介绍有用的资源。要想知道你附近有没有 LUG,上 meet.com 看看,或是附近的大学,又或是上网搜索一下。 + + 还有不少在线社区可以在你学习 Linux 的时候帮助你。这些站点和社区向 Linux 新手和有经验的管理员都能够提供帮助和支持: + + - [Linux Admin subreddit](https://www.reddit.com/r/linuxadmin) + + - [Linux.com](http://www.linux.com/) + + - [training.linuxfoundation.org](http://training.linuxfoundation.org/) + + - [http://community.ubuntu.com/help-information/](http://community.ubuntu.com/help-information/) + + - [https://forums.opensuse.org/forum.php](https://forums.opensuse.org/forum.php) + + - [http://wiki.centos.org/Documentation](http://wiki.centos.org/Documentation) + +7. 学会热爱文档 + + 最后但同样重要的是,如果你困在 Linux 的某些地方,别忘了 Linux 包含的文档。使用命令 man(manual,手册),info 和 help,你从系统内就可以找到 Linux 几乎所有方面的信息。这些内置资源的用处再夸大也不为过,你会发现你在生涯中始终会用到,所以你可能最好早点掌握使用它们。 + + 想要了解更多开始你 Linux IT 生涯的信息?查看我们免费的电子书“[开始你 Linux IT 生涯的简短指南](http://training.linuxfoundation.org/sysadmin-it-career-guide)”。 + +[立刻下载](http://training.linuxfoundation.org/sysadmin-it-career-guide) + +------------------------------------------------------------------------------ + +via: http://www.linux.com/news/featured-blogs/191-linux-training/834644-7-steps-to-start-your-linux-sysadmin-career + +作者:[linux.com][a] +译者:[alim0x](https://github.com/alim0x) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:linux.com diff --git a/translated/tech/20160218 9 Key Trends in Hybrid Cloud Computing.md b/translated/tech/20160218 9 Key Trends in Hybrid Cloud Computing.md new file mode 100644 index 0000000000..5efec75ec3 --- /dev/null +++ b/translated/tech/20160218 9 Key Trends in Hybrid Cloud Computing.md @@ -0,0 +1,76 @@ +混合云计算的9大关键趋势 +======================================== + +自从几年前云计算的概念受到IT界的关注以来,公有云、私有云和混合云这三种云计算方式都有了可观的演进。其中混合云计算方式是最热门的云计算方式,在接受调查的公司中,有[88%的公司](https://www.greenhousedata.com/blog/hybrid-continues-to-be-most-popular-cloud-option-adoption-accelerating)将混合云计算摆在至关重要的地位。 + +混合云计算的疾速演进意味着一两年前的传统观念已经过时了。为此,我们询问了几个行业分析师,混合云在2016年的走势将会如何,我们得到了几个比较有意思的答案。 + +1. **2016年可能是我们将混合云投入使用的一年。** + + 混合云从本质上来说依赖于私有云,这对企业来说是比较难实现的。事实上,亚马逊,谷歌和微软的公有云已经进行了大量的投资,并且起步也比较早。私有云拖了混合云发展和使用的后腿。 + + 私有云没有得到这么多的投资,这是有私有云的性质决定的。私有云意味着维护和投资你自己的数据中心。许多公有云提供商正在推动企业减少或者消除他们的数据中心。 + + 然而,得益于OpenStack的发展和微软的 Azure Stack ,这两者基本上就是封装在一个盒子里的私有云,我们将会看到私有云慢慢追上公有云的发展步伐。支持混合云的工具、基础设施和架构也变得更加健壮。 + + +2. **容器,微服务和unikernels将会促进混合云的发展。** + + 分析师预言,到2016年底,这些原生云技术会或多或少成为主流的。这些云技术正在快速成熟,将会成为虚拟机的一个替代品,而虚拟机需要更多的资源。 + + 更重要的是,他们既能工作在在线场景,也能工作在离线场景。容器化和编排允许快速的扩大规模,进行公有云和私有云之间的服务迁移,使你能够更容易移动你的服务。 + +3. **数据和相关性占据核心舞台。** + + 所有的云计算方式都处在发展模式。这使得云计算变成了一个技术类的故事。咨询公司[Avoa](http://avoa.com/2016/01/01/2016-is-the-year-of-data-and-relevance/)称,随着云趋于成熟,数据和相关性变得越来越重要。起初,云计算和大数据都是关于怎么吸收尽可能多的数据,然后他们担心如何处理这海量的数据。 + + 2016年,相关组织将会继续锤炼如何进行数据收集和使用的相关技术。在必须处理的技术和文化方面仍然有待提高。但是2016年应该重新将关注点放在从各个方面考虑的数据重要性上,发现最相关的信息,而不只是数据的数量。 + +4. **云服务将超越按需工作负载。** + + AWS(Amazon Web Services)起初是提供给程序员或者是开发人员能够快速启动虚拟机,做一些工作然后离线的一个地方。这就是按需使用的本质。要让这些服务持续运行,几乎需要全天候工作。 + + 然而,IT组织正开始作为服务代理,为内部用户提供各种IT服务。可以是内部IT服务,公有云基础架构提供商,平台服务和软件服务。 + + 他们将越来越多的认识到想云管理平台这样的工具的价值。云管理平台可以提供针对不同服务的基于策略的一致性管理。他们也将看到像提高可移植性的容器等技术的价值。然而,云服务代理,在不同云之间快速移动的工作负载进行价格套利或者相关原因的意义上来讲,仍然是行不通的。 + +5. **服务提供商转变成了云服务提供商。** + + 到目前为止,购买云服务成了直销模式。AWS EC2 服务的使用者通常变成了购买者,通过官方认证渠道或者通过影子IT。但是随着云服务越来越全面,提供的服务菜单越来越复杂,越来越多的人转向了经销商,服务提供商转变成了他们IT服务的购买者。 + + 2nd Watch (2nd Watch是为企业提供云管理的 AWS 的首选合作伙伴)最近的一项调查发现,在美国将近85%的IT高管愿意支付一个小的溢价从渠道商那里购买公有云服务,如果购买过程变得不再那么复杂。根据调查,这85%的高管有五分之四的愿意支付额外的15%或者更多。三分之一的受访高管表示,他们可以使用帮助来购买、使用和管理公有云服务。 + +6. **物联网和云对于2016年的意义好比移动和云对2012年的意义。** + + 物联网获得了广泛的关注,更重要的是,物联网已经从测试场景进行了实际应用。云的分布式特性使得云成为了物联网非常重要的一部分,对于工业物联网,与后端系统交互的机械和重型设备,混合云将会成为最自然的驱动者,连接,数据采集和处理将会发生在混合云环境中,这得益于私有云在安全和隐私方面的好处。 + +7. **NIST 对云的定义开始瓦解。** + + 2011年,美国国家标准与技术研究院发布了“[ NIST 对于云计算的定义](http://csrc.nist.gov/publications/nistpubs/800-145/SP800-145.pdf)”(PDF),这个定义成为了私有云、公有云、混合云和 aas模板的标准定义。 + + 然而随着时间的推移,定义开始改变。Iaas变得更加复杂,开始支持OpenStack,[Swift](https://wiki.openstack.org/wiki/Swift) 对象存储和神经网络这样的项目。Paas似乎正在消退,因为Paas和传统的中间件开发几乎无异。Saas,只是通过浏览器进行访问的应用,也正在失去发展动力,因为许多app和服务提供了许多云接口,你可以通过各种手段调用接口,不仅仅通过浏览器。 + +8. **分析变得更加重要** + + 对于混合云计算来说,分析将会成为一个巨大的增长机遇,云计算具有规模大、灵活性高的优势,使得云计算非常适合需要海量数据的分析工作。对于某些分析方式,比如高度敏感的数据,私有云仍然是主导地位但是私有云也是混合云的一部分。因此,无论如何,混合云计算胜出。 + +9. **安全仍然是一个非常紧迫的问题。** + + 随着混合云计算在2016年的发展,以及对物联网和容器等新技术的引进,这同时也增加了更多的脆弱可攻破的地方从而导致数据泄露。先增加使用新技术的趋势,然后再去考虑安全性,这种问题经常发生,同时还有缺少经验的工程师不去考虑系统的安全问题,总有一天你会尝到灾难的后果的。 + + 当一项新技术出来,管理规范总是落后于安全问题产生后,然后我们才考虑去保护技术。容器就是一个很鲜明的例子。你可以从Docker下周各种示例容器,但是你知道你下载的东西来自哪里么?在人们在对容器内容不知情的情况下下载并运行了容器之后,Docker不得不重新加上安全验证。 + + 像Path和Snapchat这样的移动技术在智能手机市场火起来之后也出现了重大的安全问题。一项新技术被恶意利用无可避免。所以安全研究人员需要通过各种手段来保证新技术的安全性。很有可能在部署之后才会发现安全问题。 + + +------------------------------------------------------------------------------ + +via: http://www.datamation.com/cloud-computing/9-key-trends-in-hybrid-cloud-computing.html + +作者:[Andy Patrizio][a] +译者:[棣琦](https://github.com/sonofelice) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.datamation.com/author/Andy-Patrizio-90720.html diff --git a/translated/tech/20160218 A Linux-powered microwave oven.md b/translated/tech/20160218 A Linux-powered microwave oven.md new file mode 100644 index 0000000000..57aaace3a7 --- /dev/null +++ b/translated/tech/20160218 A Linux-powered microwave oven.md @@ -0,0 +1,55 @@ +一个Linux驱动的微波炉 +================================================================================ + +[linux.conf.au](http://linux.conf.au/)里的人们都有一种想到什么就动手去实现的想法。随着硬件开源运动不断地发展壮大,这种想法越来越多,与现实世界联系的越来越紧密,而不仅仅存在于数字世界中。David Tulloh用他制作的[Linux驱动的微波炉 [WebM]](http://mirror.linux.org.au/linux.conf.au/2016/04_Thursday/D4.303_Costa_Theatre/Linux_driven_microwave.webm)来展示一个差劲的微波炉会多么难用以及说明他的项目可以改造这些微波炉使得它们不那么讨人厌。 + +Tulloh的故事要从他买到了一个公认很便宜的微波炉开始说起,它的用户界面比其它微波炉默认的还要糟糕。设定时间时必须使劲按按钮以至于把微波炉都向后推了一段距离——而事实上必须要用力拉仓门把手才能把微波炉拖回原来的位置,这形成了一个“优雅”的平衡。当然这只是极端情况。Tulloh很郁闷因为这个微波炉近十年来都没有一丁点明显的改善。他可能买到了一个又小又便宜的微波炉,而且特点是大部分人不研究使用手册就不会使用它——和智能手机的对比更加明显:智能手机只需知道一点点的操作指南并且被广泛使用。 + +改造这个微波炉不一定没有前途,“让微波炉重获新生”——这个想法成为了一个原型,如果Tulloh可以再平衡一下想做的功能和需求之间的关系的话他希望这变成一个众筹项目:一个Linux驱动的微波炉。 + +![](https://static.lwn.net/images/2016/lca-oven-sm.jpg) + +## 加一点新奇的小玩意 + + + +如果你把“Linux”和“微波炉”联系在一起的话就可能想到给微波炉加上一个智能手机式的触摸屏和网络链接,然后再通过社区做一款微波炉的“革命性”的手机应用,想到这些就像做菜想到分享食谱一样显而易见。但Tulloh的目标和他的原型远远超过这些,他做了两个新奇的功能——热感相机和称量物体质量的称重装置。 + +这个热感相机提供一个精确度两自由度的八乘八像素的图片,这足够发现一杯牛奶是否加热到沸腾或者牛排是否解冻到快不能用来烹饪。不论发生哪种情况,功率都可以减小或者关掉。而且在必要的时候会发出警报。这可能不是第一个可以检测温度的微波炉——GE在十年前就开始卖带温度探针的微波炉了——但是一个一直工作的内置传感器比一个手工探针有用多了尤其是有一个可用的API支持的时候。 + +第二个新发明是一个嵌入的称重装置,它可以在加热之前称量食物(和容器)。很多食谱根据质量给出指导的烹饪时间,很多微波炉支持你手动输入质量以便它帮你计算。利用内置的称重装置,这一过程可以变成自动化的。在许多微波炉的转盘下面稳固地放置一个称重装置是一个机械方面的挑战不过Tulloh觉得这个问题不难处理。反而他对微波炉的设计是基于“平板”或者“平板挂车”的风格——在四角各放置一个传感器,这不仅在机械实现上很简单而且很好的达到了要求。 + + +[用户界面] +一旦你有了这些额外添加的并与逻辑引擎相连的质量温度传感器,你可以去尝试更多好玩的可能。一杯刚从冰箱里拿出来的冰牛奶的质量温度分布可能会有适度误差。Tulloh发现这种情况可以被检测到而且提供一些有关的像“煮沸”或者“加热”的选项也是容易做到的(下面有一个模拟的界面,可点击操作的版本请点击右边链接 [here](http://mwgui.tulloh.id.au/)) + +![](https://static.lwn.net/images/2016/lca-ovengui-sm.png) + +## 改造陈旧的东西 + +除了才开发出来的新功能,Tulloh还想要提升那些原本就提供的功能。可能不是所有微波炉的门把手都像Tulloh那个廉价的一样僵硬,但是很少有微波炉将把手设计的让残疾人也能轻松使用。这些缺陷都是可调整的,尤其是在美国,微波炉应该在仓门关闭的时候给出一个确定关闭的提示。这种确认必须是可靠的以预防那些伪劣产品,所以在仓门闭合时固定的槽位里添加一个短杆以确认仓门开闭状态,不误使微波炉在仓门开着的时候工作。事实上,必须要两个相互联系的机关,如果他们提供的结果不一致, +保险丝必须断开以便启动一个呼叫服务。Tulloh认为提供一个磁力门闩有更大的灵活性(包含简单的软件控制)并且像磁控也同样用于[磁性钥匙锁](https://en.wikipedia.org/wiki/Magnetic_keyed_lock),它可以让磁力门闩确认微波炉门是否关闭。 + +微波炉的另一个痛点是它会发出令人厌烦的声音。Tulloh去掉了蜂鸣器并且使用香蕉派(类似于树莓派的单片机开发板)控制他的微波炉。这可以通过一个把文本转换成语音的系统来用令人愉悦而且可配置的警报来提示和引导使用者。显然,下一步就是装上一个用来控制声音的扩音器。 + + +许多微波炉除了定时和设置功率档位之外还可以做更多的事情——它们为烹饪,加热,化冻等提供一系列的功率谱。加上一个精确的温度测量装置感觉会为这个图表大大扩展它们的序列。Andrew Tridgell对一个问题很好奇,加热巧克力——一个需要非常精确的温度控制的过程——是否是可能的。Tulloh没有过这方面的经验,他不敢保证这个一定可以,但是这个实验结果的确值得期待。即使没做成这件事,它也显出了潜在价值——社区接下来可以更进一步去做这件事。 + +## 实用性怎么样? + +Tulloh十分乐意向全世界分享这个linux驱动的微波炉,他希望看到(因为这件事)形成一个社区并且想看到它接下来的走势。买一个现成的微波炉并且替换掉里面的电子元件看起来不是一个可行的点子。最后的结果可能会很糟,而买一个小巧智能的微波炉必然要花掉(比自己改造)更多的钱,但是潜在的顾客不想在他们的厨房里看到乱七八糟又不协调的东西。 + +许多零件都是现成的可以买到的(磁电管,处理器板,热传感器等等),像USB接口的热传感器,而且都很容易安装。软件原型当然也开源在[GitHub](https://github.com/lod?tab=repositories)。这个样例和微波炉门有不小的挑战性并且很可能要定制。Tulloh想要通过提供左侧开仓门的微波炉和颜色多样化的选项来转逆境为机遇。 + +一个对读者的快速调查:很少有人会贸然承诺他会为了一个全新的升级过的烤箱付出1000澳大利亚元。当然,很难知道是否会有充足的时间和足够多的读者来完成这个调查。这整个项目看起来很有趣。所以Tulloh的[博客](http://david.tulloh.id.au/category/microwave/) (点击这里)也很值得一看。 + +------------------------------------------------------------------------------ + +via: https://lwn.net/Articles/674877/ + +作者:Neil Brown +译者:yuba0604(https://github.com/yuba0604) + +译者水平有限,敬请指正。(lizhengyu@gmail.com) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20160218 Getting to Know Linux File Permissions.md b/translated/tech/20160218 Getting to Know Linux File Permissions.md new file mode 100644 index 0000000000..b38cef6f32 --- /dev/null +++ b/translated/tech/20160218 Getting to Know Linux File Permissions.md @@ -0,0 +1,160 @@ +初识Linux文件权限 +================================================================================ + +![](http://www.linux.com/images/stories/66866/files_a.png) + +在Linux中最基本的任务就是设置文件权限。理解如何实现是你进入LInux世界的第一步。如您所料,这一基本操作在类UNIX操作系统中大同小异。 +实际上,Linux文件权限系统就直接取自UNIX文件权限(甚至使用许多相同的工具)。 + +但不要以为在学习第二种文件权限系统的时候你需要再次一点一点的学起。事实上会很简单,让我们一起来看看你需要了解哪些内容以及如何使用它们。 + +##基础概念 + +首先你要知道文件权限适用于什么,如何有效的设置一个分组的权限。当你将其分解,那这个概念就真的简单多了。那到底什么是权限什么是分组呢。 + +你可以设置的3种权限: + +- 读 — 允许该组读文件(用`r`表示) + +- 写 — 允许该组写文件(用`w`表示) + +- 执行 — 允许该组执行(运行)文件(用`x`表示) + +为了更好的解释为何是应用于一个分组,你可是尝试允许一个分组读和写一个文件,但不能执行。或者你可以允许一个组读和执行一个文件,但不能写。 +甚至你可以允许一组有读、写、执行全部的权限,也可以删除全部权限。 + +什么是分组呢,有以下4个: + +- user — 文件实际的拥有者 + +- group — 用户所在的组 + +- others — 用户组内的其他用户 + +- all — 所有用户 + +大多数情况,你只会对前3组进行操作,all这一组只是作为快捷方式(稍后我会解释)。 + +到目前为止很简单,对吧?接下来我们将深入一层。 + +如果你打开一个终端并运行命令 ls -l ,你将会看到逐行列出当前工作目录下所有的文件和文件夹的列表(如图1). + +你会留意到最左边那列是像·-rw-rw-r--·这样的。 + +实际上这列表该这样看的: + +>rw- rw- r-- + +将其分为如下3部分: + +- rw- + +- rw- + +- r-- + +权限和组的顺序都很重要,顺序总是: + +- 用户 组 其他 — 分组 + +- 读 写 操作 — 权限 + +在我们上面示例的权限列表中,用户拥有读/写权限,用户组拥有读/写权限,其他用户仅拥有读权限。这些分组中赋予执行权限的话,就用一个x表示。 + +## 等效数值 + +接下来我们让它更复杂一些,每个权限都可以用一个数字表示。这些数字是: + +- 读 — 4 + +- 写 — 2 + +- 执行— 1 + +数值代替不是一个一个的替换,你不能像这样: + +>-42-42-4-- + +你该把每个分组的数值相加,给用户读和写权限,你该用4 + 2 得到6。给用户组相同的权限,也是使用相同的数值。假如你只想给其他用户读的权限, +那就设置它为4。现在用数只表示为: + +>664 + +如果你想给一个文件664权限,你可以使用chmod命令,如: + +>chmod 664 FILENAME + +FILENAME处为文件名。 + +## 更改权限 + +既然你已经理解了文件权限,那是时候学习如何更改这些权限了。就是使用chmod命令来实现。第一步你要知道你能否更改文件权限, +你必须是文件的所有者或者有权限编辑文件(或者使用su或sudo进行操作)。正因为这样,你不能随意切换目录和更改文件权限。 + + +继续用我们的例子(`-rw-rw-r--`),假设这个文件(命名为script.sh)实际是个shell脚本,需要执行。但是你你只想让自己有权限执行这个脚本。 +这个时候,你可能会想:“我需要是文件的权限如`-rwx-rw-r--`这样来设置`x`”。实际你可以这样使用chmod命令: + +>chmod u+x script.sh + +这时候,列表中显示的应该是 -rwx-rw-r-- 。 + +如果你想同时让用户及其所在组同时拥有执行权限,命令应该这样: + +>chmod ug+x script.sh + + +明白这是怎么工作的了,下面我们让它更有趣些。不管什么原因,你不小心给了所有分组对文件的执行权限(列表中是这样的 `-rwx-rwx-r-x` )。 +如果你想去除其他用户的执行权限,只需运行命令: + +>chmod o-x script.sh + +如果你想完全删除文件的可执行权限,你可以用两种方法: + +>chmod ugo-x script.sh + +或者 + +>chmod a-x script.sh + +以上就是所有内容,能使操作更有效率。我希望能避免哪些可能会导致一些问题的操作(例如你不小心对script.sh使用`a-rwx`这样的chmod命令)。 + +## 目录权限 + +You can also execute the chmod command on a directory. When you create a new directory as a user, it is typically created with the following permissions: +你也可以对一个目录执行chmod命令,当你创建一个新的目录,通常新建目录具有这样的权限: + +>drwxrwxr-x + +注:开头的d表示这是一个目录。 + +正如你所见,用户及其所在组都对文件夹具有操作权限,但这并不意味着在这文件夹中出创建的问价也具有与其相同的权限 +(创建的文件使用默认系统的权限`-rw-rw-r--`)。但如果你想在新文件夹中创建文件,并且移除用户组的写权限, +你不用切换到该目录下并对所有文件使用chmod命令。你可以用加上参数R(意味着递归)的chmod命令,同时更改该文件夹及其目录下所有的文件的权限。 + +现在,假设有一文件夹TEST,里面有一些脚本,所有这些(包括TEST文件夹)拥有权限`-rwxrwxr-x`。如果你想移除用户组的写权限, +你可以运行命令: + +>chmod -R g-w TEST + +运行命令`ls -l`,你讲看到列出的TEST文件夹的权限信息是`drwxr-xr-x`。用户组被去除了写权限(其目录下的所有文件也如此)。 + +## 总结 + +现在,你应该对基本的Linux文件权限有了深入的理解。对于更高级的东西学起来会很轻松,像setid,setuid和ACLs这些。没有良好的基础, +你很快就会混淆不清概念的。 + +Linux文件权限从早期到现在没有太大变化,而且很可能以后也不会。 + + +------------------------------------------------------------------------------ + +via: http://www.linux.com/learn/tutorials/885268-getting-to-know-linux-file-permissions + +作者:[Jack Wallen][a] +译者:[ynmlml](https://github.com/ynmlml) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linux.com/community/forums/person/93 diff --git a/translated/tech/20160218 Top 4 open source issue tracking tools.md b/translated/tech/20160218 Top 4 open source issue tracking tools.md new file mode 100644 index 0000000000..1ffd21a759 --- /dev/null +++ b/translated/tech/20160218 Top 4 open source issue tracking tools.md @@ -0,0 +1,63 @@ +开源问题跟踪管理工具Top4 +======================================== + +生活充满了bug。 + +无论怎样小心计划,无论花多少时间去设计,在执行阶段当轮胎压在路上,任何工程都会有未知的问题。也无妨。也许对于任何一个组织的最佳弹性衡量不是他们如何一切都按计划运行地处理事情,而是,当出现磕磕碰碰时他们如何驾驭。 + +对任何一个项目管理流程来说,特别是在软件开发领域,都需要一个关键工具——问题跟踪管理系统。其基本功能很简单:可以对bug进行查看、追踪,并以协作的方式解决bug,有了它,我们更容易跟随整个过程的进展。除了基本功能,还有很多专注于满足特定需求的选项及功能,使用场景不仅限于软件开发。你可能已经熟悉某些托管版本的工具,像 [GitHub Issues](https://guides.github.com/features/issues/)或者[Launchpad](https://launchpad.net/),其中一些工具已经有了自己的开源社区。 + +接下来,这四个bug问题跟踪管理软件的极佳备选,全部开源、易于下载,自己就可以部署。先说好,我们可能没有办法在这里列出每一个问题跟踪工具;相反,我们列出这四个,基于的是其丰富的功能和项目背后的社区规模。当然,肯定还有其他类似软件,如果你喜欢的没有列在这里,如果你有一个好的理由,一定要让我们知道,在下面的评论中使它脱颖而出吧。 + +## Redmine + +[Redmine](http://www.redmine.org/) 是一个很流行的追踪管理工具,基于Ruby on Rails构建,可以追溯到2006年。很多方面类似于Trac(另一个我们的最爱),Redmine可以管理多个项目,整合了多种版本控制系统。除了基本问题追踪,Redmine也提供论坛,wiki,时间跟踪工具,同时,它还具有生成甘特图表(Gantt charts)和日历的能力,用来跟踪项目的进展。 + +Redmine的设置相当灵活,支持多种数据库后端和几十种语言,还是可定制的,可以向问题(issue)、用户、工程等添加自定义字段。通过社区创建的插件和主题它可以进一步定制。 + +如果你想试一试,一个[在线演示](http://demo.redmine.org/)可提供使用。Redmine在开源[GPL版本2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)下许可;开源代码可以在工程的[svn仓库](https://svn.redmine.org/redmine)或在[GitHub](https://github.com/redmine/redmine)镜像上找到。 + +![](https://opensource.com/sites/default/files/images/business-uploads/issues-redmine.png) + +## Bugzilla + +[Bugzilla](https://www.bugzilla.org/)是另一个流行的具备问题跟踪能力的开发工具。从名字您可能已经猜到了,Bugzilla最初是[Mozilla基金会](https://www.mozilla.org/en-US/)创建的,用来跟踪当时称为网景通信套件中的bug。为了更好的可读性,它从原来的Tcl移植到Perl,Bugzilla是一个比较老,但却广泛采用的问题跟踪系统,它被用在许多著名的开源项目如GNOME、KDE,以及Linux内核本身。 + +从通知到重复bug检测再到搜索共享,Bugzilla拥有许多高级工具,是一个功能更丰富的选项。Bugzilla拥有一套高级搜索系统以及全面的报表工具,具有生成图表和自动化按计划生成报告的能力。像Redmine一样,Bugzilla是可扩展和可定制的,除了字段本身,还能针对bug创建自定义工作流。它也支持多种后端数据库,和自带的多语言支持。 + +Bugzilla在[Mozilla公共许可证](https://en.wikipedia.org/wiki/Mozilla_Public_License)下许可,你可以读取他们的[未来路线图](https://www.bugzilla.org/status/roadmap.html)还有在官网尝试一个[示例服务](https://landfill.bugzilla.org/) + +![](https://opensource.com/sites/default/files/images/business-uploads/issues-bugzilla.png) + +## Trac + +[Trac](http://trac.edgewall.org/browser)自称是基于web的极简主义软件工程管理软件,这里请不要混淆极简主义与缺乏功能。 + +由python编写的Trac,将其漏洞跟踪能力与它的wiki系统和版本控制系统轻度整合。项目管理能力突出,如生成里程碑和路线图,一个可定制的报表系统,大事记,支持多资源库,内置的垃圾邮件过滤,还可以使用很多通用语言。如其他我们已经看到的漏洞追踪软件,有很多插件可进一步扩展其基本特性。 + +Trac是在改进的[BSD许可](http://trac.edgewall.org/wiki/TracLicense)下获得开放源码许可,虽然更老的版本发布在GPL下。你可以在一个[自托管仓库](http://trac.edgewall.org/browser)预览Trac的源码或者查看他们的[路线图](http://trac.edgewall.org/wiki/TracRoadmap)对未来的规划。 + +![](https://opensource.com/sites/default/files/images/business-uploads/issues-trac.png) + +## Mantis + +[Mantis](https://www.mantisbt.org/)是这次合集中我们将看到的最后一个工具,基于PHP,且有16年历史。作为另一个支持多种不同版本控制系统和事件驱动通知系统的bug跟踪管理软件,Mantis有一个与其他工具类似的功能设置。虽然它不本身包含wiki,但它整合了很多流行的wiki平台且本地化到多种语言。 + +Mantis在[GPL版本2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)下获得开源许可证书;你可以在[GitHub](https://github.com/mantisbt/mantisbt)浏览他的源代码或查看自托管[路线图](https://www.mantisbt.org/bugs/roadmap_page.php?project=mantisbt&version=1.3.x)对未来的规划。一个示例,你可以查看他们的内部[漏洞跟踪](https://www.mantisbt.org/bugs/my_view_page.php)。 + +![](https://opensource.com/sites/default/files/images/business-uploads/issues-mantis.png) + +正如我们指出的,这四个不是唯一的选项。想要探索更多?[Apache Bloodhound](https://issues.apache.org/bloodhound/),[Fossil](http://fossil-scm.org/index.html/doc/trunk/www/index.wiki),[The Bug Genie](http://www.thebuggenie.com/),还有很多可替换品都有专注的追随者,每个都有不同的优点和缺点。另外,一些工具在我们[项目管理](https://opensource.com/business/15/1/top-project-management-tools-2015)摘要有问题跟踪功能。所以,哪个是你首选的跟踪和碾压bug的工具? + + +------------------------------------------------------------------------------ + +via: https://opensource.com/business/16/2/top-issue-support-and-bug-tracking-tools + +作者:[Jason Baker][a] +译者:[wyangsun](https://github.com/wyangsun) +校对:[Mr小眼儿](https://github.com/tinyeyeser) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jason-baker diff --git a/translated/tech/20160219 How to Setup Lighttpd Web server on Ubuntu 15.04 or CentOS 7.md b/translated/tech/20160219 How to Setup Lighttpd Web server on Ubuntu 15.04 or CentOS 7.md new file mode 100644 index 0000000000..8840e8b973 --- /dev/null +++ b/translated/tech/20160219 How to Setup Lighttpd Web server on Ubuntu 15.04 or CentOS 7.md @@ -0,0 +1,210 @@ +[Translated] Haohong Wang +如何在Ubuntu 15.04/CentOS 7中安装Lighttpd Web server +================================================================================= +Lighttpd 是一款开源Web服务器软件。Lighttpd 安全快速,符合行业标准,适配性强并且针对高配置环境进行了优化。Lighttpd因其CPU、内存占用小,针对小型CPU加载的快速适配以及出色的效率和速度而从众多Web服务器中脱颖而出。 而Lighttpd诸如FastCGI,CGI,Auth,Out-Compression,URL-Rewriting等高级功能更是那些低配置的服务器的福音。 + +以下便是在我们运行Ubuntu 15.04 或CentOS 7 Linux发行版的机器上安装Lighttpd Web服务器的简要流程。 + +### 安装Lighttpd + +#### 使用包管理器安装 + +这里我们通过使用包管理器这种最简单的方法来安装Lighttpd。只需以sudo模式在终端或控制台中输入下面的指令即可。 + +**CentOS 7** + +由于CentOS 7.0官方repo中并没有提供Lighttpd,所以我们需要在系统中安装额外的软件源epel repo。使用下面的yum指令来安装epel。 + + # yum install epel-release + +然后,我们需要更新系统及进程为Lighttpd的安装做准备。 + + # yum update + # yum install lighttpd + +![Install Lighttpd Centos](http://blog.linoxide.com/wp-content/uploads/2016/02/install-lighttpd-centos.png) + +**Ubuntu 15.04** + +Ubuntu 15.04官方repo中包含了Lighttpd,所以只需更新本地repo并使用apt-get指令即可安装Lighttpd。 + + # apt-get update + # apt-get install lighttpd + +![Install lighttpd ubuntu](http://blog.linoxide.com/wp-content/uploads/2016/02/install-lighttpd-ubuntu.png) + +#### 从源代码安装Lighttpd + +如果想从Lighttpd源码安装最新版本(例如1.4.39),我们需要在本地编译源码并进行安装。首先我们要安装编译源码所需的依赖包。 + + # cd /tmp/ + # wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.39.tar.gz + +下载完成后,执行下面的指令解压缩。 + + # tar -zxvf lighttpd-1.4.39.tar.gz + +然后使用下面的指令进行编译。 + + # cd lighttpd-1.4.39 + # ./configure + # make + +**注:**在这份教程中,我们安装的是默认配置的Lighttpd。其他诸如高级功能或拓展功能,如对SSL的支持,mod_rewrite,mod_redirect等,需自行配置。 + +当编译完成后,我们就可以把它安装到系统中了。 + + # make install + +### 设置Lighttpd + +如果有更高的需求,我们可以通过修改默认设置文件,如`/etc/lighttpd/lighttpd.conf`,来对Lighttpd进行进一步设置。 而在这份教程中我们将使用默认设置,不对设置文件进行修改。如果你曾做过修改并想检查设置文件是否出错,可以执行下面的指令。 + + # lighttpd -t -f /etc/lighttpd/lighttpd.conf + +#### 使用 CentOS 7 + +在CentOS 7中,我们需在Lighttpd默认设置中创设一个例如`/src/www/htdocs`的webroot文件夹。 + + # mkdir -p /srv/www/htdocs/ + +而后将默认欢迎页面从`/var/www/lighttpd`复制至刚刚新建的目录中: + + # cp -r /var/www/lighttpd/* /srv/www/htdocs/ + +### 开启服务 + +现在,通过执行systemctl指令来重启数据库服务。 + + # systemctl start lighttpd + +然后我们将它设置为伴随系统启动自动运行。 + + # systemctl enable lighttpd + +### 设置防火墙 + +如要让我们运行在Lighttpd上的网页和网站能在Internet或相似的网络上被访问,我们需要在防火墙程序中设置打开80端口。由于CentOS 7和Ubuntu15.04都附带Systemd作为默认初始化系统,所以我们安装firewalld作为解决方案。如果要打开80端口或http服务,我们只需执行下面的命令: + + # firewall-cmd --permanent --add-service=http + success + # firewall-cmd --reload + success + +### 连接至Web Server +在将80端口设置为默认端口后,我们就可以默认直接访问Lighttpd的欢迎页了。我们需要根据运行Lighttpd的设备来设置浏览器的IP地址和域名。在本教程中,我们令浏览器指向 [http://lighttpd.linoxide.com/](http://lighttpd.linoxide.com/) 同时将子域名指向它的IP地址。如此一来,我们就可以在浏览器中看到如下的欢迎页面了。 + +![Lighttpd Welcome Page](http://blog.linoxide.com/wp-content/uploads/2016/02/lighttpd-welcome-page.png) + +此外,我们可以将网站的文件添加到webroot目录下,并删除lighttpd的默认索引文件,使我们的静态网站链接至互联网上。 + +如果想在Lighttpd Web Server中运行PHP应用,请参考下面的步骤: + +### 安装PHP5模块 +在Lighttpd成功安装后,我们需要安装PHP及相关模块以在Lighttpd中运行PHP5脚本。 + +#### 使用 Ubuntu 15.04 + + # apt-get install php5 php5-cgi php5-fpm php5-mysql php5-curl php5-gd php5-intl php5-imagick php5-mcrypt php5-memcache php-pear + +#### 使用 CentOS 7 + + # yum install php php-cgi php-fpm php-mysql php-curl php-gd php-intl php-pecl-imagick php-mcrypt php-memcache php-pear lighttpd-fastcgi + +### 设置Lighttpd的PHP服务 + +如要让PHP与Lighttpd协同工作,我们只要根据所使用的发行版执行如下对应的指令即可。 + +#### 使用 CentOS 7 + +首先要做的便是使用文件编辑器编辑php设置文件(例如`/etc/php.ini`)并取消掉对**cgi.fix_pathinfo=1**的注释。 + + # nano /etc/php.ini + +完成上面的步骤之后,我们需要把PHP-FPM进程的所有权从Apache转移至Lighttpd。要完成这些,首先用文件编辑器打开`/etc/php-fpm.d/www.conf`文件。 + + # nano /etc/php-fpm.d/www.conf + +然后在文件中增加下面的语句: + + user = lighttpd + group = lighttpd + +做完这些,我们保存并退出文本编辑器。然后从`/etc/lighttpd/modules.conf`设置文件中添加FastCGI模块。 + + # nano /etc/lighttpd/modules.conf + +然后,去掉下面语句前面的`#`来取消对它的注释。 + + include "conf.d/fastcgi.conf" + +最后我们还需在文本编辑器设置FastCGI的设置文件。 + + # nano /etc/lighttpd/conf.d/fastcgi.conf + +在文件尾部添加以下代码: + + fastcgi.server += ( ".php" => + (( + "host" => "127.0.0.1", + "port" => "9000", + "broken-scriptfilename" => "enable" + )) + ) + +在编辑完成后保存并退出文本编辑器即可。 + +#### 使用 Ubuntu 15.04 + +如需启用Lighttpd的FastCGI,只需执行下列代码: + + # lighttpd-enable-mod fastcgi + + Enabling fastcgi: ok + Run /etc/init.d/lighttpd force-reload to enable changes + + # lighttpd-enable-mod fastcgi-php + + Enabling fastcgi-php: ok + Run `/etc/init.d/lighttpd` force-reload to enable changes + +然后,执行下列命令来重启Lighttpd。 + + # systemctl force-reload lighttpd + +### 检测PHP工作状态 + +如需检测PHP是否按预期工作,我们需在Lighttpd的webroot目录下新建一个php文件。本教程中,在Ubuntu下/var/www/html 目录,CentOS下/src/www/htdocs目录下使用文本编辑器创建并打开info.php。 + +**使用 CentOS 7** + + # nano /var/www/info.php + +**使用 Ubuntu 15.04** + + # nano /srv/www/htdocs/info.php + +然后只需将下面的语句添加到文件里即可。 + + + +在编辑完成后保存并推出文本编辑器即可。 + +现在,我们需根据路径 [http://lighttpd.linoxide.com/info.php](http://lighttpd.linoxide.com/info.php) 下的info.php文件的IP地址或域名,来让我们的网页浏览器指向系统上运行的Lighttpd。如果一切都按照以上说明进行,我们将看到如下图所示的PHP页面信息。 + +![phpinfo lighttpd](http://blog.linoxide.com/wp-content/uploads/2016/02/phpinfo-lighttpd.png) + +### 总结 + +至此,我们已经在CentOS 7和Ubuntu 15.04 Linux 发行版上成功安装了轻巧快捷并且安全的Lighttpd Web服务器。现在,我们已经可以利用Lighttpd Web服务器来实现上传网站文件到网站根目录,配置虚拟主机,启用SSL,连接数据库,运行Web应用等功能了。 如果你有任何疑问,建议或反馈请在下面的评论区中写下来以让我们更好的改良Lighttpd。谢谢!(译注:评论网址 http://linoxide.com/linux-how-to/setup-lighttpd-web-server-ubuntu-15-04-centos-7/ ) +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/setup-lighttpd-web-server-ubuntu-15-04-centos-7/ + +作者:[Arun Pyasi][a] +译者:[HaohongWANG](https://github.com/HaohongWANG) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ diff --git a/translated/tech/20160220 Best Cloud Services For Linux To Replace Copy.md b/translated/tech/20160220 Best Cloud Services For Linux To Replace Copy.md new file mode 100644 index 0000000000..ce9380b600 --- /dev/null +++ b/translated/tech/20160220 Best Cloud Services For Linux To Replace Copy.md @@ -0,0 +1,135 @@ +替代 Copy 的 Linux 最佳云服务 +=============================================== + +![](http://itsfoss.com/wp-content/uploads/2016/02/Linux-cloud-services.jpg) + +云存储服务 Copy 即将关闭,我们 Linux 用户是时候该寻找其他优秀的** Copy 之外的 Linux 云存储服务**。 + +全部文件将会在 2016年5月1号 被删除。如果你是 Copy 的用户,你应该保存你的文件并将它们移至其他地方。 + +在过去的两年里,Copy 已经成为了我最喜爱的云存储。它为我提供了大量的免费空间并且带有桌面平台的原生应用程序,包括 Linux 和移动平台如 iOS 和 Android。 + +对我来说,它是一个非常棒的云存储,在应用中我获得了大量的免费存储空间(380 GB)并且享受着桌面系统和移动系统之间的无缝体验。但是这些'方便免费的存储',15 GB 为注册,5 GB 为每次推荐,使我想到如果 Copy 没有获得商业用户,他们将会马上停业。如此巨大的免费存储空间仅意味着他们没有像 Dropbox 所做的一样针对个别用户。 + +当我从 Copy.com 看到它即将关闭的消息,我的担忧成真了。事实上,Copy 并不孤独。它的母公司 [Barracuda Networks](https://www.barracuda.com/)正经历一段困难时期并且已经[雇佣 Morgan Stanely 寻找 合适的卖家](http://www.bloomberg.com/news/articles/2016-02-01/barracuda-networks-said-to-work-with-morgan-stanley-to-seek-sale)(s) + +无论什么理由,我们所知道的是 Copy 将会成为历史,我们需要寻找相似的**优秀的 Linux 云服务**。我之所以强调 Linux 是因为其他流行的云存储服务,如[微软的OneDrive](https://onedrive.live.com/about/en-us/) 和 [Google Drive](https://www.google.com/drive/) 都没有提供本地 Linux 客户端。这是微软预计的事情,但是谷歌对 Linux 的冷漠令人震惊。 + +## Linux 下 Copy 的最佳替代者 + +现在,作为一个 Linux 存储,在云存储中你需要什么?让我们猜猜: + +- 大量的免费空间。毕竟,个人用户无法每月支付巨额款项。 +- 原生的 Linux 客户端。因此你能够使用提供的服务,方便地同步文件,而不用做一些特殊的调整或者定时执行脚本。 +- 其他桌面系统的客户端,比如 Windows 和 OS X。便携性是必要的,并且同步设备间的文件是一种很好的缓解。 +- Android 和 iOS 的移动应用程序。在今天的现代世界里,你需要连接所有设备。 + +我不将自托管的云服务计算在内,比如 OwnCloud 或 [Seafile](https://www.seafile.com/en/home/) ,因为它们需要自己建立和运行一个服务器。这不适合所有想要类似 Copy 的云服务的家庭用户。 + +让我们看看可以用于替代 Linux 下 Copy.com 的服务有什么。 + +## Mega + +![](http://itsfoss.com/wp-content/uploads/2016/02/Mega-Linux.jpg) + +如果你是一个 It’s FOSS 的普通读者,你可能已经看过我之前的一篇有关[Mega on Linux](http://itsfoss.com/install-mega-cloud-storage-linux/)的文章。这种云服务由[Megaupload scandal](https://en.wikipedia.org/wiki/Megaupload) 公司下臭名昭著的[Kim Dotcom](https://en.wikipedia.org/wiki/Kim_Dotcom)提供。这也使一些用户怀疑它,因为 Kim Dotcom 已经很长一段时间成为美国当局的目标。 + +Mega 拥有方便免费云服务下你所期望的一切。它给每个个人用户提供 50 GB 的免费存储空间。提供Linux 和其他平台下的原生客户端,并带有端到端的加密。原生的 Linux 客户端运行良好,可以无缝地跨平台同步。你也能在浏览器上查看操作你的文件。 + +### 优点: + +- 50 GB 的免费存储空间 +- 端到端的加密 +- Linux 和其他平台下的原生客户端,例如 Windows,Mac OS X,Android,iOS + +### 缺点: + +- Mega 拥有者见不得人的过去 + +[Mega](https://mega.nz/) + +## Hubic + +![](http://itsfoss.com/wp-content/uploads/2016/02/hubic.jpeg) + +Hubic 是一个来自法国公司的云服务。Hubic 在注册时也提供了 25 GB 免费存储空间。你可以通过推荐Hubic给朋友将空间扩大至 50 GB (对免费用户来说)。 + +Hubic 提供 Linux 客户端,其还是 beta 版本(至今已经两年了)。Hubic 拥有官方的 Linux 客户端,但是它局限在命令行。我没有去测试移动版本。 + +Hubic 拥有一些不错的功能。除了简单的用户界面、文件共享等等,它还有备份的功能,你可以定期地归档你的重要文件。 + +### 优点: + +- 25 GB 免费存储空间,可扩大至 50 GB +- 支持多个平台 +- 备份功能 + +### 缺点: + +- beta 版本的 Linux 客户端,只支持命令行 + +[Hubic](https://hubic.com/) + +## pCloud + +![](http://itsfoss.com/wp-content/uploads/2016/02/pCloud-Linux.jpeg) + +pCloud 是另一款欧洲的发行软件,但这一次从瑞士横跨法国边境。专注于加密和安全,pCloud 为每一个注册者提供 10 GB 的免费存储空间。你可以通过邀请好友、在社交媒体上分享链接等方式将空间增加至 20 GB。 + +它拥有云服务的所有标准特性,例如文件共享、同步、选择性同步等等。pCloud 也有跨平台原生客户端,当然包括 Linux。 + +Linux 客户端 容易使用,并在 Linux Mint 17.3 下的有限测试中表现良好。 + +### 优点: + +- 10 GB 免费存储空间,可扩大至 20 GB +- 运行良好的带有 GUI 的 Linux 客户端 + +### 缺点: + +- 加密是一个付费功能 + +[pCloud](https://www.pcloud.com/) + +## Yandex Disk + +![](http://itsfoss.com/wp-content/uploads/2016/02/Yandex.jpg) + +俄罗斯互联网巨人 Yandex 拥有 Google 所拥有的一切东西。搜索引擎、分析学、网站管理工具、邮箱、网页浏览器和云存储服务。 + +Yandex Disk 在注册时提供了 10 GB 的免费云存储空间。它有多平台的原生客户端,包括 Linux。然而,官方的 Linux 客户端只是命令行而已。你可以获取[非官方的 GUI 版本的 Yandex Disk 客户端](https://mintguide.org/tools/265-yd-tools-gui-indicator-for-yandexdisk-free-cloud-storage-in-linux-mint.html)。Yandex Disk 支持文件共享链接,同时带有其他标准的云存储特性。 + +### 优点: + +- 10 GB 的免费存储空间,可通过推荐的方式扩大至 20 GB + +### 缺点: + +- 只有命令行客户端 + +[Yandex Disk](https://disk.yandex.com/) + +## 公正而深思熟虑的删节 + +我从列表中删减了[Dropbox](https://www.dropbox.com/)、[SpiderOak](https://spideroak.com/)。Dropbox 对 Linux 来说非常优秀,但是它的免费存储空间限制在 2 GB。在过去的几年里,我已设法将其扩大超过 21 GB,但那又是另一件事了。 + +SpiderOak 也仅提供了 2 GB 的免费存储空间,你无法在网页浏览器上操作文件。 + +OwnCloud 需要属于自己的服务器包括建立,因此它并非人见人爱。并且它确切不符合一个典型云服务的标准。 + +## 结论 + +如果你问我应该使用什么替代 Copy,我的答案是 Mega。它带有大量的免费云存储空间和优秀的 Linux 客户端。在** Linux 下最佳云存储服务**的列表中,你的选择是什么?你更喜欢哪一个呢? + + +------------------------------------------------------------------------------ + +via: http://itsfoss.com/cloud-services-linux/ + +作者:[ABHISHEK][a] +译者:[cposture](https://github.com/cposture) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ diff --git a/translated/tech/20160221 NXP unveils a tiny 64-bit ARM processor for the Internet of Things.md b/translated/tech/20160221 NXP unveils a tiny 64-bit ARM processor for the Internet of Things.md new file mode 100644 index 0000000000..6711f5d4a6 --- /dev/null +++ b/translated/tech/20160221 NXP unveils a tiny 64-bit ARM processor for the Internet of Things.md @@ -0,0 +1,39 @@ +NXP 揭幕了一块超小型物联网64位ARM处理器 +========================================================================= + +**标签**:[ARM][1], [物联网][2], [NXP][3], [NXP 半导体][4] + +![](http://1u88jj3r4db2x4txp44yqfj1.wpengine.netdna-cdn.com/wp-content/uploads/2016/02/nxp-930x556.jpg) + +[NXP 半导体][5]揭幕了一块声称世界上最小的用于物联网(IoT)的低功耗64位ARM处理器。 + +这片小型的QorIQ LS1012A为电池供电,大小受限的应用提供了网络级的安全和性能加速。这包括了运行物联网应用,或者任何智能及可连接的设备。如果物联网能在2020达到1.7万亿美金的潜力(由IDC研究员估算市场得出),那么它将需要像NXP这样的处理器,该处理器在德国纽伦堡的Embedded World 2016 上揭开了什么的面纱。 + +该芯片带有64位ARMv8芯片,拥有网络包加速及内置的安全。它占用9.6平方毫米的空间,并且大约消耗1瓦特的电力。潜在的应用包括下一代的物联网网关、可携带娱乐平台、高性能可携带存储应用、移动硬盘、相机的移动存储、平板及其他可充电的设备。 + +除此之外,LS1012A是第一款为新起的基于对象的存储方案设计的处理器,基于对象存储基于智能硬盘,它直接连接到以太网数据中心。处理器必须足够小才能直接集成在硬盘的集成电路上。 + +NXP的高级副总裁及数字网络部的经理Tareq Bustami说:“低功耗、占用空间小及网络级性能这些突破性组合的NXP LS1012处理器是消费者、物联网相关应用的理想选择。独有的混合能力解放了物联网设计者及开发者使得他们可以在这个高增长的市场中想象并创造更多创新产品。” + +NXP说这是唯一一个能够结合全面的高速外围在一个芯片中的1瓦特、64位处理器,这意味着低系统功耗。归功于创新的封装,该处理器可以在低成本的电路板中布线。 + +NXP的LS1012A可以在2016年4月开始发货,并且现在可以订货。NXP在全球35个国家拥有超过4,5000名员工。 + +-------------------------------------------------------------------------------- + +via: http://venturebeat.com/2016/02/21/nxp-unveils-a-small-and-tiny-64-bit-arm-processor-for-the-internet-of-things/ + +作者:[DEAN TAKAHASHI][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://venturebeat.com/author/dean-takahashi/ +[1]:http://venturebeat.com/tag/arm/ +[2]:http://venturebeat.com/tag/internet-of-things/ +[3]:http://venturebeat.com/tag/nxp/ +[4]:http://venturebeat.com/tag/nxp-semiconductors/ +[5]:http://www.nxp.com/ + + diff --git a/translated/tech/20160223 Intel shows budget Android phone powering big-screen Linux.md b/translated/tech/20160223 Intel shows budget Android phone powering big-screen Linux.md new file mode 100644 index 0000000000..aedd61f966 --- /dev/null +++ b/translated/tech/20160223 Intel shows budget Android phone powering big-screen Linux.md @@ -0,0 +1,34 @@ +Intel展示了带动大屏幕Linux的便宜Android手机 +============================================================== + +![](https://regmedia.co.uk/2016/02/23/intel-bigscreen.jpg?x=648&y=348&crop=1) + +在世界移动会议**MWC16**上Intel展示了称之为“大屏体验”的一款的Android智能手机,它在插入一个外部显示后运行了一个完整的Linux桌面。 + +这个概念大体上与微软在Windows 10手机中的Continuum相似,但是Continuum面向的是高端设备,Intel的项目面向的是低端智能机何新兴市场。 + +显示上Barcelona是拥有Atom x3、2GB RAM和16GB存储以及支持外部显示的的SoFIA(Intel架构的只能或功能手机)智能机原型。插上键盘、鼠标何显示,它就变成了一台桌面Linux,可以选择在大屏幕中显示Android桌面。 + +Intel的拓荒小组经理Nir Metzer告诉Reg:“Android基于Linux内核,因此我们运行的是一个内核,我们有一个Android栈和一个Linux栈,并且我们共享一个上下文,因此文件系统是相同的。电话是全功能的。” + +Metzer说:“我有一个多窗口环境。只要我插入后就可以做电子表格,我可以拖拽、播放音频。在一个低端平台实现这一切是一个挑战。” + +现在当连上外部显示器时设备的屏幕显示的空白,但是Metzer说下个版本的Atom X3会支持双显示。 + +使用的Linux版本是由Intel维护的。Metzer说:“我们需要将Linux和Android保持一致。框架是预安装的,你不能下载任何app” + +英特尔在移动世界大会上向手机制造商们推销这一想法,但却没有实际报告购买该设备的消费者。Metzer说:“芯片已经准备好了,已经为量产准备好了。这可以明天进入生产。这是一个商业决定。” + +-------------------------------------------------------------------------------- + +via: http://www.theregister.co.uk/2016/02/23/move_over_continuum_intel_shows_android_smartphone_powering_bigscreen_linux/ + +作者:[Tim Anderson][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.theregister.co.uk/Author/2878 + + diff --git a/translated/tech/20160223 New Docker Data Center Admin Suite Should Bring Order to Containerization.md b/translated/tech/20160223 New Docker Data Center Admin Suite Should Bring Order to Containerization.md new file mode 100644 index 0000000000..147294c547 --- /dev/null +++ b/translated/tech/20160223 New Docker Data Center Admin Suite Should Bring Order to Containerization.md @@ -0,0 +1,50 @@ +新的Docker数据中心管理套件使容器化变得更加井然有序 +=============================================================================== + +![](https://tctechcrunch2011.files.wordpress.com/2016/02/shutterstock_119411227.jpg?w=738) + +[Docker][1]今天宣布了一个新的容器控制中心,称为Docker数据中心(DDC),被设计用于大型和小型企业能够创建、管理和分发容器的一个集成管理控制台。 + +DDC是由包括Docker Universal Control Plane(也是今天发布)和Docker Trusted Registry等不同的商业组件组成。它也包括了开源组件比如Docker Engine。这个主意能让公司能够在一个中心管理界面中就能够管理整个Docker化程序的生命周期。 + +产品SVP Scott Johnston告诉TechCrunch:“客户催使了这个新工具的产生。公司不仅喜欢Docker给他们带来的敏捷性,它们也希望在创建和分发容器的过程中可以进行行政、安全和管理。” + +Johnston说:“公司称这个为容器即服务(Caas),大多是是因为当客户来询问这个管理的类型时,它们是这样描述的。” + +![](https://tctechcrunch2011.files.wordpress.com/2016/02/screen-shot-2016-02-23-at-7-56-54-am.png?w=680&h=401) + +>Docker免费镜像 + +像许多开源项目那样,Docker首先获得了许多开发者的追随,但是它也很快在那些想直接追踪管理它们的开发者的公司中流行。 + +这就是DDC设计的目的。它给开发者创建容器化应用的敏捷性,也让运维变得井井有条。 + +实际中这意味着开发者可以创建一系列容器化的组件,批准部署后就可以获得一个完全认证的镜像。这可以让开发这一系列的程序中拉取他们所需而不必每次重新发明轮子。这可以加速应用的开发和部署(理论上提升了容器提供的灵活性)。 + +这方面吸引了Beta客户ADP。工资服务业巨头特别喜欢让这个中心镜像仓库提供给开发人员。 + +ADP的CTO Keith Fulton在声明中称:“作为我们将关键业务微服务化倡议的一部分,ADP正在研究能够然开发人员可以利用IT审核过的中央库和安全的核心服务进行快速迭代的方案。” + +Docker在2010年由dotcloud的Solomon Hykes发布。他在2013年将公司的重心移到Docker上,并在[8月dotCloud][2],2014年完全聚焦在Docker上。 + +根据CrunchBase的消息,公司几年来在5轮融资后势如破竹般获得了1亿8000万美元融资(自从成为Docker后获得了1亿6千8百万美元)。吸引投资者关注的是Docker提供了一种称为容器的现在分发应用的方式,可以构建、管理何分发分布式应用。 + +容器化可以让开发者创建由多个小的分布在不同服务器上的分布式应用,而不是一个运行在一个单独服务器上的独立应用。 + +DDC每月每节点150美金起。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/calico-virtual-private-networking-docker/ + +作者:[ Ron Miller][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://techcrunch.com/author/ron-miller/ +[1]: https://www.docker.com/ +[2]: http://techcrunch.com/2014/08/04/docker-sells-dotcloud-to-cloudcontrol-to-focus-on-core-container-business/ + + diff --git a/translated/tech/20160225 How to add open source experience to your resume.md b/translated/tech/20160225 How to add open source experience to your resume.md new file mode 100644 index 0000000000..234038f878 --- /dev/null +++ b/translated/tech/20160225 How to add open source experience to your resume.md @@ -0,0 +1,56 @@ +怎样将开源经历添加到你的简历中去 +================================================== +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/lightning-test.png?itok=aMceg0Vg) +在这篇文章中,我将会分享我的一些方法,目的是让你因为曾经为开源事业作出贡献的经历使得你在技术领域的求职中脱颖而出。 +凡事预则立,不预则废。在你即将进入一个新的领域或者正准备花费整个晚上来彻底完善你的简历之前,先来定义你正在寻找的工作的特征是值得的。你的简历是一张有说服力的作品,因此你必须了解你的观众,从而让它发挥出所有的潜力。看你简历的可能是任何需要你的技能并且恰好能在预算之内聘用你的人。当编辑简历的时候,读一读你的简历上的内容,同时想象一下它们最应该被书写的位置。你看起来像是一个你将会聘用的候选人吗? + +在我看来,我发现对于我所要求的目标职位的所有理想候选人,针对他们每个人的特点列出一张清单有时候是很有帮助的。我将他们每个人的特点清单合并到他们的个人经历中,并阅读工作记录,然后以同样的角色询问同事们。人际关系网和会议是很好的地方去寻求一些乐意提供这种建议的人。一些人喜欢谈论他们自己,并且邀请他们去讲述他们自己的故事的一部分来帮助你去拓展你的知识面,通过这样方式可以使每个人感觉更好。当你和其他人谈论他们的职业路线时,你不仅将会明白怎样去得到你想要从事的工作,而且还能知道你应该避免哪些容易让你失去工作机会的情况和行为。 +例如,对于一个差劲的角色,有关于他的关键特性列表可能看起来像下面这样: +###技术: +- 拥有计算机从业方面的经验,更加容易受到Jenkins的青睐。 +- 深厚的脚本编写背景,如Python和Ruby +- 精通eclipse的使用 +- 基本的git和bash知识 +###个人而言: +- 自我学习者 +- 良好的交流和文档技巧 +- 在团队开发方面富有经验 +- 精通事件捕捉工作流 +###以任意方式应用 +记住,你没有必要为了得到一份工作而去满足上面的工作描述列表中列出的每个标准。工作细节描述了任何人都可以离开这个角色,如果你已经知道你即将签约并为之工作几年的公司的全部信息,并且这份工作并不会让你觉得有什么挑战性,或者要求你去拓展你你的技能。如果你对你无法满足清单上的技能列表而感到紧张,那么检查一下自己是否有来自其他经历并能与之媲美的技能。 +例如,即使有些人从来没有使用过Jenkins,那他也可能从之前使用过Buildbot或者travis CI的项目经验中明白持续集成测试的原则。 +如果你正在申请一家大型公司,而他们可能拥有一个专门的部门和一套完整的筛选过程来确保他们不会聘用任何不能胜任职位的候选人。也就是说,在你求职的过程中,你所能做的只是提交申请,而决定是否拒绝你是公司管理层的工作。不要过早的将工作拒之门外。 +现在你已经知道了你的任务是什么,并且还知道你将需要哪些技能去完成这次面试。下一步要做的取决与你已经获取到的经验。 +### 制造已经存在的事物之间的关联 +列出一张你过去几年曾经参与过的所有项目。下面是一条快速得到这张清单的方式,生成一个跳转到你的github上的库的导航器,但是需要过滤掉你从其他地方复制过来的项目。除此之外,检查下你的清单上是否有曾经处于领导地位的项目。如果你已经有了一份简历,那么请确保你已经将你所有的经历都列在了上面。 +考虑下任何一个你曾经作为一个潜在的领导经历并拥有过特权的IRC项目。检查你的会唔和聚会并将你曾经组织过或者作为志愿者参与过的事情添加到你的清单上面。略过你前几年的日程并且标注所有志愿行动或者有作为导师的经历又或者有接触过的公共演讲. +现在进入了比较艰难的环节了,将清单上列出的必备技能与个人经历列表上的内容一一对照,我喜欢给工作需要的每个特性用一个字母或者数字作为标记,然后在每一段你经历或参与过并表现出了某一特性的地方标记相同的符号。当你产生怀疑的时候,无论如何也要加上它,尽管这样做更像是在吹嘘,但也好过显示出你的无能。 +在我们写简历的时候常常被这样的情况所困扰,就是我们不愿冒着过分吹嘘自己的技能的风险。这通常会帮助我们重新考虑这个问题,比如我们会考虑那些组织了会晤的人会表现出更好的领导才能和计划技巧吗?而不是当我组织这个会晤的时候我是否展示出了这些技巧。 +如果你已经充分了解了你在过去的几年里的业余时间都是怎么度过的或者你写了很多代码,那么你可能现在正面临着一个令人奇怪的问题,你已经拥有了太多的经验以至于一张纸的简历已经无法容纳下这些经验了。那么,如果那些列在你的清单上的经验无法证明你尝试去表现的任何技能的话,那么请扔掉它们吧。如果这份已经被缩短的简历清单上的内容仍然超过一张单页纸的容量的话,那么将你的经验按照一定的优先级排序,例如根据你获得了相关的故事或丰富的经验与所需的技术。 +在这一方面,显而易见,如果你想要磨练一个独特的技能,那么你就需要一个不错的经历。考虑使用一个类似OpenHatch的问题聚合器,并用它来寻找一个通过使用你从没使用过的工具和技术来锻炼你的技能的开源项目。 +让你的简历更加漂亮 +一份简历是否美观取决于它的简洁度,清晰度和布局。每一段经历都应该通过足够的信息来展示给读者并让他们立刻就能明白为什么你要将它包含进去,而且恰到好处。每种类型的信息都应该使用一致的文档格式来表示,一份含有斜体格式或者右对齐格式的或者其他与整体风格不协调的数据绝对会让看的人十分反感。 +使用工具来给你的简历排版会使之前设定的目标更加容易实现。我喜欢使用LaTeX,因为它 +的宏系统能够使可视化一致性变得更加容易,并且大量的面试官都能一眼就认出他。你的工具的选择可能是LibreOffice或者HTML,这取决于你的技能和你希望怎样去发布你的简历。 +记住一点,一份以数字方式提交的简历可以通过关键字被浏览到。因此,当你需要描述你的工作经历的时候使用和工作招聘告示一样的英文缩写对你的求职会有很大的帮助。为了让你的简历更加容易被面试官所使用,首先就要放上最重要的信息。 +程序员通常难以在为文档排版时量化平衡和布局。我最喜欢的技术是回退并评估我的文档的空格是否处于正确的位置,而这样做的目的就是我的PDF可以全屏显示或者打印出来,然后 +在镜像里面查看它。如果你正在使用LibreOffice Writer,保存一份你的简历的副本,然后将你的简历中的字体换成一种你无法阅读的语言。这两种技术都强制将你从阅读的内容中脱离出来,让你以一种新的方式查看文档的整体布局。他们把你从一个”那句话措辞不当!”对注意到的事物的批评,比如“在这条线上只有一个字,看起来很有趣”。 +最后,再次检查你的简历是否在它将要的展示的多媒体上看起来完全正确。如果你以网页的形式发布它,那么在不同屏幕大小的浏览器中测试它的效果。如果它是一份PDF文档,那么在你的手机或者你的朋友的电脑上面打开它,并确保它所需要的字体都是可用的。 +接下来的步骤 +最后,不要让你辛苦做出来的简历被浪费了,利用你的LinkedIn帐号把它做成一个镜像。当招聘人员找到你的时候也不要感到奇怪。尽管他们描述的工作内容并不是恰好适合你,但是你可以利用他们的时间和兴趣来得到关于你的简历中有哪些地方好与不好的反馈信息。 +-------------------------------------------------------------------------------- +via: https://opensource.com/business/16/2/add-open-source-to-your-resume + +作者:[edunham][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/edunham +[1]: https://jenkins-ci.org/ +[2]: http://buildbot.net/ +[3]: https://travis-ci.org/ +[4]: https://github.com/settings/organizations +[5]: https://www.latex-project.org/ +[6]: https://www.libreoffice.org/download/libreoffice-fresh/ diff --git a/translated/tech/20160228 Two Outstanding All-in-One Linux Servers.md b/translated/tech/20160228 Two Outstanding All-in-One Linux Servers.md new file mode 100644 index 0000000000..a60b23aea1 --- /dev/null +++ b/translated/tech/20160228 Two Outstanding All-in-One Linux Servers.md @@ -0,0 +1,103 @@ +两个杰出的一体化Linux服务器 +================================================ + +关键词:Linux服务器,SMB,clearos,Zentyal + +![](http://www.linux.com/images/stories/66866/jack-clear_a.png) + +>图1: ClearOS安装向导。 + +回到2000年,微软发布小型商务服务器。这个产品改变了很多人们对科技在商务领域的看法。你可以部署一个单独的服务器,它能处理邮件,日历,文件共享,目录服务,VPN,以及更多,而不是很多机器处理不同的任务。对很多小型商务来说,这是非常好的恩惠,但是Windows SMB的一些花费是昂贵的。对于其他人,微软设计的依赖于一个服务器的想法,根本不是一个选项。 + +对于最近的用户群,有些替代品。事实上,在Linux和开源领域里,你可以选择许多稳定的平台,它可以作为一站式服务商店服务于你的小型企业。如果你的小型企业有10到50员工,一体化服务器也许是你所需的理想方案。 + +这里,我将要看看两个Linux一体化服务器,所以你可以查看他们哪个能完美适用于你的公司。 + +记住,这些服务器不能,以任何方式,适用于大型商务或企业。大公司无法依靠一体化服务器,仅仅是因为一台服务器不能负荷在企业内所需的企望。除此之外,这就是小型企业可以从Linux一体化服务器期待什么。 + +### ClearOS + +[ClearOS][1]是在2009年在ClarkConnect下发行的,作为一个路由和网关的分支。从那以后,ClearOS已经增加了所有一体化服务器必要的特性。CearOS提供的不仅仅是一个软件。你可以购买一个[ClearBox 100][2] 或[ClearBox 300][3]。这些服务器搭载完整的ClearOS作为一个IT设备被销售。在[这里][4]查看特性比对/价格矩阵。 + +家里已经有这些硬件,你可以下载这些之一: + +- [ClearOS社区][5] — 社区(免费)版的ClearOS + +- [ClearOS家庭][6] — 理想的家庭办公室(详细的功能和订阅费用,见这里) + +- [ClearOS商务][7] — 理想的小型商务(详细的功能和订阅费用,见这里) + +使用ClearOS你得到了什么?你得到了一个单机的业务合作服务器,设计精美的网页。ClearOS独特的是什么?你可以在基础服务中得到很多特性。除了这个,你必须从 [Clear Marketplace][8]增加特性。在市场上,你可以安装免费或付费的应用程序,扩展集的ClearOS服务器的特性。这里你可以找到附加的Windows服务器活动目录,OpenLDAP,Flexshares,Antimalware,云,Web访问控制,内容过滤,还有更多。你甚至可以找到一些第三方组件像谷歌应用同步,Zarafa合作平台,卡巴斯基杀毒。 + +ClearOS的安装像其他Linux发行版(基于红帽的Anaconda安装程序)。安装完成后,系统将提示您设置网络接口就是提供你浏览器访问的地址(与ClearOS服务器在同一个网络里)。地址格式如下: + +[https://IP_OF_CLEAROS_SERVER:81][9] + +IP_OF_CLEAROS_SERVER就是服务器的真实IP地址。注:当你第一次在浏览器访问这个服务器时,你将收到一个“Connection is not private”的警告。继续访问这个地址你才能继续设置。 + +当浏览器连接上,就会提示你root用户认证(在初始化安装中你设置的root用户密码)。一通过认证,你将看到ClearOS的安装向导(上图1) + +点击下一步按钮,开始设置你的ClearOS服务器。这个向导无需加以说明,在最后还会问你想用那个版本的ClearOS。点击社区,家庭,或者商业。一旦选择,你就需要注册一个账户。创建了一个账户注册了服务器后,你可以开始更新服务器,配置服务器,从市场添加模块(图2)。 + +![](http://www.linux.com/images/stories/66866/jack-clear_b.png) + +>图2: 从市场安装模块。 + +此时,你已经准备开始深入挖掘配置你的ClearOS小型商务服务器了。 + +### Zentyal + +[Zentyal][10]是一个基于Ubuntu的小型商务服务器,现在,发布在eBox域名下。Zentyal提供了大量的服务器/服务来适应你的小型商务需求: + +- 电子邮件 — 网页邮件;原生微软邮件协议和活动目录支持;日历和通讯录;手机设备电子邮件同步;反病毒/反垃圾;IMAP,POP,SMTP,CalDAV,和CardDAV支持。 + +- 域和目录 — 核心域目录管理;多个组织单元;单点登录身份验证;文件共享;ACLs,高级域名管理,打印机管理。 + +- 网络和防火墙 — 静态和DHCP接口;对象和服务;包过滤;端口转发。 + +- 基础设施 — DNS;DHCP;NTP;认证中心;VPN。 + +- 防火墙 + +安装Zentyal很像Ubuntu服务器的文本安装而且很简单:启动安装镜像,做一些选择,等待安装完成。一旦初始化,完成基于文本安装,就提供给你桌面GUI,向导程序提供选择包。选择所有你想安装的包,让安装程序完成这些工作。 + +最终,你可以通过网页接口来访问Zentyal服务器(浏览器访问[https://IP_OF_SERVER:8443][11] - IP_OF_SERVER是Zentyal服务器的内网地址)或使用独立的桌面GUI来管理服务器(Zentyal包括快速访问管理员和用户控制台就像Zentyal管理控制台)。当全部系统已经保存开启,你将看到Zentyal面板(图3)。 + +![](http://www.linux.com/images/stories/66866/jack-zentyal_a.png) + +>图3: Zentyal活动面板. + +这个面板允许你控制服务器所有方面,比如更新,管理服务器/服务,获取服务器的敏捷状态更新。您也可以进入组件领域,然后安装部署过程中选择出来的组件或更新当前的软件包列表。点击 软件管理 > 系统更新 并选择你想更新的(图4),然后在屏幕最底端点击更新按钮。 + +![](http://www.linux.com/images/stories/66866/jack-zentyal_b.png) + +>图4: 更新你的Zentyal服务器很简单。 + +### 那个服务器适合你? + +回答这个问题要看你有什么需求。Zentyal是一个不可思议的服务器,它很好的胜任于你的小型商务网络中。如果你需要更多,如组合软件,你最好赌在ClearOS上。如果你不需要组合软件,任意的服务器将表现杰出的工作。 + +我强烈建议安装这两个一体化的服务器,看看哪个是你的小公司所需的最好服务。 + +------------------------------------------------------------------------------ + +via: http://www.linux.com/learn/tutorials/882146-two-outstanding-all-in-one-linux-servers + +作者:[Jack Wallen][a] +译者:[wyangsun](https://github.com/wyangsun) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.linux.com/community/forums/person/93 +[1]: http://www.linux.com/learn/tutorials/882146-two-outstanding-all-in-one-linux-servers#clearfoundation-overview +[2]: https://www.clearos.com/products/hardware/clearbox-100-series +[3]: https://www.clearos.com/products/hardware/clearbox-300-series +[4]: https://www.clearos.com/products/hardware/clearbox-overview +[5]: http://mirror.clearos.com/clearos/7/iso/x86_64/ClearOS-DVD-x86_64.iso +[6]: http://mirror.clearos.com/clearos/7/iso/x86_64/ClearOS-DVD-x86_64.iso +[7]: http://mirror.clearos.com/clearos/7/iso/x86_64/ClearOS-DVD-x86_64.iso +[8]: https://www.clearos.com/products/purchase/clearos-marketplace-overview +[9]: https://ip_of_clearos_server:81/ +[10]: http://www.zentyal.org/server/ +[11]: https://ip_of_server:8443/ diff --git a/translated/tech/20160301 The Evolving Market for Commercial Software Built On Open Source.md b/translated/tech/20160301 The Evolving Market for Commercial Software Built On Open Source.md new file mode 100644 index 0000000000..c45b3eb760 --- /dev/null +++ b/translated/tech/20160301 The Evolving Market for Commercial Software Built On Open Source.md @@ -0,0 +1,36 @@ +构建在开源之上的商业软件市场持续成长 +===================================================================== + +![](https://www.linux.com/images/stories/41373/Structure-event-photo.jpg) +> 与会者在 Structure 上听取演讲,Structure Data 2016 也将在 UCSF Mission Bay 会议中心举办。图片来源:Structure Events。 + +如今真的很难低估开源项目对于企业软件市场的影响;开源集成如此快速地形成了规范,我们没能捕捉到转折点也情有可原。 + +举个例子,Hadoop,改变的不止是数据分析的世界。它引领了新一代数据公司,它们围绕开源项目创造自己的软件,按需调整和支持那些代码,更像红帽在 90 年代和 21 世纪早期拥抱 Linux 那样。软件越来越多地通过公有云交付,而不是购买者自己的服务器,拥有了令人惊奇的操作灵活性,但同时也带来了一些关于授权,支持以及价格之类的新问题。 + +我们多年来持续追踪这个趋势,它们组成了我们的 Structure Data 会议,而 Structure Data 2016 也不例外。三家围绕 Hadoop 最重要的大数据公司——Hortonworks,Cloudera 和 MapR——的 CEO 将会共同讨论它们是如何销售他们围绕开源项目的企业软件和服务,获利的同时回报那个社区项目。 + +以前在企业软件上获利是很容易的事情。一个客户购买了之后,企业供应商的一系列大型软件就变成了它自己的收银机,从维护合同和阶段性升级中获得近乎终生的收入,软件也越来越难以被替代,因为它已经成为了客户的业务核心。客户抱怨这种绑定,但如果它们想提高工作队伍的生产力也确实没有多少选择。 + +而现在的情况不再是这样了。尽管无数的公司还陷于在他们的基础设施上运行至关重要的巨大软件包,新的项目被使用开源技术部署到云服务器上。这让升级功能不再需要去掉大量软件包再重新安装别的,同时也让公司按需付费,而不是为一堆永远用不到的特性买单。 + +有很多客户想要利用开源项目的优势,而又不想建立和支持一支工程师队伍来调整开源项目以满足自己的需求。这些客户愿意为开源项目和在这之上的专有特性之间的差异付费。 + +这对于基础设施相关的软件来说格外正确。当然,你的客户们可以安装他们自己对项目的调整,比如 Hadoop,Spark 或 Node.js,但付费可以帮助他们自定义包部署如今重要的开源技术而不用自己干这些活儿。只需看看 Structure Data 2016 的发言者就明白了,比如 Confluent(Kafka),Databricks(Spark),以及 Cloudera-Hortonworks-MapR(Hadoop)三人组。 + +当然还有一个值得提到的是在出错的时候有个供应商给你指责。如果你的工程师弄糟了开源项目的实现,那你只能怪你自己了。但是如果你和一个愿意保证在服务级别的特定性能和正常运行时间指标的公司签订了合同,你就是愿意为支持,指导,以及在突然出现不可避免的问题时朝你公司外的人发火的机会买单。 + +构建在开源之上的商业软件市场的持续成长是我们在 Structure Data 上追踪多年的内容,如果这个话题正合你意,我们鼓励你加入我们,在旧金山,3 月 9 日和 10 日。 + + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/enterprise/cloud-computing/889564-the-evolving-market-for-commercial-software-built-on-open-source- + +作者:[Tom Krazit ][a] +译者:[alim0x](https://github.com/alim0x) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/community/forums/person/70513 diff --git a/translated/tech/20160304 Image processing at NASA with open source tools.md b/translated/tech/20160304 Image processing at NASA with open source tools.md new file mode 100644 index 0000000000..a26b96936c --- /dev/null +++ b/translated/tech/20160304 Image processing at NASA with open source tools.md @@ -0,0 +1,79 @@ +# 在NASA中使用开源工具进行图像处理 + +关键词:NASA,图像处理,Node.js,OpenCV + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/nasa_spitzer_space_pink_spiral.jpg?itok=3XEUstkl) + +在刚结束的这个夏天里,我是 [NASA 格伦中心][1] [GVIS][2] 实验室的实习生,我将我对开源的热情带到了那里。我的任务是改进我们实验室对 Dan Schroeder 开发的一个开源流体动力学模拟器的贡献。原本的模拟器可以显示用户用鼠标绘制的障碍物,并建立计算流体动力学模型。我们团队的贡献是加入图像处理的代码,分析实况视频的每一帧以显示特定的物体如何与液体相互作用。而且,我们还要做更多事情。 + +我们想要让图像处理部分更加健壮,所以我致力于改善图像处理库。 + +得益于新的库,模拟器可以检测轮廓、进行空间坐标变换以及找到物体的质心。图像处理并不直接与流体动力学模拟器物理相关。它用摄像头检测物体,并且获取物体轮廓,为流体模拟器创建一个障碍物。随后,流体模拟器开始运行,而输出结果会被投射到真实物体上。 + +我的目标是通过以下三个方面改进模拟器: + +1. 找寻物体的轮廓 +2. 找寻物体的质心 +3. 能对物体中心进行相关的精确转换 + +我的导师建议我安装 [Node.js](http://nodejs.org/) 、 [OpenCV](http://opencv.org/) 和 [Node.js bindings for OpenCV](https://github.com/peterbraden/node-opencv)。在等待软件安装的过程中,我查看了 OpenCV 的 [GitHub 主页][3]上的示例源码。我发现示例源码使用 JavaScript 写的,而我还不懂 JavaScript ,所以我在 Codecademy 上学了一些课程。两天后,我对 JavaScript 依旧生疏,不过我还是开始了我的项目…它包含了更多的 JavaScript 。 + +检测轮廓的示例代码工作得很好。事实上,它使得我用几个小时就完成了第一个目标!获取一幅图片的轮廓,它看起来像这样: + +![](https://opensource.com/sites/default/files/resize/image_processing_nasa_1-520x293.jpg) + +> 包括所有轮廓的原始图, + +检测轮廓的示例代码工作得有点好过头了。不仅物体的轮廓被检测到了,整个图片中的轮廓都检测到了。这会导致模拟器要与那些没用的轮廓打交道。这是一个严重的问题,因为它会返回错误的数据。为了避免模拟器接触到不想要的轮廓,我加了一个区域约束。轮廓要位于一定的区域范围内才会被画出来。区域约束使得轮廓变干净了。 + +![](https://opensource.com/sites/default/files/resize/image_processing_nasa_2-520x293.jpg) + +> 过滤后的轮廓,包含了阴影轮廓 + +虽然无关的轮廓没有了,但是图像还有个问题。图像本该只有一个轮廓,但是它来回绕了自己两次,没有完整地圈起来。区域在这里不能作为决定因素,所以必须试试其他方式。 + +这一次,我不是直接去找寻轮廓,而是先将图片转换成二值图。二值图是转换之后只有黑白像素的图片。为了获取到二值图我先把彩色图转成灰度图。转换之后我再用阈值函数对图片进行处理。阈值函数遍历图片每个像素点的值,如果值小于 30 ,像素的颜色就会改成黑色。否则则反。在原始图片转换成二值图之后,结果变成这样: + +![](https://opensource.com/sites/default/files/resize/image_processing_nasa_3-520x293.jpg) + +> 二值图。 + +然后我获取了二值图的轮廓,结果是一个更干净的轮廓,没有了阴影轮廓。 + +![](https://opensource.com/sites/default/files/image_processing_nasa_4.jpg) + +> 最后的干净轮廓。 + +这个时候,我可以获取干净的轮廓、计算质心了。可惜的是,我没有足够的时间去完成质心的相关变换。由于我的实习时间只剩下几天了,我开始考虑我在这段有限时间内能做的其它事情。其中一个就是边界矩形。边界矩形是包含了图片轮廓的最小四边形。边界矩形很重要,因为它是在页面上缩放轮廓的关键。虽然很遗憾我没时间利用边界矩形做更多事情,但是我仍然想学习它,因为它是个很有用的工具。 + +最后,经过以上的努力,我完成了对图像的处理! + +![](https://opensource.com/sites/default/files/resize/image_processing_nasa_5-521x293.jpg) + +> 最终图像,红色的边界矩形和质心。 + +当这些图像处理代码写完之后,我用我的代码替代了模拟器中的老代码。令我意外的是,它可以工作。 + +嗯,基本可以。 + + + +( Youtube 演示视频) + +程序有内存泄露,每 1/10 秒泄露 100MB 。我很高兴原因不是我的代码。坏消息是我并不能修复它。好消息是仍然有解决方法。它并非最理想的,但我可以使用。这个方法是不断检查模拟器使用的内存,当使用内存超过 1GB 时,重新启动模拟器。 + +在 NASA 实验室,我们会使用很多的开源软件,没有这些开源软件的帮助,我不可能完成这些工作。 + +* * * + +via: [https://opensource.com/life/16/3/image-processing-nasa](https://opensource.com/life/16/3/image-processing-nasa) + +作者:[Lauren Egts](https://opensource.com/users/laurenegts) +译者:[willowyoung](https://github.com/willowyoung) +校对:[PurlingNayuki](https://github.com/PurlingNayuki) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]: http://www.nasa.gov/centers/glenn/home/index.html +[2]: https://ocio.grc.nasa.gov/gvis/ +[3]: https://github.com/peterbraden/node-opencv diff --git a/translated/tech/20160429 Master OpenStack with 5 new tutorials.md b/translated/tech/20160429 Master OpenStack with 5 new tutorials.md new file mode 100644 index 0000000000..47ad95b663 --- /dev/null +++ b/translated/tech/20160429 Master OpenStack with 5 new tutorials.md @@ -0,0 +1,37 @@ +Master OpenStack with 5 new tutorials +5篇文章快速掌握OpenStack +======================================= + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/education/EDUCATION_tools.png?itok=ybxr0Qe9) + +回顾这周的 OpenStack 峰会,我仍然回味着开源云生态系统的浩瀚无垠,并且需要熟悉多少个不同的项目和概念才能获得成功。但是,我们是幸运的,因为有许多资源让我们跟随项目的脚步。除了[官方文档][1]外,我们还有许多来自三方组织的培训和认证、个人分享,以及许多社区贡献的学习资源。 + +为了让我们保持获得最新消息,每个月我们将会整合发布 OpenStack 社区的最新教程、指导和小贴士等。下面是我们过去几个月最棒的发布分享。 + +- 首先,如果你正在寻找一个靠谱实惠的 OpenStack 测试实验室, Intel NUC 是最值得考虑的平台.麻雀虽小,五脏俱全,通过指导文章,可以很轻松的按照教程在 NUC 上使用 [TripleO 部署 OpenStack][2] ,并且还可以轻松预防一些常见的怪异问题。 +- 当你已经运行的一段时间 OpenStack 后,你会发现在你的云系统上许多组件生成了大量日志。其中一些是可以安全删除的,而你需要一个管理这些日志的方案。参考在部署生产 9 个月后使用 Celiometer 管理日志的[一些思考][3]。 +- 对于 OpenStack 基础设施项目的新手,想要提交补丁到 OpenStack 是相当困难的。入口在哪里,测试怎么做,我的提交步骤是怎么样的?可以通过 Arie Bregman 的[博客文章][4]快速了解整个提交过程。 +- 突发计算节点失效,不知道是硬件还是软件问题。好消息是 OpenStack 提供了一套非常简单的迁移计划可以让迁移当机节点到别的主机。然而,迁移过程中使用的命令令许多人感到困惑。可以通过[这篇文章][5]来理解 migrate 和 evacuate 命令的不同。 +- 网络功能虚拟化技术需要 OpenStack 中的额外的功能,而用户可能不熟悉它们。例如, SR-IOV 和 PCI 直通是最大限度地提高物理硬件性能的方式。可以学习[部署步骤][6]以使 OpenStack 的性能最大化。 + +这些文章基本涵盖了本月(译者注: 4 月)推送,如果你还需要更多文章,可以检索过去推送的 [OpenStack 文献][7]来获取更多资源。如果有你认为我们应该推荐的新教程,请在评论中告诉我们,谢谢。 + +------------------------------------------------------------------------------ + +via: https://opensource.com/business/16/4/master-openstack-new-tutorials + +作者:[Jason Baker][a] +译者:[VicYu/Vic020](http://vicyu.net) +校对:[PurlingNayuki](https://github.com/PurlingNayuki) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker + +[1]: http://docs.openstack.org/ +[2]: http://acksyn.org/posts/2016/03/tripleo-on-nucs/ +[3]: http://silverskysoft.com/open-stack-xwrpr/2016/03/long-term-openstack-usage-summary/ +[4]: http://abregman.com/2016/03/05/openstack-infra-jenkins-jobs/ +[5]: http://www.danplanet.com/blog/2016/03/03/evacuate-in-nova-one-command-to-confuse-us-all/ +[6]: https://trickycloud.wordpress.com/2016/03/28/openstack-for-nfv-applications-sr-iov-and-pci-passthrough/ +[7]: https://opensource.com/resources/openstack-tutorials diff --git a/translated/tech/20160502 The intersection of Drupal, IoT, and open hardware.md b/translated/tech/20160502 The intersection of Drupal, IoT, and open hardware.md new file mode 100644 index 0000000000..7cfffd953f --- /dev/null +++ b/translated/tech/20160502 The intersection of Drupal, IoT, and open hardware.md @@ -0,0 +1,62 @@ +Drupal, IoT 和开源硬件的交叉点 +======================================================= + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/drupal_blue_gray_lead.jpeg?itok=t7W_KD-D) + + +认识一下 [Amber Matz][1],来自由 Lullabot Education 提供的 [Drupalize.Me][3] 的生产经理以及培训师。当她没有倒腾 Arduino,Raspberry Pi 以及电子穿戴设备时,通常会在波特兰 Drupal 用户组里和主持人争论。 + +在即将举行的 [DrupalCon NOLA][3] 大会上,Amber 将主持一个关于 Drupal 和 IoT 的主题。如果你会去参加,也想了解下开源硬件,IoT 和 Drupal 之间的交叉点,那这个将很合适。如果你去不了新奥尔良的现场也没关系,Amber 还分享了许多很酷的事情。在这次采访中,她讲述了自己参与 Drupal 的原因,一些她自己喜欢的开源硬件项目,以及 IoT 和 Drupal 的未来。 + +![](https://opensource.com/sites/default/files/images/life/Interview%20banner%20Q%26A.png) + +**你是怎么加入 Drupal 社区的?** + +在这之前,我在一家大型非盈利性机构市场部的“站长办公室”工作,大量产出没人喜欢的定制 PHP/MySQL 表格。终于我觉得这样很烦并开始在网上寻找更好的方式。然后我找到了 Drupal 6 并开始自己沉迷进去。多年以后,在准备职业转换的时候,发现了波特兰 Drupal 用户组,然后在里面找了一份全职的 Drupal 开发者工作。我一直经常参加在波特兰的聚会,我觉得它是一种很好的社区,交友,以及专业开发的资源。一个偶然的机会,我在 Lullabot 找了一份培训师的工作为 Drupalize.Me 提供内容。现在,我管理着 Drupalize.Me 的内容管道,创建 Drupal 8 的内容,还很大程度地参与到波特兰 Drupal 社区中。我是今年的协调员,寻找并规划演讲者。 + +**我们得明白:什么是 Arduino 原型,你是怎么找到它的,以及你用 Arduino 做过的最酷的事是什么?** + +Arduino,Raspberry Pi,以及可穿戴电子设备,这些年到处都能听到这些术语。我在几年前通过 Becky Stern YouTube 秀(最近由 Becky 继续主持,每周三播出)发现了 [Adafruit 的可穿戴电子设备][4]。我被那些可穿戴设备迷住了,还订了一套 LED 缝制工具,不过没做出任何东西。我就是没搞懂。我没有任何电子相关的背景,而且在我被那些项目吸引的时候,我根本不知道怎么做出那样的东西。看上去太遥远了。 + +后来,我找到一个 Coursera 的“物联网”专题。(很时髦,对吧?)但我很快就喜欢上了。我最终找到了 Arduino 是什么的解释,以及所有这些其他的重要术语和概念。我订了一套推荐的 Arduino 初学者套件,还附带了一本如何上手的小册子。当我第一次让 LED 闪烁的时候,开心极了。我在圣诞节以及之后有两个星期的假期,然后我什么都没干,就一直根据初学者小册子给 Arduino 电路编程。很奇怪我觉得很放松!我太喜欢了。 + +一月份的时候,我开始构思我自己的原型设备。在知道我要主持公司培训的开场白时,我用五个 LED 灯和 Arduino 搭建了一个开场白视觉计时器。 + +![](https://opensource.com/sites/default/files/resize/amber-arduino-lightning-talk-timer-400x400.jpg) + +这是一次巨大的成功。我还做了我的第一个可穿戴项目,一件会发光的连帽衫,使用了和 Arduino IDE 兼容的 Gemma 微控制器,一个小的圆形可缝制部件,然后用可导电的线缝起来,将一个滑动可变电阻和衣服帽口的收缩绳连在一起,用来控制缝到帽子里的五个 NeoPixel 灯的颜色。这就是我对原型设计的看法:开展一些很好玩也可能会有点实际用途的疯狂项目。 + +**Drupal 和 IoT 带来的最大机遇是什么??** + +IoT 和网站服务以及 Drupal 分层趋势实际并没有太大差别。就是将数据从一个物体传送到另一个物体,然后将数据转换成一些有用的东西。但数据是如何送达?能用来做点什么?你觉得现在就有一大堆现成的解决方案,应用,中间层,以及 API?采用 IoT,这只会继续成指数增长。我觉得,给我任何一个设备或“物体”,需要只用一种方式来将它连接到因特网的无线可能上。然后有现成的各种代码库来帮助制作者将他们的数据从一个物体送到另一个物体。 + +那么 Drupal 在这里处于什么位置?首先,网站服务将是第一个明显的地方。但作为一个制作者,我不希望将时间花在编写 Drupal 的订制模块上。我想要的是即插即用!所以我很高兴出现这样的模块能连接 IoT 云端 API 和服务,比如 ThingSpeak,Adafruit.io,IFTTT,以及其他的。我觉得也有一个很好的商业机会,在 Drupal 里构建一套 IoT 云服务,允许用户发送和存储他们的传感器数据,并可以制成表格和图像,还可以写一些插件可以响应特定数据或阙值。每一个 IoT 云 API 服务都是一个细分的机会,所以能留下很大空间给其他人。 + +**这次 DrupalCon 你有哪些期待?** + +我喜欢重新联系 Drupal 上的朋友,认识一些新的人,还能见到 Lullabot 和 Drupalize.Me 的同事(我们是分布式的公司)!Drupal 8 有太多东西可以去探索了,不可抗拒地要帮我们的客户收集培训资料。所以,我很期待参与一些 Drupal 8 相关的主题,以及跟上最新的开发活动。最后,我对新奥尔良也很感兴趣!我曾经在 2004 年去过,很期待将这次将看到哪些改变。 + +**谈一谈你这次 DrupalCon 上的演讲,超越闪烁:将 Drupal 加到你的 IoT 游乐场中。别人为什么要参与?他们最重要的收获会是什么?** + +我的主题的标题是,超越闪烁:将 Drupal 加到你的 IoT 游乐场中,本身有很多假设,我将让所有人都放在同一速度和层次。你不需要了解任何关于 Arduino,物联网,甚至是 Drupal,都能跟上。我将从用 Arduino 让 LED 灯闪烁开始,然后我会谈一下我自己在这里面的最大收获:玩,学,教,和做。我会列出一些曾经激发过我的例子,它们也很有希望能激发和鼓励其他听众去尝试一下。然后,就是展示时间! + +首先,第一个东西。它是一个构建提醒信号灯。在这个展示里,我会说明如何将信号灯连到互联网上,以及如何响应从云 API 服务收到的数据。然后,第二个东西。它是一个蒸汽朋克风格 iPhone 外壳形式的“天气手表”。有一个小型 LED 矩阵用来显示我的天气的图标,一个气压和温度传感器,一个 GPS 模块,以及一个 Bluetooth LE 模块,都连接到一个 Adafruit Flora 微控制器上。第二个东西能通过蓝牙连接到我的 iPhone 上的一个应用,并将天气和位置数据通过 MQTT 协议发到 Adafruit.io 的服务器!然后,在 Drupal 这边,我会从云端下载这些数据,根据天气更新一个功能块,然后更新地图。所以大家也能体验一下通过网站服务,地图和 Drupal 8 的功能块所能做的事情。 + +学习和制作这些展示原型是一次烧脑的探险,我也希望有人能参与这个主题并感染一点我对这个技术交叉的传染性热情!我很兴奋能分享一些我的发现。 + + +------------------------------------------------------------------------------ + +via: https://opensource.com/business/16/5/drupalcon-interview-amber-matz + +作者:[Jason Hibbets][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jhibbets +[1]: https://www.drupal.org/u/amber-himes-matz +[2]: https://drupalize.me/ +[3]: https://events.drupal.org/neworleans2016/ +[4]: https://www.adafruit.com/beckystern diff --git a/translated/tech/20160513 How to Set Up 2-Factor Authentication for Login and sudo.md b/translated/tech/20160513 How to Set Up 2-Factor Authentication for Login and sudo.md new file mode 100644 index 0000000000..1ed524c4d4 --- /dev/null +++ b/translated/tech/20160513 How to Set Up 2-Factor Authentication for Login and sudo.md @@ -0,0 +1,117 @@ +如何为登录和 sudo 设置双重认证 +========================================================== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/auth_crop.png?itok=z_cdYZZf) +>[Used with permission][1] + +安全就是一切。我们生活的当今世界,数据具有令人难以置信的价值,而你也一直处于数据丢失的风险之中。因此,你必须想尽办法保证你桌面系统和服务器中东西的安全。结果,管理员和用户就会创建极其复杂的密码、使用密码管理器甚至其它更复杂的东西。但是,如果我告诉你你可以只需要一步-至多两步就能登录到你的 Linux 服务器或桌面系统中呢?多亏了 [Google Authenticator][2],现在你可以做到了。在这之上配置也极其简单。 + +我会给你简要介绍为登录和 sudo 设值双重认证的步骤。我基于 Ubuntu 16.04 桌面系统进行介绍,但这些步骤也适用于其它服务器。为了做到双重认证,我会使用 Google Authenticator。 + +这里有个非常重要的警告:一旦你设置了认证,没有一个从认证器中获得的由 6 个数字组成的验证码你就不可能登录账户(或者执行 sudo 命令)。这也给你增加了一步额外的操作,因此如果你不想每次登录到 Linux 服务器(或者使用 sudo)的时候都要拿出你的智能手机,这个方案就不适合你。但你也要记住,这额外的一个步骤也给你带来一层其它方法无法给予的保护。 + +话不多说,开始吧。 + +### 安装必要的组件 + +安装 Google 认证,首先要解决两个问题。一是安装智能机应用。下面是如何从 Google 应用商店安装的方法: + +1. 在你的安卓设备中打开 Google 应用商店 + +2. 搜索 google 认证 + +3. 找到并点击有 Google 标识的应用 + +4. 点击安装 + +5. 点击 接受 + +6. 等待安装完成 + +接下来,我们继续在你的 Linux 机器上安装认证。步骤如下: + +1. 打开一个终端窗口 + +2. 输入命令 sudo apt-get install google-authenticator + +3. 输入你的 sudo 密码并敲击回车 + +4. 如果有弹窗提示,输入 y 并敲击回车 + +5. 等待安装完成 + +接下来配置使用 google-authenticator 进行登录。 + +### 配置 + +要为登录和 sudo 添加两阶段认证只需要编辑一个文件。也就是 /etc/pam.d/common-auth。打开并找到如下一行: +Just one file must be edited to add two-step authentication for both login and sudo usage. The file is /etc/pam.d/common-auth. Open it and look for the line + +``` +auth [success=1 default=ignore] pam_unix.so nullok_secure +``` + +在这行上面添加: + +``` +auth required pam_google_authenticator.so +``` + +保存并关闭文件。 + +下一步就是为系统中的每个用户设置 google-authenticator(否则会不允许他们登录)。为了简单起见,我们假设你的系统中有两个用户:jack 和 olivia。首先为 jack 设置(我们假设这是我们一直使用的账户)。 + +打开一个终端窗口并输入命令 google-authenticator。之后会问你一系列的问题(每个问题你都应该用 y 回答)。问题包括: + +* 是否允许更新你的 "/home/jlwallen/.google_authenticator" 文件 (y/n) y + +* 是否禁止多个用户使用同一个认证令牌?这会限制你每 30 秒内只能登录一次,但能增加你注意到甚至防止中间人攻击的可能 (y/n) + +* 默认情况下令牌时长为 30 秒即可,为了补偿客户端和服务器之间可能出现的时间偏差,我们允许添加一个当前时间之前或之后的令牌。如果你无法进行时间同步,你可以把时间窗口由默认的 1:30 分钟增加到 4 分钟。是否希望如此 (y/n) + +* 如果你尝试登陆的计算机没有针对蛮力登陆进行加固,你可以为验证模块启用速率限制。默认情况下,限制攻击者每 30 秒不能尝试登陆超过 3 次。是否启用速率限制 (y/n) + +一旦完成了问题回答,你就会看到你的密钥、验证码以及 5 个紧急刮码。把刮码输出保存起来。你可以在无法使用手机的时候使用它们(每个刮码仅限使用一次)。密钥用于你在 Google Authenticator 上设置账户,验证码是你能立即使用(如果需要)的一次性验证码。 + +### 设置应用 + +现在你已经配置好了用户 jack。在设置用户 olivia 之前,你需要在 Google Authenticator 应用上为 jack 添加账户。在主屏幕上打开应用,点击 菜单 按钮(右上角三个竖排点)。点击添加账户然后输入提供的密钥。在下一个窗口(示意图1),你需要输入你运行 google-authenticator 应用时提供的 16 个数字的密钥。给账户取个名字(以便你记住这用于哪个账户),然后点击添加。 + +![](https://www.linux.com/sites/lcom/files/styles/floated_images/public/auth_a.png?itok=xSMkd-Mf) +>Figure 1: 在 Google Authenticator 应用上新建账户 + +添加完账户之后,你就会看到一个 6 个数字的密码,你每次登录或者使用 sudo 的时候都会需要这个密码。 + +最后,在系统上设置其它账户。正如之前提到的,我们会设置一个叫 olivia 的账户。步骤如下: + +1. 打开一个终端窗口 + +2. 输入命令 sudo su olivia + +3. 在智能机上打开 Google Authenticator + +4. 在终端窗口(示意图2)中输入(应用提供的) 6 位数字验证码并敲击回车 + +5. 输入你的 sudo 密码并敲击回车 + +6. 以新用户输入命令 google-authenticator,回答问题并记录生成的密钥和验证码。 + +成功为 olivia 用户设置好之后,用 google-authenticator 命令,在 Google Authenticator 应用上根据用户信息(和之前为第一个用户添加账户相同)添加一个新的账户。现在你在 Google Authenticator 应用上就会有 jack 和 olivia 两个账户了。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/auth_b.png?itok=FH36V1r0) +>Figure 2: 为 sudo 输入 6位数字验证码 + +好了,就是这些。每次你尝试登陆系统(或者使用 sudo) 的时候,在你输入用户密码之前,都会要求你输入提供的 6 位数字验证码。现在你的 Linux 机器就比添加双重认证之前安全多了。虽然有些人会认为这非常麻烦,我仍然推荐使用,尤其是那些保存了敏感数据的机器。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/auth_b.png?itok=FH36V1r0 + +作者:[JACK WALLEN][a] +译者:[ictlyh](http://mutouxiaogui.cn/blog/) +校对:[校对者ID](https://github.com/校对者ID) + +[a]: https://www.linux.com/users/jlwallen +[1]: https://www.linux.com/licenses/category/used-permission +[2]: https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2 + diff --git a/translated/tech/LFCS/Part 1 - LFCS--How to use GNU 'sed' Command to Create Edit and Manipulate files in Linux.md b/translated/tech/LFCS/Part 1 - LFCS--How to use GNU 'sed' Command to Create Edit and Manipulate files in Linux.md deleted file mode 100644 index 79e263d7e0..0000000000 --- a/translated/tech/LFCS/Part 1 - LFCS--How to use GNU 'sed' Command to Create Edit and Manipulate files in Linux.md +++ /dev/null @@ -1,220 +0,0 @@ -Translating by Xuanwo - -LFCS系列第一讲:如何在Linux上使用GNU'sed'命令来创建、编辑和操作文件 -================================================================================ -Linux基金会宣布了一个全新的LFCS(Linux Foundation Certified Sysadmin,Linux基金会认证系统管理员)认证计划。这一计划旨在帮助遍布全世界的人们获得其在处理Linux系统管理任务上能力的认证。这些能力包括支持运行的系统服务,以及第一手的故障诊断和分析和为工程师团队在升级时提供智能决策。 - -![Linux Foundation Certified Sysadmin](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-1.png) - -Linux基金会认证系统管理员——第一讲 - -请观看下面关于Linux基金会认证计划的演示: - - - -该系列将命名为《LFCS系列第一讲》至《LFCS系列第十讲》并覆盖关于Ubuntu,CentOS以及openSUSE的下列话题。 - -- 第一讲:如何在Linux上使用GNU'sed'命令来创建、编辑和操作文件 -- 第二讲:如何安装和使用vi/m全功能文字编辑器 -- 第三讲:归档文件/目录和在文件系统中寻找文件 -- 第四讲:为存储设备分区,格式化文件系统和配置交换分区 -- 第五讲:在Linux中挂载/卸载本地和网络(Samba & NFS)文件系统 -- 第六讲:组合分区作为RAID设备——创建&管理系统备份 -- 第七讲:管理系统启动进程和服务(使用SysVinit, Systemd 和 Upstart) -- 第八讲:管理用户和组,文件权限和属性以及启用账户的sudo权限 -- 第九讲:Linux包管理与Yum,RPM,Apt,Dpkg,Aptitude,Zypper -- 第十讲:学习简单的Shell脚本和文件系统故障排除 - -本文是覆盖这个参加LFCS认证考试的所必需的范围和能力的十个教程的第一讲。话说了那么多,快打开你的终端,让我们开始吧! - -### 处理Linux中的文本流 ### - -Linux将程序中的输入和输出当成字符流或者字符序列。在开始理解重定向和管道之前,我们必须先了解三种最重要的I/O(Input and Output,输入和输出)流,事实上,它们都是特殊的文件(根据UNIX和Linux中的约定,数据流和外围设备或者设备文件也被视为普通文件)。 - -> (重定向操作符) 和 | (管道操作符)之间的区别是:前者将命令与文件相连接,而后者将命令的输出和另一个命令相连接。 - - # command > file - # command1 | command2 - -由于重定向操作符静默创建或覆盖文件,我们必须特别小心谨慎地使用它,并且永远不要把它和管道混淆起来。在Linux和UNIX系统上管道的优势是:第一个命令的输出不会写入一个文件而是直接被第二个命令读取。 - -在下面的操作练习中,我们将会使用这首诗——《A happy child》(匿名作者) - -![cat command](http://www.tecmint.com/wp-content/uploads/2014/10/cat-command.png) - -cat 命令样例 - -#### 使用 sed #### - -sed是流编辑器(stream editor)的缩写。为那些不懂术语的人额外解释一下,流编辑器是用来在一个输入流(文件或者管道中的输入)执行基本的文本转换的工具。 - -sed最基本的用法是字符替换。我们将通过把每个出现的小写y改写为大写Y并且将输出重定向到ahappychild2.txt开始。g标志表示sed应该替换文件每一行中所有应当替换的实例。如果这个标志省略了,sed将会只替换每一行中第一次出现的实例。 - -**基本语法:** - - # sed ‘s/term/replacement/flag’ file - -**我们的样例:** - - # sed ‘s/y/Y/g’ ahappychild.txt > ahappychild2.txt - -![sed command](http://www.tecmint.com/wp-content/uploads/2014/10/sed-command.png) - -sed 命令样例 - -如果你要在替换文本中搜索或者替换特殊字符(如/,\,&),你需要使用反斜杠对它进行转义。 - -例如,我们将会用一个符号来替换一个文字。与此同时,我们将把一行最开始出现的第一个I替换为You。 - - # sed 's/and/\&/g;s/^I/You/g' ahappychild.txt - -![sed replace string](http://www.tecmint.com/wp-content/uploads/2014/10/sed-replace-string.png) - -sed 替换字符串 - -在上面的命令中,^(插入符号)是众所周知用来表示一行开头的正则表达式。 - -正如你所看到的,我们可以通过使用分号分隔以及用括号包裹来把两个或者更多的替换命令(并在他们中使用正则表达式)链接起来。 - -另一种sed的用法是显示或者删除文件中选中的一部分。在下面的样例中,将会显示/var/log/messages中从6月8日开始的头五行。 - - # sed -n '/^Jun 8/ p' /var/log/messages | sed -n 1,5p - -请注意,在默认的情况下,sed会打印每一行。我们可以使用-n选项来覆盖这一行为并且告诉sed只需要打印(用p来表示)文件(或管道)中匹配的部分(第一种情况下行开头的第一个6月8日以及第二种情况下的一到五行*此处翻译欠妥,需要修正*)。 - -最后,可能有用的技巧是当检查脚本或者配置文件的时候可以保留文件本身并且删除注释。下面的单行sed命令删除(d)空行或者是开头为`#`的行(|字符返回两个正则表达式之间的布尔值)。 - - # sed '/^#\|^$/d' apache2.conf - -![sed match string](http://www.tecmint.com/wp-content/uploads/2014/10/sed-match-string.png) - -sed 匹配字符串 - -#### uniq C命令 #### - -uniq命令允许我们返回或者删除文件中重复的行,默认写入标准输出。我们必须注意到,除非两个重复的行相邻,否则uniq命令不会删除他们。因此,uniq经常和前序排序(此处翻译欠妥)(一种用来对文本行进行排序的算法)搭配使用。默认情况下,排序使用第一个字段(用空格分隔)作为关键字段。要指定一个不同的关键字段,我们需要使用-k选项。 - -**样例** - -du –sch /path/to/directory/* 命令将会以人类可读的格式返回在指定目录下每一个子文件夹和文件的磁盘空间使用情况(也会显示每个目录总体的情况),而且不是按照大小输出,而是按照子文件夹和文件的名称。我们可以使用下面的命令来让它通过大小排序。 - - # du -sch /var/* | sort –h - -![sort command](http://www.tecmint.com/wp-content/uploads/2014/10/sort-command.jpg) - -sort 命令样例 - -你可以通过使用下面的命令告诉uniq比较每一行的前6个字符(-w 6)(指定了不同的日期)来统计日志事件的个数,而且在每一行的开头输出出现的次数(-c)。 - - - # cat /var/log/mail.log | uniq -c -w 6 - -![Count Numbers in File](http://www.tecmint.com/wp-content/uploads/2014/10/count-numbers-in-file.jpg) - -统计文件中数字 - -最后,你可以组合使用sort和uniq命令(通常如此)。考虑下面文件中捐助者,捐助日期和金额的列表。假设我们想知道有多少个捐助者。我们可以使用下面的命令来分隔第一字段(字段由冒号分隔),按名称排序并且删除重复的行。 - - # cat sortuniq.txt | cut -d: -f1 | sort | uniq - -![Find Unique Records in File](http://www.tecmint.com/wp-content/uploads/2014/10/find-uniqu-records-in-file.jpg) - -寻找文件中不重复的记录 - -- 也可阅读: [13个“cat”命令样例][1] - -#### grep 命令 #### - -grep在文件(或命令输出)中搜索指定正则表达式并且在标准输出中输出匹配的行。 - -**样例** - -显示文件/etc/passwd中用户gacanepa的信息,忽略大小写。 - - # grep -i gacanepa /etc/passwd - -![grep Command](http://www.tecmint.com/wp-content/uploads/2014/10/grep-command.jpg) - -grep 命令样例 - -显示/etc文件夹下所有rc开头并跟随任意数字的内容。 - - # ls -l /etc | grep rc[0-9] - -![List Content Using grep](http://www.tecmint.com/wp-content/uploads/2014/10/list-content-using-grep.jpg) - -使用grep列出内容 - -- 也可阅读: [12个“grep”命令样例][2] - -#### tr 命令使用技巧 #### - -tr命令可以用来从标准输入中翻译(改变)或者删除字符并将结果写入到标准输出中。 - -**样例** - -把sortuniq.txt文件中所有的小写改为大写。 - - # cat sortuniq.txt | tr [:lower:] [:upper:] - -![Sort Strings in File](http://www.tecmint.com/wp-content/uploads/2014/10/sort-strings.jpg) - -排序文件中的字符串 - -压缩`ls –l`输出中的定界符至一个空格。 - # ls -l | tr -s ' ' - -![Squeeze Delimiter](http://www.tecmint.com/wp-content/uploads/2014/10/squeeze-delimeter.jpg) - -压缩分隔符 - -#### cut 命令使用方法 #### - -cut命令可以基于字节数(-b选项),字符(-c)或者字段(-f)提取部分输入(从标准输入或者文件中)并且将结果输出到标准输出。在最后一种情况下(基于字段),默认的字段分隔符是一个tab,但不同的分隔符可以由-d选项来指定。 - -**样例** - -从/etc/passwd中提取用户账户和他们被分配的默认shell(-d选项允许我们指定分界符,-f选项指定那些字段将被提取)。 - - # cat /etc/passwd | cut -d: -f1,7 - -![Extract User Accounts](http://www.tecmint.com/wp-content/uploads/2014/10/extract-user-accounts.jpg) - -提取用户账户 - -总结一下,我们将使用最后一个命令的输出中第一和第三个非空文件创建一个文本流。我们将使用grep作为第一过滤器来检查用户gacanepa的会话,然后将分隔符压缩至一个空格(tr -s ' ')。下一步,我们将使用cut来提取第一和第三个字段,最后使用第二个字段(本样例中,指的是IP地址)来排序之后再用uniq去重。 - - # last | grep gacanepa | tr -s ‘ ‘ | cut -d’ ‘ -f1,3 | sort -k2 | uniq - -![last command](http://www.tecmint.com/wp-content/uploads/2014/10/last-command.png) - -last 命令样例 - -上面的命令显示了如何将多个命令和管道结合起来以便根据我们的愿望得到过滤后的数据。你也可以逐步地使用它以帮助你理解输出是如何从一个命令传输到下一个命令的(顺便说一句,这是一个非常好的学习经验!) - -### 总结 ### - -尽管这个例子(以及在当前教程中的其他实例)第一眼看上去可能不是非常有用,但是他们是体验在Linux命令行中创建,编辑和操作文件的一个非常好的开始。请随时留下你的问题和意见——不胜感激! - -#### 参考链接 #### - -- [关于LFCS][3] -- [为什么需要Linux基金会认证?][4] -- [注册LFCS考试][5] - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/ - -作者:[Gabriel Cánepa][a] -译者:[Xuanwo](https://github.com/Xuanwo) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/13-basic-cat-command-examples-in-linux/ -[2]:http://www.tecmint.com/12-practical-examples-of-linux-grep-command/ -[3]:https://training.linuxfoundation.org/certification/LFCS -[4]:https://training.linuxfoundation.org/certification/why-certify-with-us -[5]:https://identity.linuxfoundation.org/user?destination=pid/1 \ No newline at end of file diff --git a/translated/tech/LFCS/Part 14 - Monitor Linux Processes Resource Usage and Set Process Limits on a Per-User Basis.md b/translated/tech/LFCS/Part 14 - Monitor Linux Processes Resource Usage and Set Process Limits on a Per-User Basis.md new file mode 100644 index 0000000000..c6db6be7cc --- /dev/null +++ b/translated/tech/LFCS/Part 14 - Monitor Linux Processes Resource Usage and Set Process Limits on a Per-User Basis.md @@ -0,0 +1,275 @@ +LFCS 系列第十四讲: Linux 进程资源使用监控和基于每个用户的进程限制设置 +============================================================================================= + +由于 2016 年 2 月 2 号开始启用了新的 LFCS 考试要求,我们在已经发表的 [LFCS 系列][1] 基础上增加了一些必要的主题。为了准备考试,同时也建议你看看 [LFCE 系列][2] 文章。 + +![](http://www.tecmint.com/wp-content/uploads/2016/03/Linux-Process-Monitoring-Set-Process-Limits-Per-User.png) +>第十四讲: 监控 Linux 进程并为每个用户设置进程限制 + +每个 Linux 系统管理员都应该知道如何验证硬件、资源和主要进程的完整性和可用性。另外,基于每个用户设置资源限制也是其中一项必备技能。 + +在这篇文章中,我们会介绍一些能够确保系统硬件和软件正常工作的方法,这些方法能够避免潜在的会导致生产环境下线或钱财损失的问题发生。 + +### 报告 Linux 进程统计信息 + +你可以使用 **mpstat** 单独查看每个处理器或者系统整体的活动,可以是每次一个快照或者动态更新。 + +为了使用这个工具,你首先需要安装 **sysstat**: + +``` +# yum update && yum install sysstat [基于 CentOS 的系统] +# aptitutde update && aptitude install sysstat [基于 Ubuntu 的系统] +# zypper update && zypper install sysstat [基于 openSUSE 的系统] +``` + +你可以在 [在 Linux 中学习 Sysstat 和其中的工具 mpstat、pidstat、iostat 和 sar][3] 了解更多和 sysstat 和其中的工具相关的信息。 + +安装完 **mpstat** 之后,就可以使用它生成处理器统计信息的报告。 + +你可以使用下面的命令每隔 2 秒显示所有 CPU(用 `-P` ALL 表示) 的 CPU 利用率(`-u`),共显示 **3** 次。 + +``` +# mpstat -P ALL -u 2 3 +``` + +### 事例输出 + +``` +Linux 3.19.0-32-generic (tecmint.com) Wednesday 30 March 2016 _x86_64_ (4 CPU) + +11:41:07 IST CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle +11:41:09 IST all 5.85 0.00 1.12 0.12 0.00 0.00 0.00 0.00 0.00 92.91 +11:41:09 IST 0 4.48 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 94.53 +11:41:09 IST 1 2.50 0.00 0.50 0.00 0.00 0.00 0.00 0.00 0.00 97.00 +11:41:09 IST 2 6.44 0.00 0.99 0.00 0.00 0.00 0.00 0.00 0.00 92.57 +11:41:09 IST 3 10.45 0.00 1.99 0.00 0.00 0.00 0.00 0.00 0.00 87.56 + +11:41:09 IST CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle +11:41:11 IST all 11.60 0.12 1.12 0.50 0.00 0.00 0.00 0.00 0.00 86.66 +11:41:11 IST 0 10.50 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 88.50 +11:41:11 IST 1 14.36 0.00 1.49 2.48 0.00 0.00 0.00 0.00 0.00 81.68 +11:41:11 IST 2 2.00 0.50 1.00 0.00 0.00 0.00 0.00 0.00 0.00 96.50 +11:41:11 IST 3 19.40 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 79.60 + +11:41:11 IST CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle +11:41:13 IST all 5.69 0.00 1.24 0.00 0.00 0.00 0.00 0.00 0.00 93.07 +11:41:13 IST 0 2.97 0.00 1.49 0.00 0.00 0.00 0.00 0.00 0.00 95.54 +11:41:13 IST 1 10.78 0.00 1.47 0.00 0.00 0.00 0.00 0.00 0.00 87.75 +11:41:13 IST 2 2.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 97.00 +11:41:13 IST 3 6.93 0.00 0.50 0.00 0.00 0.00 0.00 0.00 0.00 92.57 + +Average: CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle +Average: all 7.71 0.04 1.16 0.21 0.00 0.00 0.00 0.00 0.00 90.89 +Average: 0 5.97 0.00 1.16 0.00 0.00 0.00 0.00 0.00 0.00 92.87 +Average: 1 9.24 0.00 1.16 0.83 0.00 0.00 0.00 0.00 0.00 88.78 +Average: 2 3.49 0.17 1.00 0.00 0.00 0.00 0.00 0.00 0.00 95.35 +Average: 3 12.25 0.00 1.16 0.00 0.00 0.00 0.00 0.00 0.00 86.59 +``` + +要查看指定的 **CPU**(在下面的例子中是 **CPU 0**),可以使用: + +``` +# mpstat -P 0 -u 2 3 +``` + +### 事例输出 + +``` +Linux 3.19.0-32-generic (tecmint.com) Wednesday 30 March 2016 _x86_64_ (4 CPU) + +11:42:08 IST CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle +11:42:10 IST 0 3.00 0.00 0.50 0.00 0.00 0.00 0.00 0.00 0.00 96.50 +11:42:12 IST 0 4.08 0.00 0.00 2.55 0.00 0.00 0.00 0.00 0.00 93.37 +11:42:14 IST 0 9.74 0.00 0.51 0.00 0.00 0.00 0.00 0.00 0.00 89.74 +Average: 0 5.58 0.00 0.34 0.85 0.00 0.00 0.00 0.00 0.00 93.23 +``` + +上面命令的输出包括这些列: + +* `CPU`: 整数表示的处理器号或者 all 表示所有处理器的平局值。 +* `%usr`: 运行在用户级别的应用的 CPU 利用率百分数。 +* `%nice`: 和 `%usr` 相同,但有 nice 优先级。 +* `%sys`: 执行内核应用的 CPU 利用率百分比。这不包括用于处理中断或者硬件请求的时间。 +* `%iowait`: 指定(或所有) CPU 的空闲时间百分比,这表示当前 CPU 处于 I/O 操作密集的状态。更详细的解释(附带示例)可以查看[这里][4]。 +* `%irq`: 用于处理硬件中断的时间所占百分比。 +* `%soft`: 和 `%irq` 相同,但是软中断。 +* `%steal`: 当一个客户虚拟机在竞争 CPU 时,非自主等待(时间片窃取)所占时间的百分比。应该保持这个值尽可能小。如果这个值很大,意味着虚拟机正在或者将要停止运转。 +* `%guest`: 运行虚拟处理器所用的时间百分比。 +* `%idle`: CPU(s) 没有运行任何任务所占时间的百分比。如果你观察到这个值很小,意味着系统负载很重。在这种情况下,你需要查看详细的进程列表、以及下面将要讨论的内容来确定这是什么原因导致的。 + +运行下面的命令使处理器处于极高负载,然后在另一个终端执行 mpstat 命令: + +``` +# dd if=/dev/zero of=test.iso bs=1G count=1 +# mpstat -u -P 0 2 3 +# ping -f localhost # Interrupt with Ctrl + C after mpstat below completes +# mpstat -u -P 0 2 3 +``` + +最后,和 “正常” 情况下 **mpstat** 的输出作比较: + +![](http://www.tecmint.com/wp-content/uploads/2016/03/Report-Processors-Related-Statistics.png) +> Linux 处理器相关统计信息报告 + +正如你在上面图示中看到的,在前面两个例子中,根据 `%idle` 的值可以判断 **CPU 0** 负载很高。 + +在下一部分,我们会讨论如何识别资源饥饿型进程,如何获取更多和它们相关的信息,以及如何采取恰当的措施。 + +### Linux 进程报告 + +我们可以使用有名的 `ps` 命令,用 `-eo` 选项(根据用户定义格式选中所有进程) 和 `--sort` 选项(指定自定义排序顺序)按照 CPU 使用率排序列出进程,例如: + +``` +# ps -eo pid,ppid,cmd,%cpu,%mem --sort=-%cpu +``` + +上面的命令只会显示 `PID`、`PPID`、和进程相关的命令、 CPU 使用率以及 RAM 使用率,并按照 CPU 使用率降序排序。创建 .iso 文件的时候运行上面的命令,下面是输出的前面几行: + +![](http://www.tecmint.com/wp-content/uploads/2016/03/Find-Linux-Processes-By-CPU-Usage.png) +>根据 CPU 使用率查找进程 + +一旦我们找到了感兴趣的进程(例如 `PID=2822` 的进程),我们就可以进入 `/proc/PID`(本例中是 `/proc/2822`) 列出目录内容。 + +这个目录就是进程运行的时候保存多个关于该进程详细信息的文件和子目录的目录。 + +#### 例如: + +* `/proc/2822/io` 包括该进程的 IO 统计信息( IO 操作时的读写字符数)。 +* `/proc/2822/attr/current` 显示了进程当前的 SELinux 安全属性。 +* `/proc/2822/attr/current` shows the current SELinux security attributes of the process. +* `/proc/2822/cgroup` 如果启用了 CONFIG_CGROUPS 内核设置选项,这会显示该进程所属的控制组(简称 cgroups),你可以使用下面命令验证是否启用了 CONFIG_CGROUPS: + +``` +# cat /boot/config-$(uname -r) | grep -i cgroups +``` + +如果启用了该选项,你应该看到: + +``` +CONFIG_CGROUPS=y +``` + +根据 [红帽企业版 Linux 7 资源管理指南][5] 第一到四章的内容、[openSUSE 系统分析和调优指南][6] 第九章、[Ubuntu 14.04 服务器文档 Control Groups 章节][7],你可以使用 `cgroups` 管理每个进程允许使用的资源数目。 + +`/proc/2822/fd` 这个目录包含每个打开的描述进程的文件的符号链接。下面的截图显示了 tty1(第一个终端) 中创建 **.iso** 镜像进程的相关信息: + +![](http://www.tecmint.com/wp-content/uploads/2016/03/Find-Linux-Process-Information.png) +>查找 Linux 进程信息 + +上面的截图显示 **stdin**(文件描述符 **0**)、**stdout**(文件描述符 **1**)、**stderr**(文件描述符 **2**) 相应地被映射到 **/dev/zero**、 **/root/test.iso** 和 **/dev/tty1**。 + +更多关于 `/proc` 信息的可以查看 Kernel.org 维护的 “`/proc` 文件系统” 和 Linux 开发者手册。 + +### 在 Linux 中为每个用户设置资源限制 + +如果你不够小心、让任意用户使用不受限制的进程数,最终你可能会遇到意外的系统关机或者由于系统进入不可用的状态而被锁住。为了防止这种情况发生,你应该为用户可以启动的进程数目设置上限。 + +你可以在 **/etc/security/limits.conf** 文件末尾添加下面一行来设置限制: + +``` +* hard nproc 10 +``` + +第一个字段可以用来表示一个用户、组或者所有`(*)`, 第二个字段强制限制可以使用的进程数目(nproc) 为 **10**。退出并重新登录就可以使设置生效。 + +然后,让我们来看看非 root 用户(合法用户或非法用户) 试图引起 shell fork bomb[WiKi][12] 时会发生什么。如果我们没有设置限制, shell fork bomb 会无限制地启动函数的两个实例,然后无限循环地复制任意一个实例。最终导致你的系统卡死。 + +但是,如果使用了上面的限制,fort bomb 就不会成功,但用户仍然会被锁在外面直到系统管理员杀死相关的进程。 + +![](http://www.tecmint.com/wp-content/uploads/2016/03/Shell-Fork-Bomb.png) +>运行 Shell Fork Bomb + +**提示**: `limits.conf` 文件中可以查看其它 **ulimit** 可以更改的限制。 + +### 其它 Linux 进程管理工具 + +除了上面讨论的工具, 一个系统管理员还可能需要: + +**a)** 通过使用 **renice** 调整执行优先级(系统资源使用)。这意味着内核会根据分配的优先级(众所周知的 “**niceness**”,它是一个范围从 `-20` 到 `19` 的整数)给进程分配更多或更少的系统资源。 + +这个值越小,执行优先级越高。普通用户(而非 root)只能调高他们所有的进程的 niceness 值(意味着更低的优先级),而 root 用户可以调高或调低任何进程的 niceness 值。 + +renice 命令的基本语法如下: + +``` +# renice [-n] identifier +``` + +如果没有 new priority 后面的参数(为空),默认就是 PID。在这种情况下, **PID=identifier** 的进程的 niceness 值会被设置为 ``。 + +**b)** 需要的时候中断一个进程的正常执行。这也就是通常所说的 [“杀死”进程][9]。实质上,这意味着给进程发送一个信号使它恰当地结束运行并以有序的方式释放任何占用的资源。 + +按照下面的方式使用 **kill** 命令[杀死进程][10]: + +``` +# kill PID +``` + +另外,你也可以使用 [pkill][11] 结束指定用户`(-u)`、指定组`(-G)` 甚至有共同 PPID`(-P)` 的所有进程。这些选项后面可以使用数字或者名称表示的标识符。 + +``` +# pkill [options] identifier +``` + +例如: + +``` +# pkill -G 1000 +``` + +会杀死组 `GID=1000` 的所有进程。 + +而 + +``` +# pkill -P 4993 +``` + +会杀死 `PPID 是 4993` 的所有进程。 + +在运行 `pkill` 之前,先用 `pgrep` 测试结果、或者使用 `-l` 选项列出进程名称是一个很好的办法。它需要和 `pkill` 相同的参数、但是只会返回进程的 PID(而不会有其它操作),而 `pkill` 会杀死进程。 + +``` +# pgrep -l -u gacanepa +``` + +用下面的图片说明: + +![](http://www.tecmint.com/wp-content/uploads/2016/03/List-User-Running-Processes.png) +>在 Linux 中查找用户运行的进程 + +### 总结 + +在这篇文章中我们探讨了一些监控资源使用的方法,以便验证 Linux 系统中重要硬件和软件组件的完整性和可用性。 + +我们也学习了如何在特殊情况下采取恰当的措施(通过调整给定进程的执行优先级或者结束进程)。 + +我们希望本篇中介绍的概念能对你有所帮助。如果你有任何疑问或者评论,可以使用下面的联系方式联系我们。 + + + + + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.tecmint.com/author/gacanepa/ +[1]: http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/ +[2]: http://www.tecmint.com/installing-network-services-and-configuring-services-at-system-boot/ +[3]: http://www.tecmint.com/sysstat-commands-to-monitor-linux/ +[4]: http://veithen.github.io/2013/11/18/iowait-linux.html +[5]: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Resource_Management_Guide/index.html +[6]: https://doc.opensuse.org/documentation/leap/tuning/html/book.sle.tuning/cha.tuning.cgroups.html +[7]: https://help.ubuntu.com/lts/serverguide/cgroups.html +[8]: http://man7.org/linux/man-pages/man5/proc.5.html +[9]: http://www.tecmint.com/kill-processes-unresponsive-programs-in-ubuntu/ +[10]: http://www.tecmint.com/find-and-kill-running-processes-pid-in-linux/ +[11]: http://www.tecmint.com/how-to-kill-a-process-in-linux/ +[12]: https://en.wikipedia.org/wiki/Fork_bomb diff --git a/translated/tech/LFCS/Part 8 - LFCS--Managing Users and Groups File Permissions and Attributes and Enabling sudo Access on Accounts.md b/translated/tech/LFCS/Part 8 - LFCS--Managing Users and Groups File Permissions and Attributes and Enabling sudo Access on Accounts.md new file mode 100644 index 0000000000..5f511676af --- /dev/null +++ b/translated/tech/LFCS/Part 8 - LFCS--Managing Users and Groups File Permissions and Attributes and Enabling sudo Access on Accounts.md @@ -0,0 +1,333 @@ +GHLandy Translated + +LFCS 系列第八讲:管理用户和用户组、文件权限和属性以及启用账户 sudo 访问权限 + +================================================================================ + +去年八月份,Linux 基金会发起了全新的 LFCS(Linux Foundation Certified Sysadmin,Linux 基金会认证系统管理员)认证,旨在让世界各地的人能够参与到关于 Linux 系统中间层的基本管理操作的认证考试中去,这项认证包括:维护正在运行的系统和服务的能力、全面监控和分析的能力以及何时向上游团队请求支持的决策能力。 + +![Linux Users and Groups Management](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-8.png) + +LFCS 系列第八讲 + +请看以下视频,里边将描述 LFCS 认证程序。 + +注:youtube视频 + + +本讲是《十套教程》系列的第八讲,在这一讲中,我们将引导你学习如何在 Linux 管理用户和用户组权限的设置,这些内容是 LFCS 认证开始中的必备知识。 + +由于 Linux 是一个多用户的操作系统(允许多个用户通过不同主机或者终端访问一个独立系统),因此你需要知道如何才能有效地管理用户:如何添加、编辑、禁用和删除用户账户,并赋予他们足以完成自身任务的必要权限。 + +### 添加用户账户 ### + +添加新用户账户,你需要以 root 运行一下两条命令中的任意一条: + + # adduser [new_account] + # useradd [new_account] + +当新用户账户添加到系统时,会自动执行以下操作: + +1. 自动创建用户家目录(默认是 /home/username)。 + +2. 自动拷贝下列隐藏文件到新建用户的家目录,用来设置新用户会话的环境变量。 + + .bash_logout + .bash_profile + .bashrc + +3. 自动创建邮件缓存目录 /var/spool/mail/username。 + +4. 自动创建于用户名相同的用户组。 + +**理解 /etc/passwd 中的内容** + +/etc/passwd 文件中存储了所有用户账户的信息,每个用户在里边都有一条对应的记录,其格式(每个字段用冒号隔开)如下: + + [username]:[x]:[UID]:[GID]:[Comment]:[Home directory]:[Default shell] + +- 字段 [username] 和 [Comment] 是自解释的关系。 +- 第二个字段中 x 表明通过用户名 username 登录系统是有密码保护的, 密码保存在 /etc/shadow 文件中。 +- [UID] 和 [GID] 字段用整数表示,代表该用户的用户标识符和对应所在组的组标志符。 +- 字段 [Home directory] 为 username 用户家目录的绝对路径。 +- 字段 [Default shell] 指定用户登录系统时默认使用的 shell。 + +**理解 /etc/group 中的内容** + +/etc/group 文件存储所有用户组的信息。每行记录的格式如下: + + [Group name]:[Group password]:[GID]:[Group members] + +- [Group name] 为用户组名称。 +- 字段 [Group password] 为 x 的话,则说明不适用用户组密码。 +- [GID] 与 /etc/passwd 中保存的 GID 相同。 +- [Group members] 用户组中的用户使用逗号隔开。 + +![Add User Accounts in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/add-user-accounts.png) + +添加用户账户 + +添加用户账户之后,你可以使用 usermod 命令来修改用户信息中的部分字段,该命令基本语法如下: + + # usermod [options] [username] + +**设置账户的过期时间** + +通过 –expiredate 标记后边接 年-月-日 格式的日期,如下: + + # usermod --expiredate 2014-10-30 tecmint + +**将用户添加到其他组** + +使用 -aG 或者 –append –groups 选项,后边跟着用户组,如果有多个用户组,每个用户组之间使用逗号隔开。 + + # usermod --append --groups root,users tecmint + +**改变用户家目录的默认位置** + +使用 -d 或者 –home 选项,后边跟着新的家目录的绝对路径。 + + # usermod --home /tmp tecmint + +**改变用户的默认 shell** + +使用 –shell 选项,后边跟着新 shell 的路径。 + + # usermod --shell /bin/sh tecmint + +**显示用户所属的用户组** + + # groups tecmint + # id tecmint + +下面,我们一次运行上述命令: + + # usermod --expiredate 2014-10-30 --append --groups root,users --home /tmp --shell /bin/sh tecmint + +![usermod Command Examples](http://www.tecmint.com/wp-content/uploads/2014/10/usermod-command-examples.png) + +usermod 命令例示 + +扩展阅读 + +- [15 useradd Command Examples in Linux][1] +- [15 usermod Command Examples in Linux][2] + +对于已有用户账户,我们还可以: + +**通过锁定密码来禁用账户** + +使用 -L (大写 l)或者 –lock 选项来锁定用户密码。 + + # usermod --lock tecmint + +**解锁用户密码** + +使用 –u 或者 –unlock 选项来解锁我们之前锁定的账户。 + + # usermod --unlock tecmint + +![Lock User in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/lock-user-in-linux.png) + +锁定用户账户 + +**为需要对指定文件进行读写的多个用户建立用户组** + +运行下列几条命令来完成: + + # groupadd common_group # 添加新用户组 + # chown :common_group common.txt # 将 common.txt 的用户组修改为 common_group + # usermod -aG common_group user1 # 添加用户 user1 到 common_group 用户组 + # usermod -aG common_group user2 # 添加用户 user2 到 common_group 用户组 + # usermod -aG common_group user3 # 添加用户 user3 到 common_group 用户组 + +**删除用户组** + +通过以下命令删除用户组: + + # groupdel [group_name] + +属于这个 group_name 用户组的文件是不会被删除的,而仅仅是删除了用户组。 + +### Linux 文件权限 ### + +除了我们在 [Setting File Attributes – Part 3][3] 中说到的基本的读取、写入和执行权限外,文件还有一些不常用却很重要的的权限设置,有时候把它当做“特殊权限”。 + +就像之前我们讨论的基本权限,这里同样使用八进制数字或者一个字母(象征性符号)好表示该权限类型。 + +**删除用户账户** + +你可以通过 userdel --remove 命令来删除用户账户。这样会删除用户拥有的家目录和家目录下的所有文件,以及邮件缓存目录。 + + # userdel --remove [username] + +#### 用户组管理 #### + +每次添加新用户,系统会为该用户创建同名的用户组,此时用户组里边只有新建的用户,其他用户可以随后添加进去。建立用户组的目的之一,就是为了通过对指定资源设置权限来完成对这些资源和文件进行访问控制。 + +比如,你有下列用户: + +- user1 (primary group: user1) +- user2 (primary group: user2) +- user3 (primary group: user3) + +他们都需要对你系统里边某个位置的 common.txt 文件,或者 user1 用户刚刚创建的共享进行读写。你可能会运行下列命令: + + # chmod 660 common.txt + 或 + # chmod u=rw,g=rw,o= common.txt [注意最后那个 = 号和文件名之间的空格] + +然而,这样仅仅给文件所属的用户和用户组(本例为 user1)成员的提供了读写权限。你还需要将 user2 和 user3 添加到 user1 组,打这样做也将 user1 用户和用户组的其他文件的权限开放给了 user2 和 user3。 + +这时候,用户组就派上用场了,下面将演示怎么做。 + +**理解 Setuid 位** + +当为可执行文件设置 setuid 位之后,用户运行程序是会继承该程序属主的有效特权。由于这样做会引起安全风险,因此设置 setuid 权限的文件及程序必须尽量少。你会发现,当系统中有用户需要执行 root 用户所管辖的程序时就是设置了 setuid 权限。 + +也就是说,用户不仅仅可以运行这个可执行文件,而且能以 root 权限来运行。比如,先检查 /bin/passwd 的权限,这个可执行文件用于改变账户的密码,并修改 /etc/shadow 文件。超级用户可以改变任意账户的密码,但是其他用户只能改变自己账户的密码。 + +![passwd Command Examples](http://www.tecmint.com/wp-content/uploads/2014/10/passwd-command.png) + +passwd 命令例示 + +因此,所有用户都有权限运行 /bin/passwd,但只有 root 用户可以指定改变指定用户账户的密码。其他用户只能改变其自身的密码。 + +![Change User Password in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/change-user-password.png) + +修改用户密码 + +**理解 Setgid 位** + +设置 setgid 位之后,真实用户的有效 GID 变为属组的 GID。因此,任何用户都能以赋予属组用户的权限来访问文件。另外,当目录置了 setgid 位之后,新建的文件将继承其所属目录的 GID,并且新建的子目录会继承父目录的 setgid 位。通过这个方法,你能够以一个指定用户组的身份来访问该目录里边的文件,而不必管文件属主的主属组。 + + # chmod g+s [filename] + +以八进制形式来设置 setgid 位,在当前基本权限(或者想要设置的权限)前加上数字 2 就行了。 + + # chmod 2755 [directory] + +**给目录设置 SETGID 位** + +![Add Setgid in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/add-setgid-to-directory.png) + +给命令设置 setgid 位 + +**理解 Sticky 位** + +文件设置了 Sticky 为之后,Linux 会将文件忽略,对于该文件影响到的目录,除了属主或者 root 用户外,其他用户无法删除,甚至重命名目录中其他文件也不行。 + +# chmod o+t [directory] + +以八进制形式来设置 sticky 位,在当前基本权限(或者想要设置的权限)前加上数字 1 就行了。 + +# chmod 1755 [directory] + +若没有 sticky 位,任何有权限读写目录的用户都可删除和重命名文件。因此,sticky 为通常出现在像 /tmp 之类的目录,这些目录是所有人都具有写权限的。 + +![Add Stickybit in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/add-sticky-bit-to-directory.png) + +给目录设置 sticky 位 + +### Linux 特殊文件属性 ### + +文件还有其他一些属性,用来做进一步的操作限制。比如,阻止对文件的重命名、移动、删除甚至是修改。可以通过使用 [chattr 命令][4] 来设置,并可以使用 lsattr 工具来查看这些属性。设置如下: + + # chattr +i file1 + # chattr +a file2 + +运行这些命令之后,file1 成为不可变状态(即不可移动、重命名、修改或删除),而 file2 进入“仅追加”模式(仅在追加内容模式中打开)。 + +![Protect File from Deletion](http://www.tecmint.com/wp-content/uploads/2014/10/chattr-command.png) + +通过 Chattr 命令来包含文件 + +### 访问 root 账户并启用 sudo ### + +访问 root 账户的方法之一,就是通过输入: + + $ su + +然后输入 root 账户密码。 + +倘若授权成功,你将以 root 身份登录,工作目录则是登录前所在的位置。如果是想要一登录就自动进入 root 用户的家目录,请运行: + $ su - + +然后输入 root 账户密码。 + +![Enable sudo Access on Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Enable-Sudo-Access.png) + +为用户启用 sudo 访问权限 + +执行上个步骤需要普通用户知道 root 账户的密码,这样会引起非常严重的安全问题。于是,系统管理员通常会配置 sudo 命令来让普通用户在严格控制的环境中以其他用户身份(通常是 root)来执行命令。所有,可以在严格控制用户的情况下,又允许他运行一条或多条特权命令。 + +- 扩展阅读:[Difference Between su and sudo User][5] + +普通用户通过他自己的用户密码来完成 sudo 授权。输入命令之后会出现输入密码(并不是超级用户密码)的提示,授权成功(只要赋予了用户运行该命令的权限)的话,指定的命令就会运行。 + +系统管理员必须编辑 /etc/sudoers 文件,才能为 sudo 赋予相应权限。通常建议使用 visudo 命令来编辑这个文件,而不是使用文本编辑器来打开它。 + + # visudo + +这样会使用 vim(如果你按照 [Install and Use vim as Editor – Part 2][6] 里边说的来编辑文件)来打开 /etc/sudoers 文件。 + +以下是需要设置的相关的行: + + Defaults secure_path="/usr/sbin:/usr/bin:/sbin" + root ALL=(ALL) ALL + tecmint ALL=/bin/yum update + gacanepa ALL=NOPASSWD:/bin/updatedb + %admin ALL=(ALL) ALL + +来更加深入了解这些项: + + Defaults secure_path="/usr/sbin:/usr/bin:/sbin:/usr/local/bin" + +这一行指定 sudo 将要使用的目录,这样可以阻止使用用户指定的目录,那样的话可能会危及系统。 + +下一行是用来指定权限的: + + root ALL=(ALL) ALL + +- 第一个 ALL 关键词表明这条规则适用于所有主机。 +- 第二个 ALL 关键词表明第一个字段中指定的用户能以任何用户身份所具有的权限来运行相应命令。 +- 第三个 ALL 关键词表明可以运行任何命令。 + + tecmint ALL=/bin/yum update + +如果 = 号后边没有指定用户,sudo 则默认为 root 用户。本例中,tecmint 用户能以 root身份运行 yum update 命令。 + + gacanepa ALL=NOPASSWD:/bin/updatedb + +NOPASSWD 关键词表明 gacanepa 用户不需要密码,可以直接运行 /bin/updatedb 命令。 + + %admin ALL=(ALL) ALL + +% 符号表示该行应用 admin 用户组。其他部分的含义与对于用户的含义是一样的。本例表示 admin 用户组的成员可以通过任何主机的链接来运行任何命令。 + +通过 sudo -l 命令可以查看,你的账户拥有什么样的权限。 + +![Sudo Access Rules](http://www.tecmint.com/wp-content/uploads/2014/10/sudo-access-rules.png) + +Sudo 访问规则 + +### 总结 ### +对于系统管理员来说,高效能的用户和文件管理技能是非常必要的。本文已经涵盖了这些内容,我们希望你将这些作为一个开始,,然后慢慢进步。随时在下边发表评论或提问,我们会尽快回应的。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/manage-users-and-groups-in-linux/ + +作者:[Gabriel Cánepa][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/add-users-in-linux/ +[2]:http://www.tecmint.com/usermod-command-examples/ +[3]:http://www.tecmint.com/compress-files-and-finding-files-in-linux/ +[4]:http://www.tecmint.com/chattr-command-examples/ +[5]:http://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/ +[6]:http://www.tecmint.com/vi-editor-usage/ diff --git a/translated/tech/LFCS/Part 9 - LFCS--Linux Package Management with Yum RPM Apt Dpkg Aptitude and Zypper.md b/translated/tech/LFCS/Part 9 - LFCS--Linux Package Management with Yum RPM Apt Dpkg Aptitude and Zypper.md new file mode 100644 index 0000000000..2781dde63d --- /dev/null +++ b/translated/tech/LFCS/Part 9 - LFCS--Linux Package Management with Yum RPM Apt Dpkg Aptitude and Zypper.md @@ -0,0 +1,230 @@ +Flowsnow translating... +LFCS系列第九讲: 使用Yum, RPM, Apt, Dpkg, Aptitude, Zypper进行Linux包管理 +================================================================================ +去年八月, Linux基金会宣布了一个全新的LFCS(Linux Foundation Certified Sysadmin,Linux基金会认证系统管理员)认证计划,这对广大系统管理员来说是一个很好的机会,管理员们可以通过绩效考试来表明自己可以成功支持Linux系统的整体运营。 当需要的时候一个Linux基金会认证的系统管理员有足够的专业知识来确保系统高效运行,提供第一手的故障诊断和监视,并且为工程师团队在问题升级时提供智能决策。 + +![Linux Package Management](http://www.tecmint.com/wp-content/uploads/2014/11/lfcs-Part-9.png) + +Linux基金会认证系统管理员 – 第九讲 + +请观看下面关于Linux基金会认证计划的演示。 + +注:youtube 视频 + + +本文是本系列十套教程中的第九讲,今天在这篇文章中我们会引导你学习Linux包管理,这也是LFCS认证考试所需要的。 + +### 包管理 ### + +简单的说,包管理是系统中安装和维护软件的一种方法,其中维护也包含更新和卸载。 + +在Linux早期,程序只以源代码的方式发行,还带有所需的用户使用手册和必备的配置文件,甚至更多。现如今,大多数发行商使用默认的预装程序或者被称为包的程序集合。用户使用这些预装程序或者包来安装该发行版本。然而,Linux最伟大的一点是我们仍然能够获得程序的源代码用来学习、改进和编译。 + +**包管理系统是如何工作的** + +如果某一个包需要一定的资源,如共享库,或者需要另一个包,据说就会存在依赖性问题。所有现在的包管理系统提供了一些解决依赖性的方法,以确保当安装一个包时,相关的依赖包也安装好了 + +**打包系统** + +几乎所有安装在现代Linux系统上的软件都会在互联网上找到。它要么能够通过中央库(中央库能包含几千个包,每个包都已经构建、测试并且维护好了)发行商得到,要么能够直接得到可以下载和手动安装的源代码。 + +由于不同的发行版使用不同的打包系统(Debian的*.deb文件/ CentOS的*.rpm文件/ openSUSE的专门为openSUSE构建的*.rpm文件),因此为一个发行版本开发的包会与其他发行版本不兼容。然而,大多数发行版本都可能是LFCS认证的三个发行版本之一。 + +**高级和低级打包工具** + +为了有效地进行包管理的任务,你需要知道,你将有两种类型的实用工具:低级工具(能在后端实际安装,升级,卸载包文件),以及高级工具(负责确保能很好的执行依赖性解决和元数据检索的任务,元数据也称为关于数据的数据)。 + +注:表格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
发行版低级工具高级工具
 Debian版及其衍生版 dpkg apt-get / aptitude
 CentOS版 rpm yum
 openSUSE版 rpm zypper
+ +让我们来看下低级工具和高级工具的描述。 + +dpkg的是基于Debian系统中的一个低级包管理器。它可以安装,删除,提供有关资料,并建立*.deb包,但它不能自动下载并安装它们相应的依赖包。 + +- 阅读更多: [15个dpkg命令实例][1] + +apt-get是Debian和衍生版的高级包管理器,并提供命令行方式从多个来源检索和安装软件包,其中包括解决依赖性。和dpkg不同的是,apt-get不是直接基于.deb文件工作,而是基于包的正确名称。 + +- 阅读更多: [25个apt-get命令实力][2] + +Aptitude是基于Debian的系统的另一个高级包管理器,它可用于快速简便的执行管理任务(安装,升级和删除软件包,还可以自动处理解决依赖性)。与atp-get和额外的包管理器相比,它提供了相同的功能,例如提供对包的几个版本的访问。 + +rpm是Linux标准基础(LSB)兼容发布版使用的一种包管理器,用来对包进行低级处理。就像dpkg,rpm可以查询,安装,检验,升级和卸载软件包,并能被基于Fedora的系统频繁地使用,比如RHEL和CentOS。 + +- 阅读更多: [20个rpm命令实例][3] + +相对于基于RPM的系统,yum增加了系统自动更新的功能和带依赖性管理的包管理功能。作为一个高级工具,和apt-get或者aptitude相似,yum基于库工作。 + +- 阅读更多: [20个yum命令实例][4] +- +### 低级工具的常见用法 ### + +你用低级工具处理最常见的任务如下。 + +**1. 从已编译(*.deb或*.rpm)的文件安装一个包** + +这种安装方法的缺点是没有提供解决依赖性的方案。当你在发行版本库中无法获得某个包并且又不能通过高级工具下载安装时,你很可能会从一个已编译文件安装该包。因为低级工具不需要解决依赖性问题,所以当安装一个没有解决依赖性的包时会出现出错并且退出。 + + # dpkg -i file.deb [Debian版和衍生版] + # rpm -i file.rpm [CentOS版 / openSUSE版] + +**注意**: 不要试图在CentOS中安装一个为openSUSE构建的.rpm文件,反之亦然! + +**2. 从已编译文件中更新一个包** + +同样,当中央库中没有某安装包时,你只能手动升级该包。 + + # dpkg -i file.deb [Debian版和衍生版] + # rpm -U file.rpm [CentOS版 / openSUSE版] + +**3. 列举安装的包** + +当你第一次接触一个已经在工作中的系统时,很可能你会想知道安装了哪些包。 + + # dpkg -l [Debian版和衍生版] + # rpm -qa [CentOS版 / openSUSE版] + +如果你想知道一个特定的包安装在哪儿, 你可以使用管道命令从以上命令的输出中去搜索,这在这个系列的[操作Linux文件 – 第一讲][5] 中有介绍。假定我们需要验证mysql-common这个包是否安装在Ubuntu系统中。 + + # dpkg -l | grep mysql-common + +![Check Installed Packages in Linux](http://www.tecmint.com/wp-content/uploads/2014/11/Check-Installed-Package.png) + +检查安装的包 + +另外一种方式来判断一个包是否已安装。 + + # dpkg --status package_name [Debian版和衍生版] + # rpm -q package_name [CentOS版 / openSUSE版] + +例如,让我们找出sysdig包是否安装在我们的系统。 + + # rpm -qa | grep sysdig + +![Check sysdig Package](http://www.tecmint.com/wp-content/uploads/2014/11/Check-sysdig-Package.png) + +检查sysdig包 + +**4. 查询一个文件是由那个包安装的** + + # dpkg --search file_name + # rpm -qf file_name + +例如,pw_dict.hwm文件是由那个包安装的? + + # rpm -qf /usr/share/cracklib/pw_dict.hwm + +![Query File in Linux](http://www.tecmint.com/wp-content/uploads/2014/11/Query-File-in-Linux.png) + +Linux中查询文件 + +### 高级工具的常见用法 ### + +你用高级工具处理最常见的任务如下。 + +**1. 搜索包** + +aptitude更新将会更新可用的软件包列表,并且aptitude搜索会根据包名进行实际性的搜索。 + + # aptitude update && aptitude search package_name + +在搜索所有选项中,yum不仅可以通过包名还可以通过包的描述搜索程序包。 + + # yum search package_name + # yum search all package_name + # yum whatprovides “*/package_name” + +假定我们需要一个名为sysdig的包,要知道的是我们需要先安装然后才能运行。 + + # yum whatprovides “*/sysdig” + +![Check Package Description in Linux](http://www.tecmint.com/wp-content/uploads/2014/11/Check-Package-Description.png) + +检查包描述 + +whatprovides告诉yum搜索一个含有能够匹配上述正则表达式的文件的包。 + + # zypper refresh && zypper search package_name [在openSUSE上] + +**2. 从仓库安装一个包** + +当安装一个包时,在包管理器解决了所有依赖性问题后,可能会提醒你确认安装。需要注意的是运行更新或刷新(根据所使用的软件包管理器)不是绝对必要,但是考虑到安全性和依赖性的原因,保持安装的软件包是最新的是一个好的系统管理员的做法。 + + # aptitude update && aptitude install package_name [Debian版和衍生版] + # yum update && yum install package_name [CentOS版] + # zypper refresh && zypper install package_name [openSUSE版] + +**3. 卸载包** + +按选项卸载将会卸载软件包,但把配置文件保留完好,然而清除包从系统中完全删去该程序。 +# aptitude remove / purge package_name +# yum erase package_name + + ---注意要卸载的openSUSE包前面的减号 --- + + # zypper remove -package_name + +在默认情况下,大部分(如果不是全部)的包管理器会提示你,在你实际卸载之前你是否确定要继续卸载。所以,请仔细阅读屏幕上的信息,以避免陷入不必要的麻烦! + +**4. 显示包的信息** + +下面的命令将会显示birthday这个包的信息。 + + # aptitude show birthday + # yum info birthday + # zypper info birthday + +![Check Package Information in Linux](http://www.tecmint.com/wp-content/uploads/2014/11/Check-Package-Information.png) + +检查包信息 + +### 总结 ### + +作为一个系统管理员,包管理器是你不能回避的东西。你应该立即准备使用本文中介绍的这些工具。希望你在准备LFCS考试和日常工作中会觉得这些工具好用。欢迎在下面留下您的意见或问题,我们将尽可能快的回复你。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-package-management/ + +作者:[Gabriel Cánepa][a] +译者:[Flowsnow](https://github.com/Flowsnow) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/dpkg-command-examples/ +[2]:http://www.tecmint.com/useful-basic-commands-of-apt-get-and-apt-cache-for-package-management/ +[3]:http://www.tecmint.com/20-practical-examples-of-rpm-commands-in-linux/ +[4]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ +[5]:http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/ \ No newline at end of file diff --git a/translated/tech/LXD/Part 1 - LXD 2.0--Introduction to LXD.md b/translated/tech/LXD/Part 1 - LXD 2.0--Introduction to LXD.md new file mode 100644 index 0000000000..011f385881 --- /dev/null +++ b/translated/tech/LXD/Part 1 - LXD 2.0--Introduction to LXD.md @@ -0,0 +1,165 @@ +Part 1 - LXD 2.0: LXD 入门 +====================================== + +这是 [LXD 2.0 系列介绍文章][1]的第一篇。 + +![](https://linuxcontainers.org/static/img/containers.png) + + +### 关于 LXD 几个常见问题 + +#### 什么是 LXD ? + +简单地说, LXD 就是一个提供了 REST API 的 LXC 容器管理器。 + +LXD 最主要的目标就是使用 Linux 容器而不是硬件虚拟化向用户提供一种接近虚拟机的使用体验。 + +#### LXD 和 Docker/Rkt 又有什么关系呢 ? + +这是一个最常被问起的问题,现在就让我们直接指出其中的不同吧。 + +LXD 聚焦于系统容器,通常也被称为架构容器。这就是说 LXD 容器实际上如在裸机或虚拟机上运行一般运行了一个完整的 Linux 操作系统。 + +这些容器一般基于一个干净的发布镜像并会长时间运行。传统的配置管理工具和部署工具可以如在虚拟机、云和物理机器上一样与 LXD 一起使用。 + +相对的, Docker 关注于短期的、无状态的最小容器,这些容器通常并不会升级或者重新配置,而是作为一个整体被替换掉。这就使得 Docker 及类似项目更像是一种软件发布机制,而不是一个机器管理工具。 + +这两种模型并不是完全互斥的。你完全可以使用 LXD 为你的用户提供一个完整的 Linux 系统,而他们可以在 LXD 内安装 Docker 来运行他们想要的软件。 + + +#### 为什么要用 LXD? + +我们已经持续开发并改进 LXC 好几年了。 LXC 成功的实现了它的目标,它提供了一系列很棒的用于创建和管理容器的底层工具和库。 + +然而这些底层工具的使用界面对用户并不是很友好。使用它们需要用户有很多的基础知识以理解它们的工作方式和目的。同时,向后兼容旧的容器和部署策略也使得 LXC 无法默认使用一些安全特性,这导致用户需要进行更多人工操作来实现本可以自动完成的工作。 + +我们把 LXD 作为解决这些缺陷的一个很好的机会。作为一个长时间运行的守护进程, LXD 可以绕开 LXC 的许多限制,比如动态资源限制、无法进行容器迁移和高效的在线迁移;同时,它也为创造新的默认体验提供了机会:默认开启安全特性,对用户更加友好。 + + +### LXD 的主要组件 + +LXD 是由几个主要组件构成的,这些组件都是 LXD 目录结构、命令行客户端和 API 结构体里下可见的。 + +#### 容器 + +LXD 中的容器包括以下及部分: + +- 根文件系统 +- 设备:包括磁盘、unix 字符/块设备、网络接口 +- 一组继承而来的容器配置文件 +- 属性(容器架构,暂时的或持久的,容器名) +- 运行时状态(当时为了记录检查点、恢复时用到了 CRIU时) + +#### 快照 + +容器快照和容器是一回事,只不过快照是不可修改的,只能被重命名,销毁或者用来恢复系统,但是无论如何都不能被修改。 + +值得注意的是,因为我们允许用户保存容器的运行时状态,这就有效的为我们提供了“有状态”的快照的功能。这就是说我们可以使用快照回滚容器的 CPU 和内存。 + +#### 镜像 + +LXD 是基于镜像实现的,所有的 LXD 容器都是来自于镜像。容器镜像通常是一些纯净的 Linux 发行版的镜像,类似于你们在虚拟机和云实例上使用的镜像。 + +所以就可以「发布」容器:使用容器制作一个镜像并在本地或者远程 LXD 主机上使用。 + +镜像通常使用全部或部分 sha256 哈希码来区分。因为输入长长的哈希码对用户来说不好,所以镜像可以使用几个自身的属性来区分,这就使得用户在镜像商店里方便搜索镜像。别名也可以用来 1 对 1 地把对用户友好的名字映射到某个镜像的哈希码。 + +LXD 安装时已经配置好了三个远程镜像服务器(参见下面的远程一节): + +- “ubuntu:” 提供稳定版的 Ubuntu 镜像 +- “ubuntu-daily:” 提供每天构建出来的 Ubuntu +- “images:” 社区维护的镜像服务器,提供一系列的 Linux 发布版,使用的是上游 LXC 的模板 + +LXD 守护进程会从镜像上次被使用开始自动缓存远程镜像一段时间(默认是 10 天),超过时限后这些镜像才会失效。 + +此外, LXD 还会自动更新远程镜像(除非指明不更新),所以本地的镜像会一直是最新版的。 + + +#### 配置 + +配置文件是一种在一处定义容器配置和容器设备,然后应用到一系列容器的方法。 + +一个容器可以被应用多个配置文件。当构建最终容器配置时(即通常的扩展配置),这些配置文件都会按照他们定义顺序被应用到容器上,当有重名的配置时,新的会覆盖掉旧的。然后本地容器设置会在这些基础上应用,覆盖所有来自配置文件的选项。 + +LXD 自带两种预配置的配置文件: + +- 「 default 」配置是自动应用在所有容器之上,除非用户提供了一系列替代的配置文件。目前这个配置文件只做一件事,为容器定义 eth0 网络设备。 +- 「 docker” 」配置是一个允许你在容器里运行 Docker 容器的配置文件。它会要求 LXD 加载一些需要的内核模块以支持容器嵌套并创建一些设备入口。 + +#### 远程 + +如我之前提到的, LXD 是一个基于网络的守护进程。附带的命令行客户端可以与多个远程 LXD 服务器、镜像服务器通信。 + +默认情况下,我们的命令行客户端会与下面几个预定义的远程服务器通信: + +- local:(默认的远程服务器,使用 UNIX socket 和本地的 LXD 守护进程通信) +- ubuntu:( Ubuntu 镜像服务器,提供稳定版的 Ubuntu 镜像) +- ubuntu-daily:( Ubuntu 镜像服务器,提供每天构建出来的 Ubuntu ) +- images:( images.linuxcontainers.org 镜像服务器) + +所有这些远程服务器的组合都可以在命令行客户端里使用。 + +你也可以添加任意数量的远程 LXD 主机来监听网络。匿名的开放镜像服务器,或者通过认证可以管理远程容器的镜像服务器,都可以添加进来。 + +正是这种远程机制使得与远程镜像服务器交互及在主机间复制、移动容器成为可能。 + +### 安全性 + +我们设计 LXD 时的一个核心要求,就是在不修改现代 Linux 发行版的前提下,使容器尽可能的安全。 + +LXD 使用的、通过使用 LXC 库实现的主要安全特性有: + +- 内核名字空间。尤其是用户名字空间,它让容器和系统剩余部分完全分离。LXD 默认使用用户名字空间(和 LXC 相反),并允许用户在需要的时候以容器为单位打开或关闭。 +- Seccomp 系统调用。用来隔离潜在危险的系统调用。 +- AppArmor:对 mount、socket、ptrace 和文件访问提供额外的限制。特别是限制跨容器通信。 +- Capabilities。阻止容器加载内核模块,修改主机系统时间,等等。 +- CGroups。限制资源使用,防止对主机的 DoS 攻击。 + + +为了对用户友好 , LXD 构建了一个新的配置语言把大部分的这些特性都抽象封装起来,而不是如 LXC 一般直接将这些特性暴露出来。举了例子,一个用户可以告诉 LXD 把主机设备放进容器而不需要手动检查他们的主/次设备号来更新 CGroup 策略。 + +和 LXD 本身通信是基于使用 TLS 1.2 保护的链路,这些链路只允许使用有限的几个被允许的密钥。当和那些经过系统证书认证之外的主机通信时, LXD 会提示用户验证主机的远程足迹(SSH 方式),然后把足迹缓存起来以供以后使用。 + +### REST 接口 + +LXD 的工作都是通过 REST 接口实现的。在客户端和守护进程之间并没有其他的通讯手段。 + +REST 接口可以通过本地的 unix socket 访问,这只需要经过组认证,或者经过 HTTP 套接字使用客户端认证进行通信。 + +REST 接口的结构能够和上文所说的不同的组件匹配,是一种简单、直观的使用方法。 + +当需要一种复杂的通信机制时, LXD 将会进行 websocket 协商完成剩余的通信工作。这主要用于交互式终端会话、容器迁移和事件通知。 + +LXD 2.0 附带了 1.0 版的稳定 API。虽然我们在 1.0 版 API 添加了额外的特性,但是这不会在 1.0 版 API 的端点里破坏向后兼容性,因为我们会声明额外的 API 扩展使得客户端可以找到新的接口。 + +### 容器规模化 + +虽然 LXD 提供了一个很好的命令行客户端,但是这个客户端并不能管理多个主机上大量的容器。在这种使用情况下,我们可以使用 OpenStack 的 nova-lxd 插件,它可以使 OpenStack 像使用虚拟机一样使用 LXD 容器。 + +这就允许在大量的主机上部署大量的 LXD 容器,然后使用 OpenStack 的 API 来管理网络、存储以及负载均衡。 + +### 额外信息 + +LXD 的主站在: + +LXD 的 GitHub 仓库: + +LXD 的邮件列表: + +LXD 的 IRC 频道: #lxcontainers on irc.freenode.net + +如果你不想或者不能在你的机器上安装 LXD ,你可以在 web 上[试试在线版的 LXD] [2] 。 + +-------------------------------------------------------------------------------- + +via: https://www.stgraber.org/2016/03/11/lxd-2-0-introduction-to-lxd-112/ + +作者:[Stéphane Graber][a] +译者:[ezio](https://github.com/oska874) +校对:[PurlingNayuki](https://github.com/PurlingNayuki) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.stgraber.org/author/stgraber/ +[1]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[2]: https://linuxcontainers.org/lxd/try-it diff --git a/translated/tech/LXD/Part 2 - LXD 2.0--Installing and configuring LXD.md b/translated/tech/LXD/Part 2 - LXD 2.0--Installing and configuring LXD.md new file mode 100644 index 0000000000..fe386f3229 --- /dev/null +++ b/translated/tech/LXD/Part 2 - LXD 2.0--Installing and configuring LXD.md @@ -0,0 +1,233 @@ +Part 2 - LXD 2.0: 安装与配置 +================================================= + +这是 LXD 2.0 [系列介绍文章][2]的第二篇。 + +![](https://linuxcontainers.org/static/img/containers.png) + +### 安装篇 + +有很多种办法可以获得 LXD。我们推荐你配合最新版的 LXC 和 Linux 内核使用 LXD,这样就可以享受到它的全部特性。需要注意的是,我们现在也在慢慢的降低对旧版本 Linux 发布版的支持。 + +#### Ubuntu 标准版 + +所有新发布的 LXD 都会在发布几分钟后上传到 Ubuntu 开发版的安装源里。这个安装包然后就会当作种子给全部其他的安装包源,供 Ubuntu 用户使用。 + +如果使用 Ubuntu 16.04,可以直接安装: + +``` +sudo apt install lxd +``` + +如果运行的是 Ubuntu 14.04,则可以这样安装: + +``` +sudo apt -t trusty-backports install lxd +``` + +#### Ubuntu Core + +使用 Ubuntu Core 稳定版的用户可以使用下面的命令安装 LXD: + +``` +sudo snappy install lxd.stgraber +``` + +#### Ubuntu 官方 PPA + +使用其他 Ubuntu 发布版 —— 比如 Ubuntu 15.10 —— 的用户可以添加下面的 PPA(Personal Package Archive)来安装: + +``` +sudo apt-add-repository ppa:ubuntu-lxc/stable +sudo apt update +sudo apt dist-upgrade +sudo apt install lxd +``` + +#### Gentoo + +Gentoo 已经有了最新的 LXD 包,你可以直接安装: + +``` +sudo emerge --ask lxd +``` + +#### 使用源代码安装 + +如果你曾经编译过 Go 语言的项目,那么从源代码编译 LXD 并不是十分困难。然而注意,你需要 LXC 的开发头文件。为了运行 LXD, 你的发布版需也要使用比较新的内核(最起码是 3.13)、比较新的 LXC (1.1.4 或更高版本)、LXCFS 以及支持用户子 uid/gid 分配的 shadow。 + +从源代码编译 LXD 的最新教程可以在[上游 README][2]里找到。 + +### Ubuntu 上的网络配置 + +Ubuntu 的安装包会很方便的给你提供一个“lxdbr0”网桥。这个网桥默认是没有配置过的,只提供通过 HTTP 代理的 IPv6 的本地连接。 + +要配置这个网桥并添加 IPv4 、 IPv6 子网,你可以运行下面的命令: + +``` +sudo dpkg-reconfigure -p medium lxd +``` + +或者直接通过 LXD 初始化命令一步一步的配置: + +``` +sudo lxd init +``` + +### 存储后端 + +LXD 提供了许多集中存储后端。在开始使用 LXD 之前,你应该决定将要使用的后端,因为我们不支持在后端之间迁移已经生成的容器。 + +各个[后端特性比较表][3]可以在[这里][3]找到。 + +#### ZFS + +我们的推荐是 ZFS, 因为它能支持 LXD 的全部特性,同时提供最快和最可靠的容器体验。它包括了以容器为单位的磁盘配额,即时快照和恢复,优化了的迁移(发送/接收),以及快速从镜像创建容器的能力。它同时也被认为要比 btrfs 更成熟。 + +要和 LXD 一起使用 ZFS ,你需要首先在你的系统上安装 ZFS。 + +如果你是用的是 Ubuntu 16.04 , 你只需要简单的使用命令安装: + +``` +sudo apt install zfsutils-linux +``` + +在 Ubuntu 15.10 上你可以这样安装: + +``` +sudo apt install zfsutils-linux zfs-dkms +``` + +如果是更旧的版本,你需要从 zfsonlinux PPA 安装: + +``` +sudo apt-add-repository ppa:zfs-native/stable +sudo apt update +sudo apt install ubuntu-zfs +``` + +配置 LXD 只需要执行下面的命令: + +``` +sudo lxd init +``` + +这条命令接下来会向你提问一下一些 ZFS 的配置细节,然后为你配置好 ZFS。 + +#### btrfs + +如果 ZFS 不可用,那么 btrfs 可以提供相同级别的集成,但不会合理地报告容器内的磁盘使用情况(虽然配额仍然可用)。 + +btrfs 同时拥有很好的嵌套属性,而这是 ZFS 所不具有的。也就是说如果你计划在 LXD 中再使用 LXD,那么 btrfs 就很值得你考虑。 + +使用 btrfs 的话,LXD 不需要进行任何的配置,你只需要保证 `/var/lib/lxd` 保存在 btrfs 文件系统中,然后 LXD 就会自动为你使用 btrfs 了。 + +#### LVM + +如果 ZFS 和 btrfs 都不是你想要的,你还可以考虑使用 LVM 以获得部分特性。 LXD 会以自动精简配置的方式使用 LVM,为每个镜像和容器创建 LV,如果需要的话也会使用 LVM 的快照功能。 + +要配置 LXD 使用 LVM,需要创建一个 LVM VG,然后运行: + + +``` +lxc config set storage.lvm_vg_name "THE-NAME-OF-YOUR-VG" +``` + +默认情况下 LXD 使用 ext4 作为全部 LV 的文件系统。如果你喜欢的话可以改成 XFS: + +``` +lxc config set storage.lvm_fstype xfs +``` + +#### 简单目录 + +如果上面全部方案你都不打算使用,LXD 依然能在不使用任何高级特性情况下工作。它会为每个容器创建一个目录,然后在创建每个容器时解压缩镜像的压缩包,并在容器拷贝和快照时进行一次完整的文件系统拷贝。 + +除了磁盘配额以外的特性都是支持的,但是很浪费磁盘空间,并且非常慢。如果你没有其他选择,这还是可以工作的,但是你还是需要认真的考虑一下上面的几个替代方案。 + +### 配置篇 + +LXD 守护进程的完整配置项列表可以在[这里找到][4]。 + +#### 网络配置 + +默认情况下 LXD 不会监听网络。和它通信的唯一办法是通过 `/var/lib/lxd/unix.socket` 使用本地 unix socket 进行通信。 + +要让 LXD 监听网络,下面有两个有用的命令: + +``` +lxc config set core.https_address [::] +lxc config set core.trust_password some-secret-string +``` + +第一条命令将 LXD 绑定到 IPv6 地址 “::”,也就是监听机器的所有 IPv6 地址。你可以显式的使用一个特定的 IPv4 或者 IPv6 地址替代默认地址,如果你想绑定 TCP 端口(默认是 8443)的话可以在地址后面添加端口号即可。 + +第二条命令设置了密码,用于让远程客户端用来把自己添加到 LXD 可信证书中心。如果已经给主机设置了密码,当添加 LXD 主机时会提示输入密码,LXD 守护进程会保存他们的客户端的证书以确保客户端是可信的,这样就不需要再次输入密码(可以随时设置和取消)。 + +你也可以选择不设置密码,然后通过给每个客户端发送“client.crt”(来自于 `~/.config/lxc`)文件,然后把它添加到你自己的可信中信来实现人工验证每个新客户端是否可信,可以使用下面的命令: + +``` +lxc config trust add client.crt +``` + +#### 代理配置 + +大多数情况下,你会想让 LXD 守护进程从远程服务器上获取镜像。 + +如果你处在一个必须通过 HTTP(s) 代理链接外网的环境下,你需要对 LXD 做一些配置,或保证已在守护进程的环境中设置正确的 PROXY 环境变量。 + +``` +lxc config set core.proxy_http http://squid01.internal:3128 +lxc config set core.proxy_https http://squid01.internal:3128 +lxc config set core.proxy_ignore_hosts image-server.local +``` + +以上代码使所有 LXD 发起的数据传输都使用 squid01.internal HTTP 代理,但与在 image-server.local 的服务器的数据传输则是例外。 + +#### 镜像管理 + +LXD 使用动态镜像缓存。当从远程镜像创建容器的时候,它会自动把镜像下载到本地镜像商店,同时标志为已缓存并记录来源。几天后(默认 10 天)如果某个镜像没有被使用过,那么它就会自动地被删除。每个几小时(默认是 6 小时)LXD 还会检查一下这个镜像是否有新版本,然后更新镜像的本地拷贝。 + +所有这些都可以通过下面的配置选项进行配置: + +``` +lxc config set images.remote_cache_expiry 5 +lxc config set images.auto_update_interval 24 +lxc config set images.auto_update_cached false +``` + +这些命令让 LXD 修改了它的默认属性,缓存期替换为 5 天,更新间隔为 24 小时,而且只更新那些标记为自动更新的镜像(lxc 镜像拷贝被标记为 `–auto-update`)而不是 LXD 自动缓存的镜像。 + + +### 总结 + +到这里为止,你就应该有了一个可以工作的、最新版的 LXD,现在你可以开始用 LXD 了,或者等待我们的下一篇博文,我们会在其中介绍如何创建第一个容器以及使用 LXD 命令行工具操作容器。 + +### 额外信息 + +LXD 的主站在: + +LXD 的 GitHub 仓库: + +LXD 的邮件列表: + +LXD 的 IRC 频道: #lxcontainers on irc.freenode.net + +如果你不想或者不能在你的机器上安装 LXD ,你可以[试试在线版的 LXD][1]。 + +-------------------------------------------------------------------------------- + +via: https://www.stgraber.org/2016/03/15/lxd-2-0-installing-and-configuring-lxd-212/ + +作者:[Stéphane Graber][a] +译者:[ezio](https://github.com/oska874) +校对:[PurlingNayuki](https://github.com/PurlingNayuki) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.stgraber.org/author/stgraber/ +[0]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[1]: https://linuxcontainers.org/lxd/try-it +[2]: https://github.com/lxc/lxd/blob/master/README.md +[3]: https://github.com/lxc/lxd/blob/master/doc/storage-backends.md +[4]: https://github.com/lxc/lxd/blob/master/doc/configuration.md diff --git a/translated/tech/LXD/Part 3 - LXD 2.0--Your first LXD container.md b/translated/tech/LXD/Part 3 - LXD 2.0--Your first LXD container.md new file mode 100644 index 0000000000..4b6dcfd8aa --- /dev/null +++ b/translated/tech/LXD/Part 3 - LXD 2.0--Your first LXD container.md @@ -0,0 +1,438 @@ +kylepeng93 is translating +你的地一个LXD容器 +========================================== + +这是第三篇发布的博客[LXD2.0系列] +由于在管理LXD容器时涉及到大量的命令,所以这篇文章的篇幅是比较长的,如果你更喜欢使用同样的命令来快速的一步步实现整个过程,你可以[尝试我们的在线示例]! +![](https://linuxcontainers.org/static/img/containers.png) + +### 创建并启动一个新的容器 +正如我在先前的文章中提到的一样,LXD命令行客户端使用了少量的图片来做了一个预配置。Ubuntu的所有发行版和架构平台都拥有最好的官方图片,但是对于其他的发行版仍然有大量的非官方图片,那些图片都是由社区制作并且被LXC上层贡献者所维护。 +### Ubuntu +如果你想要支持最为完善的ubuntu版本,你可以按照下面的去做: +``` +lxc launch ubuntu: +``` +注意,这里所做的解释会随着ubuntu LTS的发布而变化。因此对于你使用的脚本应该取决于下面提到的具体你想要安装的版本: +###Ubuntu14.04 LTS +得到最新的,已经测试过的,稳定的ubuntu14.04 LTS镜像,你可以简单的执行: +``` +lxc launch ubuntu:14.04 +``` +这该模式下,一个任意的容器名将会被指定给它。 +如果你更喜欢指定一个你自己的命令,你可以这样做: +``` +lxc launch ubuntu:14.04 c1 +``` + +如果你想要指定一个特定的体系架构(非主要的),比如32位Intel镜像,你可以这样做: +``` +lxc launch ubuntu:14.04/i386 c2 +``` + +### 当前的Ubuntu开发版本 +上面使用的“ubuntu:”远程方式只会给你提供官方的并经过测试的ubuntu镜像。但是如果你想要未经测试过的日常构建版本,开发版可能对你来说是合适的,你将要使用“ubuntu-daily”来远程获取。 +``` +lxc launch ubuntu-daily:devel c3 +``` + +在这个例子中,最新的ubuntu开发版本将会被选自动选中。 +你也可以更加精确,比如你可以使用代号名: +``` +lxc launch ubuntu-daily:xenial c4 +``` + +### 最新的Alpine Linux +Alpine镜像在“Images:”远程中可用,可以通过如下命令执行: +``` +lxc launch images:alpine/3.3/amd64 c5 +``` + +### And many more +### 其他 +所有ubuntu镜像列表可以这样获得: +``` +lxc image list ubuntu: +lxc image list ubuntu-daily: +``` + +所有的非官方镜像: +``` +lxc image list images: +``` + +所有给定的可用远程别名清单可以这样获得(针对“ubuntu:”远程): +``` +lxc image alias list ubuntu: +``` + + +### 创建但不启动一个容器 +如果你想创建一个容器或者一批容器,但是你不想马上启动他们,你可以使用“lxc init”替换掉“lxc launch”。所有的选项都是相同的,唯一的不同就是它并不会在你创建完成之后启动容器。 +``` +lxc init ubuntu: +``` + +### 关于你的容器的信息 +### 列出所有的容器 +为了列出你的所有容器,你可以这样这做: +``` +lxc list +``` + +有大量的选项供你选择来改变被显示出来的列。在一个拥有大量容器的系统上,默认显示的列可能会有点慢(因为必须获取容器中的网络信息),你可以这样做来避免这种情况: +``` +lxc list --fast +``` + +上面的命令显示了一个不同的列的集合,这个集合在服务器端需要处理的信息更少。 +你也可以基于名字或者属性来过滤掉一些东西: +``` +stgraber@dakara:~$ lxc list security.privileged=true ++------+---------+---------------------+-----------------------------------------------+------------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++------+---------+---------------------+-----------------------------------------------+------------+-----------+ +| suse | RUNNING | 172.17.0.105 (eth0) | 2607:f2c0:f00f:2700:216:3eff:fef2:aff4 (eth0) | PERSISTENT | 0 | ++------+---------+---------------------+-----------------------------------------------+------------+-----------+ +``` + +在这个例子中,只有那些有特权(用户命名空间不可用)的容器才会被列出来。 +``` +stgraber@dakara:~$ lxc list --fast alpine ++-------------+---------+--------------+----------------------+----------+------------+ +| NAME | STATE | ARCHITECTURE | CREATED AT | PROFILES | TYPE | ++-------------+---------+--------------+----------------------+----------+------------+ +| alpine | RUNNING | x86_64 | 2016/03/20 02:11 UTC | default | PERSISTENT | ++-------------+---------+--------------+----------------------+----------+------------+ +| alpine-edge | RUNNING | x86_64 | 2016/03/20 02:19 UTC | default | PERSISTENT | ++-------------+---------+--------------+----------------------+----------+------------+ +``` + +在这个例子中,只有在名字中带有“alpine”的容器才会被列出来(支持复杂的正则表达式)。 +### 获取容器的详细信息 +由于list命令显然不能以一种友好的可读方式显示容器的所有信息,因此你可以使用如下方式来查询单个容器的信息: +``` +lxc info +``` + +例如: +``` +stgraber@dakara:~$ lxc info zerotier +Name: zerotier +Architecture: x86_64 +Created: 2016/02/20 20:01 UTC +Status: Running +Type: persistent +Profiles: default +Pid: 31715 +Processes: 32 +Ips: + eth0: inet 172.17.0.101 + eth0: inet6 2607:f2c0:f00f:2700:216:3eff:feec:65a8 + eth0: inet6 fe80::216:3eff:feec:65a8 + lo: inet 127.0.0.1 + lo: inet6 ::1 + lxcbr0: inet 10.0.3.1 + lxcbr0: inet6 fe80::c0a4:ceff:fe52:4d51 + zt0: inet 29.17.181.59 + zt0: inet6 fd80:56c2:e21c:0:199:9379:e711:b3e1 + zt0: inet6 fe80::79:e7ff:fe0d:5123 +Snapshots: + zerotier/blah (taken at 2016/03/08 23:55 UTC) (stateless) + ``` + +### 生命周期管理命令 +这些命令对于任何容器或者虚拟机管理器或许都是最普通的命令,但是它们仍然需要被涉及到。 +所有的这些命令在批量操作时都能接受多个容器名。 +### 启动 +启动一个容器就向下面一样简单: +``` +lxc start +``` + +### 停止 +停止一个容器可以这样来完成: +``` +lxc stop +``` + +如果容器不合作(即没有对发出的信号产生回应),这时候,你可以使用下面的方式强制执行: +``` +lxc stop --force +``` + +### 重启 +通过下面的命令来重启一个容器: +``` +lxc restart +``` + +如果容器不合作(即没有对发出的信号产生回应),你可以使用下面的方式强制执行: +``` +lxc restart --force +``` + +### 暂停 +你也可以“暂停”一个容器,在这种模式下,所有的容器任务将会被发送相同的信号,这也意味着他们将仍然是可见的,并且仍然会占用内存,但是他们不会从调度程序中得到任何的CPU时间片。 +如果你有一个CPU的饥饿容器,而这个容器需要一点时间来启动,但是你却并 不会经常用到它。这时候,你可以先启动它,然后将它暂停,并在你需要它的时候再启动它。 +``` +lxc pause +``` + +### 删除 +最后,如果你不需要这个容器了,你可以用下面的命令删除它: +``` +lxc delete +``` + +注意,如果容器还处于运行状态时你将必须使用“-forece”。 +### 容器的配置 +LXD拥有大量的容器配置设定,包括资源限制,容器启动控制以及对各种设备是否允许访问的配置选项。完整的清单因为太长所以并没有在本文中列出,但是,你可以从[here]获取它。 +就设备而言,LXD当前支持下面列出的这些设备: +- 磁盘 +既可以是一块物理磁盘,也可以只是一个被挂挂载到容器上的分区,还可以是一个来自主机的绑定挂载路径。 +- 网络接口卡 +一块网卡。它可以是一块桥接的虚拟网卡,或者是一块点对点设备,还可以是一块以太局域网设备或者一块已经被连接到容器的真实物理接口。 +- unix块 +一个UNIX块设备,比如/dev/sda +- unix字符 +一块UNIX字符设备,比如/dev/kvm +- none +这种特殊类型被用来隐藏那种可以通过profiles文件被继承的设备。 + +### 配置profiles文件 +所有可用的profiles的文件列表可以这样获取: +``` +lxc profile list +``` + +为了看到给定profile文件的内容,最简单的方式是这样做: +``` +lxc profile show +``` + +你可能想要改变文件里面的内容,可以这样做: +``` +lxc profile edit +``` + +你可以使用如下命令来改变profiles的列表并将这种变化应用到给定的容器中: +``` +lxc profile apply ,,,... +``` + +### 本地配置 +For things that are unique to a container and so don’t make sense to put into a profile, you can just set them directly against the container: + +``` +lxc config edit +``` + +上面的命令将会完成和“profile edit”命令一样的功能。 + +即使不在文本编辑器中打开整个文件的内容,你也可以像这样修改单独的键: +``` +lxc config set +``` +或者添加设备,例如 +``` +lxc config device add my-container kvm unix-char path=/dev/kvm +``` + +上面的命令将会为名为“my-container”的容器打开一个/dev/kvm入口。 +对一个profile文件使用“lxc profile set”和“lxc profile device add”命令也能实现上面的功能。 +#### 读取配置 +你可以使用如下命令来阅读容器的本地配置: +``` +lxc config show +``` + +或者得到已经被展开了的配置(包含了所有的键值): +``` +lxc config show --expanded +``` + +例如: +``` +stgraber@dakara:~$ lxc config show --expanded zerotier +name: zerotier +profiles: +- default +config: + security.nesting: "true" + user.a: b + volatile.base_image: a49d26ce5808075f5175bf31f5cb90561f5023dcd408da8ac5e834096d46b2d8 + volatile.eth0.hwaddr: 00:16:3e:ec:65:a8 + volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":100000,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":100000,"Nsid":0,"Maprange":65536}]' +devices: + eth0: + name: eth0 + nictype: macvlan + parent: eth0 + type: nic + limits.ingress: 10Mbit + limits.egress: 10Mbit + root: + path: / + size: 30GB + type: disk + tun: + path: /dev/net/tun + type: unix-char +ephemeral: false +``` + +这样做可以很方便的检查有哪些配置属性被应用到了给定的容器。 +### 实时配置更新 +注意,除非在文档中已经被明确指出,否则所有的键值和设备入口都会被应用到受影响的实时容器。这意味着你可以添加和移除某些设备或者在不重启容器的情况下修改正在运行的容器的安全profile配置文件。 +### 获得一个shell +LXD允许你对容器中的任务进行直接的操作。最常用的做法是在容器中得到一个shell或者执行一些管理员任务。 +和SSH相比,这样做的好处是你可以接触到独立与容器之外的网络或者任何一个软件又或者任何一个能够在容器内可见的文件配置。 +执行环境 +对比LXD在容器内执行命令的方式,有一点是不同的,那就是它自身并不是在容器中运行。这也意味着它不知道该使用什么样的shell,以及设置什么样的环境变量和哪里是它的家目录。 +通过LXD来执行命令必须总是在最小路径环境变量集并且HONE环境变量必须为/root的情况下以容器的超级用户身份来执行(即uid为0,gid为0)。 +其他的环境变量可以通过命令行来设置,或者在“environment.”配置文件中设置成永久环境变量。 +### 执行命令 +在容器中获得一个shell可以简单的执行下列命令得到: +``` +lxc exec bash +``` + +当然,这样做的前提是容器内已经安装了bash。 + +更多复杂的命令要求有对参数分隔符的合理使用。 +``` +lxc exec -- ls -lh / +``` + +如果想要设置或者重写变量,你可以使用“-env”参数,例如: +``` +stgraber@dakara:~$ lxc exec zerotier --env mykey=myvalue env | grep mykey +mykey=myvalue +``` + +### 管理文件 +因为LXD可以直接访问容器的文件系统,因此,它可以直接往容器中读取和写入任意文件。当我们需要提取日志文件或者与容器发生交互时,这个特性是很有用的。 +#### 从容器中取回一个文件 +想要从容器中获得一个文件,简单的执行下列命令: +``` +lxc file pull / +``` + +例如: +``` +stgraber@dakara:~$ lxc file pull zerotier/etc/hosts hosts +``` + +或者将它读取到标准输出: +``` +stgraber@dakara:~$ lxc file pull zerotier/etc/hosts - +127.0.0.1 localhost + +# 下面的所有行对于支持IPv6的主机是有用的 +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +ff02::3 ip6-allhosts +``` + +#### 向容器发送一个文件 + +发送会简单的以另一种方式完成: +``` +lxc file push / +``` + +#### 直接编辑一个文件 +当只是简单的提取一个给定的路径时,编辑是一个很方便的功能,在你的默认文本编辑器中打开它,这样在你关闭编辑器时会自动将编辑的内容保存到容器。 +``` +lxc file edit / +``` + +### 快照管理 +LXD允许你对容器执行快照功能并恢复它。快照包括了容器在某一时刻的完整状态(如果-stateful被使用的话将会包括运行状态),这也意味着所有的容器配置,容器设备和容器文件系统也会被包保存。 +#### 创建一个快照 +你可以使用下面的命令来执行快照功能: +``` +lxc snapshot +``` + +命令执行完成之后将会生成名为snapX(X为一个自动增长的数)的记录。 +除此之外,你还可以使用如下命令命名你的快照: +``` +lxc snapshot +``` + +#### 列出所有的快照 +一个容器的所有快照的数量可以使用“lxc list”来得到,但是真正的快照列表只能执行“lxc info”命令才能看到。 +``` +lxc info +``` + +#### 恢复快照 +为了恢复快照,你可以简单的执行下面的命令: +``` +lxc restore +``` + +#### 给快照重命名 +可以使用如下命令来给快照重命名: +``` +lxc move / / +``` + +#### 从快照中创建一个新的容器 +你可以使用快照来创建一个新的容器,而这个新的容器除了一些可变的信息将会被重置之外(例如MAC地址)其余所有信息都将和快照完全相同。 +``` +lxc copy / +``` + +#### 删除一个快照 + +最后,你可以执行下面的命令来删除一个快照: +``` +lxc delete / +``` + +### 克隆并重命名 +得到一个纯净的发行版镜像总是让人感到愉悦,但是,有时候你想要安装一系列的软件到你的容器中,这时,你需要配置它然后将它分割并分配到多个其他的容器中。 +#### 复制一个容器 +为了复制一个容器并有效的将它克隆到一个新的容器中,你可以执行下面的命令: +``` +lxc copy +``` +目标容器在所有方面将会完全和源容器等同。除非它没有 +目标容器在所有方面将会完全和源容器等同。除了新的容器没有任何源容器的快照以及一些可变值将会被重置之外(例如MAC地址)。 +#### 移除一个快照 +LXD允许你复制容器并在主机之间移动它。但是,关于这一点将在后面的文章中介绍。 +现在,“move”命令将会被用作给容器重命名。 +``` +lxc move +``` + +唯一的要求就是当容器被停止时,容器内的任何事情都会被保存成它本来的样子,包括可变化的信息(类似MAC地址等)。 +### 结论 +这篇如此长的文章介绍了大多数你可能会在日常操作中使用到的命令。 +很显然,那些如此之多的命令都会有额外的可以让你的命令更加有效率或者可以让你指定你的LXD容器的某个具体方面的参数。最好的学习这些命令的方式就是深入学习它们的帮助文档,当然。只是对于那些你真正需要用到的命令参数。 +### 额外的信息 +LXD的主要网站是: +Github上的开发说明: +邮件列表支持: +IRC支持: #lxcontainers on irc.freenode.net +如果你不想或者不能在你的机器上安装LXD,你可以[try it online instead][1]! + +-------------------------------------------------------------------------------- + +来自于:https://www.stgraber.org/2016/03/19/lxd-2-0-your-first-lxd-container-312/ +作者:[Stéphane Graber][a] +译者:[kylepeng93](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.stgraber.org/author/stgraber/ +[0]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[1]: https://linuxcontainers.org/lxd/try-it +[2]: https://github.com/lxc/lxd/blob/master/doc/configuration.md diff --git a/translated/tech/RHCSA/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md b/translated/tech/RHCSA/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md deleted file mode 100644 index 1436621c4e..0000000000 --- a/translated/tech/RHCSA/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md +++ /dev/null @@ -1,224 +0,0 @@ -RHCSA 系列: 如何管理RHEL7的用户和组 – Part 3 -================================================================================ -和管理其他Linux服务器一样,管理一个 RHEL 7 服务器 要求你能够添加,修改,暂停或删除用户帐户,并且授予他们文件,目录,其他系统资源所必要的权限。 -![User and Group Management in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/User-and-Group-Management-in-Linux.png) - -RHCSA: 用户和组管理 – Part 3 - -### 管理用户帐户## - -如果想要给RHEL 7 服务器添加账户,你需要以root用户执行如下两条命令 - - # adduser [new_account] - # useradd [new_account] - -当添加新的用户帐户时,默认会执行下列操作。 - -- 他/她 的主目录就会被创建(一般是"/home/用户名",除非你特别设置) -- 一些隐藏文件 如`.bash_logout`, `.bash_profile` 以及 `.bashrc` 会被复制到用户的主目录,并且会为用户的回话提供环境变量.你可以进一步查看他们的相关细节。 -- 会为您的账号添加一个邮件池目录 -- 会创建一个和用户名同样的组 - -用户帐户的全部信息被保存在`/etc/passwd `文件。这个文件以如下格式保存了每一个系统帐户的所有信息(以:分割) - [username]:[x]:[UID]:[GID]:[Comment]:[Home directory]:[Default shell] - -- `[username]` 和`[Comment]` 是用于自我解释的 -- ‘x’表示帐户的密码保护(详细在`/etc/shadow`文件),就是我们用于登录的`[username]`. -- `[UID]` 和`[GID]`是用于显示`[username]` 的 用户认证和主用户组。 - -最后, - -- `[Home directory]`显示`[username]`的主目录的绝对路径 -- `[Default shell]` 是当用户登录系统后使用的默认shell - -另外一个你必须要熟悉的重要的文件是存储组信息的`/etc/group`.因为和`/etc/passwd`类似,所以也是由:分割 - [Group name]:[Group password]:[GID]:[Group members] - - - -- `[Group name]` 是组名 -- 这个组是否使用了密码 (如果是"X"意味着没有). -- `[GID]`: 和`/etc/passwd`中一样 -- `[Group members]`:用户列表,使用,隔开。里面包含组内的所有用户 - -添加过帐户后,任何时候你都可以通过 usermod 命令来修改用户战壕沟,基础的语法如下: - # usermod [options] [username] - -相关阅读 - -- [15 ‘useradd’ Command Examples][1] -- [15 ‘usermod’ Command Examples][2] - -#### 示例1 : 设置帐户的过期时间 #### - -如果你的公司有一些短期使用的帐户或者你相应帐户在有限时间内使用,你可以使用 `--expiredate` 参数 ,后加YYYY-MM-DD格式的日期。为了查看是否生效,你可以使用如下命令查看 - # chage -l [username] - -帐户更新前后的变动如下图所示 -![Change User Account Information](http://www.tecmint.com/wp-content/uploads/2015/03/Change-User-Account-Information.png) - -修改用户信息 - -#### 示例 2: 向组内追加用户 #### - -除了创建用户时的主用户组,一个用户还能被添加到别的组。你需要使用 -aG或 -append -group 选项,后跟逗号分隔的组名 -#### 示例 3: 修改用户主目录或默认Shell #### - -如果因为一些原因,你需要修改默认的用户主目录(一般为 /home/用户名),你需要使用 -d 或 -home 参数,后跟绝对路径来修改主目录 -如果有用户想要使用其他的shell来取代bash(比如sh ),一般默认是bash .使用 usermod ,并使用 -shell 的参数,后加新的shell的路径 -#### 示例 4: 展示组内的用户 #### - -当把用户添加到组中后,你可以使用如下命令验证属于哪一个组 - - # groups [username] - # id [username] - -下面图片的演示了示例2到示例四 - -![Adding User to Supplementary Group](http://www.tecmint.com/wp-content/uploads/2015/03/Adding-User-to-Supplementary-Group.png) - -添加用户到额外的组 - -在上面的示例中: - - # usermod --append --groups gacanepa,users --home /tmp --shell /bin/sh tecmint - -如果想要从组内删除用户,省略 `--append` 切换,并且可以使用 `--groups` 来列举组内的用户 - -#### 示例 5: 通过锁定密码来停用帐户 #### - -如果想要关闭帐户,你可以使用 -l(小写的L)或 -lock 选项来锁定用户的密码。这将会阻止用户登录。 - -#### 示例 6: 解锁密码 #### - -当你想要重新启用帐户让他可以继续登录时,属于 -u 或 –unlock 选项来解锁用户的密码,就像示例5 介绍的那样 - - # usermod --unlock tecmint - -下面的图片展示了示例5和示例6 - -![Lock Unlock User Account](http://www.tecmint.com/wp-content/uploads/2015/03/Lock-Unlock-User-Account.png) - -锁定上锁用户 - -#### 示例 7:删除组和用户 #### - -如果要删除一个组,你需要使用 groupdel ,如果需要删除用户 你需要使用 userdel (添加 -r 可以删除主目录和邮件池的内容) - # groupdel [group_name] # 删除组 - # userdel -r [user_name] # 删除用户,并删除主目录和邮件池 - -如果一些文件属于组,他们将不会被删除。但是组拥有者将会被设置为删除掉的组的GID -### 列举,设置,并且修改 ugo/rwx 权限 ### - -著名的 [ls 命令][3] 是管理员最好的助手. 当我们使用 -l 参数, 这个工具允许您查看一个目录中的内容(或详细格式). - -而且,该命令还可以应用于单个文件中。无论哪种方式,在“ls”输出中的前10个字符表示每个文件的属性。 -这10个字符序列的第一个字符用于表示文件类型: - -- – (连字符): 一个标准文件 -- d: 一个目录 -- l: 一个符号链接 -- c: 字符设备(将数据作为字节流,即一个终端) -- b: 块设备(处理数据块,即存储设备) - -文件属性的下一个九个字符,分为三个组,被称为文件模式,并注明读(r),写(w),并执行(x)授予文件的所有者,文件的所有组,和其他的用户(通常被称为“世界”)。 -在文件的读取权限允许打开和读取相同的权限时,允许其内容被列出,如果还设置了执行权限,还允许它作为一个程序和运行。 -文件权限是通过chmod命令改变的,它的基本语法如下: - - # chmod [new_mode] file - -new_mode是一个八进制数或表达式,用于指定新的权限。适合每一个随意的案例。或者您已经有了一个更好的方式来设置文件的权限,所以你觉得可以自由地使用最适合你自己的方法。 -八进制数可以基于二进制等效计算,可以从所需的文件权限的文件的所有者,所有组,和世界。一定权限的存在等于2的幂(R = 22,W = 21,x = 20),没有时意为0。例如: -![File Permissions](http://www.tecmint.com/wp-content/uploads/2015/03/File-Permissions.png) - -文件权限 - -在八进制形式下设置文件的权限,如上图所示 - - # chmod 744 myfile - -请用一分钟来对比一下我们以前的计算,在更改文件的权限后,我们的实际输出为: - -![Long List Format](http://www.tecmint.com/wp-content/uploads/2015/03/Long-List-Format.png) - -长列表格式 - -#### 示例 8: 寻找777权限的文件 #### - -出于安全考虑,你应该确保在正常情况下,尽可能避免777权限(读、写、执行的文件)。虽然我们会在以后的教程中教你如何更有效地找到所有的文件在您的系统的权限集的说明,你现在仍可以使用LS grep获取这种信息。 -在下面的例子,我们会寻找 /etc 目录下的777权限文件. 注意,我们要使用第二章讲到的管道的知识[第二章:文件和目录管理][4]: - - # ls -l /etc | grep rwxrwxrwx - -![Find All Files with 777 Permission](http://www.tecmint.com/wp-content/uploads/2015/03/Find-All-777-Files.png) - -查找所有777权限的文件 - -#### 示例 9: 为所有用户指定特定权限 #### - -shell脚本,以及一些二进制文件,所有用户都应该有权访问(不只是其相应的所有者和组),应该有相应的执行权限(我们会讨论特殊情况下的问题): - # chmod a+x script.sh - -**注意**: 我们可以设置文件模式使用表示用户权限的字母如“u”,组所有者权限的字母“g”,其余的为o 。所有权限为a.权限可以通过`+` 或 `-` 来管理。 - -![Set Execute Permission on File](http://www.tecmint.com/wp-content/uploads/2015/03/Set-Execute-Permission-on-File.png) - -为文件设置执行权限 - -长目录列表还显示了该文件的所有者和其在第一和第二列中的组主。此功能可作为系统中文件的第一级访问控制方法: - -![Check File Owner and Group](http://www.tecmint.com/wp-content/uploads/2015/03/Check-File-Owner-and-Group.png) - -检查文件的属主和属组 - -改变文件的所有者,您将使用chown命令。请注意,您可以在同一时间或单独的更改文件的所有权: - # chown user:group file - -虽然可以在同一时间更改用户或组,或在同一时间的两个属性,但是不要忘记冒号区分,如果你想要更新其他属性,让另外的选项保持空白: - # chown :group file # Change group ownership only - # chown user: file # Change user ownership only - -#### 示例 10:从一个文件复制权限到另一个文件#### - -If you would like to “clone” ownership from one file to another, you can do so using the –reference flag, as follows: -如果你想“克隆”一个文件的所有权到另一个,你可以这样做,使用–reference参数,如下: - # chown --reference=ref_file file - -ref_file的所有信息会复制给 file - -![Clone File Ownership](http://www.tecmint.com/wp-content/uploads/2015/03/Clone-File-Ownership.png) - -复制文件属主信息 - -### 设置 SETGID 协作目录 ### - -你应该授予在一个特定的目录中拥有访问所有的文件的权限给一个特点的用户组,你将有可能使用目录设置setgid的方法。当setgid后设置,真实用户的有效GID成为团队的主人。 -因此,任何用户都可以访问该文件的组所有者授予的权限的文件。此外,当setgid设置在一个目录中,新创建的文件继承同一组目录,和新创建的子目录也将继承父目录的setgid。 - # chmod g+s [filename] - -为了设置 setgid 在八进制形式,预先准备好数字2 来给基本的权限 - # chmod 2755 [directory] - -### 总结 ### - -扎实的用户和组管理知识,符合规则的,Linux权限管理,以及部分实践,可以帮你快速解决RHEL 7 服务器的文件权限。 -我向你保证,当你按照本文所概述的步骤和使用系统文档(和第一章解释的那样 [Part 1: Reviewing Essential Commands & System Documentation][5] of this series) 你将掌握基本的系统管理的能力。 - -请随时让我们知道你是否有任何问题或意见使用下面的表格。 - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/rhcsa-exam-manage-users-and-groups/ - -作者:[Gabriel Cánepa][a] -译者:[xiqingongzi](https://github.com/xiqingongzi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/add-users-in-linux/ -[2]:http://www.tecmint.com/usermod-command-examples/ -[3]:http://www.tecmint.com/ls-interview-questions/ -[4]:http://www.tecmint.com/file-and-directory-management-in-linux/ -[5]:http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ diff --git a/translated/tech/RHCSA/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md b/translated/tech/RHCSA/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md deleted file mode 100644 index 8438ec0351..0000000000 --- a/translated/tech/RHCSA/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md +++ /dev/null @@ -1,258 +0,0 @@ -RHCSA 系列:使用 Nano 和 Vim 编辑文本文件/使用 grep 和 regexps 分析文本 – Part 4 -================================================================================ -作为系统管理员的日常职责的一部分,每个系统管理员都必须处理文本文件,这包括编辑现存文件(大多可能是配置文件),或创建新的文件。有这样一个说法,假如你想在 Linux 世界中挑起一场圣战,你可以询问系统管理员们,什么是他们最喜爱的编辑器以及为什么。在这篇文章中,我们并不打算那样做,但我们将向你呈现一些技巧,这些技巧对使用两款在 RHEL 7 中最为常用的文本编辑器: nano(由于其简单和易用,特别是对于新手来说) 和 vi/m(由于其自身的几个特色使得它不仅仅是一个简单的编辑器)来说都大有裨益。我确信你可以找到更多的理由来使用其中的一个或另一个,或许其他的一些编辑器如 emacs 或 pico。这完全取决于你。 - -![学习 Nano 和 vi 编辑器](http://www.tecmint.com/wp-content/uploads/2015/03/Learn-Nano-and-vi-Editors.png) - -RHCSA: 使用 Nano 和 Vim 编辑文本文件 – Part 4 - -### 使用 Nano 编辑器来编辑文件 ### - -要启动 nano,你可以在命令提示符下输入 `nano`,或选择性地跟上一个文件名(在这种情况下,若文件存在,它将在编辑模式中被打开)。若文件不存在,或我们省略了文件名, nano 也将在 编辑模式下开启,但将为我们开启一个空白屏以便开始输入: - -![Nano 编辑器](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Editor.png) - -Nano 编辑器 - -正如你在上一张图片中所见的那样, nano 在屏幕的底部呈现出一些功能,它们可以通过暗指的快捷键来触发(^,即插入记号,代指 Ctrl 键)。它们中的一些是: - -- Ctrl + G: 触发一个帮助菜单,带有一个关于功能和相应的描述的完整列表; -- Ctrl + X: 离开当前文件,假如更改没有被保存,则它们将被丢弃; -- Ctrl + R: 通过指定一个完整的文件路径,让你选择一个文件来将该文件的内容插入到当前文件中; - -![Nano 编辑器帮助菜单](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Help.png) - -Nano 编辑器帮助菜单 - -- Ctrl + O: 保存更改到一个文件。它将让你用一个与源文件相同或不同的名称来保存该文件,然后按 Enter 键来确认。 - -![Nano 编辑器保存更改模式](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Save-Changes.png) - -Nano 编辑器的保存更改模式 - -- Ctrl + X: 离开当前文件,假如更改没有被保存,则它们将被丢弃; -- Ctrl + R: 通过指定一个完整的文件路径,让你选择一个文件来将该文件的内容插入到当前文件中; - -![Nano: 插入文件内容到主文件中](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-File-Content.png) - -Nano: 插入文件内容到主文件中 - -上图的操作将把 `/etc/passwd` 的内容插入到当前文件中。 - -- Ctrl + K: 剪切当前行; -- Ctrl + U: 粘贴; -- Ctrl + C: 取消当前的操作并返回先前的屏幕; - -为了轻松地在打开的文件中浏览, nano 提供了下面的功能: - -- Ctrl + F 和 Ctrl + B 分别先前或向后移动光标;而 Ctrl + P 和 Ctrl + N 则分别向上或向下移动一行,功能与箭头键相同; -- Ctrl + space 和 Alt + space 分别向前或向后移动一个单词; - -最后, - -- 假如你想将光标移动到文档中的特定位置,使用 Ctrl + _ (下划线) 并接着输入 X,Y 将准确地带你到 第 X 行,第 Y 列。 - -![在 nano 中定位到具体的行,列](http://www.tecmint.com/wp-content/uploads/2015/03/Column-Numbers.png) - -在 nano 中定位到具体的行和列 - -上面的例子将带你到当前文档的第 15 行,第 14 列。 - -假如你可以回忆起你早期的 Linux 岁月,特别是当你刚从 Windows 迁移到 Linux 中,你就可能会同意:对于一个新手来说,使用 nano 来开始学习是最好的方式。 - -### 使用 Vim 编辑器来编辑文件 ### - - -Vim 是 vi 的加强版本,它是 Linux 中一个著名的文本编辑器,可在所有兼容 POSIX 的 *nix 系统中获取到,例如在 RHEL 7 中。假如你有机会并可以安装 Vim,请继续;假如不能,这篇文章中的大多数(若不是全部)的提示也应该可以正常工作。 - -Vim 的一个出众的特点是可以在多个不同的模式中进行操作: - -- 命令模式将允许你在文件中跳转和输入命令,这些命令是由一个或多个字母组成的简洁且对大小写敏感的组合。假如你想重复执行某个命令特定次,你可以在这个命令前加上需要重复的次数(这个规则只有极少数例外)。例如, yy(或 Y,yank 的缩写)可以复制整个当前行,而 4yy(或 4Y)则复制整个当前行到接着的 3 行(总共 4 行)。 -- 在 ex 模式中,你可以操作文件(包括保存当前文件和运行外部的程序或命令)。要进入 ex 模式,你必须在命令模式前(或其他词前,Esc + :)输入一个冒号(:),再直接跟上你想使用的 ex 模式命令的名称。 -- 对于插入模式,可以输入字母 i 进入,我们只需要输入文字即可。大多数的键击结果都将出现在屏幕中的文本中。 -- 我们总是可以通过敲击 Esc 键来进入命令模式(无论我们正工作在哪个模式下)。 - -现在,让我们看看如何在 vim 中执行在上一节列举的针对 nano 的相同的操作。不要忘记敲击 Enter 键来确认 vim 命令。 - -为了从命令行中获取 vim 的完整手册,在命令模式下键入 `:help` 并敲击 Enter 键: - -![vim 编辑器帮助菜单](http://www.tecmint.com/wp-content/uploads/2015/03/vim-Help-Menu.png) - -vim 编辑器帮助菜单 - -上面的小节呈现出一个目录列表,而定义过的小节则主要关注 Vim 的特定话题。要浏览某一个小节,可以将光标放到它的上面,然后按 Ctrl + ] (闭方括号)。注意,底部的小节展示的是当前文件的内容。 - -1. 要保存更改到文件,在命令模式中运行下面命令中的任意一个,就可以达到这个目的: - -``` -:wq! -:x! -ZZ (是的,两个 ZZ,前面无需添加冒号) -``` - -2. 要离开并丢弃更改,使用 `:q!`。这个命令也将允许你离开上面描述过的帮助菜单,并返回到命令模式中的当前文件。 - -3. 剪切 N 行:在命令模式中键入 `Ndd`。 - -4. 复制 M 行:在命令模式中键入 `Myy`。 - -5. 粘贴先前剪贴或复制过的行:在命令模式中按 `P`键。 - -6. 要插入另一个文件的内容到当前文件: - - :r filename - -例如,插入 `/etc/fstab` 的内容,可以这样做: - -[在 vi 编辑器中插入文件的内容](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-Content-vi-Editor.png) - -在 vi 编辑器中插入文件的内容 - -7. 插入一个命名的输出到当前文档: - - :r! command - -例如,要在光标所在的当前位置后面插入日期和时间: - -![在 vi 编辑器中插入时间和日期](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-Time-and-Date-in-vi-Editor.png) - -在 vi 编辑器中插入时间和日期 - -在另一篇我写的文章中,([LFCS 系列的 Part 2][1]),我更加详细地解释了在 vim 中可用的键盘快捷键和功能。或许你可以参考那个教程来查看如何使用这个强大的文本编辑器的更深入的例子。 - -### 使用 Grep 和正则表达式来分析文本 ### - -到现在为止,你已经学习了如何使用 nano 或 vim 创建和编辑文件。打个比方说,假如你成为了一个文本编辑器忍者 – 那又怎样呢? 在其他事情上,你也需要知道如何在文本中搜索正则表达式。 - -正则表达式(也称为 "regex" 或 "regexp") 是一种识别一个特定文本字符串或模式的方式,使得一个程序可以将这个模式和任意的文本字符串相比较。尽管利用 grep 来使用正则表达式值得用一整篇文章来描述,这里就让我们复习一些基本的知识: - -**1. 最简单的正则表达式是一个由数字和字母构成的字符串(即,单词 "svm") 或两个(在使用两个字符串时,你可以使用 `|`(或) 操作符):** - - # grep -Ei 'svm|vmx' /proc/cpuinfo - -上面命令的输出结果中若有这两个字符串之一的出现,则标志着你的处理器支持虚拟化: - -![正则表达式示例](http://www.tecmint.com/wp-content/uploads/2015/03/Regular-Expression-Example.png) - -正则表达式示例 - -**2. 第二种正则表达式是一个范围列表,由方括号包裹。** - -例如, `c[aeiou]t` 匹配字符串 cat,cet,cit,cot 和 cut,而 `[a-z]` 和 `[0-9]` 则相应地匹配小写字母或十进制数字。假如你想重复正则表达式 X 次,在正则表达式的后面立即输入 `{X}`即可。 - -例如,让我们从 `/etc/fstab` 中析出存储设备的 UUID: - - # grep -Ei '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' -o /etc/fstab - -![在 Linux 中从一个文件中析出字符串](http://www.tecmint.com/wp-content/uploads/2015/03/Extract-String-from-a-File.png) - -从一个文件中析出字符串 - -方括号中的第一个表达式 `[0-9a-f]` 被用来表示小写的十六进制字符,`{8}`是一个量词,暗示前面匹配的字符串应该重复的次数(在一个 UUID 中的开头序列是一个 8 个字符长的十六进制字符串)。 - -在圆括号中,量词 `{4}`和连字符暗示下一个序列是一个 4 个字符长的十六进制字符串,接着的量词 `({3})`表示前面的表达式要重复 3 次。 - -最后,在 UUID 中的最后一个 12 个字符长的十六进制字符串可以由 `[0-9a-f]{12}` 取得, `-o` 选项表示只打印出在 `/etc/fstab`中匹配行中的匹配的(非空)部分。 - -**3. POSIX 字符类 ** - -注:表格 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
字符类匹配 …
 [[:alnum:]] 任意字母或数字 [a-zA-Z0-9]
 [[:alpha:]] 任意字母 [a-zA-Z]
 [[:blank:]] 空格或制表符
 [[:cntrl:]] 任意控制字符 (ASCII 码的 0 至 32)
 [[:digit:]] 任意数字 [0-9]
 [[:graph:]] 任意可见字符
 [[:lower:]] 任意小写字母 [a-z]
 [[:print:]] 任意非控制字符 -
 [[:space:]] 任意空格
 [[:punct:]] 任意标点字符
 [[:upper:]] 任意大写字母 [A-Z]
 [[:xdigit:]] 任意十六进制数字 [0-9a-fA-F]
 [:word:] 任意字母,数字和下划线 [a-zA-Z0-9_]
- -例如,我们可能会对查找已添加到我们系统中给真实用户的 UID 和 GID(参考这个系列的 [Part 2][2]来回忆起这些知识)感兴趣。那么,我们将在 `/etc/passwd` 文件中查找 4 个字符长的序列: - - # grep -Ei [[:digit:]]{4} /etc/passwd - -![在文件中查找一个字符串](http://www.tecmint.com/wp-content/uploads/2015/03/Search-For-String-in-File.png) - -在文件中查找一个字符串 - -上面的示例可能不是真实世界中使用正则表达式的最好案例,但它清晰地启发了我们如何使用 POSIX 字符类来使用 grep 分析文本。 - -### 总结 ### - - -在这篇文章中,我们已经提供了一些技巧来最大地利用针对命令行用户的两个文本编辑器 nano 和 vim,这两个工具都有相关的扩展文档可供阅读,你可以分别查询它们的官方网站(链接在下面给出)以及使用这个系列中的 [Part 1][3] 给出的建议。 - -#### 参考文件链接 #### - -- [http://www.nano-editor.org/][4] -- [http://www.vim.org/][5] - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/rhcsa-exam-how-to-use-nano-vi-editors/ - -作者:[Gabriel Cánepa][a] -译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/vi-editor-usage/ -[2]:http://www.tecmint.com/file-and-directory-management-in-linux/ -[3]:http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ -[4]:http://www.nano-editor.org/ -[5]:http://www.vim.org/ diff --git a/translated/tech/RHCSA/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md b/translated/tech/RHCSA/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md deleted file mode 100644 index 91e2482e49..0000000000 --- a/translated/tech/RHCSA/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md +++ /dev/null @@ -1,214 +0,0 @@ -RHECSA 系列:RHEL7 中的进程管理:开机,关机,以及两者之间的所有其他事项 – Part 5 -================================================================================ -我们将概括和简要地复习从你按开机按钮来打开你的 RHEL 7 服务器到呈现出命令行界面的登录屏幕之间所发生的所有事情,以此来作为这篇文章的开始。 - -![RHEL 7 开机过程](http://www.tecmint.com/wp-content/uploads/2015/03/RHEL-7-Boot-Process.png) - -Linux 开机过程 - -**请注意:** - -1. 相同的基本原则也可以应用到其他的 Linux 发行版本中,但可能需要较小的更改,并且 -2. 下面的描述并不是旨在给出开机过程的一个详尽的解释,而只是介绍一些基础的东西 - -### Linux 开机过程 ### - -1.初始化 POST(加电自检)并执行硬件检查; - -2.当 POST 完成后,系统的控制权将移交给启动管理器的第一阶段,它存储在一个硬盘的引导扇区(对于使用 BIOS 和 MBR 的旧式的系统)或存储在一个专门的 (U)EFI 分区上。 - -3.启动管理器的第一阶段完成后,接着进入启动管理器的第二阶段,通常大多数使用的是 GRUB(GRand Unified Boot Loader 的简称),它驻留在 `/boot` 中,反过来加载内核和驻留在 RAM 中的初始化文件系统(被称为 initramfs,它包含执行必要操作所需要的程序和二进制文件,以此来最终挂载真实的根文件系统)。 - -4.接着经历了闪屏过后,呈现在我们眼前的是类似下图的画面,它允许我们选择一个操作系统和内核来启动: - -![RHEL 7 开机屏幕](http://www.tecmint.com/wp-content/uploads/2015/03/RHEL-7-Boot-Screen.png) - -启动菜单屏幕 - -5.然后内核对挂载到系统的硬件进行设置,一旦根文件系统被挂载,接着便启动 PID 为 1 的进程,反过来这个进程将初始化其他的进程并最终呈现给我们一个登录提示符界面。 - -注意:假如我们想在后面这样做(注:这句话我总感觉不通顺,不明白它的意思,希望改一下),我们可以使用 [dmesg 命令][1](注:这篇文章已经翻译并发表了,链接是 https://linux.cn/article-3587-1.html )并使用这个系列里的上一篇文章中解释过的工具(注:即 grep)来过滤它的输出。 - -![登录屏幕和进程的 PID](http://www.tecmint.com/wp-content/uploads/2015/03/Login-Screen-Process-PID.png) - -登录屏幕和进程的 PID - -在上面的例子中,我们使用了众所周知的 `ps` 命令来显示在系统启动过程中的一系列当前进程的信息,它们的父进程(或者换句话说,就是那个开启这些进程的进程) 为 systemd(大多数现代的 Linux 发行版本已经切换到的系统和服务管理器): - - # ps -o ppid,pid,uname,comm --ppid=1 - -记住 `-o`(为 -format 的简写)选项允许你以一个自定义的格式来显示 ps 的输出,以此来满足你的需求;这个自定义格式使用 man ps 里 STANDARD FORMAT SPECIFIERS 一节中的特定关键词。 - -另一个你想自定义 ps 的输出而不是使用其默认输出的情形是:当你需要找到引起 CPU 或内存消耗过多的那些进程,并按照下列方式来对它们进行排序时: - - # ps aux --sort=+pcpu # 以 %CPU 来排序(增序) - # ps aux --sort=-pcpu # 以 %CPU 来排序(降序) - # ps aux --sort=+pmem # 以 %MEM 来排序(增序) - # ps aux --sort=-pmem # 以 %MEM 来排序(降序) - # ps aux --sort=+pcpu,-pmem # 结合 %CPU (增序) 和 %MEM (降序)来排列 - -![http://www.tecmint.com/wp-content/uploads/2015/03/ps-command-output.png](http://www.tecmint.com/wp-content/uploads/2015/03/ps-command-output.png) - -自定义 ps 命令的输出 - -### systemd 的一个介绍 ### - -在 Linux 世界中,很少有决定能够比在主流的 Linux 发行版本中采用 systemd 引起更多的争论。systemd 的倡导者根据以下事实命名其主要的优势: - -另外请阅读: ['init' 和 'systemd' 背后的故事][2] - -1. 在系统启动期间,systemd 允许并发地启动更多的进程(相比于先前的 SysVinit,SysVinit 似乎总是表现得更慢,因为它一个接一个地启动进程,检查一个进程是否依赖于另一个进程,然后等待守护进程去开启可以开始的更多的服务),并且 -2. 在一个运行着的系统中,它作为一个动态的资源管理器来工作。这样在开机期间,当一个服务被需要时,才启动它(以此来避免消耗系统资源)而不是在没有一个合理的原因的情况下启动额外的服务。 -3. 向后兼容 sysvinit 的脚本。 - -systemd 由 systemctl 工具控制,假如你带有 SysVinit 背景,你将会对以下的内容感到熟悉: - -- service 工具, 在旧一点的系统中,它被用来管理 SysVinit 脚本,以及 -- chkconfig 工具, 为系统服务升级和查询运行级别信息 -- shutdown, 你一定使用过几次来重启或关闭一个运行的系统。 - -下面的表格展示了使用传统的工具和 systemctl 之间的相似之处: - -注:表格 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Legacy toolSystemctl equivalentDescription
service name startsystemctl start nameStart name (where name is a service)
service name stopsystemctl stop nameStop name
service name condrestartsystemctl try-restart nameRestarts name (if it’s already running)
service name restartsystemctl restart nameRestarts name
service name reloadsystemctl reload nameReloads the configuration for name
service name statussystemctl status nameDisplays the current status of name
service –status-allsystemctlDisplays the status of all current services
chkconfig name onsystemctl enable nameEnable name to run on startup as specified in the unit file (the file to which the symlink points). The process of enabling or disabling a service to start automatically on boot consists in adding or removing symbolic links inside the /etc/systemd/system directory.
chkconfig name offsystemctl disable nameDisables name to run on startup as specified in the unit file (the file to which the symlink points)
chkconfig –list namesystemctl is-enabled nameVerify whether name (a specific service) is currently enabled
chkconfig –listsystemctl –type=serviceDisplays all services and tells whether they are enabled or disabled
shutdown -h nowsystemctl poweroffPower-off the machine (halt)
shutdown -r nowsystemctl rebootReboot the system
- -systemd 也引进了单元(它可能是一个服务,一个挂载点,一个设备或者一个网络套接字)和目标(它们定义了 systemd 如何去管理和同时开启几个相关的进程,并可认为它们与在基于 SysVinit 的系统中的运行级别等价,尽管事实上它们并不等价)。 - -### 总结归纳 ### - -其他与进程管理相关,但并不仅限于下面所列的功能的任务有: - -**1. 在考虑到系统资源的使用上,调整一个进程的执行优先级:** - -这是通过 `renice` 工具来完成的,它可以改变一个或多个正在运行着的进程的调度优先级。简单来说,调度优先级是一个允许内核(当前只支持 >= 2.6 的版本)根据某个给定进程被分配的执行优先级(即优先级,从 -20 到 19)来为其分配系统资源的功能。 - -`renice` 的基本语法如下: - - # renice [-n] priority [-gpu] identifier - -在上面的通用命令中,第一个参数是将要使用的优先级数值,而另一个参数可以解释为进程 ID(这是默认的设定),进程组 ID,用户 ID 或者用户名。一个常规的用户(即除 root 以外的用户)只可以更改他或她所拥有的进程的调度优先级,并且只能增加优先级的层次(这意味着占用更少的系统资源)。 - -![在 Linux 中调整进程的优先级](http://www.tecmint.com/wp-content/uploads/2015/03/Process-Scheduling-Priority.png) - -进程调度优先级 - -**2. 按照需要杀死一个进程(或终止其正常执行):** - -更精确地说,杀死一个进程指的是通过 [kill 或 pkill][3]命令给该进程发送一个信号,让它优雅地(SIGTERM=15)或立即(SIGKILL=9)结束它的执行。 - -这两个工具的不同之处在于前一个被用来终止一个特定的进程或一个进程组,而后一个则允许你在进程的名称和其他属性的基础上,执行相同的动作。 - -另外, pkill 与 pgrep 相捆绑,pgrep 提供将受影响的进程的 PID 给 pkill 来使用。例如,在运行下面的命令之前: - - # pkill -u gacanepa - -查看一眼由 gacanepa 所拥有的 PID 或许会带来点帮助: - - # pgrep -l -u gacanepa - -![找到用户拥有的 PID](http://www.tecmint.com/wp-content/uploads/2015/03/Find-PIDs-of-User.png) - -找到用户拥有的 PID - -默认情况下,kill 和 pkiill 都发送 SIGTERM 信号给进程,如我们上面提到的那样,这个信号可以被忽略(即该进程可能会终止其自身的执行或者不终止),所以当你因一个合理的理由要真正地停止一个运行着的进程,则你将需要在命令行中带上特定的 SIGKILL 信号: - - # kill -9 identifier # 杀死一个进程或一个进程组 - # kill -s SIGNAL identifier # 同上 - # pkill -s SIGNAL identifier # 通过名称或其他属性来杀死一个进程 - -### 结论 ### - -在这篇文章中,我们解释了在 RHEL 7 系统中,有关开机启动过程的基本知识,并分析了一些可用的工具来帮助你通过使用一般的程序和 systemd 特有的命令来管理进程。 - -请注意,这个列表并不旨在涵盖有关这个话题的所有花哨的工具,请随意使用下面的评论栏来添加你自已钟爱的工具和命令。同时欢迎你的提问和其他的评论。 - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/rhcsa-exam-boot-process-and-process-management/ - -作者:[Gabriel Cánepa][a] -译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/dmesg-commands/ -[2]:http://www.tecmint.com/systemd-replaces-init-in-linux/ -[3]:http://www.tecmint.com/how-to-kill-a-process-in-linux/ diff --git a/中文排版指北.md b/中文排版指北.md new file mode 100644 index 0000000000..8f54947f8f --- /dev/null +++ b/中文排版指北.md @@ -0,0 +1,300 @@ +# 中文文案排版指北 +[![devDependency Status](https://david-dm.org/mzlogin/chinese-copywriting-guidelines/dev-status.svg)](https://david-dm.org/mzlogin/chinese-copywriting-guidelines#info=devDependencies) + +统一中文文案、排版的相关用法,降低团队成员之间的沟通成本,增强网站气质。 + +Other languages: + +- [English](https://github.com/mzlogin/chinese-copywriting-guidelines/blob/Simplified/README.en.md) +- [Chinese Traditional](https://github.com/sparanoid/chinese-copywriting-guidelines) +- [Chinese Simplified](README.md) + +----- + +## 目录 + +- [空格](#空格) + - [中英文之间需要增加空格](#中英文之间需要增加空格) + - [中文与数字之间需要增加空格](#中文与数字之间需要增加空格) + - [数字与单位之间需要增加空格](#数字与单位之间需要增加空格) + - [全角标点与其他字符之间不加空格](#全角标点与其他字符之间不加空格) + - [`-ms-text-autospace` to the rescue?](#-ms-text-autospace-to-the-rescue) +- [标点符号](#标点符号) + - [不重复使用标点符号](#不重复使用标点符号) +- [全角和半角](#全角和半角) + - [使用全角中文标点](#使用全角中文标点) + - [数字使用半角字符](#数字使用半角字符) + - [遇到完整的英文整句、特殊名词,其內容使用半角标点](#遇到完整的英文整句特殊名词其內容使用半角标点) +- [名词](#名词) + - [专有名词使用正确的大小写](#专有名词使用正确的大小写) + - [不要使用不地道的缩写](#不要使用不地道的缩写) +- [争议](#争议) + - [链接之间增加空格](#链接之间增加空格) + - [简体中文使用直角引号](#简体中文使用直角引号) +- [工具](#工具) +- [谁在这样做?](#谁在这样做) +- [参考文献](#参考文献) + +## 空格 + +「有研究显示,打字的时候不喜欢在中文和英文之间加空格的人,感情路都走得很辛苦,有七成的比例会在 34 岁的时候跟自己不爱的人结婚,而其余三成的人最后只能把遗产留给自己的猫。毕竟爱情跟书写都需要适时地留白。 + +与大家共勉之。」——[vinta/paranoid-auto-spacing](https://github.com/vinta/pangu.js) + +### 中英文之间需要增加空格 + +正确: + +> 在 LeanCloud 上,数据存储是围绕 `AVObject` 进行的。 + +错误: + +> 在LeanCloud上,数据存储是围绕`AVObject`进行的。 + +> 在 LeanCloud上,数据存储是围绕`AVObject` 进行的。 + +完整的正确用法: + +> 在 LeanCloud 上,数据存储是围绕 `AVObject` 进行的。每个 `AVObject` 都包含了与 JSON 兼容的 key-value 对应的数据。数据是 schema-free 的,你不需要在每个 `AVObject` 上提前指定存在哪些键,只要直接设定对应的 key-value 即可。 + +例外:「豆瓣FM」等产品名词,按照官方所定义的格式书写。 + +### 中文与数字之间需要增加空格 + +正确: + +> 今天出去买菜花了 5000 元。 + +错误: + +> 今天出去买菜花了 5000元。 + +> 今天出去买菜花了5000元。 + +### 数字与单位之间需要增加空格 + +正确: + +> 我家的光纤入户宽带有 10 Gbps,SSD 一共有 20 TB。 + +错误: + +> 我家的光纤入户宽带有 10Gbps,SSD 一共有 10TB。 + +例外:度/百分比与数字之间不需要增加空格: + +正确: + +> 今天是 233° 的高温。 + +> 新 MacBook Pro 有 15% 的 CPU 性能提升。 + +错误: + +> 今天是 233 ° 的高温。 + +> 新 MacBook Pro 有 15 % 的 CPU 性能提升。 + +### 全角标点与其他字符之间不加空格 + +正确: + +> 刚刚买了一部 iPhone,好开心! + +错误: + +> 刚刚买了一部 iPhone ,好开心! + +### `-ms-text-autospace` to the rescue? + +Microsoft 有个 [`-ms-text-autospace`](http://msdn.microsoft.com/en-us/library/ie/ms531164(v=vs.85).aspx) 的 CSS 属性可以实现自动为中英文之间增加空白。不过目前并未普及,另外在其他应用场景,例如 OS X、iOS 的用户界面目前并不存在这个特性,所以请继续保持随手加空格的习惯。 + +## 标点符号 + +### 不重复使用标点符号 + +正确: + +> 德国队竟然战胜了巴西队! + +> 她竟然对你说「喵」?! + +错误: + +> 德国队竟然战胜了巴西队!! + +> 德国队竟然战胜了巴西队!!!!!!!! + +> 她竟然对你说「喵」??!! + +> 她竟然对你说「喵」?!?!??!! + +## 全角和半角 + +不明白什么是全角(全形)与半角(半形)符号?请查看维基百科词条『[全角和半角](http://zh.wikipedia.org/wiki/%E5%85%A8%E5%BD%A2%E5%92%8C%E5%8D%8A%E5%BD%A2)』。 + +### 使用全角中文标点 + +正确: + +> 嗨!你知道嘛?今天前台的小妹跟我说「喵」了哎! + +> 核磁共振成像(NMRI)是什么原理都不知道?JFGI! + +错误: + +> 嗨! 你知道嘛? 今天前台的小妹跟我说 "喵" 了哎! + +> 嗨!你知道嘛?今天前台的小妹跟我说"喵"了哎! + +> 核磁共振成像 (NMRI) 是什么原理都不知道? JFGI! + +> 核磁共振成像(NMRI)是什么原理都不知道?JFGI! + +### 数字使用半角字符 + +正确: + +> 这件蛋糕只卖 1000 元。 + +错误: + +> 这件蛋糕只卖 1000 元。 + +例外:在设计稿、宣传海报中如出现极少量数字的情形时,为方便文字对齐,是可以使用全角数字的。 + +### 遇到完整的英文整句、特殊名词,其內容使用半角标点 + +正确: + +> 乔布斯那句话是怎么说的?「Stay hungry, stay foolish.」 + +> 推荐你阅读《Hackers & Painters: Big Ideas from the Computer Age》,非常的有趣。 + +错误: + +> 乔布斯那句话是怎么说的?「Stay hungry,stay foolish。」 + +> 推荐你阅读《Hackers&Painters:Big Ideas from the Computer Age》,非常的有趣。 + +## 名词 + +### 专有名词使用正确的大小写 + +大小写相关用法原属于英文书写范畴,不属于本 wiki 讨论內容,在这里只对部分易错用法进行简述。 + +正确: + +> 使用 GitHub 登录 + +> 我们的客户有 GitHub、Foursquare、Microsoft Corporation、Google、Facebook, Inc.。 + +错误: + +> 使用 github 登录 + +> 使用 GITHUB 登录 + +> 使用 Github 登录 + +> 使用 gitHub 登录 + +> 使用 gイんĤЦ8 登录 + +> 我们的客户有 github、foursquare、microsoft corporation、google、facebook, inc.。 + +> 我们的客户有 GITHUB、FOURSQUARE、MICROSOFT CORPORATION、GOOGLE、FACEBOOK, INC.。 + +> 我们的客户有 Github、FourSquare、MicroSoft Corporation、Google、FaceBook, Inc.。 + +> 我们的客户有 gitHub、fourSquare、microSoft Corporation、google、faceBook, Inc.。 + +> 我们的客户有 gイんĤЦ8、キouЯƧquムгє、๓เςг๏ร๏Ŧt ς๏гק๏гคtเ๏ภn、900913、ƒ4ᄃëв๏๏к, IПᄃ.。 + +注意:当网页中需要配合整体视觉风格而出现全部大写/小写的情形,HTML 中请使用标准的大小写规范进行书写;并通过 `text-transform: uppercase;`/`text-transform: lowercase;` 对表现形式进行定义。 + +### 不要使用不地道的缩写 + +正确: + +> 我们需要一位熟悉 JavaScript、HTML5,至少理解一种框架(如 Backbone.js、AngularJS、React 等)的前端开发者。 + +错误: + +> 我们需要一位熟悉 Js、h5,至少理解一种框架(如 backbone、angular、RJS 等)的 FED。 + +## 争议 + +以下用法略带有个人色彩,既:无论是否遵循下述规则,从语法的角度来讲都是**正确**的。 + +### 链接之间增加空格 + +用法: + +> 请 [提交一个 issue](#) 并分配给相关同事。 + +> 访问我们网站的最新动态,请 [点击这里](#) 进行订阅! + +对比用法: + +> 请[提交一个 issue](#) 并分配给相关同事。 + +> 访问我们网站的最新动态,请[点击这里](#)进行订阅! + +### 简体中文使用直角引号 + +用法: + +> 「老师,『有条不紊』的『紊』是什么意思?」 + +对比用法: + +> “老师,‘有条不紊’的‘紊’是什么意思?” + +## 工具 + +仓库 | 语言 +--- | --- +[vinta/paranoid-auto-spacing](https://github.com/vinta/paranoid-auto-spacing) | JavaScript +[huei90/pangu.node](https://github.com/huei90/pangu.node) | Node.js +[huacnlee/auto-correct](https://github.com/huacnlee/auto-correct) | Ruby +[sparanoid/space-lover](https://github.com/sparanoid/space-lover) | PHP (WordPress) +[nauxliu/auto-correct](https://github.com/NauxLiu/auto-correct) | PHP +[hotoo/pangu.vim](https://github.com/hotoo/pangu.vim) | Vim +[sparanoid/grunt-auto-spacing](https://github.com/sparanoid/grunt-auto-spacing) | Node.js (Grunt) +[hjiang/scripts/add-space-between-latin-and-cjk](https://github.com/hjiang/scripts/blob/master/add-space-between-latin-and-cjk) | Python + +## 谁在这样做? + +网站 | 文案 | UGC +--- | --- | --- +[Apple 中国](http://www.apple.com/cn/) | Yes | N/A +[Apple 香港](http://www.apple.com/hk/) | Yes | N/A +[Apple 台湾](http://www.apple.com/tw/) | Yes | N/A +[Microsoft 中国](http://www.microsoft.com/zh-cn/) | Yes | N/A +[Microsoft 香港](http://www.microsoft.com/zh-hk/) | Yes | N/A +[Microsoft 台湾](http://www.microsoft.com/zh-tw/) | Yes | N/A +[LeanCloud](https://leancloud.cn/) | Yes | N/A +[知乎](https://www.zhihu.com/) | Yes | 部分用户达成 +[V2EX](https://www.v2ex.com/) | Yes | Yes +[SegmentFault](https://segmentfault.com/) | Yes | 部分用户达成 +[Apple4us](http://apple4us.com/) | Yes | N/A +[豌豆荚](https://www.wandoujia.com/) | Yes | N/A +[Ruby China](https://ruby-china.org/) | Yes | 标题达成 +[PHPHub](https://phphub.org/) | Yes | 标题达成 + +## 参考文献 + +- [Guidelines for Using Capital Letters](http://grammar.about.com/od/punctuationandmechanics/a/Guidelines-For-Using-Capital-Letters.htm) +- [Letter case - Wikipedia](http://en.wikipedia.org/wiki/Letter_case) +- [Punctuation - Oxford Dictionaries](http://www.oxforddictionaries.com/words/punctuation) +- [Punctuation - The Purdue OWL](https://owl.english.purdue.edu/owl/section/1/6/) +- [How to Use English Punctuation Corrently - wikiHow](http://www.wikihow.com/Use-English-Punctuation-Correctly) +- [格式 - openSUSE](https://zh.opensuse.org/index.php?title=Help:%E6%A0%BC%E5%BC%8F) +- [全角和半角 - 维基百科](http://zh.wikipedia.org/wiki/%E5%85%A8%E5%BD%A2%E5%92%8C%E5%8D%8A%E5%BD%A2) +- [引号 - 维基百科](http://zh.wikipedia.org/wiki/%E5%BC%95%E8%99%9F) +- [疑问惊叹号 - 维基百科](http://zh.wikipedia.org/wiki/%E7%96%91%E5%95%8F%E9%A9%9A%E5%98%86%E8%99%9F) + +## CopyRight + +[中文文案排版指北](https://github.com/sparanoid/chinese-copywriting-guidelines) diff --git a/选题模板.txt b/选题模板.txt new file mode 100644 index 0000000000..fabd1f1dba --- /dev/null +++ b/选题模板.txt @@ -0,0 +1,41 @@ +选题标题格式: + + 原文日期 标题.md + +正文内容: + + 标题 + ======= + + ### 子一级标题 + + 正文 + + #### 子二级标题 + + 正文内容 + + ![](图片地址) + + ### 子一级标题 + + 正文内容 : I have a [dream][1]。 + + + -------------------------------------------------------------------------------- + + via: 原文地址 + + 作者:[作者名][a] + 译者:[译者ID](https://github.com/译者ID) + 校对:[校对者ID](https://github.com/校对者ID) + + 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + + [a]: 作者介绍地址 + [1]: 引文链接地址 + +说明: +1. 标题层级很多时从 “##” 开始 +2. 引文链接地址在下方集中写 +