Merge pull request #97 from LCTT/master

更新至2015年12月29日
This commit is contained in:
struggling 2015-12-29 19:26:36 +08:00
commit eb77e6c6f1
34 changed files with 2079 additions and 1649 deletions

View File

@ -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

View File

@ -1,8 +1,8 @@
Linux 中如何命令行访问 Dropbox
Linux 中如何通过命令行访问 Dropbox
================================================================================
在当今这个多设备的环境下,云存储无处不在。无论身处何方,人们都想通过多种设备来从云存储中获取所需的内容。由于优雅的 UI 和完美的跨平台兼容性Dropbox 已成为最为广泛使用的云存储服务。 Dropbox 的流行已引发了一系列官方或非官方 Dropbox 客户端的出现,它们支持不同的操作系统平台。
在当今这个多设备的环境下,云存储无处不在。无论身处何方,人们都想通过多种设备来从云存储中获取所需的内容。由于拥有漂亮的 UI 和完美的跨平台兼容性Dropbox 已成为最为广泛使用的云存储服务。 Dropbox 的流行已引发了一系列官方或非官方 Dropbox 客户端的出现,它们支持不同的操作系统平台。
当然 Linux 平台下也有着自己的 Dropbox 客户端: 既有命令行的,也有图形界面。[Dropbox Uploader][1] 是一个简单易用的 Dropbox 命令行客户端,它是用 BASH 脚本语言所编写的。在这篇教程中,我将描述 **在 Linux 中如何使用 Dropbox Uploader 通过命令行来访问 Dropbox**
当然 Linux 平台下也有着自己的 Dropbox 客户端: 既有命令行的,也有图形界面客户端。[Dropbox Uploader][1] 是一个简单易用的 Dropbox 命令行客户端,它是用 Bash 脚本语言所编写的LCTT 译注:对,你没看错, 就是 Bash。在这篇教程中,我将描述 **在 Linux 中如何使用 Dropbox Uploader 通过命令行来访问 Dropbox**
### Linux 中安装和配置 Dropbox Uploader ###
@ -13,7 +13,7 @@ Linux 中如何从命令行访问 Dropbox
请确保你已经在系统中安装了 `curl`,因为 Dropbox Uploader 通过 curl 来运行 Dropbox 的 API。
要配置 Dropbox Uploader只需运行 dropbox_uploader.sh 即可。当你第一次运行这个脚本时,它将询问你,以使得它可以访问你的 Dropbox 账户。
要配置 Dropbox Uploader只需运行 dropbox_uploader.sh 即可。当你第一次运行这个脚本时,它将请求得到授权以使得脚本可以访问你的 Dropbox 账户。
$ ./dropbox_uploader.sh
@ -88,7 +88,7 @@ via: http://xmodulo.com/access-dropbox-command-line-linux.html
作者:[Dan Nanni][a]
译者:[FSSlc](https://github.com/FSSlc)
校对:[校对者ID](https://github.com/校对者ID)
校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,19 +1,17 @@
如何在 Ubuntu 15.04 / CentOS 7 上安装 Android Studio
================================================================================
随着最近几年智能手机的进步,安卓成为了最大的手机平台之一,也有很多免费的用于开发安卓应用的工具。Android Studio 是基于 [IntelliJ IDEA][1] 用于开发安卓应用的集成开发环境。它是 Google 2014 年发布的免费开源软件,继 Eclipse 之后成为主要的 IDE。
随着最近几年智能手机的进步,安卓成为了最大的手机平台之一,在开发安卓应用中所用到的所有工具也都可以免费得到。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 或者更新版本。
我们可以用两种方式安装 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 是否安装成功:
@ -27,12 +25,11 @@
![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
@ -48,7 +45,7 @@
![下载组件](http://blog.linoxide.com/wp-content/uploads/2015/11/Download.png)
这一步之后就完成了 Android Studio 的安装。当你重启 Android Studio 时,你会看到下面的欢迎界面,从这里你可以开始用 Android Studio 工作了。
这一步完成之后就结束了 Android Studio 的安装。当你重启 Android Studio 时,你会看到下面的欢迎界面,从这里你可以开始用 Android Studio 工作了。
![欢迎界面](http://blog.linoxide.com/wp-content/uploads/2015/11/Welcome-screen.png)
@ -85,21 +82,14 @@
如果你安装 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
- glibc.i686
- glibc-devel.i686
- libstdc++.i686
- zlib-devel.i686
- ncurses-devel.i686
- libX11-devel.i686
- libXrender.i686
- libXrandr.i686
通过从 [Android 网站][3] 下载 IDE 文件然后解压安装 studio 也是一样的。
@ -121,7 +111,7 @@
### 总结 ###
虽然发布不到一年,但是 Android Studio 已经替代 Eclipse 成为了安装开发最主要的 IDE。它是唯一一个能支持之后 Google 提供的 Android SDKs 和其它 Android 特性的官方 IDE 工具。那么,你还在等什么呢?赶快安装 Android Studio 然后体验开发安装应用的乐趣吧。
虽然发布不到一年,但是 Android Studio 已经替代 Eclipse 成为了 Android 的开发最主要的 IDE。它是唯一能支持 Google 之后将要提供的 Android SDK 和其它 Android 特性的官方 IDE 工具。那么,你还在等什么呢?赶快安装 Android Studio 来体验开发 Android 应用的乐趣吧。
--------------------------------------------------------------------------------
@ -129,11 +119,11 @@ via: http://linoxide.com/tools/install-android-studio-ubuntu-15-04-centos-7/
作者:[B N Poornima][a]
译者:[ictlyh](http://mutouxiaogui.cn/blog/)
校对:[校对者ID](https://github.com/校对者ID)
校对:[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
[3]:http://developer.android.com/sdk/index.html

View File

@ -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 发行版中运行,比如 ArchFedora。使用 dnfpacman 等命令就能轻松安装。
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

View File

@ -1,123 +0,0 @@
Ten Biggest Linux Stories Of The Year 2015
================================================================================
![Biggest Linux Stories of 2015](http://itsfoss.com/wp-content/uploads/2015/12/Biggest-Linux-Stories-2015.jpg)
Year 2015 is coming to an end and I am here with Year 2015 special series on Its FOSS. First in this series is the biggest Linux stories of the year 2015. These stories are the ones that had the most impact on the Linux world, both positive and negative.
I have summarized ten of such stories which created the most buzz in 2015. Here we go!
### Biggest Linux and Open Source stories of the year 2015 ###
Just to add, the listed items are not ordered chronologically.
#### Microsofts partnering with Linux ####
In late September, everyone was shocked to hear that [Microsoft created its own Linux distribution][1]. It was later revealed that [it was a software][2] developed for its Azur cloud switches.
But the story did not end up just there. Microsoft indeed partnered with Canonical (parent company of Ubuntu Linux) for [HDInsight][3], Microsofts big data Hadoop-on-Azure service. Ubuntu was the first Linux on which [Microsoft deployed this software][4].
Will Microsoft continue its affair with Linux? Or will it dump it after Linux has served its purpose (Azur). Only time will tell.
#### Microsoft releases Visual Studio Code for Linux ####
Before Microsoft-Linux distribution uproar, Microsoft has dropped another bomb by releasing Visual Studio Code for Linux, along with Windows and OS X versions. Though Visual Studio Code is not open source, releasing a Linux version was somehow a win for Linux users. After all, Linus Torvalds had famously said, “if Microsoft ever does an application for Linux, it means Ive won”.
You can follow this tutorial to see [how to install Visual Studio Code in Ubuntu][5].
#### Apple open sources Swift programming language ####
Apple was not behind in showing off its love for Linux and Open Source. Apples flagship programming language Swift which is used for making iOS apps, [is now open source][6] with Linux ports available. Though in beta, you can easily [install Swift in Ubuntu][7].
But Apple is Apple and it [started bragging itself][8] as the “first major computer company to make Open Source development a key part of its software strategy…(sic)”.
#### Ubuntu Phone finally launched ####
Ubuntu Phone was finally launched earlier this year. Intended for early adopters and developers, Ubuntu was welcomed with open heart by the Ubuntu community. Mainstream smartphone users are still shying away from it, mainly [because the OS is still under heavy development][9]. Year 2016 will be deciding for the existence of Ubuntu Phone.
#### Financial crisis hits Jolla ####
Jolla, the company behind Linux based smartphone operating system Sailfish OS, hit a major financial hurdle. It resulted in [half of Jolla employees being laid off][10].
Jolla had a very [successful crowdfunding campaign][11] in 2014 for its tablet. Apparently, they spent most of the budget on the development of Sailfish OS and when the lead investor backed off, company struggled for its survival.
Good news is that Jolla has managed to get some solid funding and its ]back in business][12].
#### Firefox OS is dead ####
One of the open source alternatives to Android, Mozillas mobile operating system Firefox OS died a slow death earlier this month. Intended at developing countries with smartphones as cheap as $25, Firefox OS based smartphones could never gained popularity. I think lack of popular apps and cheap hardware was the main reason.
In December, [Mozilla announced][13] that it will stop developing Firefox OS and also stop the sale of Firefox smartphones.
Though it is never announced, I think even [Tizen][14], Linux foundations own Linux based mobile OS, is dead as well. I dont see any development news on Tizen and Linux Foundation never promotes it. It is just the matter of time when we will be invited to the funeral of Tizen.
#### Infighting in “Ubuntu family” ####
There were lots of heated discussion in May this year when Kubuntu project lead, [Jonathan Riddell was forced out by Ubuntu Community Council][15]. Jonathan had asked questions about how the donations received by Ubuntu is being spent. He had complained that Kubuntu never saw the money.
This led to an exchange of accusation between both sides. Ultimately, big daddy of Ubuntu, [Mark Shuttleworth asked Jonathan to step down][16].
#### Female Linux Kernel developer quits citing brutal communication style ####
Linux creator Linux Torvalds is known for the use of abusive language. Linux Kernel dev [Sarah Sharp][17] is also known for being out spoken.
Sarah Sharp had earlier locked horns with Linus Torvalds in 2013 when she publicly [advised Linus to keep “verbal violence” off the mailing list][18]. Linus did not take it [lightly][19] as well.
That was in 2013. In 2015, Sarah announced that she is [stepping down from her work in Kernel community][20] because the communication style lacks basic decency and is brutal and profane.
This move left people discussing if Linux Kernel community should really change the way they behave or if Sarah took things too far.
#### Unity gaming editor ported to Linux ####
While [gaming on Linux][21] is still the Achilles heel for Linux users, the community got excited when gaming engine Unity announced that it is testing its [game editor on Linux][22]. As Linux is used very well for rendering, it is speculated that this move will bring game developers to Linux. It is not confirmed yet if Unity will actually bring a final Linux version of its game editor though.
#### Open Source adoption in government organization ####
Administration in several [European cities decided to ditch proprity software][23] and opt for open source alternatives. Most city administration replaced Microsoft Office with LibreOffice or OpenOffice. Few cities and [government][24] schools also went ahead and replaced Microsoft Windows with Linux.
Cost cutting was one of the major factor in this decision as the city administration saved hundreds of thousands of Euro by adopting Open Source.
Universities were not far behind in adopting open source as well. All year round, we get to hear how a [university dropped Photoshop for Krita][25] or [university using open source office][26].
### Conclusion ###
As with any other year, 2015 also had some positive and some negative moments for Linux lovers. We saw competitors like Microsoft and Apple coming close to Linux, government organizations adopting to open source. At the same time, we witnessed the failure of Firefox smartphone OS. A mixed year, I would say.
What do you think? I let you share what you think was the most important news for Linux-ers in the year 2015 and your overall feel about it.
--------------------------------------------------------------------------------
via: http://itsfoss.com/biggest-linux-stories-2015/
作者:[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://www.theregister.co.uk/2015/09/18/microsoft_has_developed_its_own_linux_repeat_microsoft_has_developed_its_own_linux/
[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]:http://itsfoss.com/install-visual-studio-code-ubuntu/
[6]:http://itsfoss.com/swift-open-source-linux/
[7]:http://itsfoss.com/use-swift-linux/
[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]:http://techcrunch.com/2015/11/20/jolla-running-out-of-runway-for-its-android-alternative/
[11]:https://www.indiegogo.com/projects/jolla-tablet-world-s-first-crowdsourced-tablet#/
[12]:https://blog.jolla.com/jolla-back-business/
[13]:http://arstechnica.com/gadgets/2015/12/firefox-os-smartphones-are-dead/
[14]:https://www.tizen.org/
[15]:http://www.omgubuntu.co.uk/2015/05/kubuntu-project-lead-asked-to-step-down-by-ubuntu-community-council
[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]:http://www.networkworld.com/article/2988850/opensource-subnet/linux-kernel-dev-sarah-sharp-quits-citing-brutal-communications-style.html
[21]:http://itsfoss.com/linux-gaming-guide/
[22]:http://itsfoss.com/unity-gaming-engine-linux/
[23]:http://itsfoss.com/tag/open-source-adoption/
[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/

View File

@ -0,0 +1,66 @@
While the event had a certain amount of drama surrounding it, the [announcement][1] of the end for the [Debian Live project][2] seems likely to have less of an impact than it first appeared. The loss of the lead developer will certainly be felt—and the treatment he and the project received seems rather baffling—but the project looks like it will continue in some form. So Debian will still have tools to create live CDs and other media going forward, but what appears to be a long-simmering dispute between project founder and leader Daniel Baumann and the Debian CD and installer teams has been "resolved", albeit in an unfortunate fashion.
The November 9 announcement from Baumann was titled "An abrupt End to Debian Live". In that message, he pointed to a number of different events over the nearly ten years since the [project was founded][3] that indicated to him that his efforts on Debian Live were not being valued, at least by some. The final straw, it seems, was an "intent to package" (ITP) bug [filed][4] by Iain R. Learmonth that impinged on the namespace used by Debian Live.
Given that one of the main Debian Live packages is called "live-build", the new package's name, "live-build-ng", was fairly confrontational in and of itself. Live-build-ng is meant to be a wrapper around the [vmdebootstrap][5] tool for creating live media (CDs and USB sticks), which is precisely the role Debian Live is filling. But when Baumann [asked][6] Learmonth to choose a different name for his package, he got an "interesting" [reply][7]:
```
It is worth noting that live-build is not a Debian project, it is an external project that claims to be an official Debian project. This is something that needs to be fixed.
There is no namespace issue, we are building on the existing live-config and live-boot packages that are maintained and bringing these into Debian as native projects. If necessary, these will be forks, but I'm hoping that won't have to happen and that we can integrate these packages into Debian and continue development in a collaborative manner.
live-build has been deprecated by debian-cd, and live-build-ng is replacing it. In a purely Debian context at least, live-build is deprecated. live-build-ng is being developed in collaboration with debian-cd and D-I [Debian Installer].
```
Whether or not Debian Live is an "official" Debian project (or even what "official" means in this context) has been disputed in the thread. Beyond that, though, Neil Williams (who is the maintainer of vmdebootstrap) [provided some][8] explanation for the switch away from Debian Live:
```
vmdebootstrap is being extended explicitly to provide support for a replacement for live-build. This work is happening within the debian-cd team to be able to solve the existing problems with live-build. These problems include reliability issues, lack of multiple architecture support and lack of UEFI support. vmdebootstrap has all of these, we do use support from live-boot and live-config as these are out of the scope for vmdebootstrap.
```
Those seem like legitimate complaints, but ones that could have been fixed within the existing project. Instead, though, something of a stealth project was evidently undertaken to replace live-build. As Baumann [pointed out][9], nothing was posted to the debian-live mailing list about the plans. The ITP was the first notice that anyone from the Debian Live project got about the plans, so it all looks like a "secret plan"—something that doesn't sit well in a project like Debian.
As might be guessed, there were multiple postings that supported Baumann's request to rename "live-build-ng", followed by many that expressed dismay at his decision to stop working on Debian Live. But Learmonth and Williams were adamant that replacing live-build is needed. Learmonth did [rename][10] live-build-ng to a perhaps less confrontational name: live-wrapper. He noted that his aim had been to add the new tool to the Debian Live project (and "bring the Debian Live project into Debian"), but things did not play out that way.
```
I apologise to everyone that has been upset by the ITP bug. The software is not yet ready for use as a full replacement for live-build, and it was filed to let people know that the work was ongoing and to collect feedback. This sort of worked, but the feedback wasn't the kind I was looking for.
```
The backlash could perhaps have been foreseen. Communication is a key aspect of free-software communities, so a plan to replace the guts of a project seems likely to be controversial—more so if it is kept under wraps. For his part, Baumann has certainly not been perfect—he delayed the "wheezy" release by [uploading an unsuitable syslinux package][11] and [dropped down][12] from a Debian Developer to a Debian Maintainer shortly thereafter—but that doesn't mean he deserves this kind of treatment. There are others involved in the project as well, of course, so it is not just Baumann who is affected.
One of those other people is Ben Armstrong, who has been something of a diplomat during the event and has tried to smooth the waters. He started with a [post][13] that celebrated the project and what Baumann and the team had accomplished over the years. As he noted, the [list of downstream projects][14] for Debian Live is quite impressive. In another post, he also [pointed out][15] that the project is not dead:
```
If the Debian CD team succeeds in their efforts and produces a replacement that is viable, reliable, well-tested, and a suitable candidate to replace live-build, this can only be good for Debian. If they are doing their job, they will not "[replace live-build with] an officially improved, unreliable, little-tested alternative". I've seen no evidence so far that they operate that way. And in the meantime, live-build remains in the archive -- there is no hurry to remove it, so long as it remains in good shape, and there is not yet an improved successor to replace it.
```
On November 24, Armstrong also [posted][16] an update (and to [his blog][17]) on Debian Live. It shows some good progress made in the two weeks since Baumann's exit; there are even signs of collaboration between the project and the live-wrapper developers. There is also a [to-do list][18], as well as the inevitable call for more help. That gives reason to believe that all of the drama surrounding the project was just a glitch—avoidable, perhaps, but not quite as dire as it might have seemed.
---------------------------------
via: https://lwn.net/Articles/665839/
作者Jake Edge
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [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

View File

@ -1,8 +1,12 @@
taichirain 翻译中
5 great Raspberry Pi projects for the classroom
5 伟大的树莓派项目教室
================================================================================
![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/osdc-open-source-yearbook-lead3.png)
Image by : opensource.com
图片来源 : opensource.com
### 1. Minecraft Pi ###
@ -93,4 +97,4 @@ via: https://opensource.com/education/15/12/5-great-raspberry-pi-projects-classr
[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
[14]:http://camjam.me/?page_id=1035#worksheets

View File

@ -1,80 +0,0 @@
Sonofelice Translating
Top 5 open source community metrics to track
================================================================================
![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/yearbook2015-osdc-lead-1.png)
So you decided to use metrics to track your free, open source software (FOSS) community. Now comes the big question: Which metrics should I be tracking?
To answer this question, you must have an idea of what information you need. For example, you may want to know about the sustainability of the project community. How quickly does the community react to problems? How is the community attracting, retaining, or losing contributors? Once you decide which information you need, you can figure out which traces of community activity are available to provide it. Fortunately, FOSS projects following an open development model tend to leave loads of public data in their software development repositories, which can be analyzed to gather useful data.
In this article, I'll introduce metrics that help provide a multi-faceted view of your project community.
### 1. Activity ###
The overall activity of the community and how it evolves over time is a useful metric for all open source communities. Activity provides a first view of how much the community is doing, and can be used to track different kinds of activity. For example, the number of commits gives a first idea about the volume of the development effort. The number of tickets opened provides insight into how many bugs are reported or new features are proposed. The number of messages in mailing lists or posts in forums gives an idea of how much discussion is being held in public.
![Activity metrics chart](https://opensource.com/sites/default/files/images/business-uploads/activity-metrics.png)
Number of commits and number of merged changes after code review in the OpenStack project, as found in the [OpenStack Activity Dashboard][1]. Evolution over time (weekly data).
### 2. Size ###
The size of the community is the number of people participating in it, but, depending on the kind of participation, size numbers may vary. Usually you're interested in active contributors, which is good news. Active people may leave traces in the repositories of the project, which means you can count contributors who are active in producing code by looking at the **Author** field in git repositories, or count people participating in the resolution of tickets by looking at who is contributing to them.
This basic idea of activity" (somebody did something) can be extended in many ways. One common way to track activity is to look at how many people did a sizable chunk of the activity. Generally most of a project's code contributions, for example, are from a small fraction of the people in the project's community. Knowing about that fraction helps provide an idea of the core group (i.e., the people who help lead the community).
![Size metrics chart](https://opensource.com/sites/default/files/images/business-uploads/size-metrics.png)
Number of authors and number of posters in mailing lists in the Xen project, as found in the [Xen Project Development Dashboard][2]. Evolution over time (monthly data).
### 3. Performance ###
So far, I have focused on measuring quantities of activities and contributors. You also can analyze how processes and people are performing. For example, you can measure how long processes take to finish. Time to resolve or close tickets shows how the project is reacting to new information that requires action, such as fixing a reported bug or implementing a requested new feature. Time spent in code review—from the moment when a change to the code is proposed to the moment it is accepted—shows how long upgrading a proposed change to the quality standards expected by the community takes.
Other metrics deal with how well the project is coping with pending work, such as the ratio of new to closed tickets, or the backlog of still non-completed code reviews. Those parameters tell us, for example, whether or not the resources put into solving issues is enough.
![Efficiency metrics chart](https://opensource.com/sites/default/files/images/business-uploads/efficiency-metrics.png)
Ratio of tickets closed by tickets opened, and ratio of change proposals accepted or abandoned by new change proposals per quarter. OpenStack project, as shown in the [OpenStack Development Report, 2015-Q3][3] (PDF).
### 4. Demographics ###
Communities change as contributors move in and out. Depending on how people enter and leave a community over time, the age (time since members joined the community) of the community varies. The [community aging chart][4] nicely illustrates these exchanges over time. The chart is structured as a set of horizontal bars, two per "generation" of people joining the community. For each generation, the attracted bar shows how many new people joined the community during the corresponding period of time. The retained bar shows how many people are still active in the community.
The relationship between the two bars for each generation is the retention rate: the fraction of people of that generation who are still in the project. The complete set of attracted bars show how attractive the project was in the past. And the complete set of the retention bars shows the current age structure of the community.
![Demographics metrics chart](https://opensource.com/sites/default/files/images/business-uploads/demography-metrics.png)
Community aging chart for the Eclipse community, as shown in the [Eclipse Development Dashboard][5]. Generations are defined every six months.
### 5. Diversity ###
Diversity is an important factor in the resiliency of communities. In general, the more diverse communities are—in terms of people or organizations participating—the more resilient they are. For example, when a company decides to leave a FOSS community, the potential problems the departure may cause are much smaller if its employees were contributing 5% of the work rather than 85%.
The [Pony Factor][6], a term defined by [Daniel Gruno][7] for the minimum number of developers performing 50% of the commits. Based on the Pony Factor, the Elephant Factor is the minimum number of companies whose employees perform 50% of the commits. Both numbers provide an indication of how many people or companies the community depends on.
![Diversity metrics chart](https://opensource.com/sites/default/files/images/business-uploads/diversity-metrics.png)
Pony and Elephant Factor for several FOSS projects in the area of cloud computing, as presented in [The quantitative state of the open cloud 2015][8] (slides).
There are many other metrics to help measure a community. When determing which metrics to collect, think about the goals of your community, and which metrics will help you reach them.
--------------------------------------------------------------------------------
via: https://opensource.com/business/15/12/top-5-open-source-community-metrics-track
作者:[Jesus M. Gonzalez-Barahona][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/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

View File

@ -1,3 +1,4 @@
translating By Bestony
Remember sed and awk? All Linux admins should
================================================================================
![](http://images.techhive.com/images/article/2015/03/linux-100573790-primary.idge.jpg)

View File

@ -1,64 +0,0 @@
translation by bestony
DFileManager: Cover Flow File Manager
================================================================================
A real gem of a file manager absent from the standard Ubuntu repositories but sporting a unique feature. Thats DFileManager in a twitterish statement.
A tricky question to answer is just how many open source Linux applications are available. Just out of curiosity, you can type at the shell:
~$ for f in /var/lib/apt/lists/*Packages; do printf %5d %s\n $(grep ^Package: “$f” | wc -l) ${f##*/} done | sort -rn
On my Ubuntu 15.04 system, it produces the following results:
![Ubuntu 15.04 Packages](http://www.linuxlinks.com/portal/content/reviews/FileManagers/UbuntuPackages.png)
As the screenshot above illustrates, there are approximately 39,000 packages in the Universe repository, and around 8,500 packages in the main repository. These numbers sound a lot. But there is a smorgasbord of open source applications, utilities, and libraries that dont have an Ubuntu team generating a package. And more importantly, there are some real treasures missing from the repositories which can only be discovered by compiling source code. DFileManager is one such utility. It is a Qt based cross-platform file manager which is in an early stage of development. Qt provides single-source portability across all major desktop operating systems.
In the absence of a binary package, the user needs to compile the code. For some tools, this can be problematic, particularly if the application depends on any obscure libraries, or specific versions which may be incompatible with other software installed on a system.
### Installation ###
Fortunately, DFileManager is simple to compile. The installation instructions on the developers website provide most of the steps necessary for my creaking Ubuntu box, but a few essential packages were missing (why is it always that way however many libraries clutter up your filesystem?) To prepare my system, download the source code from GitHub and then compile the software, I entered the following commands at the 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
You can then start the application by typing at the shell:
~$ dfm
Here is a screenshot of DFileManager in action, with the main attraction in full view; the Cover Flow view. This offers the ability to slide through items in the current folder with an attractive feel. Its ideal for viewing photos. The file manager bears a resemblance to Finder (the default file manager and graphical user interface shell used on all Macintosh operating systems), which may appeal to you.
![DFileManager in action](http://www.linuxlinks.com/portal/content/reviews/FileManagers/Screenshot-dfm.png)
### Features: ###
- 4 views: Icons, Details, Columns, and Cover Flow
- Categorised bookmarks with Places and Devices
- Tabs
- Simple searching and filtering
- Customizable thumbnails for filetypes including multimedia files
- Information bar which can be undocked
- Open folders and files with one click
- Option to queue IO operations
- Remembers some view properties for each folder
- Show hidden files
DFileManager is not a replacement for KDEs Dolphin, but do give it a go. Its a file manager that really helps the user browse files. And dont forget to give feedback to the developer; thats a contribution anyone can offer.
--------------------------------------------------------------------------------
via: http://gofk.tumblr.com/post/131014089537/dfilemanager-cover-flow-file-manager-a-real-gem
作者:[gofk][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://gofk.tumblr.com/

View File

@ -1,317 +0,0 @@
How to Setup Drone - a Continuous Integration Service in Linux
==============================================================
Are you tired of cloning, building, testing, and deploying codes time and again? If yes, switch to continuous integration. Continuous Integration aka CI is practice in software engineering of making frequent commits to the code base, building, testing and deploying as we go. CI helps to quickly integrate new codes into the existing code base. If this process is made automated, then this will speed up the development process as it reduces the time taken for the developer to build and test things manually. [Drone][1] is a free and open source project which provides an awesome environment of continuous integration service and is released under Apache License Version 2.0. It integrates with many repository providers like Github, Bitbucket and Google Code and has the ability to pull codes from the repositories enabling us to build the source code written in number of languages including PHP, Node, Ruby, Go, Dart, Python, C/C++, JAVA and more. It is made such a powerful platform cause it uses containers and docker technology for every build making users a complete control over their build environment with guaranteed isolation.
### 1. Installing Docker ###
First of all, we'll gonna install Docker as its the most vital element for the complete workflow of Drone. Drone does a proper utilization of docker for the purpose of building and testing application. This container technology speeds up the development of the applications. To install docker, we'll need to run the following commands with respective the distribution of linux. In this tutorial, we'll cover the steps with Ubuntu 14.04 and CentOS 7 linux distributions.
#### On Ubuntu ####
To install Docker in Ubuntu, we can simply run the following commands in a terminal or console.
# apt-get update
# apt-get install docker.io
After the installation is done, we'll restart our docker engine using service command.
# service docker restart
Then, we'll make docker start automatically in every system boot.
# 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
#### On CentOS ####
First, we'll gonna update every packages installed in our centos machine. We can do that by running the following command.
# sudo yum update
To install docker in centos, we can simply run the following commands.
# curl -sSL https://get.docker.com/ | sh
After our docker engine is installed in our centos machine, we'll simply start it by running the following systemd command as systemd is the default init system in centos 7.
# systemctl start docker
Then, we'll enable docker to start automatically in every system startup.
# systemctl enable docker
ln -s '/usr/lib/systemd/system/docker.service' '/etc/systemd/system/multi-user.target.wants/docker.service'
### 2. Installing SQlite Driver ###
It uses SQlite3 database server for storing its data and information by default. It will automatically create a database file named drone.sqlite under /var/lib/drone/ which will handle database schema setup and migration. To setup SQlite3 drivers, we'll need to follow the below steps.
#### On Ubuntu 14.04 ####
As SQlite3 is available on the default respository of Ubuntu 14.04, we'll simply install it by running the following apt command.
# apt-get install libsqlite3-dev
#### On CentOS 7 ####
To install it on CentOS 7 machine, we'll need to run the following yum command.
# yum install sqlite-devel
### 3. Installing Drone ###
Finally, after we have installed those dependencies successfully, we'll now go further towards the installation of drone in our machine. In this step, we'll simply download the binary package of it from the official download link of the respective binary formats and then install them using the default package manager.
#### On Ubuntu ####
We'll use wget to download the debian package of drone for ubuntu from the [official Debian file download link][2]. Here is the command to download the required debian package of drone.
# 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]
After its downloaded, we'll gonna install it with dpkg package manager.
# 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
#### On CentOS ####
In the machine running CentOS, we'll download the RPM package from the [official download link for RPM][3] using wget command as shown below.
# 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]
Then, we'll install the download rpm package using yum package manager.
# yum localinstall drone.rpm
### 4. Configuring Port ###
After the installation is completed, we'll gonna configure drone to make it workable. The configuration of drone is inside **/etc/drone/drone.toml** file. By default, drone web interface is exposed under port 80 which is the default port of http, if we wanna change it, we can change it by replacing the value under server block as shown below.
[server]
port=":80"
### 5. Integrating Github ###
In order to run Drone we must setup at least one integration points between GitHub, GitHub Enterprise, Gitlab, Gogs, Bitbucket. In this tutorial, we'll only integrate github but if we wanna integrate other we can do that from the configuration file. In order to integrate github, we'll need to create a new application in our [github settings][4].
![Registering App Github](http://blog.linoxide.com/wp-content/uploads/2015/11/registering-app-github.png)
To create, we'll need to click on Register a New Application then fill out the form as shown in the following image.
![Registering OAuth app github](http://blog.linoxide.com/wp-content/uploads/2015/11/registering-OAuth-app-github.png)
We should make sure that **Authorization callback URL** looks like http://drone.linoxide.com/api/auth/github.com under the configuration of the application. Then, we'll click on Register application. After done, we'll note the Client ID and Client Secret key as we'll need to configure it in our drone configuration.
![Client ID and Secret Token](http://blog.linoxide.com/wp-content/uploads/2015/11/client-id-secret-token.png)
After thats done, we'll need to edit our drone configuration using a text editor by running the following command.
# nano /etc/drone/drone.toml
Then, we'll find the [github] section and append the section with the above noted configuration as shown below.
[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. Configuring SMTP server ###
If we wanna enable drone to send notifications via emails, then we'll need to specify the SMTP configuration of our SMTP server. If we already have an SMTP server, we can use its configuration but as we don't have an SMTP server, we'll need to install an MTA ie Postfix and then specify the SMTP configuration in the drone configuration.
#### On Ubuntu ####
We can install postfix in ubuntu by running the following apt command.
# apt-get install postfix
#### On CentOS ####
We can install postfix in CentOS by running the following yum command.
# yum install postfix
After installing, we'll need to edit the configuration of our postfix configuration using a text editor.
# nano /etc/postfix/main.cf
Then, we'll need to replace the value of myhostname parameter to our FQDN ie drone.linoxide.com .
myhostname = drone.linoxide.com
Now, we'll gonna finally configure the SMTP section of our drone configuration file.
# nano /etc/drone/drone.toml
Then, we'll find the [stmp] section and then we'll need to append the setting as follows.
[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)
Note: Here, **user** and **pass** parameters are strongly recommended to be changed according to one's user configuration.
### 7. Configuring Worker ###
As we know that drone utilizes docker for its building and testing task, we'll need to configure docker as the worker for our drone. To do so, we'll need to edit the [worker] section in the drone configuration file.
# nano /etc/drone/drone.toml
Then, we'll uncomment the following lines and append as shown below.
[worker]
nodes=[
"unix:///var/run/docker.sock",
"unix:///var/run/docker.sock"
]
Here, we have set only 2 node which means the above configuration is capable of executing only 2 build at a time. In order to increase concurrency, we can increase the number of nodes.
[worker]
nodes=[
"unix:///var/run/docker.sock",
"unix:///var/run/docker.sock",
"unix:///var/run/docker.sock",
"unix:///var/run/docker.sock"
]
Here, in the above configuration, drone is configured to process four builds at a time, using the local docker daemon.
### 8. Restarting Drone ###
Finally, after everything is done regarding the installation and configuration, we'll now start our drone server in our linux machine.
#### On Ubuntu ####
To start drone in our Ubuntu 14.04 machine, we'll simply run service command as the default init system of Ubuntu 14.04 is SysVinit.
# service drone restart
To make drone start automatically in every boot of the system, we'll run the following command.
# update-rc.d drone defaults
#### On CentOS ####
To start drone in CentOS machine, we'll simply run systemd command as CentOS 7 is shipped with systemd as init system.
# systemctl restart drone
Then, we'll enable drone to start automatically in every system boot.
# systemctl enable drone
### 9. Allowing Firewalls ###
As we know drone utilizes port 80 by default and we haven't changed the port, we'll gonna configure our firewall programs to allow port 80 (http) and be accessible from other machines in the network.
#### On Ubuntu 14.04 ####
Iptables is a popular firewall program which is installed in the ubuntu distributions by default. We'll make iptables to expose port 80 so that we can make our Drone web interface accessible in the network.
# iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
# /etc/init.d/iptables save
#### On CentOS 7 ####
As CentOS 7 has systemd installed by default, it contains firewalld running as firewall problem. In order to open the port 80 (http service) on firewalld, we'll need to execute the following commands.
# firewall-cmd --permanent --add-service=http
success
# firewall-cmd --reload
success
### 10. Accessing Web Interface ###
Now, we'll gonna open the web interface of drone using our favourite web browser. To do so, we'll need to point our web browser to our machine running drone in it. As the default port of drone is 80 and we have also set 80 in this tutorial, we'll simply point our browser to http://ip-address/ or http://drone.linoxide.com according to our configuration. After we have done that correctly, we'll see the first page of it having options to login into our dashboard.
![Login Github Drone](http://blog.linoxide.com/wp-content/uploads/2015/11/login-github-drone-e1446834688394.png)
As we have configured Github in the above step, we'll simply select github and we'll go through the app authentication process and after its done, we'll be forwarded to our Dashboard.
![Drone Dashboard](http://blog.linoxide.com/wp-content/uploads/2015/11/drone-dashboard.png)
Here, it will synchronize all our github repository and will ask us to activate the repo which we want to build with drone.
![Activate Repository](http://blog.linoxide.com/wp-content/uploads/2015/11/activate-repository-e1446835574595.png)
After its activated, it will ask us to add a new file named .drone.yml in our repository and define the build process and configuration in that file like which image to fetch and which command/script to run while compiling, etc.
We'll need to configure our .drone.yml as shown below.
image: python
script:
- python helloworld.py
- echo "Build has been completed."
After its done, we'll be able to build our application using the configuration YAML file .drone.yml in our drone appliation. All the commits made into the repository is synced in realtime. It automatically syncs the commit and changes made to the repository. Once the commit is made in the repository, build is automatically started in our drone application.
![Building Application Drone](http://blog.linoxide.com/wp-content/uploads/2015/11/building-application-drone.png)
After the build is completed, we'll be able to see the output of the build with the output console.
![Build Success Drone](http://blog.linoxide.com/wp-content/uploads/2015/11/build-success-drone.png)
### Conclusion ###
In this article, we learned to completely setup a workable Continuous Intergration platform with Drone. If we want, we can even get started with the services provided by the official Drone.io project. We can start with free service or paid service according to our requirements. It has changed the world of Continuous integration with its beautiful web interface and powerful bunches of features. It has the ability to integrate with many third party applications and deployment platforms. 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 !
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-how-to/setup-drone-continuous-integration-linux/
作者:[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://drone.io/
[2]:http://downloads.drone.io/master/drone.deb
[3]:http://downloads.drone.io/master/drone.rpm
[4]:https://github.com/settings/developers

View File

@ -1,135 +0,0 @@
taichirain 翻译中
How to Configure Apache Solr on Ubuntu 14 / 15
================================================================================
Hello and welcome to our today's article on Apache Solr. The brief description about Apache Solr is that it is an Open Source most famous search platform with Apache Lucene at the back end for Web sites that enables you to easily create search engines which searches websites, databases and files. It can index and search multiple sites and return recommendations for related contents based on the searched text.
Solr works with HTTP Extensible Markup Language (XML) that offers application program interfaces (APIs) for Javascript Object Notation, Python, and Ruby. According to the Apache Lucene Project, Solr offers capabilities that have made it popular with administrators including it many featuring like:
- Full Text Search
- Faceted Navigation
- Snippet generation/highting
- Spell Suggestion/Auto complete
- Custom document ranking/ordering
#### Prerequisites: ####
On a fresh Linux Ubuntu 14/15 with minimal packages installed, you only have to take care of few prerequisites in order to install Apache Solr.
### 1)System Update ###
Login to your Ubuntu server with a non-root sudo user that will be used to perform all the steps to install and use Solr.
After successful login, issue the following command to update your system with latest updates and patches.
$ sudo apt-get update
### 2) JRE Setup ###
The Solr setup needs Java Runtime Environment to be installed on the system as its basic requirement because solr and tomcat both are the Java based applications. So, we need to install and configure its home environment with latest Java.
To install the latest version on Oracle Java 8, we need to install Python Software Properties using the below command.
$ sudo apt-get install python-software-properties
Upon completion, run the setup its the repository for the latest version of Java 8.
$ sudo add-apt-repository ppa:webupd8team/java
Now you are able to install the latest version of Oracle Java 8 with 'wget' by issuing the below commands to update the packages source list and then to install Java.
$ sudo apt-get update
----------
$ sudo apt-get install oracle-java8-installer
Accept the Oracle Binary Code License Agreement for the Java SE Platform Products and JavaFX as you will be asked during the Java installation and configuration process by a click on the 'OK' button.
When the installation process complete, run the below command to test the successful installation of Java and check its version.
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)
The output indicates that we have successfully fulfilled the basic requirement of Solr by installing the Java. Now move to the next step to install Solr.
### Installing Solr ###
Installing Solr on Ubuntu can be done by using two different ways but in this article we prefer to install its latest package from the source.
To install Solr from its source, download its available package with latest version from there Official [Web Page][1], copy the link address and get it using 'wget' command.
$ wget http://www.us.apache.org/dist/lucene/solr/5.3.1/solr-5.3.1.tgz
Run the command below to extract the archived service into '/bin' folder.
$ tar -xzf solr-5.3.1.tgz solr-5.3.1/bin/install_solr_service.sh --strip-components=2
Then run the script to start Solr service that will creates a new 'solr' user and then installs solr as a service.
$ sudo bash ./install_solr_service.sh solr-5.3.1.tgz
![Solr Installation](http://blog.linoxide.com/wp-content/uploads/2015/11/12.png)
To check the status of Solr service, you use the below command.
$ service solr status
![Solr Status](http://blog.linoxide.com/wp-content/uploads/2015/11/22.png)
### Creating Solr Collection: ###
Now we can create multiple collections using Solr user. To do so just run the below command by mentioning the name of the collection you want to create and by specifying its configuration set as shown.
$ sudo su - solr -c "/opt/solr/bin/solr create -c myfirstcollection -n data_driven_schema_configs"
![creating collection](http://blog.linoxide.com/wp-content/uploads/2015/11/32.png)
We have successfully created the new core instance directory for our our first collection where we can add new data in it. To view its default schema file in directory '/opt/solr/server/solr/configsets/data_driven_schema_configs/conf' .
### Using Solr Web ###
Apache Solr can be accessible on the default port of Solr that 8983. Open your favorite browser and navigate to http://your_server_ip:8983/solr or http://your-domain.com:8983/solr. Make sure that the port is allowed in your firewall.
http://172.25.10.171:8983/solr/
![Solr Web Access](http://blog.linoxide.com/wp-content/uploads/2015/11/42.png)
From the Solr Web Console click on the 'Core Admin' button from the left bar, then you will see your first collection that we created earlier using CLI. While you can also create new cores by pointing on the 'Add Core' button.
![Adding Core](http://blog.linoxide.com/wp-content/uploads/2015/11/52.png)
You can also add the document and query from the document as shown in below image by selecting your particular collection and pointing the document. Add the data in the specified format as shown in the box.
{
"number": 1,
"Name": "George Washington",
"birth_year": 1989,
"Starting_Job": 2002,
"End_Job": "2009-04-30",
"Qualification": "Graduation",
"skills": "Linux and Virtualization"
}
After adding the document click on the 'Submit Document' button.
![adding Document](http://blog.linoxide.com/wp-content/uploads/2015/11/62.png)
### Conclusion ###
You are now able to insert and query data using the Solr web interface after its successful installation on Ubuntu. Now add more collections and insert you own data and documents that you wish to put and manage through Solr. We hope you have got this article much helpful and enjoyed reading this.
--------------------------------------------------------------------------------
via: http://linoxide.com/ubuntu-how-to/configure-apache-solr-ubuntu-14-15/
作者:[Kashif][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/
[1]:http://lucene.apache.org/solr/

View File

@ -1,176 +0,0 @@
translating by NearTan
How to Install Laravel PHP Framework on CentOS 7 / Ubuntu 15.04
================================================================================
Hi All, In this article we are going to setup Laravel on CentOS 7 and Ubuntu 15.04. If you are a PHP web developer then you don't need to worry about of all modern PHP frameworks, Laravel is the easiest to get up and running that saves your time and effort and makes web development a joy. Laravel embraces a general development philosophy that sets a high priority on creating maintainable code by following some simple guidelines, you should be able to keep a rapid pace of development and be free to change your code with little fear of breaking existing functionality.
Laravel's PHP framework installation is not a big deal. You can simply follow the step by step guide in this article for your CentOS 7 or Ubuntu 15 server.
### 1) Server Requirements ###
Laravel depends upon a number of prerequisites that must be setup before installing it. Those prerequisites includes some basic tuning parameter of server like your system update, sudo rights and installation of required packages.
Once you are connected to your server make sure to configure the fully qualified domain name then run the commands below to enable EPEL Repo and update your server.
#### 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) Firewall Setup ###
System Firewall and SELinux setup is an important part regarding the security of your applications in production. You can make firewall off if you are working on test server and keep SELinux to permissive mode using the below command, so that you installing setup won't be affected by it.
# setenforce 0
### 3) Apache, MariaDB, PHP Setup ###
Laravel installation requires a complete LAMP stack with OpenSSL, PDO, Mbstring and Tokenizer PHP Extensions. If you are already running LAMP server then you can skip this step to move on and just make sure that the required PHP extensions are installed.
To install AMP stack you can use the below commands on your respective server.
#### CentOS ####
# yum install httpd mariadb-server php56w php56w-mysql php56w-mcrypt php56w-dom php56w-mbstring
To start and enable Apache web and MySQL/Mariadb services at bootup on CentOS 7 , we will use below commands.
# systemctl start httpd
# systemctl enable httpd
----------
#systemctl start mysqld
#systemctl enable mysqld
After starting MariaDB service, we will configure its secured password with below command.
#mysql_secure_installation
#### Ubuntu ####
# apt-get install mysql-server apache2 libapache2-mod-php5 php5-mysql
### 4) Install Composer ###
Now we are going to install composer that is one of the most important requirement before starting the Laravel installation that helps in installing Laravel's dependencies.
#### CentOS/Ubuntu ####
Run the below commands to setup 'composer' in CentOS/Ubuntu.
# 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) Installing Laravel ###
Laravel's installation package can be downloaded from github using the command below.
# wget https://github.com/laravel/laravel/archive/develop.zip
To extract the archived package and move into the document root directory use below commands.
# unzip develop.zip
----------
# mv laravel-develop /var/www/
Now use the following compose command that will install all required dependencies for Laravel within its directory.
# cd /var/www/laravel-develop/
# composer install
![compose laravel](http://blog.linoxide.com/wp-content/uploads/2015/11/25.png)
### 6) Key Encryption ###
For encrypter service, we will be generating a 32 digit encryption key using the command below.
# php artisan key:generate
Application key [Lf54qK56s3qDh0ywgf9JdRxO2N0oV9qI] set successfully
Now put this key into the 'app.php' file as shown below.
# vim /var/www/laravel-develop/config/app.php
![Key encryption](http://blog.linoxide.com/wp-content/uploads/2015/11/45.png)
### 7) Virtua Host and Ownership ###
After composer installation assign the permissions and apache user ownership to the document root directory as shown.
# chmod 775 /var/www/laravel-develop/app/storage
----------
# chown -R apache:apache /var/www/laravel-develop
Open the default configuration file of apache web server using any editor to add the following lines at the end file for new virtual host entry.
# vim /etc/httpd/conf/httpd.conf
----------
ServerName laravel-develop
DocumentRoot /var/www/laravel/public
start Directory /var/www/laravel
AllowOverride All
Directory close
Now the time is to restart apache web server services as shown below and then open your web browser to check your localhost page.
#### CentOS ####
# systemctl restart httpd
#### Ubuntu ####
# service apache2 restart
### 8) Laravel 5 Web Access ###
Open your web browser and give your server IP or Fully Qualified Domain name and you will see the default web page of Laravel 5 frame work.
![Laravel Default](http://blog.linoxide.com/wp-content/uploads/2015/11/35.png)
### Conclusion ###
Laravel Framework is a great tool to develop your web applications. So, at the end of this article you have learned its installation setup on Ubuntu 15 and CentOS 7 , Now start using this awesome PHP framework that provides you a lot of more features and comfort in your development work. Feel free to comment us back for your valuable suggestions an feedback to guide you in more specific and easiest way.
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-how-to/install-laravel-php-centos-7-ubuntu-15-04/
作者:[Kashif][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/

View File

@ -1,55 +0,0 @@
Translating by itsang
NetworkManager and privacy in the IPv6 internet
======================
IPv6 is gaining momentum. With growing use of the protocol concerns about privacy that were not initially anticipated arise. The Internet community actively publishes solutions to them. Whats the current state and how does NetworkManager catch up? Lets figure out!
![](https://blogs.gnome.org/lkundrak/files/2015/12/cameras1.jpg)
## The identity of a IPv6-connected host
The IPv6 enabled nodes dont need a central authority similar to IPv4 [DHCP](https://tools.ietf.org/html/rfc2132) servers to configure their addresses. They discover the networks they are in and [complete the addresses themselves](https://tools.ietf.org/html/rfc4862) by generating the host part. This makes the network configuration simpler and scales better to larger networks. However, theres some drawbacks to this approach. Firstly, the node needs to ensure that its address doesnt collide with an address of any other node on the network. Secondly, if the node uses the same host part of the address in every network it enters then its movement can be tracked and the privacy is at risk.
Internet Engineering Task Force (IETF), the organization behind the Internet standards, [acknowledged this problem](https://tools.ietf.org/html/draft-iesg-serno-privacy-00) and recommends against use of hardware serial numbers to identify the node in the network.
But what does the actual implementation look like?
The problem of address uniqueness is addressed with [Duplicate Address Detection](https://tools.ietf.org/html/rfc4862#section-5.4) (DAD) mechanism. When a node creates an address for itself it first checks whether another node uses the same address using the [Neighbor Discovery Protocol](https://tools.ietf.org/html/rfc4861) (a mechanism not unlike IPv4 [ARP](https://tools.ietf.org/html/rfc826) protocol). When it discovers the address is already used, it must discard it.
The other problem (privacy) is a bit harder to solve. An IP address (be it IPv4 or IPv6) address consists of a network part and the host part. The host discovers the relevant network parts and is supposed generate the host part. Traditionally it just uses an Interface Identifier derived from the network hardwares (MAC) address. The MAC address is set at manufacturing time and can uniquely identify the machine. This guarantees the address is stable and unique. Thats a good thing for address collision avoidance but a bad thing for privacy. The host part remaining constant in different network means that the machine can be uniquely identified as it enters different networks. This seemed like non-issue at the time the protocol was designed, but the privacy concerns arose as the IPv6 gained popularity. Fortunately, theres a solution to this problem.
## Enter privacy extensions
Its no secret that the biggest problem with IPv4 is that the addresses are scarce. This is no longer true with IPv6 and in fact an IPv6-enabled host can use addresses quite liberally. Theres absolutely nothing wrong with having multiple IPv6 addresses attached to the same interface. On the contrary, its a pretty standard situation. At the very minimum each node has an address that is used for contacting nodes on the same hardware link called a link-local address.  When the network contains a router that connects it to other networks in the internet, a node has an address for every network its directly connected to. If a host has more addresses in the same network the node accepts incoming traffic for all of them. For the outgoing connections which, of course, reveal the address to the remote host, the kernel picks the fittest one. But which one is it?
With privacy extensions enabled, as defined by [RFC4941](https://tools.ietf.org/html/rfc4941), a new address with a random host part is generated every now and then. The newest one is used for new outgoing connections while the older ones are deprecated when theyre unused. This is a nifty trick — the host does not reveal the stable address as its not used for outgoing connections, but still accepts connections to it from the hosts that are aware of it.
Theres a downside to this. Certain applications tie the address to the user identity. Consider a web application that issues a HTTP Cookie for the user during the authentication but only accepts it for the connections that come from the address that conducted the authentications. As the kernel generates a new temporary address, the server would reject the requests that use it, effectively logging the user out. It could be argued that the address is not an appropriate mechanism for establishing users identity but thats what some real-world applications do.
## Privacy stable addressing to the rescue
Another approach would be needed to cope with this. Theres a need for an address that is unique (of course), stable for a particular network but still changes when user enters another network so that tracking is not possible. The RFC7217 introduces a mechanism that provides exactly this.
Creation of a privacy stable address relies on a pseudo-random key thats only known the host itself and never revealed to other hosts in the network. This key is then hashed using a cryptographically secure algorithm along with values specific for a particular network connection. It includes an identifier of the network interface, the network prefix and possibly other values specific to the network such as the wireless SSID. The use of the secret key makes it impossible to predict the resulting address for the other hosts while the network-specific data causes it to be different when entering a different network.
This also solves the duplicate address problem nicely. The random key makes collisions unlikely. If, in spite of this, a collision occurs then the hash can be salted with a DAD failure counter and a different address can be generated instead of failing the network connectivity. Now thats clever.
Using privacy stable address doesnt interfere with the privacy extensions at all. You can use the [RFC7217](https://tools.ietf.org/html/rfc7217) stable address while still employing the RFC4941 temporary addresses at the same time.
## Where does NetworkManager stand?
Weve already enabled the privacy extensions with the release NetworkManager 1.0.4. Theyre turned on by default; you can control them with ipv6.ip6-privacy property.
With the release of NetworkManager 1.2, were adding the stable privacy addressing. Its supposed to address the situations where the privacy extensions dont make the cut. The use of the feature is controlled with the ipv6.addr-gen-mode property. If its set to stable-privacy then stable privacy addressing is used. Setting it to “eui64” or not setting it at all preserves the traditional default behavior.
Stay tuned for NetworkManager 1.2 release in early 2016! If you want to try the bleeding-edge snapshot, give Fedora Rawhide a try. It will eventually become Fedora 24.
*Id like to thank Hannes Frederic Sowa for a valuable feedback. The article would make less sense without his corrections. Hannes also created the in-kernel implementation of the RFC7217 mechanism which can be used when the networking is not managed by NetworkManager.*
--------------------------------------------------------------------------------
via: https://blogs.gnome.org/lkundrak/2015/12/03/networkmanager-and-privacy-in-the-ipv6-internet/
作者:[Lubomir Rintel]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,106 +0,0 @@
How to Use Glances to Monitor System on Ubuntu
================================================================================
![](https://www.maketecheasier.com/assets/uploads/2015/12/glances_featured.jpg)
Glances is a cross-platform command-line text-based tool to monitor your system. It is written in Python language and uses the `psutil` library to get information from the system. Using it you can monitor CPU, Load Average, Memory, Network Interfaces, Disk I/O, File System spaces utilization, mounted devices, total number of active processes and top processes. There are many interesting options available in Glances. One of the main features is that you can set thresholds (careful, warning and critical) in a configuration file, and information will be shown in colors which indicates the bottleneck in the system.
### Glances Features ###
- the average CPU load
- total number of processes like active, sleeping processes, etc.
- total memory information like RAM, swap, free memory, etc.
- CPU information
- Network download and upload speed of connections
- Disk I/O read/write speed details
- Currently mounted devices disk usages
- Top processes with their CPU/memory usages
### Installing Glances ###
Installing Glances on Ubuntu is easy, as it is available on Ubuntus repository. You can install Glances by running the following command.
sudo apt-get install glances
### Usage of Glances ###
After installation has been finished, you can launch Glances by running the following command:
glances
You will see an output like the following:
![glances monitor system output](https://www.maketecheasier.com/assets/uploads/2015/12/glances_output1.png)
Press ESC or “Ctrl + C” to quit from the Glances terminal.
By default, the interval time is set to 1 second, but you can define the custom interval time while running glances from the terminal.
To set the interval time to 5 seconds, run the following command:
glances -t 5
### Glances Color Codes ###
Glances color code meanings:
- `GREEN` : OK
- `BLUE` : CAREFUL
- `VIOLET` : ALERT
- `RED` : CRITICAL
By default, Glances thresholds set is: careful=50, warning=70, critical=90. You can customize the threshold by using the default configuration file glances.conf located at the “/etc/glances/” directory.
### Glances Options ###
Glances provides sever so hot keys to find output information while it is running.
Below are the list of several hot keys.
- `m` : sort processes by MEM%
- `p` : sort processes by name
- `c` : sort processes by CPU%
- `d` : show/hide disk I/O stats
- `a` : sort processes automatically
- `f` : show/hide file system statshddtemp
- `i` : sort processes by I/O rate
- `s` : show/hide sensors stats
- `y` : show/hide hddtemp stats
- `l` : show/hide logs
- `n` : show/hide network stats
- `x` : delete warning and critical logs
- `h` : show/hide help screen
- `q` : quit
- `w` : delete warning logs
### Use Glances to Monitor Remote Systems ###
You can also monitor remote systems using Glances. To use it on a remote system, use the following command:
glances -s
You will see an output like the following:
![glances monitor remote system server](https://www.maketecheasier.com/assets/uploads/2015/12/glances_server.png)
You will see Glances running on port 61209.
Now, go to the remote machine and execute the following command to connect to a Glances server by specifying the IP address as shown below. For example, 192.168.1.10 is your Glances server IP address.
glances -c -P 192.168.1.10
### Conclusion ###
Glances is a very useful tool for every Linux system administrator. Using it, you can easily monitor your Linux system in less time. Feel free to comment if you have any questions.
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/glances-monitor-system-ubuntu/
作者:[Hitesh Jethva][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/hiteshjethva/

View File

@ -0,0 +1,68 @@
Back in early 2013, your editor [dedicated a sacrificial handset][2] to the testing of the then-new Ubuntu Touch distribution. At that time, things were so unbaked that the distribution came with mocked-up data for unready apps; it even came with a set of fake tweets. Nearly three years later, it seemed time to give Ubuntu Touch another try on another sacrificial device. This distribution has certainly made some progress in those years, but, sadly, it still seems far from being a competitive offering in this space.
In particular, your editor tested version 16.04r3 from the testing channel on a Nexus 4 handset. The Nexus 4 is certainly past its prime at the end of 2015, but it still functions as a credible Android device. It is, in any case, the only phone handset on [the list of supported devices][1] other than the three that were sold (in locations far from your editor's home) with Ubuntu Touch pre-installed. It is a bit discouraging that Ubuntu Touch is not supported on a more recent device; the Nexus 4 was discontinued over two years ago.
People who are accustomed to putting strange systems on Nexus devices know the drill fairly well: unlock the bootloader, install a new recovery image if necessary, then use the **fastboot** tool to flash a new image. Ubuntu Touch does not work that way; instead, one must use a set of tools available only on the Ubuntu desktop distribution. Your editor's current menagerie of systems does not include any of those, but, fortunately, running the Ubuntu 15.10 distribution off a USB drive works just fine. It must be said, though, that Ubuntu appears not to have gotten the memo regarding high-DPI laptop displays; 15.10 is an exercise in eyestrain on such a device.
Once the requisite packages have been installed, the **ubuntu-device-flash** command can be used to install Ubuntu Touch on the phone. It finds the installation image wherever Canonical hides them (it's not obvious where that is) and puts it onto the phone; the process, on the Nexus 4, took about three hours — a surprisingly long time. Among other things, it installs a Ubuntu-specific recovery image, regardless of whether that should be necessary or not. The installation takes up about 4.5GB of space on the device. At the end, the phone reboots and comes up with the Ubuntu Touch lock screen, which has changed little in the last three years. The first boot takes a discouragingly long time, but subsequent reboots are faster, perhaps faster than Android on the same device.
Alas, that's about the only thing that is faster than Android. The phone starts sluggish and gets worse as time goes on. At one point it took a solid minute to get the dialer screen up on the running device. Scrolling can be jerky and unpleasant to work with. At least once, the phone bogged down to the point that there was little alternative to shutting it down and starting over.
Logging into the device over the USB connection offers some clues as to why that might be. There were no less than 258 processes running on the system. A number of them have "evolution" in their name, which is never a good sign even on a heftier system. Daemons like NetworkManager and pulseaudio are running. In general, Ubuntu Touch seems to have a large number of relatively large moving parts, leading, seemingly, to memory pressure and a certain amount of thrashing.
Three years ago, Ubuntu Touch was built on an Android chassis. There are still bits of Android that show up here and there (it uses binder, for example), but a number of those components have been replaced. This release runs an Android-derived kernel that identifies itself as "3.4.0-7 #39-Ubuntu". 3.4.0 was released in May 2012, so it is getting a bit long in the tooth; the 3.4.0 number suggests this kernel hasn't even gotten the stable updates that followed that release. Finding the source for the kernel in this distribution is not easy; it must almost certainly be hidden somewhere in this Gerrit repository, but your editor ran out of time while trying to find it. The SurfaceFlinger display manager has been replaced by Ubuntu's own Mir, with Unity providing the interface. Upstart is the init system, despite the fact that Ubuntu has moved to systemd on desktop systems.
When one moves beyond the command-line interface and starts playing with the touchscreen, one finds that the basics of the interface resemble what was demonstrated three years ago. Swiping from the left edge brings the [Overview screen] Unity icon bar (but no longer switches to a home screen; the "home screen" concept doesn't really seem to exist anymore). Swiping from the right will either switch to another application or produce an overview of running applications; it's not clear how it decides which. The overview provides a cute oblique view of the running applications; it's sufficient to choose one, but seems somewhat wasteful of screen space. Swiping up from the bottom produces an application-specific menu — usually.
![][3]
The swipe gestures work well enough once one gets used to them, but there is scope for confusion. The camera app, for example, will instruct the user to "swipe left for photo roll," but, unless one is careful to avoid [Swipe left] the right edge of the screen, that gesture will yield the overview screen instead. One can learn subtleties like "swipes involving the edge" and "swipes avoiding the edge," but one could argue that such an interface is more difficult than it needs to be and less discoverable than it could be.
![][4]
Speaking of the camera app, it takes pictures as one might expect, and it has gained a high-dynamic-range mode in recent years. It still has no support for stitching together photos in a panorama or "photo sphere" mode, though.
![][5]
The base distribution comes with a fairly basic set of apps. Many of them appear to be interfaces to an associated web page; the Amazon, GMail, and Facebook apps, for example. Something called "Shorts" appears to be an RSS reader, though it seems impervious to the addition of arbitrary feeds. There is a terminal app, but it prompts for a password — a bit surprising [Terminal emulator] given that no password had ever been supplied for the device (it turns out that one should use the screen-lock PIN here). It's not clear that this extra level of "security" is helpful, given that the user involved is already able to install, launch, and run applications on the device, but so it goes.
Despite the presence of all those evolution processes, there is no IMAP-capable email app; there are also no mapping apps. There is a rudimentary web browser with Ubuntu branding; it appears that this browser is based on Chromium. The weather app is limited to a few dozen hardwired locations worldwide; the closest supported location to LWN headquarters was Houston, which, one assumes, is unlikely to be dealing with the foot of snow your editor had to shovel while partway through this article. One suspects we would have heard about that.
![][6]
Inevitably, there is a store from which one can obtain other apps. There are, for example, a couple of seemingly capable, OpenStreetMap-based mapping apps there, including one that claims turn-by-turn navigation, but nothing requiring GPS access worked in your editor's tests. Games abound, of course, but [Maps] there is little in the way of apps that are well known in the Android or iOS worlds. The store will refuse to allow the installation of apps until one creates a "Ubuntu One" account; that is unfortunate, but most Android users never get anywhere near that far before having to create or supply a Google account.
![][7]
Canonical puts a fair amount of energy into promoting its "scopes," which are said to be better than apps for the aggregation of content. In truth, they seem to just be another type of app with a focus on gathering information from more than one source. Although, with "branded scopes," the "more than one source" part is often deliberately put by the wayside. Your editor played around with scopes for a while, but, in truth, could not find what was supposed to make them special.
Permissions management in Ubuntu Touch resembles that found in recent Android releases: the user will be prompted the first time an application tries to exercise a specific privilege. As with Android, the number of [Permissions request] actions requiring privilege is relatively small, and "connect to any arbitrary site on the Internet" is not among them. Access to location information or the camera, though, will generate a prompt. There is also, again as with Android, a way to control which applications are allowed to place notifications on the screen.
Ubuntu Touch still seems to drain the battery far more quickly than Android does on the same device. Indeed, it is barely able to get through the night while sitting idle. There is a cute battery app that offers a couple of "ways to reduce battery use," but it lacks Android's ability to say which apps are actually draining the battery (though, it must be said, that information from Android is often less helpful than one might hope).
![][8]
The keyboard now has proper multi-lingual support (though there is no visual indication of which language is currently in effect) and, as with Android, one can switch between languages on the fly. It offers word suggestions, does [Keyboard] spelling correction, and all the usual things. One missing feature, though, is "swipe" typing which, your editor has found, can speed the process of inputting text on a small keyboard considerably. There is also no voice input; no major loss from your editor's point of view, but others will probably see that differently.
There is a lot to like in Ubuntu Touch. There is some appeal to running something that looks like a proper Linux system, even if it still has a number of Ubuntu-specific components. One does not get the sense that the device is watching quite as closely as Android devices do, though it's not entirely clear, for example, what happens with location data or where it might be stored. In any case, a Ubuntu device clearly has more free software on it than most alternatives do; there is no proprietary "play services" layer maintaining control over the system.
Sadly, though, this distribution still is not up to the capabilities and the performance of the big alternatives. Switching to Ubuntu Touch means settling for a much slower system, running on a severely limited set of devices, with a relative scarcity of apps to choose from. Your editor would very much like to see a handset distribution that is more free and more open than the alternatives, but that distribution must also be competitive with those alternatives, and that does not seem to be the case here. Unless Canonical can find a way to close the performance and feature gaps with Android, it seems unlikely to have much hope of achieving uptake that is within a few orders of magnitude of Android's.
--------------------------------------
via: https://lwn.net/Articles/667983/
作者Jonathan Corbet
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[1]: https://developer.ubuntu.com/en/start/ubuntu-for-devices/devices/
[2]: https://lwn.net/Articles/540138/
[3]: https://static.lwn.net/images/2015/utouch/overview-sm.png
[4]: https://static.lwn.net/images/2015/utouch/camera-swipe-sm.png
[5]: https://static.lwn.net/images/2015/utouch/terminal.png
[6]: https://static.lwn.net/images/2015/utouch/gps-sm.png
[7]: https://static.lwn.net/images/2015/utouch/camera-perm.png
[8]: https://static.lwn.net/images/2015/utouch/schifo.png

View File

@ -0,0 +1,235 @@
Grub 2: Heal your bootloader
================================================================================
**There are few things as irritating as a broken bootloader. Get the best out of Grub 2 and keep it shipshape.**
Why do this?
- Grub 2 is the most popular bootloader thats used by almost every Linux distribution.
- A bootloader is a vital piece of software, but they are susceptible to damage.
- Grub 2 is an expansive and flexible boot loader that offers various customisable options.
The Grub 2 Linux bootloader is a wonderful and versatile piece of software. While it isnt the only bootloader out there, its the most popular and almost all the leading desktop distros use it. The job of the Grub bootloader is twofold. First, it displays a menu of all installed operating systems on a computer and invites you to pick one. Second, Grub loads the Linux kernel if you choose a Linux operating system from the boot menu.
As you can see, if you use Linux, you cant escape the bootloader. Yet its one the least understood components inside a Linux distro. In this tutorial well familiarise you with some of Grub 2s famed versatility and equip you with the skills to help yourself when you have a misbehaving bootloader.
The most important parts of Grub 2 are a bunch of text files and a couple of scripts. The first piece to know is **/etc/default/grub**. This is the text file in which you can set the general configuration variables and other characteristics of the Grub 2 menu (see box titled “Common user settings”).
The other important aspect of Grub 2 is the **/etc/grub.d** folder. All the scripts that define each menu entry are housed there. The names of these scripts must have a two-digit numeric prefix. Its purpose is to define the order in which the scripts are executed and the order of the corresponding entries when the Grub 2 menu is built. The **00_header** file is read first, which parses the **/etc/default/grub** configuration file. Then come the entries for the Linux kernels in the **10_linux** file. This script creates one regular and one recovery menu entry for each kernel in the default **/boot** partition.
This script is followed by others for third-party apps such as **30_os-prober** and **40_custom**. The **os-prober** script creates entries for kernels and other operating systems found on other partitions. It can recognise Linux, Windows, BSD and Mac OS X installations. If your hard disk layout is too exotic for the **os-prober** script to pick up an installed distro, you can add it to the **40_custom** file (see the “Add custom entries” box).
**Grub** 2 does not require you to manually maintain your boot options configuration file: instead it generates the **/boot/grub/grub.cfg** file with the **grub2-mkconfig** command. This utility will parse the scripts in the **/etc/grub.d** directory and the **/etc/default/grub** settings file to define your setup.
Graphical boot repair
A vast majority of Grub 2 issues can easily be resolved with the touch of a button thanks to the Boot Repair app. This nifty little application has an intuitive user interface and can scan and comprehend various kinds of disk layouts and partitioning schemes, and can sniff out and correctly identify operating system installations inside them. The utility works on traditional computers with a Master Boot Record (MBR) as well as the newer UEFI computers with the UID Partition Table (GPT) layout.
The easiest way to use Boot Repair is to install it inside a Live Ubuntu session. Fire up an Ubuntu Live distro on a machine with a broken bootloader and install Boot Repair by first adding its PPA repository with
sudo add-apt-repository ppa:yannubuntu/Boot Repair
Then refresh the list of repositories with
sudo apt-get update
before installing the app with
sudo apt-get install -y Boot Repair
Fire up the tool once its installed. The app will scan your hard disk before displaying its interface, which is made up of a couple of buttons. To follow the advice of the tool, simply press the Recommended Repair button, which should fix most broken bootloaders. After its restored your bootloader, the tool also spits out a small URL which you should note. The URL contains a detailed summary of your disks, including your partitions along with the contents of important Grub 2 files including **/etc/default/grub** and **boot/grub/grub.cfg**. If the tool hasnt been able to fix your bootloader, you can share the URL on your distros forum boards to allow others to understand your disk layout and offer suggestions.
![](http://www.linuxvoice.com/wp-content/uploads/2015/10/boot-repair-large.jpg)
**Boot Repair also lets you customise Grub 2s options.**
#### Bootloader bailout ####
Grub 2 boot problems can leave the system in several states. The text on the display where youd expect the bootloader menu gives an indication of the current state of the system. If the system stops booting at the **grub>** prompt, it means the Grub 2 modules were loaded but it couldnt find the **grub.cfg** file. This is the full Grub 2 command shell and you can do quite a bit here to help yourself. If you see the **grub rescue>** prompt, it means that the bootloader couldnt find the Grub 2 modules nor could it find any of your boot files. However, if your screen just displays the word GRUB, it means the bootloader has failed to find even the most basic information thats usually contained in the Master Boot Record.
You can correct these Grub failures either by using a live CD or from Grub 2s command shell. If youre lucky and your bootloader drops you at the **grub>** prompt, you have the power of the Grub 2 shell at your disposal to correct any errors.
The next few commands work with both **grub>** and **grub rescue>**. The **set pager=1** command invokes the pager, which prevents text from scrolling off the screen. You can also use the **ls** command which lists all partitions that Grub sees, like this:
grub> ls
(hd0) (hd0,msdos5) (hd0,msdos6) (hd1,msdos1)
As you can see, the command also lists the partition table scheme along with the partitions.
You can also use the **ls** command on each partition to find your root filesystem:
grub> ls (hd0,5)/
lost+found/ var/ etc/ media/ bin/ initrd.gz
boot/ dev/ home/ selinux/ srv/ tmp/ vmlinuz
You can drop the **msdos** bit from the name of the partition. Also, if you miss the trailing slash and instead say **ls (hd0,5)** youll get information about the partition including its filesystem type, total size, and last modification time. If you have multiple partitions, read the contents of the **/etc/issue** file with the **cat** command to identify the distro, such as **cat (hd0,5)/etc/issue**.
Assuming you find the root filesystem youre looking for inside **(hd0,5)**, make sure that it contains the /**boot/grub** directory and the Linux kernel image you wish to boot into, such as **vmlinuz-3.13.0-24-generic**. Now type the following:
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
The first command points Grub to the partition housing the distro we wish to boot into. The second command then tells Grub the location of the kernel image inside the partition as well as the location of the root filesystem. The final line sets the location of the initial ramdisk file. You can use tab autocompletion to fill in the name of the kernel and the initrd, which will save you a lot of time and effort.
Once youve keyed these in, type **boot** at the next **grub>** prompt and Grub will boot into the specified operating system.
Things are a little different if youre at the **grub rescue>** prompt. Since the bootloader hasnt been able to find and load any of the required modules, youll have to insert them manually:
grub rescue> set root=(hd0,5)
grub rescue> insmod (hd0,5)/boot/grub/normal.mod
grub rescue> normal
grub> insmod linux
As you can see, just like before, after we use the **ls** command to hunt down the Linux partition, we mark it with the **set** command. We then insert the **normal** module, which when activated will return us to the standard **grub>** mode. The next command then inserts the linux module in case it hasnt been loaded. Once this module has been loaded you can proceed to point the boot loader to the kernel image and initrd files just as before and round off the procedure with the **boot** command to bring up the distro.
Once youve successfully booted into the distro, dont forget to regenerate a new configuration file for Grub with the
grub-mkconfig -o /boot/grub/grub.cfg
command. Youll also have to install a copy of the bootloader into the MBR with the
sudo grub2-install /dev/sda
command.
![](http://www.linuxvoice.com/wp-content/uploads/2015/10/grub2-cfg-large.jpg)
**To disable a script under the /etc/grub.d, all you need to do is remove the executable bit, for example with chmod -x /etc/grub.d/20_memtest86+ which will remove the Memory Test option from the menu.**
### Grub 2 and UEFI ###
UEFI-enabled machines (more or less, any machine sold in the last couple of years) have added another layer of complexity to debugging a broken **Grub 2** bootloader. While the procedure for restoring a **Grub 2** install on a UEFI machine isnt much different than it is on a non-UEFI machine, the newer firmware handles things differently, which results in mixed restoration results.
On a UEFI-based system, you do not install anything in the MBR. Instead you install a Linux EFI bootloader in the EFI System Partition (ESP) and set it as the EFIs default boot program using a tool such as **efibootmgr** for Linux, or **bcdedit** for Windows.
As things stand now, the Grub 2 bootloader should be installed properly when installing any major desktop Linux distro, which will happily coexist with Windows 8. However, if you end up with a broken bootloader, you can restore the machine with a live distro. When you boot the live medium, make sure you boot it in the UEFI mode. The computers boot menu will have two boot options for each removable drive a vanilla option and an option tagged with UEFI. Use the latter to expose the EFI variables in **/sys/firmware/efi/**.
From the live environment, mount the root filesystem of the broken installation as mentioned in the tutorial. Youll also have to mount the ESP partition. Assuming its **/dev/sda1**, you can mount it with
sudo mount /dev/sda1 /mnt/boot/efi
Then load the **efivars** module with **modprobe efivars** before chrooting into the installed distribution as shown in the tutorial.
Here on, if youre using Fedora, reinstall the bootloader with the
yum reinstall grub2-efi shim
command followed by
grub2-mkconfig -o /boot/grub2/grub.cfg
to generate the new configuration file. Ubuntu users can do this with
apt-get install --reinstall grub-efi-amd64
With the bootloader in place, exit chroot, unmount all partitions and reboot to the Grub 2 menu.
#### Dude, wheres my Grub? ####
The best thing about Grub 2 is that you can reinstall it whenever you want. So if you lose the Grub 2 bootloader, say when another OS like Windows replaces it with its own bootloader, you can restore Grub within a few steps with the help of a live distro. Assuming youve installed a distro on **/dev/sda5**, you can reinstall Grub by first creating a mount directory for the distro with
sudo mkdir -p /mnt/distro
and then mounting the partition with
mount /dev/sda5 /mnt/distro
You can then reinstall Grub with
grub2-install --root-directory=/mnt/distro /dev/sda
This command will rewrite the MBR information on the **/dev/sda** device, point to the current Linux installation and rewrite some Grub 2 files such as **grubenv** and **device.map**.
Another common issue pops up on computers with multiple distros. When you install a new Linux distro, its bootloader should pick up the already installed distros. In case it doesnt, just boot into the newly installed distro and run
grub2-mkconfig
Before running the command, make sure that the root partitions of the distros missing from the boot menu are mounted. If the distro you wish to add has **/root** and **/home** on separate partitions, only mount the partition that contains /root, before running the **grub2-mkconfig** command.
While Grub 2 will be able to pick most distros, trying to add a Fedora installation from within Ubuntu requires one extra step. If youve installed Fedora with its default settings, the distros installer would have created LVM partitions. In this case, youll first have to install the **lvm2** driver using the distros package management system, such as with
sudo apt-get install lvm2
before Grub 2s **os-prober** script can find and add Fedora to the boot menu.
### Common user settings ###
Grub 2 has lots of configuration variables. Here are some of the common ones that youre most likely to modify in the **/etc/default/grub** file. The **GRUB_DEFAULT** variable specifies the default boot entry. It will accept a numeric value such as 0, which denotes the first entry, or “saved” which will point it to the selected option from the previous boot. The **GRUB_TIMEOUT** variable specifies the delay before booting the default menu entry and the **GRUB_CMDLINE_LINUX** variable lists the parameters that are passed on the kernel command line for all Linux menu entries.
If the **GRUB_DISABLE_RECOVERY** variable is set to **true**, the recovery mode menu entries will not be generated. These entries boot the distro into single-user mode from where you can repair your system with command line tools. Also useful is the **GRUB_GFXMODE** variable, which specifies the resolution of the text shown in the menu. The variable can take any value supported by your graphics card.
![](http://www.linuxvoice.com/wp-content/uploads/2015/10/grub2-cli-large.jpg)
**Grub 2 has a command line, which you can invoke by pressing C at the bootloader menu.**
#### Thorough fix ####
If the **grub2-install** command didnt work for you, and you still cant boot into Linux, youll need to completely reinstall and reconfigure the bootloader. For this task, well use the venerable **chroot** utility to change the run environment from that of the live CD to the Linux install we want to recover. You can use any Linux live CD for this purpose as long as it has the **chroot** tool. However, make sure the live medium is for the same architecture as the architecture of the installation on the hard disk. So if you wish to **chroot** to a 64-bit installation you must use an amd64 live distro.
After youve booted the live distro, the first order of business is to check the partitions on the machine. Use **fdisk -l** to list all the partitions on the disk and make note of the partition that holds the Grub 2 installation that you want to fix.
Lets assume we wish to restore the bootloader from the distro installed in **/dev/sda5**. Fire up a terminal and mount it with:
sudo mount /dev/sda5 /mnt
Now youll have to bind the directories that the Grub 2 bootloader needs access to in order to detect other operating systems:
$ 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
Were now all set to leave the live environment and enter into the distro installed inside the **/dev/sda5** partition via **chroot**:
$ sudo chroot /mnt /bin/bash
Youre now all set to install, check, and update Grub. Just like before, use the
sudo grub2-install /dev/sda
command to reinstall the bootloader. Since the **grub2-install** command doesnt touch the **grub.cfg** file, well have to create it manually with
sudo grub-mkconfig -o /boot/grub/grub.cfg
That should do the trick. You now have a fresh copy of Grub 2 with a list of all the operating systems and distros installed on your machine. Before you can restart the computer, youll have to exit the chrooted system and unmount all the partitions in the following order:
$ exit
$ sudo umount /mnt/sys
$ sudo umount /mnt/proc
$ sudo umount /mnt/dev/pts
$ sudo umount /mnt/dev
$ sudo umount /mnt
You can now safely reboot the machine, which should be back under Grub 2s control, and the bootloader under yours!
### Add custom entries ###
If you wish to add an entry to the bootloader menu, you should add a boot stanza to the **40_custom** script. You can, for example, use it to display an entry to boot a Linux distro installed on a removable USB drive. Assuming your USB drive is **sdb1**, and the vmlinuz kernel image and the initrd files are under the root (/) directory, add the following to the **40_custom** file:
menuentry “Linux on USB” {
set root=(hd1,1)
linux /vmlinuz root=/dev/sdb1 ro quiet splash
initrd /initrd.img
}
For more accurate results, instead of device and partition names you can use their UUIDs, such as
set root=UUID=54f22dd7-eabe
Use
sudo blkid
to find the UUIDs of all the connected drives and partitions. You can also add entries for any distros on your disk that werent picked up by the os-prober script, as long as you know where the distros installed and the location of its kernel and initrd image files.
--------------------------------------------------------------------------------
via: https://www.linuxvoice.com/grub-2-heal-your-bootloader/
作者:[Mayank Sharma][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.linuxvoice.com/author/mayank/

View File

@ -0,0 +1,53 @@
Watch Star Wars In Linux Terminal
================================================================================
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-2.png)
Star Wars fever has gripped the world. The latest installment in the [Star Wars series, Star Wars: The Force Awakens, has broken the opening records][1].
While I cannot help you to get a ticket of the latest Star Wars movie, I can certainly provide you a way to watch [Star Wars episode IV][2], the original and very first Star Wars movie.
No, it wont be HD, Blue Ray edition. Instead, it will be the ASCII version of Star Wars episode IV and you can watch it in Linux Terminal, in true geek way :)
### Watch Star Wars in Linux Terminal ###
Open a terminal and use the following command:
telnet towel.blinkenlights.nl
Wait for a few seconds and you can see animated ASCII art in the terminal like this:
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal.png)
And it will keep on going:
![](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)
To stop the animation, press ctrl+]. After that type quit to come out of telnet command.
### More terminal fun ###
In fact, watching Star Wars is not the only fun thing you can do in Linux terminal. You can run a [train in terminal][3] or [get Linux logo in ASCII art][4].
I let you enjoy Star Wars in Linux :)
--------------------------------------------------------------------------------
via: http://itsfoss.com/star-wars-linux/
作者:[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://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/

View File

@ -1,389 +0,0 @@
GHLandy Translating
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 its 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 视频
<iframe width="720" height="405" frameborder="0" allowfullscreen="allowfullscreen" src="//www.youtube.com/embed/Y29qZ71Kicg"></iframe>
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 youre 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/ms 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 were 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, <b.:q! enforces quitting without saving).
注:表格
<table cellspacing="0" border="0">
<colgroup width="290">
</colgroup>
<colgroup width="781">
</colgroup>
<tbody>
<tr>
<td bgcolor="#999999" height="19" align="LEFT" style="border: 1px solid #000000;"><b><span style="font-size: small;">&nbsp;Key command</span></b></td>
<td bgcolor="#999999" align="LEFT" style="border: 1px solid #000000;"><b><span style="font-size: small;">&nbsp;Description</span></b></td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;h or left arrow</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go one character to the left</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;j or down arrow</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go down one line</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;k or up arrow</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go up one line</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;l (lowercase L) or right arrow</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go one character to the right</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;H</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go to the top of the screen</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;L</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go to the bottom of the screen</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;G</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go to the end of the file</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;w</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Move one word to the right</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;b</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Move one word to the left</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;0 (zero)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go to the beginning of the current line</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;^</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go to the first nonblank character on the current line</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;$</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go to the end of the current line</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;Ctrl-B</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go back one screen</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;Ctrl-F</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Go forward one screen</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;i</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Insert at the current cursor position</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;I (uppercase i)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Insert at the beginning of the current line</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;J (uppercase j)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Join current line with the next one (move next line up)</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;a</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Append after the current cursor position</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;o (lowercase O)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Creates a blank line after the current line</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;O (uppercase o)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Creates a blank line before the current line</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;r</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Replace the character at the current cursor position</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;R</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Overwrite at the current cursor position</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;x</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Delete the character at the current cursor position</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;X</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Delete the character immediately before (to the left) of the current cursor position</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;dd</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Cut (for later pasting) the entire current line</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;D</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Cut from the current cursor position to the end of the line (this command is equivalent to d$)</td>
</tr>
<tr class="alt">
<td height="20" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;yX</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Give a movement command X, copy (yank) the appropriate number of characters, words, or lines from the current cursor position</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;yy or Y</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Yank (copy) the entire current line</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;p</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Paste after (next line) the current cursor position</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;P</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Paste before (previous line) the current cursor position</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;. (period)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Repeat the last command</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;u</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Undo the last command</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;U</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Undo the last command in the last line. This will work as long as the cursor is still on the line.</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;n</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Find the next match in a search</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;N</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Find the previous match in a search</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;:n</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Next file; when multiple files are specified for editing, this commands loads the next file.</td>
</tr>
<tr class="alt">
<td height="20" align="LEFT" style="border: 1px solid #000000;">&nbsp;:e file</td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Load file in place of the current file.</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000000;">&nbsp;:r file</td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Insert the contents of file after (next line) the current cursor position</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;:q</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Quit without saving changes.</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000000;">&nbsp;:w file</td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Write the current buffer to file. To append to an existing file, use :w &gt;&gt; file.</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;:wq</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Write the contents of the current file and quit. Equivalent to x! and ZZ</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000000;">&nbsp;:r! command</td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;Execute command and insert output after (next line) the current cursor position.</td>
</tr>
</tbody>
</table>
#### 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 youre 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 seds) 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 ####
Lets 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 (lets 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

View File

@ -1,3 +1,5 @@
GHLandy Translateing
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.
@ -379,4 +381,4 @@ via: http://www.tecmint.com/compress-files-and-finding-files-in-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
[6]:https://identity.linuxfoundation.org/user?destination=pid/1

View File

@ -1,69 +0,0 @@
黑客利用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)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [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&amp;action=click&amp;pgtype=Homepage&amp;module=first-column-region%C2%AEion=top-news&amp;WT.nav=top-news&amp;_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

View File

@ -1,64 +0,0 @@
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接口程序的支持下eSpeak仍然能正常使用
- 可移植到其它平台包括安卓OSX等
- 多种特色声音提供选择
- 语音输出可保存为[.WAV][2]格式的文件
- 部分SSML([Speech Synthesis Markup Language][3])能为HTML所支持
- 体积小巧整个程序包括语言支持等占用不足2MB
- 可以实现文本到音素编码的转化,能被其它语音合成引擎吸纳为前端工具
- 可作为生成和调制音素数据的开发工具
### 安装eSpeak ###
基于Ubuntu的系统中在终端运行以下命令安装eSpeak
sudo apt-get install espeak
eSpeak is an old tool and I presume that it should be available in the repositories of other Linux distributions such as Arch Linux, Fedora etc. You can install eSpeak easily using dnf, pacman etc.eSpeak是一个古老的工具我推测它应该能在其它众多Linux发行版如ArchFedora中运行。使用dnfpacman等命令就能轻易安装。
eSpeak用法如下输入espeak按enter键运行程序。输入字符按enter转换为语音输出译补。使用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还是挺方便使用的。需则用之吧~
--------------------------------------------------------------------------------
via: http://itsfoss.com/espeak-text-speech-linux/
作者:[Abhishek][a]
译者:[译者ID](https://github.com/soooogreen)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [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

View File

@ -0,0 +1,125 @@
# 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]这个消息时都大吃一惊。其在后来被揭露,这其实是一个微软开发的用于`Azur cloud switches`的[软件][2]。
但故事还没结束。微软真的与Canonical Ubuntu Linux的母公司达成合作 来开发[HDInsight][3]——微软在通过Azure上构建Hadoop来进行大数据处理的服务. Ubuntu是[微软在其上部署软件][4]的第一个Linux系统。
微软会继续保持它与Linux的关系吗 还是在使用Linux达到其目的(Azur)就会收手?只有时间能告诉我们一切。
#### 微软发布适用于Linux的Visual Studio Code
在微软发布Linux发行版引起喧嚣之前微软扔下了另一枚炸弹——发布Linux版Visual Studio Code, 与其一并发布的还有Windows以及OS X版。尽管Visual Studio Code并不是开源的从某种意义上讲发布Linux版本仍然是Linux用户的胜利。 无论如何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何时死亡只是一个时间问题。
#### “Ubuntu家族”内讧
今年五月Jonathan RiddellKubuntu项目的领导者[被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)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: http://itsfoss.com/author/abhishek/
[1]: http://www.theregister.co.uk/2015/09/18/microsoft_has_developed_its_own_linux_repeat_microsoft_has_developed_its_own_linux/
[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]: http://itsfoss.com/install-visual-studio-code-ubuntu/
[6]: http://itsfoss.com/swift-open-source-linux/
[7]: http://itsfoss.com/use-swift-linux/
[8]: https://business.facebook.com/itsfoss/photos/pb.115098615297581.-2207520000.1450817108./634288916711879/?type=3&amp;theater
[9]: http://www.engadget.com/2015/07/24/ubuntu-phone-review/
[10]: http://techcrunch.com/2015/11/20/jolla-running-out-of-runway-for-its-android-alternative/
[11]: https://www.indiegogo.com/projects/jolla-tablet-world-s-first-crowdsourced-tablet#/
[12]: https://blog.jolla.com/jolla-back-business/
[13]: http://arstechnica.com/gadgets/2015/12/firefox-os-smartphones-are-dead/
[14]: https://www.tizen.org/
[15]: http://www.omgubuntu.co.uk/2015/05/kubuntu-project-lead-asked-to-step-down-by-ubuntu-community-council
[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&amp;m=137392506516022&amp;w=2
[20]: http://www.networkworld.com/article/2988850/opensource-subnet/linux-kernel-dev-sarah-sharp-quits-citing-brutal-communications-style.html
[21]: http://itsfoss.com/linux-gaming-guide/
[22]: http://itsfoss.com/unity-gaming-engine-linux/
[23]: http://itsfoss.com/tag/open-source-adoption/
[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/

View File

@ -0,0 +1,61 @@
DFileManager:文件流文件管理器
================================================================================
一个像宝石一样的文件管理器从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
在我的Ubuntu15.04系统上,会产生如下结果
![Ubuntu 15.04 Packages](http://www.linuxlinks.com/portal/content/reviews/FileManagers/UbuntuPackages.png)
正如上面的截图所示在所有的库中大约有39000个包在主库中有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文件流视图.这提供了一个拥有相当有吸引力的体验的滑动当前文件夹下的文件的能力。这是看图片的理想选择。这个文件管理器酷似Finder(Macintosh 操作系统下的默认文件管理器),可能会对你有吸引力。
![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)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://gofk.tumblr.com/

View File

@ -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 的默认init 系统是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 企业版GitlabGogsBitbucket 关联的集成点。在本文里我们只集成了github但是如果哦我们要集成其他的我们可以在配置文件做修改。为了集成github 我们需要在[github setting] 创建一个新的应用。
![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 作为默认的init 系统所以只需要简单执行下面的service 命令就可以启动drone 了。
# service drone restart
要让drone 在系统启动时也自动运行,需要运行下面的命令。
# update-rc.d drone defaults
#### CentOS ####
因为CentOS 7使用systemd 作为init 系统所以只需要运行下面的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)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [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

View File

@ -1,6 +1,6 @@
在 Ubuntu 15.10 上为单个网卡设置多个 IP 地址
================================================================================
有时候你可能想在你的网卡上使用多个 IP 地址。遇到这种情况你会怎么办呢?买一个新的网卡并分配一个新的 IP没有必要(至少在小网络中)。现在我们可以在 Ubuntu 系统中为一个网卡分配多个 IP 地址。想知道怎么做到的?跟着我往下看,其实并不难。
有时候你可能想在你的网卡上使用多个 IP 地址。遇到这种情况你会怎么办呢?买一个新的网卡并分配一个新的 IP没有这个必要(至少在小网络中)。现在我们可以在 Ubuntu 系统中为一个网卡分配多个 IP 地址。想知道怎么做到的?跟着我往下看,其实并不难。
这个方法也适用于 Debian 以及它的衍生版本。
@ -12,7 +12,7 @@
sudo ip addr
**例输出:**
**例输出:**
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
@ -31,7 +31,7 @@
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
@ -50,7 +50,7 @@
collisions:0 txqueuelen:0
RX bytes:38793 (38.7 KB) TX bytes:38793 (38.7 KB)
正如你在上面看到的,我的网卡名称是 **enp0s3**,它的 IP 地址是 **192.168.1.103**
正如你在上面输出中看到的,我的网卡名称是 **enp0s3**,它的 IP 地址是 **192.168.1.103**
现在让我们来为网卡添加一个新的 IP 地址,例如说 **192.168.1.104**
@ -73,7 +73,7 @@
inet6 fe80::a00:27ff:fe2a:34e/64 scope link
valid_lft forever preferred_lft forever
类似地,你可以添加想要的任意多的 IP 地址
类似地,你可以添加任意数量的 IP 地址,只要你想要
让我们 ping 一下这个 IP 地址验证一下。
@ -108,7 +108,7 @@
可以看到已经没有了!!
也许你已经知道,你重启系统后会丢失这些设置。那么怎么设置才能永久有效呢?这也很简单。
正如你所知,重启系统后这些设置会失效。那么怎么设置才能永久有效呢?这也很简单。
### 添加永久 IP 地址 ###
@ -154,7 +154,7 @@ Ubuntu 系统的网卡配置文件是 **/etc/network/interfaces**。
保存并关闭文件。
无需重启运行下面的命令使更改生效。
运行下面的命令使更改无需重启即生效。
sudo ifdown enp0s3 && sudo ifup enp0s3
@ -182,7 +182,7 @@ Ubuntu 系统的网卡配置文件是 **/etc/network/interfaces**。
DHCPACK of 192.168.1.103 from 192.168.1.1
bound to 192.168.1.103 -- renewal in 35146 seconds.
**注意**:如果你从远程连接到服务器,把上面的两个命令放到**一行**中**非常重要**,因为第一个命令会断掉你的连接。而采用这种方式可以存活你的 ssh 会话。
**注意**:如果你从远程连接到服务器,把上面的两个命令放到**一行**中**非常重要**,因为第一个命令会断掉你的连接。而采用这种方式可以保留你的 ssh 会话。
现在,让我们用下面的命令来检查一下是否添加了新的 IP
@ -228,9 +228,9 @@ via: http://www.unixmen.com/assign-multiple-ip-addresses-to-one-interface-on-ubu
作者:[SK][a]
译者:[ictlyh](http://mutouxiaogui.cn/blog/)
校对:[校对者ID](https://github.com/校对者ID)
校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.unixmen.com/author/sk/
[1]:http://www.unixmen.com/linux-basics-assign-multiple-ip-addresses-single-network-interface-card-centos-7/
[1]:http://www.unixmen.com/linux-basics-assign-multiple-ip-addresses-single-network-interface-card-centos-7/

View File

@ -0,0 +1,134 @@
如何在Ubuntu 14/15上配置Apache Solr
================================================================================
大家好,欢迎来阅读我们今天Apache Solr的文章。Apache Solr是一个最有名的开源搜索平台基于在网站后端运行的Apache Lucene能够让你轻松创建搜索引擎来搜索网站、数据库和文件。它能够索引和搜索多个网站并根据搜索文本的相关内容返回搜索建议.
Solr工作在可扩展标记语言(XML),并可以为JSON、Python和Ruby提供应用程序接口(APIs)。根据Apache Lucene项目Solr提供了非常多的功能让它很受管理员们的欢迎
- 全文检索
- 分面导航
- 拼写建议/自动完成
- 自定义文档排序/排列
#### 前提条件: ####
在一个使用最小化安装包的全新 Ubuntu 14/15 系统上,你仅仅需要少量的准备,就开始安装 Apache Solor.
### 1)System Update 系统更新###
使用一个具有sudo权限的非root用户登录你的Ubuntu服务器这将会在接下来的所有安装和使用Solr的步骤中使用。
登录成功后,使用下面的命令,升级你的系统到最新的更新及补丁
$ sudo apt-get update
### 2) JRE Setup 安装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
现在你可以通过以下命令更新包源列表使用wget来安装最新版本的Oracle Java 8然后安装Java。
$ sudo apt-get update
----------
$ sudo apt-get install oracle-java8-installer
在安装和配置Java SE Platform 和 JavaFX 过程中点击'OK'按钮接受 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先要从官网 [Web Page][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页面###
可以使用默认的端口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'按钮你将会看见我们之前使用CLI方式创建的集合。你可以点击'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/

View File

@ -1,9 +1,9 @@

如何在FreeBSD 10.2上安装Nginx作为Apache的反向代理
================================================================================
Nginx是一款免费的开源的HTTP和反向代理服务器, 以及一个代理POP3/IMAP的邮件服务器. Nginx是一款高性能的web服务器其特点是丰富的功能简单的结构以及低内存的占用. 第一个版本由 Igor Sysoev在2002年发布,然而到现在为止很多大的科技公司都在使用,包括 Netflix, Github, Cloudflare, WordPress.com等等
Nginx是一款免费的开源HTTP和反向代理服务器, 以及一个POP3/IMAP的邮件代理服务器。Nginx是一款高性能的web服务器其特点是丰富的功能简单的结构以及低内存的占用. 第一个版本由 Igor Sysoev在2002年发布,迄今为止很多大的科技公司依然在使用,包括 Netflix, Github, Cloudflare, WordPress.com等等
在这篇教程里我们会 "**在freebsd 10.2系统上安装和配置Nginx网络服务器作为Apache的反向代理**". Apache 会用PHP在8080端口上运行,并且我们需要在80端口配置Nginx的运行用来接收用户/访问者的请求.如果网页的用户请求来自于浏览器的80端口, 那么Nginx会用Apache网络服务器和PHP来通过这个请求并运行在8080端口.
在这篇教程里我们会 "**在freebsd 10.2系统上安装和配置Nginx网络服务器作为Apache的反向代理**". Apache 会用PHP在8080端口上运行,并且我们需要在80端口配置Nginx的运行用来接收用户/访问者的请求.如果网页的用户请求来自于浏览器的80端口, 那么Nginx会用Apache网络服务器和PHP来通过这个请求并运行在8080端口
#### 前提条件 ####
@ -19,7 +19,7 @@ Nginx是一款免费的开源的HTTP和反向代理服务器, 以及一个代
### 步骤 2 - 安装 Apache ###
Apache是现在使用范围最广的网络服务器以及开源的HTTP服务器.在FreeBSD里Apache是未被默认安装的, 但是我们可以直接从端口下载,或者解压包在"/usr/ports/www/apache24" 目录下再或者直接从PKG命令的FreeBSD系统信息库安装。在本教程中我们将使用PKG命令从FreeBSD的库中安装
Apache是现在使用范围最广的web服务器以及开源的HTTP服务器.在FreeBSD里Apache是未被默认安装的, 但是我们可以直接通过端口或者在"/usr/ports/www/apache24" 目录下的解压包安装再或者直接从PKG命令的FreeBSD系统信息库安装。在本教程中我们将使用PKG命令从FreeBSD的库中安装
pkg install apache24
@ -31,7 +31,7 @@ Apache是现在使用范围最广的网络服务器以及开源的HTTP服务器.
### 步骤 4 - 配置 Apache 和 PHP ###
一旦所有都安装好了, 我们将会配置Apache在8080端口上运行, 并让PHP与Apache一同工作. 为了配置Apache,我们可以编辑 "httpd.conf"这个配置文件, 然而PHP我们只需要复制PHP的配置文件 php.ini 在 "/usr/local/etc/"目录下.
一旦所有都安装好了, 我们将会配置Apache在8080端口上运行, 并让PHP与Apache一同工作. 要想配置Apache,我们可以编辑 "httpd.conf"这个配置文件, 然而PHP我们只需要复制"/usr/local/etc/"目录下的PHP配置文件 php.ini 。
进入到 "/usr/local/etc/" 目录 并且复制 php.ini-production 文件到 php.ini :
@ -64,7 +64,7 @@ Apache是现在使用范围最广的网络服务器以及开源的HTTP服务器.
SetHandler application/x-httpd-php-source
</FilesMatch>
保存然后退出.
保存并退出。
现在用sysrc命令来添加Apache作为开机启动项目 :
@ -78,7 +78,7 @@ Apache是现在使用范围最广的网络服务器以及开源的HTTP服务器.
service apache24 start
如果全部完毕, 在"/usr/local/www/apache24/data" 目录下创建一个phpinfo文件是验证PHP在Apache下完美运行的好方法 :
如果全部完毕, 在"/usr/local/www/apache24/data" 目录下创建一个phpinfo文件来验证PHP在Apache下完美运行:
cd /usr/local/www/apache24/data
echo "<?php phpinfo(); ?>" > info.php
@ -87,17 +87,17 @@ Apache是现在使用范围最广的网络服务器以及开源的HTTP服务器.
![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端口下运行的.
Apache 是使用 PHP 在 8080 端口下运行的。
### 步骤 5 - 安装 Nginx ###
Nginx 以低内存的占用作为一款高性能的web服务器以及反向代理服务器.在这个步骤里我们将会使用Nginx作为Apache的反向代理, 因此让我们用pkg命令来安装它吧 :
Nginx 以低内存的占用作为一款高性能的web服务器以及反向代理服务器在这个步骤里我们将会使用Nginx作为Apache的反向代理, 因此让我们用pkg命令来安装它吧 :
pkg install nginx
### 步骤 6 - 配置 Nginx ###
一旦 Nginx 安装完毕, 在 "**nginx.conf**" 文件里我们需要做一个新的配置文件来替换掉原来的nginx文件. 更改到 "/usr/local/etc/nginx/"目录下 并且默认备份到 nginx.conf 文件:
一旦 Nginx 安装完毕, 在 "**nginx.conf**" 文件里我们需要做一个新的配置文件来替换掉原来的nginx文件。更改到 "/usr/local/etc/nginx/"目录下,并且备份默认 nginx.conf 文件:
cd /usr/local/etc/nginx/
mv nginx.conf nginx.conf.oroginal
@ -164,7 +164,7 @@ Nginx 以低内存的占用作为一款高性能的web服务器以及反向代
}
保存退出.
保存并退出。
下一步, 在nginx目录下面创建一个 **proxy.conf** 文件,使其作为反向代理 :
@ -186,7 +186,7 @@ Nginx 以低内存的占用作为一款高性能的web服务器以及反向代
proxy_buffers 100 8k;
add_header X-Cache $upstream_cache_status;
保存退出.
保存退出.
最后一步, 为 nginx 的高速缓存创建一个 "/var/nginx/cache"的新目录 :
@ -194,14 +194,14 @@ Nginx 以低内存的占用作为一款高性能的web服务器以及反向代
### 步骤 7 - 配置 Nginx 的虚拟主机 ###
在这个步骤里面,我们需要创建一个新的虚拟主机域 "saitama.me", 以跟文件 "/usr/local/www/saitama.me" 和日志文件一同放在 "/var/log/nginx" 目录下.
在这个步骤里面,我们需要创建一个新的虚拟主机域 "saitama.me", 以跟文件 "/usr/local/www/saitama.me" 和日志文件一同放在 "/var/log/nginx" 目录下
我们必须做的第一件事情就是创建新的目录来存放虚拟主机文件, 在这里我们将用到一个"**vhost**"的新文件. 并创建它 :
cd /usr/local/etc/nginx/
mkdir vhost
创建好vhost 目录, 那么我们就进入这个目录并创建一个新的虚拟主机文件. 这里我取名为 "**saitama.conf**" :
创建好vhost 目录, 那么我们就进入这个目录并创建一个新的虚拟主机文件这里我取名为 "**saitama.conf**" :
cd vhost/
nano -c saitama.conf
@ -252,7 +252,7 @@ Nginx 以低内存的占用作为一款高性能的web服务器以及反向代
}
保存退出.
保存并退出。
下一步, 为nginx和虚拟主机创建一个新的日志目录 "/var/log/" :
@ -265,7 +265,7 @@ Nginx 以低内存的占用作为一款高性能的web服务器以及反向代
### 步骤 8 - 测试 ###
在这个步骤里面我们只是测试我们的nginx和虚拟主机的配置.
在这个步骤里面我们只是测试我们的nginx和虚拟主机的配置
用如下命令测试nginx的配置 :
@ -282,37 +282,37 @@ Nginx 以低内存的占用作为一款高性能的web服务器以及反向代
cd /usr/local/www/saitama.me
echo "<?php phpinfo(); ?>" > info.php
然后便访问这个文档 : **www.saitama.me/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也同样在进行工作了.
Nginx 作为Apache的反向代理正在运行了PHP也同样在进行工作了
这是另一种结果 :
Test .html 文件无缓存.
无缓存的 Test .html 文件。
curl -I www.saitama.me
![html with no-cache](http://blog.linoxide.com/wp-content/uploads/2015/11/html-with-no-cache.png)
Test .css 文件只有三十天的缓存.
有三十天缓存的 Test .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)
Test .php 文件正常缓存 :
正常缓存的 Test .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的反向代理.
Nginx 是最受欢迎的 HTTP 和反向代理服务器,拥有丰富的高性能和低内存/RAM的使用功能。Nginx使用了太多的缓存 我们可以在网络上缓存静态文件使得网页加速并且在用户需要的时候再缓存php文件。这样 Nginx 的轻松配置和使用可以让它用作HTTP服务器或者 apache的反向代理。
--------------------------------------------------------------------------------
@ -320,8 +320,8 @@ via: http://linoxide.com/linux-how-to/install-nginx-reverse-proxy-apache-freebsd
作者:[Arul][a]
译者:[KnightJoker](https://github.com/KnightJoker)
校对:[校对者ID](https://github.com/校对者ID)
校对:[Caroline(https://github.com/carolinewuyan
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/arulm/
[a]:http://linoxide.com/author/arulm/

View File

@ -1,6 +1,10 @@
# 使用SystemBack备份你的Ubuntu/Linux Mint系统还原
# 使用 SystemBack 备份你的 Ubuntu/Linux Mint系统还原
系统还原对于任何一款允许用户还原电脑到之前状态(包括文件系统,安装的应用,以及系统设置)的操作系统来说,都是必备功能,可以处理系统故障以及其他的问题。有的时候安装一个程序或者驱动可能让你的系统黑屏。系统还原则让你电脑里面的系统文件(译者注:是系统文件,并非普通文件,详情请看**注意**部分)和程序恢复到之前工作正常时候的状态,进而让你远离那让人头痛的排障过程了。而且它也不会影响你的文件,照片或者其他数据。简单的系统备份还原工具[Systemback](https://launchpad.net/systemback)让你很容易地创建系统备份以及用户配置文件。如果遇到问题你可以傻瓜式还原。它还有一些额外的特征包括系统复制系统安装以及Live系统创建。
对于任何一款允许用户还原电脑到之前状态(包括文件系统,安装的应用,以及系统设置)的操作系统来说,系统还原都是必备功能,可以恢复系统故障以及其他的问题。
有的时候安装一个程序或者驱动可能让你的系统黑屏。系统还原则让你电脑里面的系统文件(译者注:是系统文件,并非普通文件,详情请看**注意**部分)和程序恢复到之前工作正常时候的状态,进而让你远离那让人头痛的排障过程了。而且它也不会影响你的文件,照片或者其他数据。
简单的系统备份还原工具[Systemback](https://launchpad.net/systemback)让你很容易地创建系统备份以及用户配置文件。一旦遇到问题你可以简单地恢复到系统先前的状态。它还有一些额外的特征包括系统复制系统安装以及Live系统创建。
截图
@ -12,7 +16,7 @@
![](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衍生版打开终端将下面这些命令复制过去
@ -32,7 +36,7 @@ sudo apt-get install systemback
via: http://www.noobslab.com/2015/11/backup-system-restore-point-your.html
译者:[DongShuaike](https://github.com/DongShuaike)
校对:[校对者ID](https://github.com/校对者ID)
校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,176 @@
如何在 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、PDOMbstring 和 Tokenizer PHP Extensions。如果 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) 虚拟 Host 和 所属用户 ###
在 composer 安装好后,分配 document 根目录的权限和所属用户,如下所示。
# chmod 775 /var/www/laravel-develop/app/storage
----------
# chown -R apache:apache /var/www/laravel-develop
用任意一款编辑器打开 apache 服务器的默认配置文件,在文件最后加上虚拟 host 入口。
# 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/

View File

@ -0,0 +1,55 @@
IPv6因特网中的隐私保护和网络管理器
======================
IPv6的使用量正在不断增加让我们始料未及的是伴随这个协议不断增加的使用量大量隐私问题涌现出来。互联网社区在积极发表相关解决方案当前状况是怎样的呢网络管理器又是如何跟上的呢让我们来瞧瞧吧
![](https://blogs.gnome.org/lkundrak/files/2015/12/cameras1.jpg)
## 通过IPv6方式连接的主机的特性
通过IPv6方式激活的结点译者注结点在网络中指一个联网的设备不需要类似IPv4网络中[DHCP](https://tools.ietf.org/html/rfc2132)服务器的中央机构来配置他们的地址。它们发现自己所在的网络然后通过生成主机部分来[自主生成地址](https://tools.ietf.org/html/rfc2132)。这种方式使得网络配置更加简单,并且能够更好的扩展到更大规模的网络。然而,这种方式也有一些缺点。首先,这个结点需要确保它的地址不会和网络上其他结点冲突。其次,如果这个结点在进入的每一个网络中使用相同的主机部分,它的运动就可以被追踪,如此一来,隐私便处于危险之中。
负责制定因特网标准的组织Internet工程任务组Internet Engineering Task ForceIETF[意识到了这个问题](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由网络部分和主机部分组成译者注网络部分用来划分子网主机部分用来从相应子网中找到具体的主机。主机查找出相关的网络部分并且生成主机部分。传统上它只使用了源自网络硬件MAC地址的接口识别器。MAC地址在硬件制造的时候就被设置好了它可以唯一的识别机器。这样就确保了地址的稳定性和唯一性。这对避免地址冲突来说是件好事但是对隐私来说一点也不好。主机部分在不同网络下保持恒定意味着机器在进入不同网络时可以被唯一的识别。这在协议制定的时候看起来无可非议但是随着IPv6的流行人们对于隐私问题的担忧也愈演愈烈。幸运的是解决办法还是有的。
## 进入隐私扩展
Pv4的最大问题——地址枯竭已经不是什么秘密。对IPv6来说这一点不再成立事实上使用IPv6的主机能够相当大方的利用地址。多个IPv6地址对应一块网卡绝对没有任何错误正好相反这是一种标准情形。最起码每个结点都有一个“本地连接地址”它被用来与同一物理链路的结点联络。当网络包含了一个连接其他网络的路由器这个网络中的每一个结点都有一个与每个直接连接网络联络的地址。如果主机在相同网络有更多的地址结点译者注指路由器将接受它们全部的传入流量。对于输出连接它会把地址显示给远程主机内核会挑选最适合的地址。但到底是哪一个呢
隐私扩展可用时,就像[RFC4941](https://tools.ietf.org/html/rfc4941)定义的那样,时常会生成带有随机主机部分的新地址。最新的那个被用于最新的输出连接,与此同时,那些不被使用了的旧地址将被丢弃。这是一个极好的窍略——当固定地址不用于输出连接的时候,主机就不会显示它,但它仍然会接受注意到它的主机的连接。
但这也存在美中不足之处——某些应用会把地址与用户识别绑定在一起。让我们来考虑一下这种情形一个web应用在用户认证的时候生成一个HTTP Cookie但它只接受实施认证的地址的连接。当内核生成了一个新的临时地址服务器会拒绝使用这个地址的请求实际上相当于将用户登出。地址是不是建立用户认证的合适机制值得商榷但这确实是现实中应用程序正在做的。
## 解救之道——隐私固定寻址
解决这个问题可能需要另辟蹊径。唯一的当然咯地址确实有必要对于特定网络来说是稳定的但当用户进入了另一个网络后仍然会变这样的话追踪就变得几乎不可能。RFC7217介绍了一种如上所述的机制。
创建隐私固定地址依赖于伪随机值这个随机值只被主机本身知晓它不会显示给网络上的其他主机。这个随机值随后被一个密码安全算法加密一起被加密的还有一些与网络连接的特殊值。这些值包含用以标识网卡的标识符网络前缀对于这个网络来说有可能的其他特殊值例如无线的SSID。使用安全值使其他主机很难预测结果地址与此同时当进入不同的网络时网络的特殊数据会让地址变得不同。
这也巧妙的解决了地址重复问题。因为有随机值的存在,冲突也不太可能发生。万一发生了冲突,结果地址会得到重复地址检测失败的记录,这时会生成一个不同的地址而不会断开网络连接。看,这种方式很聪明吧。
使用隐私固定地址一点儿也不会妨碍隐私扩展。你可以在使用RFC4941所描述的临时地址的同时使用[RFC7217](https://tools.ietf.org/html/rfc7217)中的固定地址。
## 网络管理器处于什么样的状况?
我们已经在网络管理器1.0.4版本中实现了隐私扩展。在这个版本中隐私扩展默认开启。你可以用ipv6.ip6-privacy参数来控制它。
在网络管理器1.2版本中我们将会加入固定隐私寻址。应该指出的是目前的隐私扩展还不符合这种需求。我们可以使用ipv6.addr-gen-mode参数来控制这个特性。如果它被设置成固定隐私那么将会使用固定隐私寻址。设置成“eui64”或者干脆不设置它将会保持传统的默认寻址方式。
敬请期待明年也就是2016年年初网络管理器1.2版本的发布吧如果你想尝试一下最新的版本不妨试试Fedora Rawhide它最终会变成Fedora24。
*我想感谢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)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,81 @@
五大开源社区指标追踪
================================================================================
![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/yearbook2015-osdc-lead-1.png)
如果你决定使用指标来追踪你的免费开源的软件社区。那么问题来了:我应该去追踪哪些指标呢?
要回答这个问题你必须知道你需要什么信息。比如你可能想要知道一个项目社区的可持续性。一个社区对问题的应对速度有多快。一个社区怎么吸引、维护或者流失贡献者。一旦你知道需要哪类信息你就可以找出哪些社区活动可以提供你想要知道的内容。幸运的是免费开源软件社区FOSS一些遵从开放式开发模型的项目在其软件开发仓库里留下了大量的公共数据我们可以对这些数据进行分析并从中收集到一些有用的数据。
在这篇文章中,我会介绍一些指标,从而为你的项目社区提供一个多方位的视角分析。
### 1. 社区活动 ###
一个社区的总体活动和这个社区怎样随着时间演变是度量所有社区好坏的非常有用的指标。社区活动是评价一个社区工作量的第一印象也可以用来追踪不同种类的活动。比如提交次数给人的第一印象就是跟开发工作量挂钩。通过开放的投票数我们可以大概知道提交了多少bug或者又提出了多少新特性。邮件列表的数量或者论坛帖子的数量可以让我们了解到有过多少次公开的讨论。
![Activity metrics chart](https://opensource.com/sites/default/files/images/business-uploads/activity-metrics.png)
[OpenStack活动看板][1]上面显示的项目代码提交次数和代码评审之后代码合并次数随时间变化的趋势图(周数据)
### 2. 社区规模 ###
社区的规模指的是参与到这个社区的人数但是基于不同形式的参与人数也有很大的差别。好消息是通常你只对积极活跃的贡献者比较感兴趣。活跃的贡献者会在项目的仓库留下一些线索。这意味着你可以通过查看git仓库存放的代码中**author**字段来统计积极贡献代码的人数,或者通过看积极参与问题解决的人的得票数来统计活跃人数。
所谓活跃(某些人做了某些事)可以扩展到很多方面。一种常见的跟踪活动的方式是看有多少人做了工作量相当可观的任务。比如,通常一个项目代码的贡献者是来自这个项目社区的一小部分人。了解了这一小部分人,就对核心的工作组(比如,领导这个社区的人)有一个基本的认识了。
![Size metrics chart](https://opensource.com/sites/default/files/images/business-uploads/size-metrics.png)
[Xen项目开发看板][2]上展示的该项目邮件列表上作者人数和提交人数随时间的变化趋势(每月数据)
### 3. 社区表现 ###
到目前为止关注点主要集中在活动数量和贡献者数量的统计上了。你也可以分析流程还有用户的表现如何。比如你可以测量某流程需要多久才能执行完成。解决或者关闭投票的时间可以表明一个需要及时响应的项目对新信息的应对如何比如修复一个已经提出的bug或者实现一个新需求。代码评审花费的时间即从代码修改提交到被通过的时间可以看出更新一个提出的改变要达到社区期望的标准需要多久。
其他的一些指标主要与项目处理挂起的工作表现如何有关,比如新的和被关闭投票的比例,或者仍然没有关闭的代码评审的后台日志。这些参数能告诉我们像投入到解决这些问题的资源是否充足这样的一些信息。
![Efficiency metrics chart](https://opensource.com/sites/default/files/images/business-uploads/efficiency-metrics.png)
在[2015第三季度OpenStack开发报告][3]上显示的,每季度关闭与打开状态的投票数之比,接受与放弃的改变提案与最新的改变提案之比。
### 4. 社区人口统计 ###
随着贡献者的参与或者退出,社区也在不断改变。社区的年龄(从社区成员加入时算起)取决于随着时间变化,人们怎么加入和退出社区。[社区年龄统计图表][4]很直观的展现了这些改变随时间的变化。图标是由一系列的水平条组成每两条水平条代表加入到社区的一代人。对于每一代Attracted水平条表示在相应的时间里有多少人加入到了社区。Retained水平条表示有多少人目前仍然活跃在社区。
代表一代人的两个水平条的关系就是滞留比例依然在这个项目中的那一代人的一部分。Attracted水平条的完整集合表示这个项目在过去有多么受欢迎。Retained水平条的完整集合则表示社区目前的年龄结构。
![Demographics metrics chart](https://opensource.com/sites/default/files/images/business-uploads/demography-metrics.png)
[Eclipse开发看板][5]上显示的Eclipse社区的社区年龄表。每六个月定义一次。
### 5. 社区多样性 ###
多样性是一个社区保持弹性的很关键的因素。通常来说一个社区越具有多样性人或者组织参与的多元化那么这个社区的弹性也就越大。比如如果一个公司要决定离开一个免费开源社区那么这个公司的员工贡献5%要远比贡献85%所可能引起的潜在问题要小很多。
[小马因素][6],是[Daniel Gruno][7] 为“最少的开发者贡献了50%的代码提交量”这一现象定义的术语。基于这一小马因素大象因素则是指最少量的公司其员工贡献了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)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [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

View File

@ -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 中不同颜色的含义:
- `绿色`:正常
- `蓝色`:需要注意
- `紫色`:警告
- `红色`:严重
默认设置下Glances 的阀值设置是careful=50warning=70critical=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)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/hiteshjethva/

View File

@ -0,0 +1,392 @@
GHLandy Translated
LFCS系列第二讲如何安装和使用纯文本编辑器vi/vim
================================================================================
几个月前, Linux 基金会发起了 LFCS Linux Foundation Certified System administratorLinux 基金会认证系统管理员)认证,以帮助世界各地的人来验证他们能够在 Linux 系统上做基本的中间系统管理任务:如系统支持,第一手的故障诊断和处理,以及何时向上游支持团队提出问题的智能决策。
![Learning VI Editor in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/LFCS-Part-2.png)
在 Linux 中学习 vi 编辑器
请简要看看一下视频,里边介绍了 Linux 基金会认证的程序。
youtube 视频
<iframe width="720" height="405" frameborder="0" allowfullscreen="allowfullscreen" src="//www.youtube.com/embed/Y29qZ71Kicg"></iframe>
这篇文章是《十个教程》系列的第二部分,在这个部分,我们会介绍 vi/vim 基本的文件编辑操作帮助读者理解编辑器中的三个模式这是LFCS认证考试中必须掌握的。
### 使用 vi/vim 执行基本的文件编辑操作 ###
vi 是为 Unix 而生的第一个全屏文本编辑器。它的设计小巧简单,对于仅仅使用过诸如 NotePad++ 或 gedit 等图形界面的文本编辑器的用户来说,使用起来可能存在一些困难。
为了使用 vi我们必须首先理解这个强大的程序操作中的三种模式方便我们后边学习这个强大的文本处理软件的相关操作。
请注意,大多数的现代 Linux 发行版都集成了 vi 的变种——— vimVi IMprovedVI 的改进),相比于 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稍后详细介绍 buffer在你编辑完成之后就可以存储在磁盘中了。
#### 理解 vi 的三个模式 ####
1.在命令模式中vi 允许用户浏览该文件并输入由一个或多个字母组成简短的、大小写敏感的 vi 命令。这些命令的大部分都可以增加一个前缀数字表示执行次数。
比如yy或Y 复制当前的整行3yy或3Y 复制当前整行和下边紧接着的两行总共3行。通过 Esc 键可以随时进入命令模式(而不管当前工作在什么模式下)。事实上,在命令模式下,键盘上所有的输入都被解释为命令而非文本,这往往使得初学者困惑不已。
2.在末行模式中,我们可以处理文件(包括保存当前文件和运行外部程序)。我们必须在命令模式下输入一个冒号(:),才能进入这个模式,紧接着是需要使用的末行模式下的命令。执行之后 vi 自动回到命令模式。
3.在文本输入模式(通常使用字母 i 进入这个模式我们可以随意输入文本。大多数的键入将以文本形式输出到屏幕一个重要的例外是Esc键它将退出文本编辑模式并回到命令模式
![vi Insert Mode](http://www.tecmint.com/wp-content/uploads/2014/10/vi-insert-mode.png)
vi 文本插入模式
#### vi 命令 ####
下面的表格列出常用的 vi 命令。文件版本的命令可以通过添加叹号的命令强制执行(如,:q! 命令强制退出编辑器而不保存文件)。
注:表格
<table cellspacing="0" border="0">
<colgroup width="290">
</colgroup>
<colgroup width="781">
</colgroup>
<tbody>
<tr>
<td bgcolor="#999999" height="19" align="LEFT" style="border: 1px solid #000000;"><b><span style="font-size: small;">&nbsp;关键命令</span></b></td>
<td bgcolor="#999999" align="LEFT" style="border: 1px solid #000000;"><b><span style="font-size: small;">&nbsp;描述</span></b></td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;h 或 ←</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标左移一个字符</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;j 或 ↓</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标下移一行</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;k 或 ↑</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标上移一行</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;l (小写 L) 或 →</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标右移一个字符</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;H</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标移至屏幕顶行</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;L</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标移至屏幕末行</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;G</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标移至文件末行</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;w</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标右移一个词</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;b</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标左移一个词</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;0 (零)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标移至行首</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;^</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标移至当前行第一个非空格字符</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;$</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标移至当前行行尾</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;Ctrl-B</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;向后翻页</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;Ctrl-F</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;向前翻页</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;i</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;在光标所在位置插入文本</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;I (大写 i)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;在当前行首插入文本</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;J (大写 j)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;将下一行与当前行合并(下一行上移到当前行)</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;a</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;在光标所在位置后追加文本</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;o (小写 O)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;在当前行下边插入空白行</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;O (大写 o)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;在当前行上边插入空白行</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;r</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;替换光标所在位置的字符</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;R</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;光标所在位置覆盖插入文本</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;x</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;删除光标所在位置的字符</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;X</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;立即删除光标所在位置之前(左边)的一个字符</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;dd</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;剪切当前整行文本(为了之后进行粘贴)</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;D</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;剪切光标所在位置到行末的文本(该命令等效于 d$</td>
</tr>
<tr class="alt">
<td height="20" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;yX</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;给 X 命令一个移动长度,复制适当数量的字符、单词或者从光标开始到一定数量的行</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;yy 或 Y</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;复制当前整行</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;p</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;粘贴在光标所在位置之后(下一行)</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;P</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;粘贴在光标所在位置之前(上一行)</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;. (句点)</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;重复最后一个命令</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;u</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;撤销最后一个命令</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;U</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;撤销最后一行的最后一个命令,只有光标仍在最后一行才能执行。</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;n</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;在查找中跳到下一个匹配项</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;N</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;在查找中跳到前一个匹配项</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;:n</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;下一个文件,编辑多个指定文件时,该命令加载下一个文件。</td>
</tr>
<tr class="alt">
<td height="20" align="LEFT" style="border: 1px solid #000000;">&nbsp;:e file</td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;加载新文件来替代当前文件</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000000;">&nbsp;:r file</td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;将新文件的内容插入到光标所在位置的下一行</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;:q</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;退出并放弃更改</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000000;">&nbsp;:w file</td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;将当期打开的buffer保存为file。如果是追加到已存在的文件中则使用 w &gt;&gt; file 命令</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Courier New;">&nbsp;:wq</span></td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;保存当前文件的内容并退出。等效于 x! 和 ZZ</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000000;">&nbsp;:r! command</td>
<td align="LEFT" style="border: 1px solid #000000;">&nbsp;执行 command 命令,并将命令的输出插入到光标所在位置的下一行</td>
</tr>
</tbody>
</table>
#### 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会打开 file 进行编辑。
在上边的图片中,标记符号 # 表示该文件当前已被打开在后台,而 %a 标记的文件是正在被编辑的。另外,文件号(如上边例子的 3后边的空格表示该文件还没有被打开。
#### vi 的临时 buffers ####
为了复制连续的多行(比如,假设为 4 行)到一个名为 a 的临时 buffer与文件无关并且还要将这些行粘贴到在当前 vi 会话文件中的其它位置,我们需要:
1. 按下 Esc 键以确认 vi 处在命令模式
2. 将光标放在我们希望复制的第一行文本
3. 输入 a4yy 复制当前行和接下来的 3 行,进入一个名为 a 的 buffer。我们一继续编辑我们的文件————我们不需要立即插入刚刚复制的行。
4. 当到了需要使用刚刚复制行的位置,在 p(小写)或 P(大写)命令来讲复制行插入到名为 a 的 buffer
- 输入 ap复制行将插入到光标位置所在行的下一行。
- 输入 aP复制行将插入到光标位置所在行的上一行。
如果愿意,我们可以重复上述步骤,将 buffer a 中的内容插入到我们文件的多个位置。一个临时 buffer像本次会话中的一样会在当前窗口关闭时释放掉。
### 总结 ###
像我们看到的一样vi/vim 在命令接口下是一个强大而灵活的文本编辑器。通过以下链接,随时分享你自己的技巧和评论。
#### 参考链接 ####
- [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]
译者:[GHLandy](https://github.com/GHLandy)
校对:[东风唯笑](https://github.com/dongfengweixiao)
本文由 [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