From ee1dc9ac5df93a17f9d0797dc9d9271d38b63eb2 Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Wed, 27 May 2015 10:53:16 +0800 Subject: [PATCH 001/153] Translating by ZTinoZ --- .../tech/20150526 20 Useful Terminal Emulators for Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index 436b28f79f..a77c665426 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -1,5 +1,5 @@ Translating by ZTinoZ -20 Useful Terminal Emulators for Linux +20款优秀的Linux终端仿真器 ================================================================================ A Terminal emulator is a computer program that reproduces a video terminal within some other display structure. In other words the Terminal emulator has an ability to make a dumb machine appear like a client computer networked to the server. The terminal emulator allows an end user to access console as well as its applications such as text user interface and command line interface. @@ -272,7 +272,7 @@ If you know any other capable Linux terminal emulators that I’ve not included via: http://www.tecmint.com/linux-terminal-emulators/ 作者:[Ravi Saive][a] -译者:[译者ID](https://github.com/译者ID) +译者:[ZTinoZ](https://github.com/ZTinoZ) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From 2f85a93f0944070b9a16017470e0d1d2835d2965 Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Thu, 28 May 2015 18:01:24 +0800 Subject: [PATCH 002/153] Translating by ZTinoZ --- sources/tech/20150526 20 Useful Terminal Emulators for Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index a77c665426..9103f53b4d 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -1,7 +1,7 @@ Translating by ZTinoZ 20款优秀的Linux终端仿真器 ================================================================================ -A Terminal emulator is a computer program that reproduces a video terminal within some other display structure. In other words the Terminal emulator has an ability to make a dumb machine appear like a client computer networked to the server. The terminal emulator allows an end user to access console as well as its applications such as text user interface and command line interface. +终端仿真器是一款计算机程序A Terminal emulator is a computer program that reproduces a video terminal within some other display structure. In other words the Terminal emulator has an ability to make a dumb machine appear like a client computer networked to the server. The terminal emulator allows an end user to access console as well as its applications such as text user interface and command line interface. ![Linux Terminal Emulators](http://www.tecmint.com/wp-content/uploads/2014/01/Linux-Terminal-Emulators1.jpeg) From 1bcacc03f439f78d08a9dab84bf6c7d57e70818b Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Fri, 29 May 2015 18:07:42 +0800 Subject: [PATCH 003/153] Translating by ZTinoZ --- ...0150526 20 Useful Terminal Emulators for Linux.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index 9103f53b4d..d3f974bd05 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -1,11 +1,11 @@ Translating by ZTinoZ 20款优秀的Linux终端仿真器 ================================================================================ -终端仿真器是一款计算机程序A Terminal emulator is a computer program that reproduces a video terminal within some other display structure. In other words the Terminal emulator has an ability to make a dumb machine appear like a client computer networked to the server. The terminal emulator allows an end user to access console as well as its applications such as text user interface and command line interface. +终端仿真器是一款用其它显示结构重现可视终端的计算机程序。换句话说就是终端仿真器能使哑终端看似像一台客户机连接上了服务器。终端仿真器允许最终用户像文本用户界面和命令行界面一样连接控制台和应用程序。 ![Linux Terminal Emulators](http://www.tecmint.com/wp-content/uploads/2014/01/Linux-Terminal-Emulators1.jpeg) -20 Linux Terminal Emulators +20款Linux终端仿真器 You may find huge number of terminal emulators to choose from this open source world. Some of them offers large range of features while others offers less features. To give a better understanding to the quality of software that are available, we have gathered a list of marvelous terminal emulator for Linux. Each title provides its description and feature along with screenshot of the software with relevant download link. @@ -13,7 +13,7 @@ You may find huge number of terminal emulators to choose from this open source w Terminator is an advanced and powerful terminal emulator which supports multiple terminals windows. This emulator is fully customizable. You can change the size, colour, give different shapes to the terminal. Its very user friendly and fun to use. -#### Features of Terminator #### +#### Terminator的特性 #### - Customize your profiles and colour schemes, set the size to fit your needs. - Use plugins to get even more functionality. @@ -31,7 +31,7 @@ Terminator Terminal Tilda is a stylish drop-down terminal based on GTK+. With the help of a single key press you can launch a new or hide Tilda window. However, you can add colors of your choice to change the look of the text and Terminal background. -#### Features of Tilda #### +#### Tilda的特性 #### Interface with Highly customization option. You can set the transparency level for Tilda window. @@ -61,7 +61,7 @@ Yakuake (Yet Another Kuake) is a KDE based drop-down terminal emulator very much Yakuake is basically a KDE application, which can be easily installed on KDE desktop, but if you try to install Yakuake in GNOME desktop, it will prompt you to install huge number of dependency packages. -#### Yakuake Features #### +#### Yakuake的特性 #### - Fluently turn down from the top of your screen - Tabbed interface @@ -164,7 +164,7 @@ TermKit Terminal - [TermKit Homepage][12] -12. st +### 12. st ### st is a simple terminal implementation for X Window. From e4b49322dd36a373e45817b15797bf4d51d2af6b Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Thu, 4 Jun 2015 18:14:37 +0800 Subject: [PATCH 004/153] Translating by ZTinoZ --- .../tech/20150526 20 Useful Terminal Emulators for Linux.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index d3f974bd05..4ac5708fa6 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -1,4 +1,3 @@ -Translating by ZTinoZ 20款优秀的Linux终端仿真器 ================================================================================ 终端仿真器是一款用其它显示结构重现可视终端的计算机程序。换句话说就是终端仿真器能使哑终端看似像一台客户机连接上了服务器。终端仿真器允许最终用户像文本用户界面和命令行界面一样连接控制台和应用程序。 @@ -7,11 +6,11 @@ Translating by ZTinoZ 20款Linux终端仿真器 -You may find huge number of terminal emulators to choose from this open source world. Some of them offers large range of features while others offers less features. To give a better understanding to the quality of software that are available, we have gathered a list of marvelous terminal emulator for Linux. Each title provides its description and feature along with screenshot of the software with relevant download link. +你能从开源世界中找到大量的终端仿真器来使用,有些拥有大量的特性而有些则反之。为了能更好地理解它们所能提供的质量,我们收集了一份不可思议的Linux终端仿真器清单。每一款都列出了它们各自的描述和特性以及软件界面截图和下载链接。 ### 1. Terminator ### -Terminator is an advanced and powerful terminal emulator which supports multiple terminals windows. This emulator is fully customizable. You can change the size, colour, give different shapes to the terminal. Its very user friendly and fun to use. +Terminator是一款先进且强大的终端仿真器,它支持多终端窗口。这款仿真器可以完全自定义。你可以更改它的界面尺寸、颜色,给它设置不同的形状。拥有高用户友好性且使用起来很有乐趣。 #### Terminator的特性 #### From f2a275e7d04fd30f0d0056d210955c8aed7feb64 Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Fri, 5 Jun 2015 16:53:11 +0800 Subject: [PATCH 005/153] Translating by ZTinoZ --- ...526 20 Useful Terminal Emulators for Linux.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index 4ac5708fa6..4d2f8cfc16 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -14,10 +14,10 @@ Terminator是一款先进且强大的终端仿真器,它支持多终端窗口 #### Terminator的特性 #### -- Customize your profiles and colour schemes, set the size to fit your needs. -- Use plugins to get even more functionality. -- Several key-shortcuts are available to speed up common activities. -- Split the terminal window into several virtual terminals and re-size them as needed. +- 自定义外形和色彩设计,根据你的需要设置尺寸。 +- 使用插件来获取更多功能。 +- 快捷键可以加快普通操作。 +- 可以把终端窗口分裂成几个虚拟终端并把它们重新设置成你需要的尺寸。 ![Terminator Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Terminator-Emulator.jpeg) @@ -28,13 +28,13 @@ Terminator Terminal ### 2. Tilda ### -Tilda is a stylish drop-down terminal based on GTK+. With the help of a single key press you can launch a new or hide Tilda window. However, you can add colors of your choice to change the look of the text and Terminal background. +Tilda是一款漂亮的基于GTK+的下拉式终端。敲击一个键你就可以打开一个新的或隐藏着的Tilda窗口。然而,你可以添加你所选择的颜色来更改文本颜色和终端背景颜色。 #### Tilda的特性 #### - Interface with Highly customization option. - You can set the transparency level for Tilda window. - Excellent built-in colour schemes. +- 高度定制的选项界面设置。 +- 你可以给Tilda设置透明度。 +- 优秀的嵌入式色彩设计。 ![Tilda Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Tilda-Emulator.jpeg) From 7a1ebd4b153eb013272d6802f09cba3ec045eeda Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 8 Jun 2015 10:19:12 +0800 Subject: [PATCH 006/153] PUB:20150420 Managing file and directory attributes in linux using chattr and lsattr command @ictlyh --- ...n linux using chattr and lsattr command.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) rename {translated/tech => published}/20150420 Managing file and directory attributes in linux using chattr and lsattr command.md (85%) diff --git a/translated/tech/20150420 Managing file and directory attributes in linux using chattr and lsattr command.md b/published/20150420 Managing file and directory attributes in linux using chattr and lsattr command.md similarity index 85% rename from translated/tech/20150420 Managing file and directory attributes in linux using chattr and lsattr command.md rename to published/20150420 Managing file and directory attributes in linux using chattr and lsattr command.md index 0aaef749c8..052103ddda 100644 --- a/translated/tech/20150420 Managing file and directory attributes in linux using chattr and lsattr command.md +++ b/published/20150420 Managing file and directory attributes in linux using chattr and lsattr command.md @@ -1,11 +1,11 @@ 在Linux中用chattr和lsattr命令管理文件和目录属性 ================================================================================ -为了允许添加数据,防止更改或者删除等,文件和文件夹中设定了一定的控制属性。例如,你可以在关键系统文件或者文件夹中启用属性,然后没有用户,包括root,可以删除或者修改它,不允许比如dump命令等备份工具去备份一个特定的文件或者文件夹,等等。这些属性只可以在ext2,ext3或者ext4文件系统中的文件和文件夹上设定。 +为了允许添加数据,防止更改或者删除等,文件和文件夹可以设定了特定的控制属性。例如,你可以在关键的系统文件或者文件夹中启用属性,然后没有任何用户,包括root,可以删除或者修改它,比如不允许使用像dump这样的命令等备份工具去备份一个特定的文件或者文件夹,等等。这些属性只可以在ext2,ext3或者ext4文件系统中的文件和文件夹上设定。 有两个命令 **lsattr** 和 **chattr** 用来管理属性。下面是常用属性的列表。 注:表格代码 - +
@@ -63,7 +63,7 @@

e (extent format)

@@ -71,7 +71,7 @@

i (immutable)

@@ -96,14 +96,14 @@ chattr属性中可以使用的不同选项 : - **-R** 递归地修改文件夹和子文件夹的属性 -- **-V** chattr命令的输出伴随版本信息 -- **-f** 压缩大部分错误信息 +- **-V** chattr命令会输出带有版本信息的冗余信息 +- **-f** 忽略大部分错误信息 在chattr中用于设置或者取消属性的 **操作符** -- ‘+’ 符号用来为文件和文件夹设置属性, -- ‘-‘ 符号用来移除或者取消属性 -- ‘=’ 使它们成为文件有的唯一属性。 +- '+' 符号用来为文件和文件夹设置属性, +- '-' 符号用来移除或者取消属性 +- '=' 使它们成为文件有的唯一属性。 **chattr** 和 **lsattr** 命令的基本语法 : @@ -120,7 +120,7 @@ chattr属性中可以使用的不同选项 : 现在试着删除或者修改文件 [root@linuxtechi ~]# rm -f dummy_data - rm: cannot remove ‘dummy_data’: Operation not permitted + rm: cannot remove 'dummy_data': Operation not permitted [root@linuxtechi ~]# echo "test" >> dummy_data -bash: dummy_data: Permission denied @@ -193,7 +193,7 @@ via: http://www.linuxtechi.com/file-directory-attributes-in-linux-using-chattr-l 作者:[Pradeep Kumar][a] 译者:[ictlyh](https://github.com/ictlyh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 From 210c1637e5e3734a5485859ffa015f4caaf96ac6 Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 8 Jun 2015 11:38:07 +0800 Subject: [PATCH 007/153] PUB:20150506 First Step Guide for Learning Shell Scripting @GOLinux --- ...Step Guide for Learning Shell Scripting.md | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) rename {translated/tech => published}/20150506 First Step Guide for Learning Shell Scripting.md (85%) diff --git a/translated/tech/20150506 First Step Guide for Learning Shell Scripting.md b/published/20150506 First Step Guide for Learning Shell Scripting.md similarity index 85% rename from translated/tech/20150506 First Step Guide for Learning Shell Scripting.md rename to published/20150506 First Step Guide for Learning Shell Scripting.md index af71b8f4ca..6369c96c8a 100644 --- a/translated/tech/20150506 First Step Guide for Learning Shell Scripting.md +++ b/published/20150506 First Step Guide for Learning Shell Scripting.md @@ -1,4 +1,4 @@ -Shell脚本学习初次操作指南 +Shell脚本编程初体验 ================================================================================ ![](http://blog.linoxide.com/wp-content/uploads/2015/04/myfirstshellscript.jpg) @@ -18,33 +18,33 @@ Linux世界中最为流行的shell脚本语言之一,就是bash。而我认为 shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象成能帮你做事的那些人,只要你用正确的方式来请求他们去做。比如说,你想要写文档。首先,你需要纸。然后,你需要把内容说给某个人听,让他帮你写。最后,你想要把它存放到某个地方。或者说,你想要造一所房子,因而你需要请合适的人来清空场地。在他们说“事情干完了”,那么另外一些工程师就可以帮你来砌墙。最后,当这些工程师们也告诉你“事情干完了”的时候,你就可以叫油漆工来给房子粉饰了。如果你让油漆工在墙砌好前就来粉饰,会发生什么呢?我想,他们会开始发牢骚了。几乎所有这些像人一样的命令都会说话,如果它们完成了工作而没有发生什么问题,那么它们就会告诉“标准输出”。如果它们不能做你叫它们做的事——它们会告诉“标准错误”。这样,最后,所有的命令都通过“标准输入”来听你的话。 -快速实例——当你打开linux终端并写一些文本时——你正通过“标准输入”和bash说话。那么,让我们来问问bash shell **who am i**吧。 +快速实例——当你打开linux终端并写一些文本时——你正通过“标准输入”和bash说话。那么,让我们来问问bash shell **who am i(我是谁?)**吧。 - root@localhost ~]# who am i <--- you speaking through the standard input to bash shell - root pts/0 2015-04-22 20:17 (192.168.1.123) <--- bash shell answering to you through the standard output + root@localhost ~]# who am i <--- 你通过标准输入对 bash shell 说 + root pts/0 2015-04-22 20:17 (192.168.1.123) <--- bash shell通过标准输出回答你 现在,让我们说一些bash听不懂的问题: [root@localhost ~]# blablabla <--- 哈,你又在和标准输入说话了 -bash: blablabla: command not found <--- bash通过标准错误在发牢骚了 -“:”之前的第一个单词通常是向你发牢骚的命令。实际上,这些流中的每一个都有它们自己的索引号: +“:”之前的第一个单词通常是向你发牢骚的命令。实际上,这些流中的每一个都有它们自己的索引号(LCTT 译注:文件句柄号): - 标准输入(**stdin**) - 0 - 标准输出(**stdout**) - 1 - 标准错误(**stderr**) - 2 -如果你真的想要知道哪个输出命令说了些什么——你需要重定向(在命令后使用大于号“>”和流索引)那次发言到文件: +如果你真的想要知道哪个输出命令说了些什么——你需要将那次发言重定向到(在命令后使用大于号“>”和流索引)文件: [root@localhost ~]# blablabla 1> output.txt -bash: blablabla: command not found -在本例中,我们试着重定向1(**stdout**)流到名为output.txt的文件。让我们来看对该文件内容所做的事情吧,使用cat命令可以做这事: +在本例中,我们试着重定向流1(**stdout**)到名为output.txt的文件。让我们来看对该文件内容所做的事情吧,使用cat命令可以做这事: [root@localhost ~]# cat output.txt [root@localhost ~]# -看起来似乎是空的。好吧,现在让我们来重定向2(**stderr**)流: +看起来似乎是空的。好吧,现在让我们来重定向流2(**stderr**): [root@localhost ~]# blablabla 2> error.txt [root@localhost ~]# @@ -77,17 +77,17 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 rm: cannot remove `folder1': Is a directory [root@localhost ~]# -正如我们所看到的,不同的流被分离到了不同的文件。有时候,这也不似很方便,因为我们想要查看出现错误时,在某些操作前面或后面所连续发生的事情。要实现这一目的,我们可以重定向两个流到同一个文件: +正如我们所看到的,不同的流被分离到了不同的文件。有时候,这也不是很方便,因为我们想要查看出现错误时,在某些操作前面或后面所连续发生的事情。要实现这一目的,我们可以重定向两个流到同一个文件: command >>out_err.txt 2>>out_err.txt 注意:请注意,我使用“>>”替代了“>”。它允许我们附加到文件,而不是覆盖文件。 -我们可以重定向一个流到另一个: +我们也可以重定向一个流到另一个: command >out_err.txt 2>&1 -让我来解释一下吧。所有命令的标准输出将被重定向到out_err.txt,错误输出将被重定向到1-st流(上面已经解释过了),而该流会被重定向到同一个文件。让我们看这个实例: +让我来解释一下吧。所有命令的标准输出将被重定向到out_err.txt,错误输出将被重定向到流1(上面已经解释过了),而该流会被重定向到同一个文件。让我们看这个实例: [root@localhost ~]# rm -fv folder2 file2 >out_err.txt 2>&1 [root@localhost ~]# cat out_err.txt @@ -127,7 +127,7 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 如果你打算grep一些双引号引起来带有空格的内容呢! -注意: fdisk命令显示关于Linux操作系统磁盘驱动器的信息 +注意:fdisk命令显示关于Linux操作系统磁盘驱动器的信息。 就像我们看到的,这种方式很不方便,因为我们不一会儿就把临时文件空间给搞乱了。要完成该任务,我们可以使用管道。它们允许我们重定向一个命令的**stdout**到另一个命令的**stdin**流: @@ -147,11 +147,11 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 正如我们所知道的,通常,与shell的交流以及shell内的交流是以对话的方式进行的。因此,让我们创建一些真正的脚本吧,这些脚本也会和我们讲话。这会让你学到一些简单的命令,并对脚本的概念有一个更好的理解。 -假设我们是某个公司的总服务台经理,我们想要创建某个shell脚本来注册呼叫信息:电话号码、用户名以及问题的简要描述。我们打算把这些信息存储到普通文本文件data.txt中,以便今后统计。脚本它自己就是以对话的方式工作,这会让总服务台的工作人员的小日子过得轻松点。那么,首先我们需要显示问题。对于现实信息,我们可以用echo和printf命令。这两个都是用来显示信息的,但是printf更为强大,因为我们可以通过它很好地格式化输出,我们可以让它右对齐、左对齐或者为信息留出专门的空间。让我们从一个简单的例子开始吧。要创建文件,请使用你喜欢的文本编辑器(kate,nano,vi,……),然后创建名为note.sh的文件,里面写入这些命令: +假设我们是某个公司的总服务台经理,我们想要创建某个shell脚本来注册呼叫信息:电话号码、用户名以及问题的简要描述。我们打算把这些信息存储到普通文本文件data.txt中,以便今后统计。脚本它自己就是以对话的方式工作,这会让总服务台的工作人员的小日子过得轻松点。那么,首先我们需要显示提问。对于显示信息,我们可以用echo和printf命令。这两个都是用来显示信息的,但是printf更为强大,因为我们可以通过它很好地格式化输出,我们可以让它右对齐、左对齐或者为信息留出专门的空间。让我们从一个简单的例子开始吧。要创建文件,请使用你惯用的文本编辑器(kate,nano,vi,……),然后创建名为note.sh的文件,里面写入这些命令: echo "Phone number ?" - -### Script执行 ### + +### 如何运行/执行脚本? ### 在保存文件后,我们可以使用bash命令来运行,把我们的文件作为它的参数: @@ -176,7 +176,7 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 [root@localhost ~]# ./note.sh Phone number ? -在脚本名前,我添加了./组合。.(点)在unix世界中意味着当前位置(当前文件夹),/(斜线)是文件夹分隔符。(在Windows系统中,我们使用\(反斜线)实现同样功能)所以,这整个组合的意思是说:“从当前文件夹执行note.sh脚本”。我想,如果我用完整路径来运行这个脚本的话,你会更加清楚一些: +在脚本名前,我添加了 ./ 组合。.(点)在unix世界中意味着当前位置(当前文件夹),/(斜线)是文件夹分隔符。(在Windows系统中,我们使用反斜线 \ 表示同样功能)所以,这整个组合的意思是说:“从当前文件夹执行note.sh脚本”。我想,如果我用完整路径来运行这个脚本的话,你会更加清楚一些: [root@localhost ~]# /root/note.sh Phone number ? @@ -184,7 +184,7 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 它也能工作。 -如果所有linux用户都有相同的默认shell,那就万事OK。如果我们只是执行该脚本,默认的用户shell就会用于解析脚本内容并运行命令。不同的shell有着一丁点不同的语法、内部命令等等,所以,为了保证我们的脚本会使用**bash**,我们应该添加**#!/bin/bash**到文件首行。这样,默认的用户shell将调用**/bin/bash**,而只有在那时候,脚本中的命令才会被执行: +如果所有linux用户都有相同的默认shell,那就万事OK。如果我们只是执行该脚本,默认的用户shell就会用于解析脚本内容并运行命令。不同的shell的语法、内部命令等等有着一丁点不同,所以,为了保证我们的脚本会使用**bash**,我们应该添加**#!/bin/bash**到文件首行。这样,默认的用户shell将调用**/bin/bash**,而只有在那时候,脚本中的命令才会被执行: [root@localhost ~]# cat note.sh #!/bin/bash @@ -194,13 +194,13 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 ### 读取输入 ### -在现实信息后,脚本会等待用户回答。那儿有个**read**命令用来接收用户的回答: +在显示信息后,脚本会等待用户回答。有个**read**命令用来接收用户的回答: #!/bin/bash echo "Phone number ?" read phone -在执行后,脚本会等待用户输入,直到用户按[ENTER]键: +在执行后,脚本会等待用户输入,直到用户按[ENTER]键结束输入: [root@localhost ~]# ./note.sh Phone number ? @@ -220,7 +220,7 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 You have entered 123456 as a phone number [root@localhost ~]# -在**bash** shell中,我们使用**$**(美元)符号作为变量标示,除了读入到变量和其它为数不多的时候(将在今后说明)。 +在**bash** shell中,一般我们使用**$**(美元)符号来表明这是一个变量,除了读入到变量和其它为数不多的时候才不用这个$(将在今后说明)。 好了,现在我们准备添加剩下的问题了: @@ -244,7 +244,7 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 太完美了!剩下来就是重定向所有东西到文件data.txt了。作为字段分隔符,我们将使用/(斜线)符号。 -**注意** : 你可以选择任何你认为是最好,但是确保文件内容不会包含这些符号在内。它会导致在文本行中产生额外字段。 +**注意** : 你可以选择任何你认为是最好的分隔符,但是确保文件内容不会包含这些符号在内,否则它会导致在文本行中产生额外字段。 别忘了使用“>>”来代替“>”,因为我们想要将输出内容附加到文件末! @@ -262,7 +262,7 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 987/Jimmy/Keybord issue. [root@localhost ~]# -**注意** : **tail**命令显示了文件的最后**-n**行。 +**注意** : **tail**命令显示了文件的最后的**n**行。 搞定。让我们再来运行一次看看: @@ -285,7 +285,7 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 [root@localhost ~]# date "+%Y.%m.%d %H:%M:%S" 2015.04.23 21:33:18 <---- 格式化后的输出 -有几种方式可以读取命令输出到变脸,在这种简单的情况下,我们将使用`(反引号): +有几种方式可以读取命令的输出到变量,在这种简单的情况下,我们将使用`(是反引号,不是单引号,和波浪号~在同一个键位): [root@localhost ~]# cat note.sh #!/bin/bash @@ -320,7 +320,7 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 你可以直接从控制台查找到各个命令的大量有趣的信息,只需输入:**man read, man echo, man date, man ……** -同意吗?它看上去是好多了! +同意吗?它看上去是舒服多了! [root@localhost ~]# ./note.sh Phone number: 321 @@ -331,9 +331,9 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 2015.04.23 21:43:50/321/Susane/Mouse was stolen [root@localhost ~]# -光标在消息的后面(不是在新的一行中),这有点意思。 +光标在消息的后面(不是在新的一行中),这有点意思。(LCTT 译注:如果用 echo 命令输出显示的话,可以用 -n 参数来避免换行。) -循环 +### 循环 ### 是时候来改进我们的脚本了。如果用户一整天都在接电话,如果每次都要去运行,这岂不是很麻烦?让我们让这些活动都永无止境地循环去吧: @@ -348,7 +348,7 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 echo "$now/$phone/$name/$issue">>data.txt done -我已经交换了**read phone**和**now=`date`**行。这是因为我想要在输入电话号码后再获得时间。如果我把它放在循环**- the**的首行,变量就会在数据存储到文件中后获得时间。而这并不好,因为下一次呼叫可能在20分钟后,甚至更晚。 +我已经交换了**read phone**和**now=`date`**行的位置。这是因为我想要在输入电话号码后再获得时间。如果我把它放在循环的首行,那么循环一次后,变量 now 就会在数据存储到文件中后马上获得时间。而这并不好,因为下一次呼叫可能在20分钟后,甚至更晚。 [root@localhost ~]# ./note.sh Phone number: 123 @@ -365,11 +365,11 @@ shell脚本语言就跟和几个人聊天类似。你只需把所有命令想象 2015.04.23 21:48:16/777/Daniel/I broke my monitor [root@localhost ~]# -注意: 要从无限循环中退出,你可以按[Ctrl]+[C]键。Shell会显示^表示Ctrl键。 +注意: 要从无限循环中退出,你可以按[Ctrl]+[C]键。Shell会显示\^表示Ctrl键。 ### 使用管道重定向 ### -让我们添加更多功能到我们的“弗兰肯斯坦”,我想要脚本在每次呼叫后显示某个统计数据。比如说,我想要查看各个号码呼叫了我几次。对于这个,我们应该cat文件data.txt: +让我们添加更多功能到我们的“弗兰肯斯坦(Frankenstein)”,我想要脚本在每次呼叫后显示某个统计数据。比如说,我想要查看各个号码呼叫了我几次。对于这个,我们应该cat文件data.txt: [root@localhost ~]# cat data.txt 2015.04.23 21:38:56/123/Jim/Script hanging. @@ -453,7 +453,7 @@ via: http://linoxide.com/linux-shell-script/guide-start-learning-shell-scripting 作者:[Petras Liumparas][a] 译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From b9e86d827951075cc56e6e80f0d63dc3eafae148 Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Mon, 8 Jun 2015 16:02:17 +0800 Subject: [PATCH 008/153] Translating by ZTinoZ --- .../20150526 20 Useful Terminal Emulators for Linux.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index 4d2f8cfc16..bafcc15d71 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -28,7 +28,7 @@ Terminator Terminal ### 2. Tilda ### -Tilda是一款漂亮的基于GTK+的下拉式终端。敲击一个键你就可以打开一个新的或隐藏着的Tilda窗口。然而,你可以添加你所选择的颜色来更改文本颜色和终端背景颜色。 +Tilda是一款漂亮的基于GTK+的下拉式终端,敲击一个键你就可以呼出一个新的或隐藏着的Tilda窗口。你也可以添加你所选择的颜色来更改文本颜色和终端背景颜色。 #### Tilda的特性 #### @@ -44,9 +44,9 @@ Tilda Terminal ### 3. Guake ### -Guake is a python based drop-down terminal created for the GNOME Desktop Environment. It is invoked by pressing a single keystroke, and can make it hidden by pressing same keystroke again. Its design was determined from FPS (First Person Shooter) games such as Quake and one of its main target is be easy to reach. +Guake是一款基于python的下拉式终端,诞生于GNOME桌面环境。按一个键就能调出,再按一下就能隐藏。它的设计构思来源于FPS (第一人称射击) 游戏例如Quake,其目标显而易见。 -Guake is very much similar to Yakuaka and Tilda, but it’s an experiment to mix the best of them into a single GTK-based program. Guake has been written in python from scratch using a little piece in C (global hotkeys stuff). +Guake与Yakuaka和Tilda非常相似,不过它是一个集上述二者的优点于一体的基于GTK的程序。Guake完全是用Python和小片的C写成的(全局热键部分)。 ![Guake Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Guake-Terminal.jpeg) @@ -56,7 +56,7 @@ Guake Terminal ### 4. Yakuake ### -Yakuake (Yet Another Kuake) is a KDE based drop-down terminal emulator very much similar to Guake terminal emulator in functionality. It’s design was inspired from fps consoles games such as Quake. +Yakuake (Yet Another Kuake) 是一款基于KDE的下拉式终端仿真器,它与Guake再功能上非常相似。它的射击构思也是受FPS游戏的启发例如Quake。 Yakuake is basically a KDE application, which can be easily installed on KDE desktop, but if you try to install Yakuake in GNOME desktop, it will prompt you to install huge number of dependency packages. From 1fe543421b67080516ee3775ba44f512df143f3b Mon Sep 17 00:00:00 2001 From: DeadFire Date: Mon, 8 Jun 2015 16:39:28 +0800 Subject: [PATCH 009/153] =?UTF-8?q?2015-06-08-1=20=E9=80=89=E9=A2=98=20RHC?= =?UTF-8?q?SA=20Series=201-6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ntial Commands and System Documentation.md | 313 +++++++++++++++++ ...o Perform File and Directory Management.md | 322 ++++++++++++++++++ ...ow to Manage Users and Groups in RHEL 7.md | 248 ++++++++++++++ ...or Analyzing text with grep and regexps.md | 254 ++++++++++++++ ...Boot Shutdown and Everything in Between.md | 216 ++++++++++++ ...to Configure and Encrypt System Storage.md | 269 +++++++++++++++ 6 files changed, 1622 insertions(+) create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 02--How to Perform File and Directory Management.md create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md b/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md new file mode 100644 index 0000000000..9b32c93453 --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md @@ -0,0 +1,313 @@ +RHCSA Series: Reviewing Essential Commands & System Documentation – Part 1 +================================================================================ +RHCSA (Red Hat Certified System Administrator) is a certification exam from Red Hat company, which provides an open source operating system and software to the enterprise community, It also provides support, training and consulting services for the organizations. + +![RHCSA Exam Guide](http://www.tecmint.com/wp-content/uploads/2015/02/RHCSA-Series-by-Tecmint.png) + +RHCSA Exam Preparation Guide + +RHCSA exam is the certification obtained from Red Hat Inc, after passing the exam (codename EX200). RHCSA exam is an upgrade to the RHCT (Red Hat Certified Technician) exam, and this upgrade is compulsory as the Red Hat Enterprise Linux was upgraded. The main variation between RHCT and RHCSA is that RHCT exam based on RHEL 5, whereas RHCSA certification is based on RHEL 6 and 7, the courseware of these two certifications are also vary to a certain level. + +This Red Hat Certified System Administrator (RHCSA) is essential to perform the following core system administration tasks needed in Red Hat Enterprise Linux environments: + +- Understand and use necessary tools for handling files, directories, command-environments line, and system-wide / packages documentation. +- Operate running systems, even in different run levels, identify and control processes, start and stop virtual machines. +- Set up local storage using partitions and logical volumes. +- Create and configure local and network file systems and its attributes (permissions, encryption, and ACLs). +- Setup, configure, and control systems, including installing, updating and removing software. +- Manage system users and groups, along with use of a centralized LDAP directory for authentication. +- Ensure system security, including basic firewall and SELinux configuration. + +To view fees and register for an exam in your country, check the [RHCSA Certification page][1]. + +To view fees and register for an exam in your country, check the RHCSA Certification page. + +In this 15-article RHCSA series, titled Preparation for the RHCSA (Red Hat Certified System Administrator) exam, we will going to cover the following topics on the latest releases of Red Hat Enterprise Linux 7. + +- Part 1: Reviewing Essential Commands & System Documentation +- Part 2: How to Perform File and Directory Management in RHEL 7 +- Part 3: How to Manage Users and Groups in RHEL 7 +- Part 4: Editing Text Files with Nano and Vim / Analyzing text with grep and regexps +- Part 5: Process Management in RHEL 7: boot, shutdown, and everything in between +- Part 6: Using ‘Parted’ and ‘SSM’ to Configure and Encrypt System Storage +- Part 7: Using ACLs (Access Control Lists) and Mounting Samba / NFS Shares +- Part 8: Securing SSH, Setting Hostname and Enabling Network Services +- Part 9: Installing, Configuring and Securing a Web and FTP Server +- Part 10: Yum Package Management, Automating Tasks with Cron and Monitoring System Logs +- Part 11: Firewall Essentials and Control Network Traffic Using FirewallD and Iptables +- Part 12: Automate RHEL 7 Installations Using ‘Kickstart’ +- Part 13: RHEL 7: What is SELinux and how it works? +- Part 14: Use LDAP-based authentication in RHEL 7 +- Part 15: Virtualization in RHEL 7: KVM and Virtual machine management + +In this Part 1 of the RHCSA series, we will explain how to enter and execute commands with the correct syntax in a shell prompt or terminal, and explained how to find, inspect, and use system documentation. + +![RHCSA: Reviewing Essential Linux Commands – Part 1](http://www.tecmint.com/wp-content/uploads/2015/02/Reviewing-Essential-Linux-Commands.png) + +RHCSA: Reviewing Essential Linux Commands – Part 1 + +#### Prerequisites: #### + +At least a slight degree of familiarity with basic Linux commands such as: + +- [cd command][2] (change directory) +- [ls command][3] (list directory) +- [cp command][4] (copy files) +- [mv command][5] (move or rename files) +- [touch command][6] (create empty files or update the timestamp of existing ones) +- rm command (delete files) +- mkdir command (make directory) + +The correct usage of some of them are anyway exemplified in this article, and you can find further information about each of them using the suggested methods in this article. + +Though not strictly required to start, as we will be discussing general commands and methods for information search in a Linux system, you should try to install RHEL 7 as explained in the following article. It will make things easier down the road. + +- [Red Hat Enterprise Linux (RHEL) 7 Installation Guide][7] + +### Interacting with the Linux Shell ### + +If we log into a Linux box using a text-mode login screen, chances are we will be dropped directly into our default shell. On the other hand, if we login using a graphical user interface (GUI), we will have to open a shell manually by starting a terminal. Either way, we will be presented with the user prompt and we can start typing and executing commands (a command is executed by pressing the Enter key after we have typed it). + +Commands are composed of two parts: + +- the name of the command itself, and +- arguments + +Certain arguments, called options (usually preceded by a hyphen), alter the behavior of the command in a particular way while other arguments specify the objects upon which the command operates. + +The type command can help us identify whether another certain command is built into the shell or if it is provided by a separate package. The need to make this distinction lies in the place where we will find more information about the command. For shell built-ins we need to look in the shell’s man page, whereas for other binaries we can refer to its own man page. + +![Check Shell built in Commands](http://www.tecmint.com/wp-content/uploads/2015/02/Check-shell-built-in-Commands.png) + +Check Shell built in Commands + +In the examples above, cd and type are shell built-ins, while top and less are binaries external to the shell itself (in this case, the location of the command executable is returned by type). + +Other well-known shell built-ins include: + +- [echo command][8]: Displays strings of text. +- [pwd command][9]: Prints the current working directory. + +![More Built in Shell Commands](http://www.tecmint.com/wp-content/uploads/2015/02/More-Built-in-Shell-Commands.png) + +More Built in Shell Commands + +**exec command** + +Runs an external program that we specify. Note that in most cases, this is better accomplished by just typing the name of the program we want to run, but the exec command has one special feature: rather than create a new process that runs alongside the shell, the new process replaces the shell, as can verified by subsequent. + + # ps -ef | grep [original PID of the shell process] + +When the new process terminates, the shell terminates with it. Run exec top and then hit the q key to quit top. You will notice that the shell session ends when you do, as shown in the following screencast: + +注:youtube视频 + + +**export command** + +Exports variables to the environment of subsequently executed commands. + +**history Command** + +Displays the command history list with line numbers. A command in the history list can be repeated by typing the command number preceded by an exclamation sign. If we need to edit a command in history list before executing it, we can press Ctrl + r and start typing the first letters associated with the command. When we see the command completed automatically, we can edit it as per our current need: + +注:youtube视频 + + +This list of commands is kept in our home directory in a file called .bash_history. The history facility is a useful resource for reducing the amount of typing, especially when combined with command line editing. By default, bash stores the last 500 commands you have entered, but this limit can be extended by using the HISTSIZE environment variable: + +![Linux history Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-history-Command.png) + +Linux history Command + +But this change as performed above, will not be persistent on our next boot. In order to preserve the change in the HISTSIZE variable, we need to edit the .bashrc file by hand: + + # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) + HISTSIZE=1000 + +**Important**: Keep in mind that these changes will not take effect until we restart our shell session. + +**alias command** + +With no arguments or with the -p option prints the list of aliases in the form alias name=value on standard output. When arguments are provided, an alias is defined for each name whose value is given. + +With alias, we can make up our own commands or modify existing ones by including desired options. For example, suppose we want to alias ls to ls –color=auto so that the output will display regular files, directories, symlinks, and so on, in different colors: + + # alias ls='ls --color=auto' + +![Linux alias Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-alias-Command.png) + +Linux alias Command + +**Note**: That you can assign any name to your “new command” and enclose as many commands as desired between single quotes, but in that case you need to separate them by semicolons, as follows: + + # alias myNewCommand='cd /usr/bin; ls; cd; clear' + +**exit command** + +The exit and logout commands both terminate the shell. The exit command terminates any shell, but the logout command terminates only login shells—that is, those that are launched automatically when you initiate a text-mode login. + +If we are ever in doubt as to what a program does, we can refer to its man page, which can be invoked using the man command. In addition, there are also man pages for important files (inittab, fstab, hosts, to name a few), library functions, shells, devices, and other features. + +#### Examples: #### + +- man uname (print system information, such as kernel name, processor, operating system type, architecture, and so on). +- man inittab (init daemon configuration). + +Another important source of information is provided by the info command, which is used to read info documents. These documents often provide more information than the man page. It is invoked by using the info keyword followed by a command name, such as: + + # info ls + # info cut + +In addition, the /usr/share/doc directory contains several subdirectories where further documentation can be found. They either contain plain-text files or other friendly formats. + +Make sure you make it a habit to use these three methods to look up information for commands. Pay special and careful attention to the syntax of each of them, which is explained in detail in the documentation. + +**Converting Tabs into Spaces with expand Command** + +Sometimes text files contain tabs but programs that need to process the files don’t cope well with tabs. Or maybe we just want to convert tabs into spaces. That’s where the expand tool (provided by the GNU coreutils package) comes in handy. + +For example, given the file NumbersList.txt, let’s run expand against it, changing tabs to one space, and display on standard output. + + # expand --tabs=1 NumbersList.txt + +![Linux expand Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-expand-Command.png) + +Linux expand Command + +The unexpand command performs the reverse operation (converts spaces into tabs). + +**Display the first lines of a file with head and the last lines with tail** + +By default, the head command followed by a filename, will display the first 10 lines of the said file. This behavior can be changed using the -n option and specifying a certain number of lines. + + # head -n3 /etc/passwd + # tail -n3 /etc/passwd + +![Linux head and tail Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-head-and-tail-Command.png) + +Linux head and tail Command + +One of the most interesting features of tail is the possibility of displaying data (last lines) as the input file grows (tail -f my.log, where my.log is the file under observation). This is particularly useful when monitoring a log to which data is being continually added. + +Read More: [Manage Files Effectively using head and tail Commands][10] + +**Merging Lines with paste** + +The paste command merges files line by line, separating the lines from each file with tabs (by default), or another delimiter that can be specified (in the following example the fields in the output are separated by an equal sign). + + # paste -d= file1 file2 + +![Merge Files in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Merge-Files-in-Linux-with-paste-command.png) + +Merge Files in Linux + +**Breaking a file into pieces using split command** + +The split command is used split a file into two (or more) separate files, which are named according to a prefix of our choosing. The splitting can be defined by size, chunks, or number of lines, and the resulting files can have a numeric or alphabetic suffixes. In the following example, we will split bash.pdf into files of size 50 KB (-b 50KB), using numeric suffixes (-d): + + # split -b 50KB -d bash.pdf bash_ + +![Split Files in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Split-Files-in-Linux-with-split-command.png) + +Split Files in Linux + +You can merge the files to recreate the original file with the following command: + + # cat bash_00 bash_01 bash_02 bash_03 bash_04 bash_05 > bash.pdf + +**Translating characters with tr command** + +The tr command can be used to translate (change) characters on a one-by-one basis or using character ranges. In the following example we will use the same file2 as previously, and we will change: + +- lowercase o’s to uppercase, +- and all lowercase to uppercase + + # cat file2 | tr o O + # cat file2 | tr [a-z] [A-Z] + +![Translate Characters in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Translate-characters-in-Linux-with-tr-command.png) + +Translate Characters in Linux + +**Reporting or deleting duplicate lines with uniq and sort command** + +The uniq command allows us to report or remove duplicate lines in a file, writing to stdout by default. We must note that uniq does not detect repeated lines unless they are adjacent. Thus, uniq is commonly used along with a preceding sort (which is used to sort lines of text files). + +By default, sort takes the first field (separated by spaces) as key field. To specify a different key field, we need to use the -k option. Please note how the output returned by sort and uniq change as we change the key field in the following example: + + # cat file3 + # sort file3 | uniq + # sort -k2 file3 | uniq + # sort -k3 file3 | uniq + +![Remove Duplicate Lines in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Remove-Duplicate-Lines-in-file.png) + +Remove Duplicate Lines in Linux + +**Extracting text with cut command** + +The cut command extracts portions of input lines (from stdin or files) and displays the result on standard output, based on number of bytes (-b), characters (-c), or fields (-f). + +When using cut based on fields, the default field separator is a tab, but a different separator can be specified by using the -d option. + + # cut -d: -f1,3 /etc/passwd # Extract specific fields: 1 and 3 in this case + # cut -d: -f2-4 /etc/passwd # Extract range of fields: 2 through 4 in this example + +![Extract Text From a File in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Extract-Text-from-a-file.png) + +Extract Text From a File in Linux + +Note that the output of the two examples above was truncated for brevity. + +**Reformatting files with fmt command** + +fmt is used to “clean up” files with a great amount of content or lines, or with varying degrees of indentation. The new paragraph formatting defaults to no more than 75 characters wide. You can change this with the -w (width) option, which set the line length to the specified number of characters. + +For example, let’s see what happens when we use fmt to display the /etc/passwd file setting the width of each line to 100 characters. Once again, output has been truncated for brevity. + + # fmt -w100 /etc/passwd + +![File Reformatting in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/File-Reformatting-in-Linux-with-fmt-command.png) + +File Reformatting in Linux + +**Formatting content for printing with pr command** + +pr paginates and displays in columns one or more files for printing. In other words, pr formats a file to make it look better when printed. For example, the following command: + + # ls -a /etc | pr -n --columns=3 -h "Files in /etc" + +Shows a listing of all the files found in /etc in a printer-friendly format (3 columns) with a custom header (indicated by the -h option), and numbered lines (-n). + +![File Formatting in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/File-Formatting-in-Linux-with-pr-command.png) + +File Formatting in Linux + +### Summary ### + +In this article we have discussed how to enter and execute commands with the correct syntax in a shell prompt or terminal, and explained how to find, inspect, and use system documentation. As simple as it seems, it’s a large first step in your way to becoming a RHCSA. + +If you would like to add other commands that you use on a periodic basis and that have proven useful to fulfill your daily responsibilities, feel free to share them with the world by using the comment form below. Questions are also welcome. We look forward to hearing from you! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ + +作者:[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://www.redhat.com/en/services/certification/rhcsa +[2]:http://www.tecmint.com/cd-command-in-linux/ +[3]:http://www.tecmint.com/ls-command-interview-questions/ +[4]:http://www.tecmint.com/advanced-copy-command-shows-progress-bar-while-copying-files/ +[5]:http://www.tecmint.com/rename-multiple-files-in-linux/ +[6]:http://www.tecmint.com/8-pratical-examples-of-linux-touch-command/ +[7]:http://www.tecmint.com/redhat-enterprise-linux-7-installation/ +[8]:http://www.tecmint.com/echo-command-in-linux/ +[9]:http://www.tecmint.com/pwd-command-examples/ +[10]:http://www.tecmint.com/view-contents-of-file-in-linux/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 02--How to Perform File and Directory Management.md b/sources/tech/RHCSA Series/RHCSA Series--Part 02--How to Perform File and Directory Management.md new file mode 100644 index 0000000000..7566862597 --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 02--How to Perform File and Directory Management.md @@ -0,0 +1,322 @@ +RHCSA Series: How to Perform File and Directory Management – Part 2 +================================================================================ +In this article, RHCSA Part 2: File and directory management, we will review some essential skills that are required in the day-to-day tasks of a system administrator. + +![RHCSA: Perform File and Directory Management – Part 2](http://www.tecmint.com/wp-content/uploads/2015/03/RHCSA-Part2.png) + +RHCSA: Perform File and Directory Management – Part 2 + +### Create, Delete, Copy, and Move Files and Directories ### + +File and directory management is a critical competence that every system administrator should possess. This includes the ability to create / delete text files from scratch (the core of each program’s configuration) and directories (where you will organize files and other directories), and to find out the type of existing files. + +The [touch command][1] can be used not only to create empty files, but also to update the access and modification times of existing files. + +![touch command example](http://www.tecmint.com/wp-content/uploads/2015/03/touch-command-example.png) + +touch command example + +You can use `file [filename]` to determine a file’s type (this will come in handy before launching your preferred text editor to edit it). + +![file command example](http://www.tecmint.com/wp-content/uploads/2015/03/file-command-example.png) + +file command example + +and `rm [filename]` to delete it. + +![Linux rm command examples](http://www.tecmint.com/wp-content/uploads/2015/03/rm-command-examples.png) + +rm command example + +As for directories, you can create directories inside existing paths with `mkdir [directory]` or create a full path with `mkdir -p [/full/path/to/directory].` + +![mkdir command example](http://www.tecmint.com/wp-content/uploads/2015/03/mkdir-command-example.png) + +mkdir command example + +When it comes to removing directories, you need to make sure that they’re empty before issuing the `rmdir [directory]` command, or use the more powerful (handle with care!) `rm -rf [directory]`. This last option will force remove recursively the `[directory]` and all its contents – so use it at your own risk. + +### Input and Output Redirection and Pipelining ### + +The command line environment provides two very useful features that allows to redirect the input and output of commands from and to files, and to send the output of a command to another, called redirection and pipelining, respectively. + +To understand those two important concepts, we must first understand the three most important types of I/O (Input and Output) streams (or sequences) of characters, which are in fact special files, in the *nix sense of the word. + +- Standard input (aka stdin) is by default attached to the keyboard. In other words, the keyboard is the standard input device to enter commands to the command line. +- Standard output (aka stdout) is by default attached to the screen, the device that “receives” the output of commands and display them on the screen. +- Standard error (aka stderr), is where the status messages of a command is sent to by default, which is also the screen. + +In the following example, the output of `ls /var` is sent to stdout (the screen), as well as the result of ls /tecmint. But in the latter case, it is stderr that is shown. + +![Linux input output redirect](http://www.tecmint.com/wp-content/uploads/2015/03/Linux-input-output-redirect.png) + +Input and Output Example + +To more easily identify these special files, they are each assigned a file descriptor, an abstract representation that is used to access them. The essential thing to understand is that these files, just like others, can be redirected. What this means is that you can capture the output from a file or script and send it as input to another file, command, or script. This will allow you to store on disk, for example, the output of commands for later processing or analysis. + +To redirect stdin (fd 0), stdout (fd 1), or stderr (fd 2), the following operators are available. + +注:表格 +
-

它表明,该文件使用扩展到映射磁盘上的块

+

它表明,该文件使用磁盘上的块的映射扩展

-

在文件上启用这个属性时,我们不能更改,重命名或者删除这个文件

+

在文件上启用这个属性时,我们不能更改、重命名或者删除这个文件

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Redirection OperatorEffect
>Redirects standard output to a file containing standard output. If the destination file exists, it will be overwritten.
>>Appends standard output to a file.
2>Redirects standard error to a file containing standard output. If the destination file exists, it will be overwritten.
2>>Appends standard error to the existing file.
&>Redirects both standard output and standard error to a file; if the specified file exists, it will be overwritten.
<Uses the specified file as standard input.
<>The specified file is used for both standard input and standard output.
+ +As opposed to redirection, pipelining is performed by adding a vertical bar `(|)` after a command and before another one. + +Remember: + +- Redirection is used to send the output of a command to a file, or to send a file as input to a command. +- Pipelining is used to send the output of a command to another command as input. + +#### Examples Of Redirection and Pipelining #### + +**Example 1: Redirecting the output of a command to a file** + +There will be times when you will need to iterate over a list of files. To do that, you can first save that list to a file and then read that file line by line. While it is true that you can iterate over the output of ls directly, this example serves to illustrate redirection. + + # ls -1 /var/mail > mail.txt + +![Redirect output of command tot a file](http://www.tecmint.com/wp-content/uploads/2015/03/Redirect-output-to-a-file.png) + +Redirect output of command tot a file + +**Example 2: Redirecting both stdout and stderr to /dev/null** + +In case we want to prevent both stdout and stderr to be displayed on the screen, we can redirect both file descriptors to `/dev/null`. Note how the output changes when the redirection is implemented for the same command. + + # ls /var /tecmint + # ls /var/ /tecmint &> /dev/null + +![Redirecting stdout and stderr ouput to /dev/null](http://www.tecmint.com/wp-content/uploads/2015/03/Redirecting-stdout-stderr-ouput.png) + +Redirecting stdout and stderr ouput to /dev/null + +#### Example 3: Using a file as input to a command #### + +While the classic syntax of the [cat command][2] is as follows. + + # cat [file(s)] + +You can also send a file as input, using the correct redirection operator. + + # cat < mail.txt + +![Linux cat command examples](http://www.tecmint.com/wp-content/uploads/2015/03/cat-command-examples.png) + +cat command example + +#### Example 4: Sending the output of a command as input to another #### + +If you have a large directory or process listing and want to be able to locate a certain file or process at a glance, you will want to pipeline the listing to grep. + +Note that we use to pipelines in the following example. The first one looks for the required keyword, while the second one will eliminate the actual `grep command` from the results. This example lists all the processes associated with the apache user. + + # ps -ef | grep apache | grep -v grep + +![Send output of command as input to another](http://www.tecmint.com/wp-content/uploads/2015/03/Send-output-of-command-as-input-to-another1.png) + +Send output of command as input to another + +### Archiving, Compressing, Unpacking, and Uncompressing Files ### + +If you need to transport, backup, or send via email a group of files, you will use an archiving (or grouping) tool such as [tar][3], typically used with a compression utility like gzip, bzip2, or xz. + +Your choice of a compression tool will be likely defined by the compression speed and rate of each one. Of these three compression tools, gzip is the oldest and provides the least compression, bzip2 provides improved compression, and xz is the newest and provides the best compression. Typically, files compressed with these utilities have .gz, .bz2, or .xz extensions, respectively. + +注:表格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CommandAbbreviationDescription
–createcCreates a tar archive
–concatenateAAppends tar files to an archive
–appendrAppends non-tar files to an archive
–updateuAppends files that are newer than those in an archive
–diff or –comparedCompares an archive to files on disk
–listtLists the contents of a tarball
–extract or –getxExtracts files from an archive
+ +注:表格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Operation modifierAbbreviationDescription
directory dir CChanges to directory dir before performing operations
same-permissions and same-owner pPreserves permissions and ownership information, respectively.
–verbose vLists all files as they are read or extracted; if combined with –list, it also displays file sizes, ownership, and timestamps
exclude fileExcludes file from the archive. In this case, file can be an actual file or a pattern.
gzip or gunzip zCompresses an archive through gzip
–bzip2 jCompresses an archive through bzip2
–xz JCompresses an archive through xz
+ +#### Example 5: Creating a tarball and then compressing it using the three compression utilities #### + +You may want to compare the effectiveness of each tool before deciding to use one or another. Note that while compressing small files, or a few files, the results may not show much differences, but may give you a glimpse of what they have to offer. + + # tar cf ApacheLogs-$(date +%Y%m%d).tar /var/log/httpd/* # Create an ordinary tarball + # tar czf ApacheLogs-$(date +%Y%m%d).tar.gz /var/log/httpd/* # Create a tarball and compress with gzip + # tar cjf ApacheLogs-$(date +%Y%m%d).tar.bz2 /var/log/httpd/* # Create a tarball and compress with bzip2 + # tar cJf ApacheLogs-$(date +%Y%m%d).tar.xz /var/log/httpd/* # Create a tarball and compress with xz + +![Linux tar command examples](http://www.tecmint.com/wp-content/uploads/2015/03/tar-command-examples.png) + +tar command examples + +#### Example 6: Preserving original permissions and ownership while archiving and when #### + +If you are creating backups from users’ home directories, you will want to store the individual files with the original permissions and ownership instead of changing them to that of the user account or daemon performing the backup. The following example preserves these attributes while taking the backup of the contents in the `/var/log/httpd` directory: + + # tar cJf ApacheLogs-$(date +%Y%m%d).tar.xz /var/log/httpd/* --same-permissions --same-owner + +### Create Hard and Soft Links ### + +In Linux, there are two types of links to files: hard links and soft (aka symbolic) links. Since a hard link represents another name for an existing file and is identified by the same inode, it then points to the actual data, as opposed to symbolic links, which point to filenames instead. + +In addition, hard links do not occupy space on disk, while symbolic links do take a small amount of space to store the text of the link itself. The downside of hard links is that they can only be used to reference files within the filesystem where they are located because inodes are unique inside a filesystem. Symbolic links save the day, in that they point to another file or directory by name rather than by inode, and therefore can cross filesystem boundaries. + +The basic syntax to create links is similar in both cases: + + # ln TARGET LINK_NAME # Hard link named LINK_NAME to file named TARGET + # ln -s TARGET LINK_NAME # Soft link named LINK_NAME to file named TARGET + +#### Example 7: Creating hard and soft links #### + +There is no better way to visualize the relation between a file and a hard or symbolic link that point to it, than to create those links. In the following screenshot you will see that the file and the hard link that points to it share the same inode and both are identified by the same disk usage of 466 bytes. + +On the other hand, creating a hard link results in an extra disk usage of 5 bytes. Not that you’re going to run out of storage capacity, but this example is enough to illustrate the difference between a hard link and a soft link. + +![Difference between a hard link and a soft link](http://www.tecmint.com/wp-content/uploads/2015/03/hard-soft-link.png) + +Difference between a hard link and a soft link + +A typical usage of symbolic links is to reference a versioned file in a Linux system. Suppose there are several programs that need access to file fooX.Y, which is subject to frequent version updates (think of a library, for example). Instead of updating every single reference to fooX.Y every time there’s a version update, it is wiser, safer, and faster, to have programs look to a symbolic link named just foo, which in turn points to the actual fooX.Y. + +Thus, when X and Y change, you only need to edit the symbolic link foo with a new destination name instead of tracking every usage of the destination file and updating it. + +### Summary ### + +In this article we have reviewed some essential file and directory management skills that must be a part of every system administrator’s tool-set. Make sure to review other parts of this series as well in order to integrate these topics with the content covered in this tutorial. + +Feel free to let us know if you have any questions or comments. We are always more than glad to hear from our readers. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/file-and-directory-management-in-linux/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/8-pratical-examples-of-linux-touch-command/ +[2]:http://www.tecmint.com/13-basic-cat-command-examples-in-linux/ +[3]:http://www.tecmint.com/18-tar-command-examples-in-linux/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md b/sources/tech/RHCSA Series/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md new file mode 100644 index 0000000000..be78c87e3a --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md @@ -0,0 +1,248 @@ +RHCSA Series: How to Manage Users and Groups in RHEL 7 – Part 3 +================================================================================ +Managing a RHEL 7 server, as it is the case with any other Linux server, will require that you know how to add, edit, suspend, or delete user accounts, and grant users the necessary permissions to files, directories, and other system resources to perform their assigned tasks. + +![User and Group Management in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/User-and-Group-Management-in-Linux.png) + +RHCSA: User and Group Management – Part 3 + +### Managing User Accounts ### + +To add a new user account to a RHEL 7 server, you can run either of the following two commands as root: + + # adduser [new_account] + # useradd [new_account] + +When a new user account is added, by default the following operations are performed. + +- His/her home directory is created (`/home/username` unless specified otherwise). +- These `.bash_logout`, `.bash_profile` and `.bashrc` hidden files are copied inside the user’s home directory, and will be used to provide environment variables for his/her user session. You can explore each of them for further details. +- A mail spool directory is created for the added user account. +- A group is created with the same name as the new user account. + +The full account summary is stored in the `/etc/passwd `file. This file holds a record per system user account and has the following format (fields are separated by a colon): + + [username]:[x]:[UID]:[GID]:[Comment]:[Home directory]:[Default shell] + +- These two fields `[username]` and `[Comment]` are self explanatory. +- The second filed ‘x’ indicates that the account is secured by a shadowed password (in `/etc/shadow`), which is used to logon as `[username]`. +- The fields `[UID]` and `[GID]` are integers that shows the User IDentification and the primary Group IDentification to which `[username]` belongs, equally. + +Finally, + +- The `[Home directory]` shows the absolute location of `[username]’s` home directory, and +- `[Default shell]` is the shell that is commit to this user when he/she logins into the system. + +Another important file that you must become familiar with is `/etc/group`, where group information is stored. As it is the case with `/etc/passwd`, there is one record per line and its fields are also delimited by a colon: + + [Group name]:[Group password]:[GID]:[Group members] + +where, + +- `[Group name]` is the name of group. +- Does this group use a group password? (An “x” means no). +- `[GID]`: same as in `/etc/passwd`. +- `[Group members]`: a list of users, separated by commas, that are members of each group. + +After adding an account, at anytime, you can edit the user’s account information using usermod, whose basic syntax is: + + # usermod [options] [username] + +Read Also: + +- [15 ‘useradd’ Command Examples][1] +- [15 ‘usermod’ Command Examples][2] + +#### EXAMPLE 1: Setting the expiry date for an account #### + +If you work for a company that has some kind of policy to enable account for a certain interval of time, or if you want to grant access to a limited period of time, you can use the `--expiredate` flag followed by a date in YYYY-MM-DD format. To verify that the change has been applied, you can compare the output of + + # chage -l [username] + +before and after updating the account expiry date, as shown in the following image. + +![Change User Account Information](http://www.tecmint.com/wp-content/uploads/2015/03/Change-User-Account-Information.png) + +Change User Account Information + +#### EXAMPLE 2: Adding the user to supplementary groups #### + +Besides the primary group that is created when a new user account is added to the system, a user can be added to supplementary groups using the combined -aG, or –append –groups options, followed by a comma separated list of groups. + +#### EXAMPLE 3: Changing the default location of the user’s home directory and / or changing its shell #### + +If for some reason you need to change the default location of the user’s home directory (other than /home/username), you will need to use the -d, or –home options, followed by the absolute path to the new home directory. + +If a user wants to use another shell other than bash (for example, sh), which gets assigned by default, use usermod with the –shell flag, followed by the path to the new shell. + +#### EXAMPLE 4: Displaying the groups an user is a member of #### + +After adding the user to a supplementary group, you can verify that it now actually belongs to such group(s): + + # groups [username] + # id [username] + +The following image depicts Examples 2 through 4: + +![Adding User to Supplementary Group](http://www.tecmint.com/wp-content/uploads/2015/03/Adding-User-to-Supplementary-Group.png) + +Adding User to Supplementary Group + +In the example above: + + # usermod --append --groups gacanepa,users --home /tmp --shell /bin/sh tecmint + +To remove a user from a group, omit the `--append` switch in the command above and list the groups you want the user to belong to following the `--groups` flag. + +#### EXAMPLE 5: Disabling account by locking password #### + +To disable an account, you will need to use either the -l (lowercase L) or the –lock option to lock a user’s password. This will prevent the user from being able to log on. + +#### EXAMPLE 6: Unlocking password #### + +When you need to re-enable the user so that he can log on to the server again, use the -u or the –unlock option to unlock a user’s password that was previously blocked, as explained in Example 5 above. + + # usermod --unlock tecmint + +The following image illustrates Examples 5 and 6: + +![Lock Unlock User Account](http://www.tecmint.com/wp-content/uploads/2015/03/Lock-Unlock-User-Account.png) + +Lock Unlock User Account + +#### EXAMPLE 7: Deleting a group or an user account #### + +To delete a group, you’ll want to use groupdel, whereas to delete a user account you will use userdel (add the –r switch if you also want to delete the contents of its home directory and mail spool): + + # groupdel [group_name] # Delete a group + # userdel -r [user_name] # Remove user_name from the system, along with his/her home directory and mail spool + +If there are files owned by group_name, they will not be deleted, but the group owner will be set to the GID of the group that was deleted. + +### Listing, Setting and Changing Standard ugo/rwx Permissions ### + +The well-known [ls command][3] is one of the best friends of any system administrator. When used with the -l flag, this tool allows you to view a list a directory’s contents in long (or detailed) format. + +However, this command can also be applied to a single file. Either way, the first 10 characters in the output of `ls -l` represent each file’s attributes. + +The first char of this 10-character sequence is used to indicate the file type: + +- – (hyphen): a regular file +- d: a directory +- l: a symbolic link +- c: a character device (which treats data as a stream of bytes, i.e. a terminal) +- b: a block device (which handles data in blocks, i.e. storage devices) + +The next nine characters of the file attributes, divided in groups of three from left to right, are called the file mode and indicate the read (r), write(w), and execute (x) permissions granted to the file’s owner, the file’s group owner, and the rest of the users (commonly referred to as “the world”), respectively. + +While the read permission on a file allows the same to be opened and read, the same permission on a directory allows its contents to be listed if the execute permission is also set. In addition, the execute permission in a file allows it to be handled as a program and run. + +File permissions are changed with the chmod command, whose basic syntax is as follows: + + # chmod [new_mode] file + +where new_mode is either an octal number or an expression that specifies the new permissions. Feel free to use the mode that works best for you in each case. Or perhaps you already have a preferred way to set a file’s permissions – so feel free to use the method that works best for you. + +The octal number can be calculated based on the binary equivalent, which can in turn be obtained from the desired file permissions for the owner of the file, the owner group, and the world.The presence of a certain permission equals a power of 2 (r=22, w=21, x=20), while its absence means 0. For example: + +![File Permissions](http://www.tecmint.com/wp-content/uploads/2015/03/File-Permissions.png) + +File Permissions + +To set the file’s permissions as indicated above in octal form, type: + + # chmod 744 myfile + +Please take a minute to compare our previous calculation to the actual output of `ls -l` after changing the file’s permissions: + +![Long List Format](http://www.tecmint.com/wp-content/uploads/2015/03/Long-List-Format.png) + +Long List Format + +#### EXAMPLE 8: Searching for files with 777 permissions #### + +As a security measure, you should make sure that files with 777 permissions (read, write, and execute for everyone) are avoided like the plague under normal circumstances. Although we will explain in a later tutorial how to more effectively locate all the files in your system with a certain permission set, you can -by now- combine ls with grep to obtain such information. + +In the following example, we will look for file with 777 permissions in the /etc directory only. Note that we will use pipelining as explained in [Part 2: File and Directory Management][4] of this RHCSA series: + + # ls -l /etc | grep rwxrwxrwx + +![Find All Files with 777 Permission](http://www.tecmint.com/wp-content/uploads/2015/03/Find-All-777-Files.png) + +Find All Files with 777 Permission + +#### EXAMPLE 9: Assigning a specific permission to all users #### + +Shell scripts, along with some binaries that all users should have access to (not just their corresponding owner and group), should have the execute bit set accordingly (please note that we will discuss a special case later): + + # chmod a+x script.sh + +**Note**: That we can also set a file’s mode using an expression that indicates the owner’s rights with the letter `u`, the group owner’s rights with the letter `g`, and the rest with `o`. All of these rights can be represented at the same time with the letter `a`. Permissions are granted (or revoked) with the `+` or `-` signs, respectively. + +![Set Execute Permission on File](http://www.tecmint.com/wp-content/uploads/2015/03/Set-Execute-Permission-on-File.png) + +Set Execute Permission on File + +A long directory listing also shows the file’s owner and its group owner in the first and second columns, respectively. This feature serves as a first-level access control method to files in a system: + +![Check File Owner and Group](http://www.tecmint.com/wp-content/uploads/2015/03/Check-File-Owner-and-Group.png) + +Check File Owner and Group + +To change file ownership, you will use the chown command. Note that you can change the file and group ownership at the same time or separately: + + # chown user:group file + +**Note**: That you can change the user or group, or the two attributes at the same time, as long as you don’t forget the colon, leaving user or group blank if you want to update the other attribute, for example: + + # chown :group file # Change group ownership only + # chown user: file # Change user ownership only + +#### EXAMPLE 10: Cloning permissions from one file to another #### + +If you would like to “clone” ownership from one file to another, you can do so using the –reference flag, as follows: + + # chown --reference=ref_file file + +where the owner and group of ref_file will be assigned to file as well: + +![Clone File Ownership](http://www.tecmint.com/wp-content/uploads/2015/03/Clone-File-Ownership.png) + +Clone File Ownership + +### Setting Up SETGID Directories for Collaboration ### + +Should you need to grant access to all the files owned by a certain group inside a specific directory, you will most likely use the approach of setting the setgid bit for such directory. When the setgid bit is set, the effective GID of the real user becomes that of the group owner. + +Thus, any user can access a file under the privileges granted to the group owner of such file. In addition, when the setgid bit is set on a directory, newly created files inherit the same group as the directory, and newly created subdirectories will also inherit the setgid bit of the parent directory. + + # chmod g+s [filename] + +To set the setgid in octal form, prepend the number 2 to the current (or desired) basic permissions. + + # chmod 2755 [directory] + +### Conclusion ### + +A solid knowledge of user and group management, along with standard and special Linux permissions, when coupled with practice, will allow you to quickly identify and troubleshoot issues with file permissions in your RHEL 7 server. + +I assure you that as you follow the steps outlined in this article and use the system documentation (as explained in [Part 1: Reviewing Essential Commands & System Documentation][5] of this series) you will master this essential competence of system administration. + +Feel free to let us know if you have any questions or comments using the form below. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-manage-users-and-groups/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/add-users-in-linux/ +[2]:http://www.tecmint.com/usermod-command-examples/ +[3]:http://www.tecmint.com/ls-interview-questions/ +[4]:http://www.tecmint.com/file-and-directory-management-in-linux/ +[5]:http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md b/sources/tech/RHCSA Series/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md new file mode 100644 index 0000000000..1529fecf2e --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md @@ -0,0 +1,254 @@ +RHCSA Series: Editing Text Files with Nano and Vim / Analyzing text with grep and regexps – Part 4 +================================================================================ +Every system administrator has to deal with text files as part of his daily responsibilities. That includes editing existing files (most likely configuration files), or creating new ones. It has been said that if you want to start a holy war in the Linux world, you can ask sysadmins what their favorite text editor is and why. We are not going to do that in this article, but will present a few tips that will be helpful to use two of the most widely used text editors in RHEL 7: nano (due to its simplicity and easiness of use, specially to new users), and vi/m (due to its several features that convert it into more than a simple editor). I am sure that you can find many more reasons to use one or the other, or perhaps some other editor such as emacs or pico. It’s entirely up to you. + +![Learn Nano and vi Editors](http://www.tecmint.com/wp-content/uploads/2015/03/Learn-Nano-and-vi-Editors.png) + +RHCSA: Editing Text Files with Nano and Vim – Part 4 + +### Editing Files with Nano Editor ### + +To launch nano, you can either just type nano at the command prompt, optionally followed by a filename (in this case, if the file exists, it will be opened in edition mode). If the file does not exist, or if we omit the filename, nano will also be opened in edition mode but will present a blank screen for us to start typing: + +![Nano Editor](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Editor.png) + +Nano Editor + +As you can see in the previous image, nano displays at the bottom of the screen several functions that are available via the indicated shortcuts (^, aka caret, indicates the Ctrl key). To name a few of them: + +- Ctrl + G: brings up the help menu with a complete list of functions and descriptions:Ctrl + X: exits the current file. If changes have not been saved, they are discarded. +- Ctrl + R: lets you choose a file to insert its contents into the present file by specifying a full path. + +![Nano Editor Help Menu](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Help.png) + +Nano Editor Help Menu + +- Ctrl + O: saves changes made to a file. It will let you save the file with the same name or a different one. Then press Enter to confirm. + +![Nano Editor Save Changes Mode](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Save-Changes.png) + +Nano Editor Save Changes Mode + +- Ctrl + X: exits the current file. If changes have not been saved, they are discarded. +- Ctrl + R: lets you choose a file to insert its contents into the present file by specifying a full path. + +![Nano: Insert File Content to Parent File](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-File-Content.png) + +Nano: Insert File Content to Parent File + +will insert the contents of /etc/passwd into the current file. + +- Ctrl + K: cuts the current line. +- Ctrl + U: paste. +- Ctrl + C: cancels the current operation and places you at the previous screen. + +To easily navigate the opened file, nano provides the following features: + +- Ctrl + F and Ctrl + B move the cursor forward or backward, whereas Ctrl + P and Ctrl + N move it up or down one line at a time, respectively, just like the arrow keys. +- Ctrl + space and Alt + space move the cursor forward and backward one word at a time. + +Finally, + +- Ctrl + _ (underscore) and then entering X,Y will take you precisely to Line X, column Y, if you want to place the cursor at a specific place in the document. + +![Navigate to Line Numbers in Nano](http://www.tecmint.com/wp-content/uploads/2015/03/Column-Numbers.png) + +Navigate to Line Numbers in Nano + +The example above will take you to line 15, column 14 in the current document. + +If you can recall your early Linux days, specially if you came from Windows, you will probably agree that starting off with nano is the best way to go for a new user. + +### Editing Files with Vim Editor ### + +Vim is an improved version of vi, a famous text editor in Linux that is available on all POSIX-compliant *nix systems, such as RHEL 7. If you have the chance and can install vim, go ahead; if not, most (if not all) the tips given in this article should also work. + +One of vim’s distinguishing features is the different modes in which it operates: + + +- Command mode will allow you to browse through the file and enter commands, which are brief and case-sensitive combinations of one or more letters. If you need to repeat one of them a certain number of times, you can prefix it with a number (there are only a few exceptions to this rule). For example, yy (or Y, short for yank) copies the entire current line, whereas 4yy (or 4Y) copies the entire current line along with the next three lines (4 lines in total). +- In ex mode, you can manipulate files (including saving a current file and running outside programs or commands). To enter ex mode, we must type a colon (:) starting from command mode (or in other words, Esc + :), directly followed by the name of the ex-mode command that you want to use. +- In insert mode, which is accessed by typing the letter i, we simply enter text. Most keystrokes result in text appearing on the screen. +- We can always enter command mode (regardless of the mode we’re working on) by pressing the Esc key. + +Let’s see how we can perform the same operations that we outlined for nano in the previous section, but now with vim. Don’t forget to hit the Enter key to confirm the vim command! + +To access vim’s full manual from the command line, type :help while in command mode and then press Enter: + +![vim Edito Help Menu](http://www.tecmint.com/wp-content/uploads/2015/03/vim-Help-Menu.png) + +vim Edito Help Menu + +The upper section presents an index list of contents, with defined sections dedicated to specific topics about vim. To navigate to a section, place the cursor over it and press Ctrl + ] (closing square bracket). Note that the bottom section displays the current file. + +1. To save changes made to a file, run any of the following commands from command mode and it will do the trick: + + :wq! + :x! + ZZ (yes, double Z without the colon at the beginning) + +2. To exit discarding changes, use :q!. This command will also allow you to exit the help menu described above, and return to the current file in command mode. + +3. Cut N number of lines: type Ndd while in command mode. + +4. Copy M number of lines: type Myy while in command mode. + +5. Paste lines that were previously cutted or copied: press the P key while in command mode. + +6. To insert the contents of another file into the current one: + + :r filename + +For example, to insert the contents of `/etc/fstab`, do: + +![Insert Content of File in vi Editor](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-Content-vi-Editor.png) + +Insert Content of File in vi Editor + +7. To insert the output of a command into the current document: + + :r! command + +For example, to insert the date and time in the line below the current position of the cursor: + +![Insert Time an Date in vi Editor](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-Time-and-Date-in-vi-Editor.png) + +Insert Time an Date in vi Editor + +In another article that I wrote for, ([Part 2 of the LFCS series][1]), I explained in greater detail the keyboard shortcuts and functions available in vim. You may want to refer to that tutorial for further examples on how to use this powerful text editor. + +### Analyzing Text with Grep and Regular Expressions ### + +By now you have learned how to create and edit files using nano or vim. Say you become a text editor ninja, so to speak – now what? Among other things, you will also need how to search for regular expressions inside text. + +A regular expression (also known as “regex” or “regexp“) is a way of identifying a text string or pattern so that a program can compare the pattern against arbitrary text strings. Although the use of regular expressions along with grep would deserve an entire article on its own, let us review the basics here: + +**1. The simplest regular expression is an alphanumeric string (i.e., the word “svm”) or two (when two are present, you can use the | (OR) operator):** + + # grep -Ei 'svm|vmx' /proc/cpuinfo + +The presence of either of those two strings indicate that your processor supports virtualization: + +![Regular Expression Example](http://www.tecmint.com/wp-content/uploads/2015/03/Regular-Expression-Example.png) + +Regular Expression Example + +**2. A second kind of a regular expression is a range list, enclosed between square brackets.** + +For example, `c[aeiou]t` matches the strings cat, cet, cit, cot, and cut, whereas `[a-z]` and `[0-9]` match any lowercase letter or decimal digit, respectively. If you want to repeat the regular expression X certain number of times, type `{X}` immediately following the regexp. + +For example, let’s extract the UUIDs of storage devices from `/etc/fstab`: + + # grep -Ei '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' -o /etc/fstab + +![Extract String from a File in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/Extract-String-from-a-File.png) + +Extract String from a File + +The first expression in brackets `[0-9a-f]` is used to denote lowercase hexadecimal characters, and `{8}` is a quantifier that indicates the number of times that the preceding match should be repeated (the first sequence of characters in an UUID is a 8-character long hexadecimal string). + +The parentheses, the `{4}` quantifier, and the hyphen indicate that the next sequence is a 4-character long hexadecimal string, and the quantifier that follows `({3})` denote that the expression should be repeated 3 times. + +Finally, the last sequence of 12-character long hexadecimal string in the UUID is retrieved with `[0-9a-f]{12}`, and the -o option prints only the matched (non-empty) parts of the matching line in /etc/fstab. + +**3. POSIX character classes.** + +注:表格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Character ClassMatches…
 [[:alnum:]] Any alphanumeric [a-zA-Z0-9] character
 [[:alpha:]] Any alphabetic [a-zA-Z] character
 [[:blank:]] Spaces or tabs
 [[:cntrl:]] Any control characters (ASCII 0 to 32)
 [[:digit:]] Any numeric digits [0-9]
 [[:graph:]] Any visible characters
 [[:lower:]] Any lowercase [a-z] character
 [[:print:]] Any non-control characters
 [[:space:]] Any whitespace
 [[:punct:]] Any punctuation marks
 [[:upper:]] Any uppercase [A-Z] character
 [[:xdigit:]] Any hex digits [0-9a-fA-F]
 [:word:] Any letters, numbers, and underscores [a-zA-Z0-9_]
+ +For example, we may be interested in finding out what the used UIDs and GIDs (refer to [Part 2][2] of this series to refresh your memory) are for real users that have been added to our system. Thus, we will search for sequences of 4 digits in /etc/passwd: + + # grep -Ei [[:digit:]]{4} /etc/passwd + +![Search For a String in File](http://www.tecmint.com/wp-content/uploads/2015/03/Search-For-String-in-File.png) + +Search For a String in File + +The above example may not be the best case of use of regular expressions in the real world, but it clearly illustrates how to use POSIX character classes to analyze text along with grep. + +### Conclusion ### + +In this article we have provided some tips to make the most of nano and vim, two text editors for the command-line users. Both tools are supported by extensive documentation, which you can consult in their respective official web sites (links given below) and using the suggestions given in [Part 1][3] of this series. + +#### Reference Links #### + +- [http://www.nano-editor.org/][4] +- [http://www.vim.org/][5] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-how-to-use-nano-vi-editors/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/vi-editor-usage/ +[2]:http://www.tecmint.com/file-and-directory-management-in-linux/ +[3]:http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ +[4]:http://www.nano-editor.org/ +[5]:http://www.vim.org/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md b/sources/tech/RHCSA Series/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md new file mode 100644 index 0000000000..2befb7bc55 --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md @@ -0,0 +1,216 @@ +RHCSA Series: Process Management in RHEL 7: Boot, Shutdown, and Everything in Between – Part 5 +================================================================================ +We will start this article with an overall and brief revision of what happens since the moment you press the Power button to turn on your RHEL 7 server until you are presented with the login screen in a command line interface. + +![RHEL 7 Boot Process](http://www.tecmint.com/wp-content/uploads/2015/03/RHEL-7-Boot-Process.png) + +Linux Boot Process + +**Please note that:** + +1. the same basic principles apply, with perhaps minor modifications, to other Linux distributions as well, and +2. the following description is not intended to represent an exhaustive explanation of the boot process, but only the fundamentals. + +### Linux Boot Process ### + +1. The POST (Power On Self Test) initializes and performs hardware checks. + +2. When the POST finishes, the system control is passed to the first stage boot loader, which is stored on either the boot sector of one of the hard disks (for older systems using BIOS and MBR), or a dedicated (U)EFI partition. + +3. The first stage boot loader then loads the second stage boot loader, most usually GRUB (GRand Unified Boot Loader), which resides inside /boot, which in turn loads the kernel and the initial RAM–based file system (also known as initramfs, which contains programs and binary files that perform the necessary actions needed to ultimately mount the actual root filesystem). + +4. We are presented with a splash screen that allows us to choose an operating system and kernel to boot: + +![RHEL 7 Boot Screen](http://www.tecmint.com/wp-content/uploads/2015/03/RHEL-7-Boot-Screen.png) + +Boot Menu Screen + +5. The kernel sets up the hardware attached to the system and once the root filesystem has been mounted, launches process with PID 1, which in turn will initialize other processes and present us with a login prompt. + +Note: That if we wish to do so at a later time, we can examine the specifics of this process using the [dmesg command][1] and filtering its output using the tools that we have explained in previous articles of this series. + +![Login Screen and Process PID](http://www.tecmint.com/wp-content/uploads/2015/03/Login-Screen-Process-PID.png) + +Login Screen and Process PID + +In the example above, we used the well-known ps command to display a list of current processes whose parent process (or in other words, the process that started them) is systemd (the system and service manager that most modern Linux distributions have switched to) during system startup: + + # ps -o ppid,pid,uname,comm --ppid=1 + +Remember that the -o flag (short for –format) allows you to present the output of ps in a customized format to suit your needs using the keywords specified in the STANDARD FORMAT SPECIFIERS section in man ps. + +Another case in which you will want to define the output of ps instead of going with the default is when you need to find processes that are causing a significant CPU and / or memory load, and sort them accordingly: + + # ps aux --sort=+pcpu # Sort by %CPU (ascending) + # ps aux --sort=-pcpu # Sort by %CPU (descending) + # ps aux --sort=+pmem # Sort by %MEM (ascending) + # ps aux --sort=-pmem # Sort by %MEM (descending) + # ps aux --sort=+pcpu,-pmem # Combine sort by %CPU (ascending) and %MEM (descending) + +![http://www.tecmint.com/wp-content/uploads/2015/03/ps-command-output.png](http://www.tecmint.com/wp-content/uploads/2015/03/ps-command-output.png) + +Customize ps Command Output + +### An Introduction to SystemD ### + +Few decisions in the Linux world have caused more controversies than the adoption of systemd by major Linux distributions. Systemd’s advocates name as its main advantages the following facts: + +Read Also: [The Story Behind ‘init’ and ‘systemd’][2] + +1. Systemd allows more processing to be done in parallel during system startup (as opposed to older SysVinit, which always tends to be slower because it starts processes one by one, checks if one depends on another, and then waits for daemons to launch so more services can start), and + +2. It works as a dynamic resource management in a running system. Thus, services are started when needed (to avoid consuming system resources if they are not being used) instead of being launched without a valid reason during boot. + +3. Backwards compatibility with SysVinit scripts. + +Systemd is controlled by the systemctl utility. If you come from a SysVinit background, chances are you will be familiar with: + +- the service tool, which -in those older systems- was used to manage SysVinit scripts, and +- the chkconfig utility, which served the purpose of updating and querying runlevel information for system services. +- shutdown, which you must have used several times to either restart or halt a running system. + +The following table shows the similarities between the use of these legacy tools and systemctl: + +注:表格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Legacy toolSystemctl equivalentDescription
service name startsystemctl start nameStart name (where name is a service)
service name stopsystemctl stop nameStop name
service name condrestartsystemctl try-restart nameRestarts name (if it’s already running)
service name restartsystemctl restart nameRestarts name
service name reloadsystemctl reload nameReloads the configuration for name
service name statussystemctl status nameDisplays the current status of name
service –status-allsystemctlDisplays the status of all current services
chkconfig name onsystemctl enable nameEnable name to run on startup as specified in the unit file (the file to which the symlink points). The process of enabling or disabling a service to start automatically on boot consists in adding or removing symbolic links inside the /etc/systemd/system directory.
chkconfig name offsystemctl disable nameDisables name to run on startup as specified in the unit file (the file to which the symlink points)
chkconfig –list namesystemctl is-enabled nameVerify whether name (a specific service) is currently enabled
chkconfig –listsystemctl –type=serviceDisplays all services and tells whether they are enabled or disabled
shutdown -h nowsystemctl poweroffPower-off the machine (halt)
shutdown -r nowsystemctl rebootReboot the system
+ +Systemd also introduced the concepts of units (which can be either a service, a mount point, a device, or a network socket) and targets (which is how systemd manages to start several related process at the same time, and can be considered -though not equal- as the equivalent of runlevels in SysVinit-based systems. + +### Summing Up ### + +Other tasks related with process management include, but may not be limited to, the ability to: + +**1. Adjust the execution priority as far as the use of system resources is concerned of a process:** + +This is accomplished through the renice utility, which alters the scheduling priority of one or more running processes. In simple terms, the scheduling priority is a feature that allows the kernel (present in versions => 2.6) to allocate system resources as per the assigned execution priority (aka niceness, in a range from -20 through 19) of a given process. + +The basic syntax of renice is as follows: + + # renice [-n] priority [-gpu] identifier + +In the generic command above, the first argument is the priority value to be used, whereas the other argument can be interpreted as process IDs (which is the default setting), process group IDs, user IDs, or user names. A normal user (other than root) can only modify the scheduling priority of a process he or she owns, and only increase the niceness level (which means taking up less system resources). + +![Renice Process in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/Process-Scheduling-Priority.png) + +Process Scheduling Priority + +**2. Kill (or interrupt the normal execution) of a process as needed:** + +In more precise terms, killing a process entitles sending it a signal to either finish its execution gracefully (SIGTERM=15) or immediately (SIGKILL=9) through the [kill or pkill commands][3]. + +The difference between these two tools is that the former is used to terminate a specific process or a process group altogether, while the latter allows you to do the same based on name and other attributes. + +In addition, pkill comes bundled with pgrep, which shows you the PIDs that will be affected should pkill be used. For example, before running: + + # pkill -u gacanepa + +It may be useful to view at a glance which are the PIDs owned by gacanepa: + + # pgrep -l -u gacanepa + +![Find PIDs of User](http://www.tecmint.com/wp-content/uploads/2015/03/Find-PIDs-of-User.png) + +Find PIDs of User + +By default, both kill and pkill send the SIGTERM signal to the process. As we mentioned above, this signal can be ignored (while the process finishes its execution or for good), so when you seriously need to stop a running process with a valid reason, you will need to specify the SIGKILL signal on the command line: + + # kill -9 identifier # Kill a process or a process group + # kill -s SIGNAL identifier # Idem + # pkill -s SIGNAL identifier # Kill a process by name or other attributes + +### Conclusion ### + +In this article we have explained the basics of the boot process in a RHEL 7 system, and analyzed some of the tools that are available to help you with managing processes using common utilities and systemd-specific commands. + +Note that this list is not intended to cover all the bells and whistles of this topic, so feel free to add your own preferred tools and commands to this article using the comment form below. Questions and other comments are also welcome. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-boot-process-and-process-management/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/dmesg-commands/ +[2]:http://www.tecmint.com/systemd-replaces-init-in-linux/ +[3]:http://www.tecmint.com/how-to-kill-a-process-in-linux/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md b/sources/tech/RHCSA Series/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md new file mode 100644 index 0000000000..474b707d23 --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md @@ -0,0 +1,269 @@ +RHCSA Series: Using ‘Parted’ and ‘SSM’ to Configure and Encrypt System Storage – Part 6 +================================================================================ +In this article we will discuss how to set up and configure local system storage in Red Hat Enterprise Linux 7 using classic tools and introducing the System Storage Manager (also known as SSM), which greatly simplifies this task. + +![Configure and Encrypt System Storage](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-and-Encrypt-System-Storage.png) + +RHCSA: Configure and Encrypt System Storage – Part 6 + +Please note that we will present this topic in this article but will continue its description and usage on the next one (Part 7) due to vastness of the subject. + +### Creating and Modifying Partitions in RHEL 7 ### + +In RHEL 7, parted is the default utility to work with partitions, and will allow you to: + +- Display the current partition table +- Manipulate (increase or decrease the size of) existing partitions +- Create partitions using free space or additional physical storage devices + +It is recommended that before attempting the creation of a new partition or the modification of an existing one, you should ensure that none of the partitions on the device are in use (`umount /dev/partition`), and if you’re using part of the device as swap you need to disable it (`swapoff -v /dev/partition`) during the process. + +The easiest way to do this is to boot RHEL in rescue mode using an installation media such as a RHEL 7 installation DVD or USB (Troubleshooting → Rescue a Red Hat Enterprise Linux system) and Select Skip when you’re prompted to choose an option to mount the existing Linux installation, and you will be presented with a command prompt where you can start typing the same commands as shown as follows during the creation of an ordinary partition in a physical device that is not being used. + +![RHEL 7 Rescue Mode](http://www.tecmint.com/wp-content/uploads/2015/04/RHEL-7-Rescue-Mode.png) + +RHEL 7 Rescue Mode + +To start parted, simply type. + + # parted /dev/sdb + +Where `/dev/sdb` is the device where you will create the new partition; next, type print to display the current drive’s partition table: + +![Creat New Partition](http://www.tecmint.com/wp-content/uploads/2015/04/Create-New-Partition.png) + +Creat New Partition + +As you can see, in this example we are using a virtual drive of 5 GB. We will now proceed to create a 4 GB primary partition and then format it with the xfs filesystem, which is the default in RHEL 7. + +You can choose from a variety of file systems. You will need to manually create the partition with mkpart and then format it with mkfs.fstype as usual because mkpart does not support many modern filesystems out-of-the-box. + +In the following example we will set a label for the device and then create a primary partition `(p)` on `/dev/sdb`, which starts at the 0% percentage of the device and ends at 4000 MB (4 GB): + +![Set Partition Name in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Label-Partition.png) + +Label Partition Name + +Next, we will format the partition as xfs and print the partition table again to verify that changes were applied: + + # mkfs.xfs /dev/sdb1 + # parted /dev/sdb print + +![Format Partition in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Format-Partition-in-Linux.png) + +Format Partition as XFS Filesystem + +For older filesystems, you could use the resize command in parted to resize a partition. Unfortunately, this only applies to ext2, fat16, fat32, hfs, linux-swap, and reiserfs (if libreiserfs is installed). + +Thus, the only way to resize a partition is by deleting it and creating it again (so make sure you have a good backup of your data!). No wonder the default partitioning scheme in RHEL 7 is based on LVM. + +To remove a partition with parted: + + # parted /dev/sdb print + # parted /dev/sdb rm 1 + +![Remove Partition in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Remove-Partition-in-Linux.png) + +Remove or Delete Partition + +### The Logical Volume Manager (LVM) ### + +Once a disk has been partitioned, it can be difficult or risky to change the partition sizes. For that reason, if we plan on resizing the partitions on our system, we should consider the possibility of using LVM instead of the classic partitioning system, where several physical devices can form a volume group that will host a defined number of logical volumes, which can be expanded or reduced without any hassle. + +In simple terms, you may find the following diagram useful to remember the basic architecture of LVM. + +![Basic Architecture of LVM](http://www.tecmint.com/wp-content/uploads/2015/04/LVM-Diagram.png) + +Basic Architecture of LVM + +#### Creating Physical Volumes, Volume Group and Logical Volumes #### + +Follow these steps in order to set up LVM using classic volume management tools. Since you can expand this topic reading the [LVM series on this site][1], I will only outline the basic steps to set up LVM, and then compare them to implementing the same functionality with SSM. + +**Note**: That we will use the whole disks `/dev/sdb` and `/dev/sdc` as PVs (Physical Volumes) but it’s entirely up to you if you want to do the same. + +**1. Create partitions `/dev/sdb1` and `/dev/sdc1` using 100% of the available disk space in /dev/sdb and /dev/sdc:** + + # parted /dev/sdb print + # parted /dev/sdc print + +![Create New Partitions](http://www.tecmint.com/wp-content/uploads/2015/04/Create-New-Partitions.png) + +Create New Partitions + +**2. Create 2 physical volumes on top of /dev/sdb1 and /dev/sdc1, respectively.** + + # pvcreate /dev/sdb1 + # pvcreate /dev/sdc1 + +![Create Two Physical Volumes](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Physical-Volumes.png) + +Create Two Physical Volumes + +Remember that you can use pvdisplay /dev/sd{b,c}1 to show information about the newly created PVs. + +**3. Create a VG on top of the PV that you created in the previous step:** + + # vgcreate tecmint_vg /dev/sd{b,c}1 + +![Create Volume Group in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Volume-Group.png) + +Create Volume Group + +Remember that you can use vgdisplay tecmint_vg to show information about the newly created VG. + +**4. Create three logical volumes on top of VG tecmint_vg, as follows:** + + # lvcreate -L 3G -n vol01_docs tecmint_vg [vol01_docs → 3 GB] + # lvcreate -L 1G -n vol02_logs tecmint_vg [vol02_logs → 1 GB] + # lvcreate -l 100%FREE -n vol03_homes tecmint_vg [vol03_homes → 6 GB] + +![Create Logical Volumes in LVM](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Logical-Volumes.png) + +Create Logical Volumes + +Remember that you can use lvdisplay tecmint_vg to show information about the newly created LVs on top of VG tecmint_vg. + +**5. Format each of the logical volumes with xfs (do NOT use xfs if you’re planning on shrinking volumes later!):** + + # mkfs.xfs /dev/tecmint_vg/vol01_docs + # mkfs.xfs /dev/tecmint_vg/vol02_logs + # mkfs.xfs /dev/tecmint_vg/vol03_homes + +**6. Finally, mount them:** + + # mount /dev/tecmint_vg/vol01_docs /mnt/docs + # mount /dev/tecmint_vg/vol02_logs /mnt/logs + # mount /dev/tecmint_vg/vol03_homes /mnt/homes + +#### Removing Logical Volumes, Volume Group and Physical Volumes #### + +**7. Now we will reverse the LVM implementation and remove the LVs, the VG, and the PVs:** + + # lvremove /dev/tecmint_vg/vol01_docs + # lvremove /dev/tecmint_vg/vol02_logs + # lvremove /dev/tecmint_vg/vol03_homes + # vgremove /dev/tecmint_vg + # pvremove /dev/sd{b,c}1 + +**8. Now let’s install SSM and we will see how to perform the above in ONLY 1 STEP!** + + # yum update && yum install system-storage-manager + +We will use the same names and sizes as before: + + # ssm create -s 3G -n vol01_docs -p tecmint_vg --fstype ext4 /mnt/docs /dev/sd{b,c}1 + # ssm create -s 1G -n vol02_logs -p tecmint_vg --fstype ext4 /mnt/logs /dev/sd{b,c}1 + # ssm create -n vol03_homes -p tecmint_vg --fstype ext4 /mnt/homes /dev/sd{b,c}1 + +Yes! SSM will let you: + +- initialize block devices as physical volumes +- create a volume group +- create logical volumes +- format LVs, and +- mount them using only one command + +**9. We can now display the information about PVs, VGs, or LVs, respectively, as follows:** + + # ssm list dev + # ssm list pool + # ssm list vol + +![Check Information of PVs, VGs, or LVs](http://www.tecmint.com/wp-content/uploads/2015/04/Display-LVM-Information.png) + +Check Information of PVs, VGs, or LVs + +**10. As we already know, one of the distinguishing features of LVM is the possibility to resize (expand or decrease) logical volumes without downtime.** + +Say we are running out of space in vol02_logs but have plenty of space in vol03_homes. We will resize vol03_homes to 4 GB and expand vol02_logs to use the remaining space: + + # ssm resize -s 4G /dev/tecmint_vg/vol03_homes + +Run ssm list pool again and take note of the free space in tecmint_vg: + +![Check Volume Size](http://www.tecmint.com/wp-content/uploads/2015/04/Check-LVM-Free-Space.png) + +Check Volume Size + +Then do: + + # ssm resize -s+1.99 /dev/tecmint_vg/vol02_logs + +**Note**: that the plus sign after the -s flag indicates that the specified value should be added to the present value. + +**11. Removing logical volumes and volume groups is much easier with ssm as well. A simple,** + + # ssm remove tecmint_vg + +will return a prompt asking you to confirm the deletion of the VG and the LVs it contains: + +![Remove Logical Volume and Volume Group](http://www.tecmint.com/wp-content/uploads/2015/04/Remove-LV-VG.png) + +Remove Logical Volume and Volume Group + +### Managing Encrypted Volumes ### + +SSM also provides system administrators with the capability of managing encryption for new or existing volumes. You will need the cryptsetup package installed first: + + # yum update && yum install cryptsetup + +Then issue the following command to create an encrypted volume. You will be prompted to enter a passphrase to maximize security: + + # ssm create -s 3G -n vol01_docs -p tecmint_vg --fstype ext4 --encrypt luks /mnt/docs /dev/sd{b,c}1 + # ssm create -s 1G -n vol02_logs -p tecmint_vg --fstype ext4 --encrypt luks /mnt/logs /dev/sd{b,c}1 + # ssm create -n vol03_homes -p tecmint_vg --fstype ext4 --encrypt luks /mnt/homes /dev/sd{b,c}1 + +Our next task consists in adding the corresponding entries in /etc/fstab in order for those logical volumes to be available on boot. Rather than using the device identifier (/dev/something). + +We will use each LV’s UUID (so that our devices will still be uniquely identified should we add other logical volumes or devices), which we can find out with the blkid utility: + + # blkid -o value UUID /dev/tecmint_vg/vol01_docs + # blkid -o value UUID /dev/tecmint_vg/vol02_logs + # blkid -o value UUID /dev/tecmint_vg/vol03_homes + +In our case: + +![Find Logical Volume UUID](http://www.tecmint.com/wp-content/uploads/2015/04/Logical-Volume-UUID.png) + +Find Logical Volume UUID + +Next, create the /etc/crypttab file with the following contents (change the UUIDs for the ones that apply to your setup): + + docs UUID=ba77d113-f849-4ddf-8048-13860399fca8 none + logs UUID=58f89c5a-f694-4443-83d6-2e83878e30e4 none + homes UUID=92245af6-3f38-4e07-8dd8-787f4690d7ac none + +And insert the following entries in /etc/fstab. Note that device_name (/dev/mapper/device_name) is the mapper identifier that appears in the first column of /etc/crypttab. + + # Logical volume vol01_docs: + /dev/mapper/docs /mnt/docs ext4 defaults 0 2 + # Logical volume vol02_logs + /dev/mapper/logs /mnt/logs ext4 defaults 0 2 + # Logical volume vol03_homes + /dev/mapper/homes /mnt/homes ext4 defaults 0 2 + +Now reboot (systemctl reboot) and you will be prompted to enter the passphrase for each LV. Afterwards you can confirm that the mount operation was successful by checking the corresponding mount points: + +![Verify Logical Volume Mount Points](http://www.tecmint.com/wp-content/uploads/2015/04/Verify-LV-Mount-Points.png) + +Verify Logical Volume Mount Points + +### Conclusion ### + +In this tutorial we have started to explore how to set up and configure system storage using classic volume management tools and SSM, which also integrates filesystem and encryption capabilities in one package. This makes SSM an invaluable tool for any sysadmin. + +Let us know if you have any questions or comments – feel free to use the form below to get in touch with us! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-create-format-resize-delete-and-encrypt-partitions-in-linux/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/create-lvm-storage-in-linux/ \ No newline at end of file From b2f12c57e60872a6fffbce963039d81e4d9acaf3 Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 8 Jun 2015 20:32:51 +0800 Subject: [PATCH 010/153] PUB:20150604 Ubuntu's Juju Now Supports systemd and Google Cloud Platform @geekpi --- ...Now Supports systemd and Google Cloud Platform.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename {translated/news => published}/20150604 Ubuntu's Juju Now Supports systemd and Google Cloud Platform.md (63%) diff --git a/translated/news/20150604 Ubuntu's Juju Now Supports systemd and Google Cloud Platform.md b/published/20150604 Ubuntu's Juju Now Supports systemd and Google Cloud Platform.md similarity index 63% rename from translated/news/20150604 Ubuntu's Juju Now Supports systemd and Google Cloud Platform.md rename to published/20150604 Ubuntu's Juju Now Supports systemd and Google Cloud Platform.md index 4ff1fa23a0..952b673c41 100644 --- a/translated/news/20150604 Ubuntu's Juju Now Supports systemd and Google Cloud Platform.md +++ b/published/20150604 Ubuntu's Juju Now Supports systemd and Google Cloud Platform.md @@ -2,15 +2,15 @@ Ubuntu下的Juju现在支持systemd和Google Cloud Platform了 ================================================================================ > Juju已经更新到1.23.3了 -**Cononical旗下的Ubuntu认证公共云总监,Udi Nachmany宣布了juju新版本的发布,一个开源的、解决方案驱动的Ubuntu下的协同工具。** +**Cononical旗下的Ubuntu认证公共云总监Udi Nachmany宣布了juju新版本的发布,一个开源的、解决方案驱动的Ubuntu下的协同工具。** -根据[声明][1]和官方[发布公告][2],Juju 1.23.3是一个非常主流的版本,它打包了那些你想要在云上扩展和管理的包,而没有太多的麻烦。 +根据[声明][1]和官方[发布公告][2],Juju 1.23.3是一个主要版本,它打包了那些你想要在云上扩展和管理的包,而不需太多操作。 -Juju 1.23.3显著的功能是包含了对GCE的支持,支持systemd初始化系统,支持Ubuntu 15.04(Vivid Vervet),新的好玩的功能和对受限网络的支持。 +Juju 1.23.3显著的功能是包含了对GCE的支持,支持systemd初始化系统,支持Ubuntu 15.04(Vivid Vervet),新的好玩的功能和对受限网络的代理支持。 -另外,juju的发布带来了一个新的恢复、新的消息、新的块和实验性地支持Service Leader Elections,还有Ubuntu MAS和AWS上的可寻址的LXC和KVM。 +另外,juju的发布带来了一个新的样式恢复、新的消息、新的块和实验性地支持Service Leader Elections,还有Ubuntu MAS和AWS上的LXC容器和KVM实例。 -Udi Nachmany说:“在一个相关告示中,如果你正在使用Google云平台,你可能已经注意到了Google最近发布了云启动器。如果你密切关注,你同样注意到你说可以使用这个非常友好的UI来启动你的Ubuntu虚拟机。” +Udi Nachmany说:“在一个相关告示中,如果你正在使用Google云平台,你可能已经注意到了Google最近发布了云启动器。如果你观察的足够仔细,你也会注意到你可以使用这个非常友好的UI来启动你的Ubuntu虚拟机。” ![](http://i1-news.softpedia-static.com/images/news2/Ubuntu-s-Juju-Now-Supports-systemd-and-Google-Cloud-Platform-483279-2.jpg) @@ -20,7 +20,7 @@ via: http://linux.softpedia.com/blog/Ubuntu-s-Juju-Now-Supports-systemd-and-Goog 作者:[Marius Nestor][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From 89c6e75408abd4096e206ef12cb69cbce3446073 Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 8 Jun 2015 21:34:46 +0800 Subject: [PATCH 011/153] PUB:20150423 How IP forwarding Helps Connecting Private interface to Internet in Linux @ictlyh --- ...ng Private interface to Internet in Linux.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) rename {translated/tech => published}/20150423 How IP forwarding Helps Connecting Private interface to Internet in Linux.md (70%) diff --git a/translated/tech/20150423 How IP forwarding Helps Connecting Private interface to Internet in Linux.md b/published/20150423 How IP forwarding Helps Connecting Private interface to Internet in Linux.md similarity index 70% rename from translated/tech/20150423 How IP forwarding Helps Connecting Private interface to Internet in Linux.md rename to published/20150423 How IP forwarding Helps Connecting Private interface to Internet in Linux.md index a8ba20fff0..0b141dcf33 100644 --- a/translated/tech/20150423 How IP forwarding Helps Connecting Private interface to Internet in Linux.md +++ b/published/20150423 How IP forwarding Helps Connecting Private interface to Internet in Linux.md @@ -1,12 +1,13 @@ -Linux 上IP转发如何帮助专用接口连接到互联网 +如何在 Linux 上用 IP转发使内部网络连接到互联网 ================================================================================ -大家好,今天我们学习一下在 Linux 上用 iptables 实现从一个网络接口到另一个接口的IP转发或者数据包转发。IP转发的概念是,使 Linux 机器像路由器一样将数据从一个网络发送到另一个网络。所以,它能作为一个**路由器**或者代理服务器,实现从一个连接到多个客户端机器的共享互联网或者网络连接。 + +大家好,今天我们学习一下在 Linux 上用 iptables 实现从一个网络接口到另一个接口的IP转发(数据包转发)。IP转发的概念是,使 Linux 机器像路由器一样将数据从一个网络发送到另一个网络。所以,它能作为一个**路由器**或者代理服务器,实现将一个连接的互联网或者网络连接共享给多个客户端机器。 这是一些启用IP转发或网络包转发方法的简单步骤。 ### 1. 启用 IPv4 转发 ### -首先,我们打算在我们的 Linux 操作系统上启用 IPv4 转发。要做到这点,我们需要用 sudo 模式在 shell 或终端下执行下面的命令。 +首先,我们需要在我们的 Linux 操作系统上启用 IPv4 转发。要做到这点,我们需要用 sudo 模式在 shell 或终端下执行下面的命令。 $ sudo -s @@ -14,7 +15,7 @@ Linux 上IP转发如何帮助专用接口连接到互联网 ![临时IP转发](http://blog.linoxide.com/wp-content/uploads/2015/03/ip-forward-temporary.png) -**注意:上面的命令能马上启用ip转发,但只是临时的,直到下一次重启。要永久启用,我们需要使用我们喜欢的文本编辑器打开 /etc/sysctl.conf 文件。** +**注意:上面的命令能马上启用ip转发,但只是临时的,直到下一次重启。要永久启用,我们需要使用我们惯用的文本编辑器打开 /etc/sysctl.conf 文件。** # nano /etc/sysctl.conf @@ -38,13 +39,13 @@ Linux 上IP转发如何帮助专用接口连接到互联网 ![Ifconfig](http://blog.linoxide.com/wp-content/uploads/2015/03/ifconfig.png) -这里,在我们的机器中, eth2 是连接到互联网或者网络的网卡接口, wlan2 是我们要使用 iptables 从 eth2 转发数据包的接口。要做到这点,我们需要运行以下命令。 +这里,在我们的机器中, eth2 是连接到互联网或者网络的网卡接口, wlan2 是我们要使用 iptables 从 eth2 转发数据包的接口。要实现转发,我们需要运行以下命令。 # iptables -A FORWARD -i wlan2 -o eth2 -j ACCEPT 注意:请用你 Linux 机器中的可用设备名称替换 wlan2 和 eth2。 -现在,由于网络过滤器是一个无状态的防火墙,我们要用 iptables 允许已建立的连接通过。要做到这点,我们要运行下面的命令。 +现在,由于netfilter/iptables是一个无状态的防火墙,我们需要让 iptables 允许已建立的连接通过。要做到这点,我们要运行下面的命令。 # iptables -A FORWARD -i eth2 -o wlan2 -m state --state ESTABLISHED,RELATED -j ACCEPT @@ -60,7 +61,7 @@ Linux 上IP转发如何帮助专用接口连接到互联网 ### 总结 ### -最后,用安装的 iptables 作为防火墙解决方案,我们在我们的 Linux 机器上成功的配置了从一个接口到另一个接口的数据包转发。这篇文章允许你的专用接口连接到互联网,你不需要桥接接口,而是路由从一个接口进来的数据包到另一个接口,就是这些。如果你有任何问题、建议、反馈,请写到下面的评论框中,然后我们可以改进或更新我们的内容。非常感谢!享受吧 :-) +最后,我们在我们以 iptables 作为防火墙 Linux 机器上成功的配置了从一个接口到另一个接口的数据包转发。这篇文章教给你将你的私有接口连接到互联网,不需要桥接接口,而是将从一个接口进来的数据包路由到另一个接口。就是这些,如果你有任何问题、建议、反馈,请写到下面的评论框中,然后我们可以改进或更新我们的内容。非常感谢!享受吧 :-) -------------------------------------------------------------------------------- @@ -68,7 +69,7 @@ via: http://linoxide.com/firewall/ip-forwarding-connecting-private-interface-int 作者:[Arun Pyasi][a] 译者:[ictlyh](https://github.com/ictlyh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 From 7c5b82e7d16d6dd6b3f0f59343c26dccd3e7e9bf Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 8 Jun 2015 23:58:07 +0800 Subject: [PATCH 012/153] PUB:20150429 How To Integrate Apache2 With Tomcat 7 Using mod_jk Connector @geekpi --- ...e2 With Tomcat 7 Using mod_jk Connector.md | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) rename {translated/tech => published}/20150429 How To Integrate Apache2 With Tomcat 7 Using mod_jk Connector.md (54%) diff --git a/translated/tech/20150429 How To Integrate Apache2 With Tomcat 7 Using mod_jk Connector.md b/published/20150429 How To Integrate Apache2 With Tomcat 7 Using mod_jk Connector.md similarity index 54% rename from translated/tech/20150429 How To Integrate Apache2 With Tomcat 7 Using mod_jk Connector.md rename to published/20150429 How To Integrate Apache2 With Tomcat 7 Using mod_jk Connector.md index be9297c370..dff5090cfc 100644 --- a/translated/tech/20150429 How To Integrate Apache2 With Tomcat 7 Using mod_jk Connector.md +++ b/published/20150429 How To Integrate Apache2 With Tomcat 7 Using mod_jk Connector.md @@ -1,65 +1,63 @@ 如何用mod_jk连接器来集成Apache2和Tomcat 7 ================================================================================ -Apache是最流行的web服务器。通常用来接收客户端的请求并响应。它得到一个URL并将它翻译成一个文件名(或者静态请求),并将文件从本地磁盘中通过因特网返回,或者将它翻译成程序名执行它,接着将输出返回给请求方。如果web服务器不能处理和完成请求,它会返回一个错误信息。 +Apache是最流行的web服务器,它通常用来接收客户端的请求并响应。它得到一个URL并将它翻译成一个文件名(或者静态请求),并将文件从本地磁盘中取出,通过因特网返回;或者将它翻译成程序执行它,接着将输出返回给请求方。如果web服务器不能处理和完成请求,它会返回一个错误信息。 -在本篇中,我们会列出Apache的特性以及我们该如何用mod_jk连接器来集成Tomcat7和Tomcat8. +在本篇中,我们会列出Apache的特性以及我们该如何用mod\_jk连接器来集成Tomcat 7和Tomcat 8. ### Apache的特性 ### 如我们所说Apache是最流行的web服务器。下面是流行背后的原因: - 它是自由工具,你可以很简单地下载和安装 -- 它开放源码因此你可以查看源码,调整它,优化它,并且修复错误和安全漏洞。也可以增加新的功能和模块。 +- 它开放源码,因此你可以查看源码,调整它,优化它,并且修复错误和安全漏洞。也可以增加新的功能和模块。 - 它可以用在只有一两个页面的小网站,或者是有成千上万个页面的大网站,每月处理上百万的常规访问者的请求。它可以同时处理静态和动态内容。 -- 提高的缓存模块(mod_cache、 mod_disk_cache、 mod_mem_cache)。 +- 改进的缓存模块(mod\_cache、 mod\_disk\_cache、 mod\_mem\_cache)。 - Apache 2 支持 IPv6. -### Tomcat 目录 ### +### Tomcat 的目录 ### ${tomcat_home} 是tomcat的根目录。你的tomcat安装应该有下面的子目录: - ${tomcat_home}\conf – 存放不同配置文件的地方 - ${tomcat_home}\webapps – 包含示例程序 -- ${tomcat_home}\bin – 存放插件的地方 +- ${tomcat_home}\bin – 存放你的Web服务器的插件的地方 ### Mod_jk 模块 ### -mod_jk有两种可接受的方式:二进制或者源码。取决于你运行的web服务器的平台,二进制版本的mod_jk也许可以找到。如果有二进制版本的话建议使用这个。 +mod\_jk有两种可接受的方式:二进制或者源码。取决于你运行的web服务器的平台,也许有符合你的平台的二进制版本的mod\_jk。如果有的话建议使用这个。 -mod_jk模块在这些平台上开发及测试过: +mod\_jk模块在这些平台上开发及测试过: -- Linux、 FreeBSD、 AIX、 HP-UX、 MacOS X、 Solaris ,应该在主流的Unix平台上都支持Apache 1.3 和/或者 2.x。 -- 0-i386 SP4/SP5/SP6a (应该可以于其他的服务包一起工作), Win2K and WinXP and Win98 +- Linux、 FreeBSD、 AIX、 HP-UX、 MacOS X、 Solaris ,应该在主流的支持Apache 1.3 和/或者 2.x的Unix平台上都工作。 +- WinNT 4.0-i386 SP4/SP5/SP6a (应该可以与其他的服务包一起工作), Win2K 和 WinXP 和 Win98 - Cygwin (需要你有apache服务器及autoconf/automake支持工具) - Netware -- i5/OS V5R4 (System I) 中的 Apache HTTP Server 2.0.58。 确保已经安装了Apache PTF -- Tomcat 3.2 到 Tomcat 8. +- i5/OS V5R4 (System I) ,带有 Apache HTTP Server 2.0.58。 确保已经安装了最新的 Apache PTF +- Tomcat 3.2 到 Tomcat 8 -The mod_jk 需要两个组件: +The mod\_jk 需要两个组件: -- **mod_jk.xxx** – Apache HTTP服务器模块,取决于你的操作系统,它可能是mod_jk.so、mod_jk.nlm或者MOD_JK.SRVPGM。 -- **workers.properties** - 描述主机以及处理器使用的端口(Tomcat进程)。在下载的源码内可以在conf目录下找到workers.properties文件。 +- **mod\_jk.xxx** – Apache HTTP服务器模块,取决于你的操作系统,它可能是mod\_jk.so、mod\_jk.nlm或者mod\_jk.SRVPGM。 +- **workers.properties** - 描述Worker (Tomcat进程)所用的主机以及处理器使用的端口。在下载的源码的conf目录下找到示例的workers.properties文件。 -和Apache HTTP服务器其他的模块一样,mod_jk应该安装在你的Apache服务器下的模块目录下:/usr/lib/apache,你应该更新你的**httpd.conf**文件。 +和Apache HTTP服务器其他的模块一样,mod\_jk应该安装在你的Apache服务器下的模块目录下:/usr/lib/apache,而且你应该更新你的**httpd.conf**文件。 ### 安装 ### -它需要非root用户在安装钱使用“sudo”特权。现在我们开始安装,我们将使用下面的命令来安装Apache2和Tomcat: +在开始安装前,非root用户需要使用“sudo”特权。现在我们开始安装,我们将使用下面的命令来安装Apache2和Tomcat: - sudo apt-get install apache2 - + sudo apt-get install apache2 sudo apt-get install tomcat7 - sudo apt-get install tomcat7-admin -下面在我们将会使用下面的命令来创建一个测试程序: +下面,我们将会使用如下的命令来创建一个测试程序: cd /var/lib/tomcat7/webapps sudo mkdir tomcat-demo sudo mkdir tomcat-demo/goodmoring sudo vim tomcat-demo/helloworld/index.jsp -粘贴下面的代码: +并粘贴下面的代码到上述的 index.jsp: @@ -71,19 +69,19 @@ The mod_jk 需要两个组件: -一切完毕后,我们将使用下面的命令安装和配置mod_jk: +一切完毕后,我们将使用下面的命令安装和配置mod\_jk: sudo apt-get install libapache2-mod-jk -我们将使用下面的命令启用Tomcat的8443转发端口: +我们需要使用下面的命令启用Tomcat的8443转发端口: sudo vim /etc/tomcat7/server.xml -我们将解除下面的注释行: +解除下面的注释行: -之后,我们将用下面的命令位Apache创建workers.properties文件: +之后,我们将用下面的命令为Apache创建workers.properties文件: sudo vim /etc/apache2/workers.properties @@ -123,7 +121,7 @@ The mod_jk 需要两个组件: ### 总结 ### -在本篇中我们展示了你该如何使用mod_jk连接器配置和安装Apache2以及Tomcat7。 +在本篇中我们展示了你该如何使用mod\_jk连接器配置和安装Apache2以及Tomcat7。 -------------------------------------------------------------------------------- @@ -131,7 +129,7 @@ via: http://www.unixmen.com/integrate-apache2-tomcat-7-using-mod_jk-connector/ 作者:[anismaj][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 From 48f8b8987bf3e73d3f7b9838aec87651f1abd897 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 9 Jun 2015 10:01:42 +0800 Subject: [PATCH 013/153] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 26ea32fd81..968c8434a1 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ LCTT的组成 * 2014/11/04 提升zpl1025为Core Translators成员。 * 2014/12/25 提升runningwater为Core Translators成员。 * 2015/04/19 发起 LFS-BOOK-7.7-systemd 项目。 +* 2015/06/09 提升ictlyh和dongfengweixiao为Core Translators成员。 活跃成员 ------------------------------- @@ -63,6 +64,8 @@ LCTT的组成 - CORE @reinoir, - CORE @bazz2, - CORE @zpl1025, +- CORE @ictlyh, +- CORE @dongfengweixiao - Senior @tinyeyeser, - Senior @vito-L, - Senior @jasminepeng, @@ -76,7 +79,6 @@ LCTT的组成 - @alim0x, - @2q1w2007, - @theo-l, -- @ictlyh, - @FSSlc, - @su-kaiyao, - @blueabysm, @@ -167,7 +169,7 @@ LFS 项目活跃成员有: - @KevinSJ - @Yuking-net -(更新于2015/05/31,以Github contributors列表排名) +(更新于2015/06/09,以Github contributors列表排名) 谢谢大家的支持! From 4844e99b918c2c330d82bc2c261c1771c89e09bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=A7=E5=87=AF?= <2q1w2007@users.noreply.github.com> Date: Tue, 9 Jun 2015 10:23:47 +0800 Subject: [PATCH 014/153] =?UTF-8?q?2q1w2007=E7=94=B3=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit How to access a Linux server behind NAT via reverse SSH tunnel --- ...to access a Linux server behind NAT via reverse SSH tunnel.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20150504 How to access a Linux server behind NAT via reverse SSH tunnel.md b/sources/tech/20150504 How to access a Linux server behind NAT via reverse SSH tunnel.md index b67f5aee26..7eeb33676b 100644 --- a/sources/tech/20150504 How to access a Linux server behind NAT via reverse SSH tunnel.md +++ b/sources/tech/20150504 How to access a Linux server behind NAT via reverse SSH tunnel.md @@ -1,3 +1,4 @@ +2q1w2007申领 How to access a Linux server behind NAT via reverse SSH tunnel ================================================================================ You are running a Linux server at home, which is behind a NAT router or restrictive firewall. Now you want to SSH to the home server while you are away from home. How would you set that up? SSH port forwarding will certainly be an option. However, port forwarding can become tricky if you are dealing with multiple nested NAT environment. Besides, it can be interfered with under various ISP-specific conditions, such as restrictive ISP firewalls which block forwarded ports, or carrier-grade NAT which shares IPv4 addresses among users. From a6fa2fa8add0d23d688ecad4b491e1540e3d5c45 Mon Sep 17 00:00:00 2001 From: DeadFire Date: Tue, 9 Jun 2015 14:10:03 +0800 Subject: [PATCH 015/153] =?UTF-8?q?20150609-1=20=E9=80=89=E9=A2=98=20RHCSA?= =?UTF-8?q?=20Series=207-13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Lists) and Mounting Samba or NFS Shares.md | 212 +++++++++++++++++ ... Hostname and Enabling Network Services.md | 215 ++++++++++++++++++ ...uring and Securing a Web and FTP Server.md | 176 ++++++++++++++ ...ks with Cron and Monitoring System Logs.md | 197 ++++++++++++++++ ...ic Control Using FirewallD and Iptables.md | 191 ++++++++++++++++ ... RHEL 7 Installations Using 'Kickstart'.md | 142 ++++++++++++ ...ntrol Essentials with SELinux in RHEL 7.md | 176 ++++++++++++++ 7 files changed, 1309 insertions(+) create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 07--Using ACLs (Access Control Lists) and Mounting Samba or NFS Shares.md create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 08--Securing SSH, Setting Hostname and Enabling Network Services.md create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 09--Installing, Configuring and Securing a Web and FTP Server.md create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 10--Yum Package Management, Automating Tasks with Cron and Monitoring System Logs.md create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 11--Firewall Essentials and Network Traffic Control Using FirewallD and Iptables.md create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 12--Automate RHEL 7 Installations Using 'Kickstart'.md create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 13--Mandatory Access Control Essentials with SELinux in RHEL 7.md diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 07--Using ACLs (Access Control Lists) and Mounting Samba or NFS Shares.md b/sources/tech/RHCSA Series/RHCSA Series--Part 07--Using ACLs (Access Control Lists) and Mounting Samba or NFS Shares.md new file mode 100644 index 0000000000..d4801d9923 --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 07--Using ACLs (Access Control Lists) and Mounting Samba or NFS Shares.md @@ -0,0 +1,212 @@ +RHCSA Series: Using ACLs (Access Control Lists) and Mounting Samba / NFS Shares – Part 7 +================================================================================ +In the last article ([RHCSA series Part 6][1]) we started explaining how to set up and configure local system storage using parted and ssm. + +![Configure ACL's and Mounting NFS / Samba Shares](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-ACLs-and-Mounting-NFS-Samba-Shares.png) + +RHCSA Series:: Configure ACL’s and Mounting NFS / Samba Shares – Part 7 + +We also discussed how to create and mount encrypted volumes with a password during system boot. In addition, we warned you to avoid performing critical storage management operations on mounted filesystems. With that in mind we will now review the most used file system formats in Red Hat Enterprise Linux 7 and then proceed to cover the topics of mounting, using, and unmounting both manually and automatically network filesystems (CIFS and NFS), along with the implementation of access control lists for your system. + +#### Prerequisites #### + +Before proceeding further, please make sure you have a Samba server and a NFS server available (note that NFSv2 is no longer supported in RHEL 7). + +During this guide we will use a machine with IP 192.168.0.10 with both services running in it as server, and a RHEL 7 box as client with IP address 192.168.0.18. Later in the article we will tell you which packages you need to install on the client. + +### File System Formats in RHEL 7 ### + +Beginning with RHEL 7, XFS has been introduced as the default file system for all architectures due to its high performance and scalability. It currently supports a maximum filesystem size of 500 TB as per the latest tests performed by Red Hat and its partners for mainstream hardware. + +Also, XFS enables user_xattr (extended user attributes) and acl (POSIX access control lists) as default mount options, unlike ext3 or ext4 (ext2 is considered deprecated as of RHEL 7), which means that you don’t need to specify those options explicitly either on the command line or in /etc/fstab when mounting a XFS filesystem (if you want to disable such options in this last case, you have to explicitly use no_acl and no_user_xattr). + +Keep in mind that the extended user attributes can be assigned to files and directories for storing arbitrary additional information such as the mime type, character set or encoding of a file, whereas the access permissions for user attributes are defined by the regular file permission bits. + +#### Access Control Lists #### + +As every system administrator, either beginner or expert, is well acquainted with regular access permissions on files and directories, which specify certain privileges (read, write, and execute) for the owner, the group, and “the world” (all others). However, feel free to refer to [Part 3 of the RHCSA series][2] if you need to refresh your memory a little bit. + +However, since the standard ugo/rwx set does not allow to configure different permissions for different users, ACLs were introduced in order to define more detailed access rights for files and directories than those specified by regular permissions. + +In fact, ACL-defined permissions are a superset of the permissions specified by the file permission bits. Let’s see how all of this translates is applied in the real world. + +1. There are two types of ACLs: access ACLs, which can be applied to either a specific file or a directory), and default ACLs, which can only be applied to a directory. If files contained therein do not have a ACL set, they inherit the default ACL of their parent directory. + +2. To begin, ACLs can be configured per user, per group, or per an user not in the owning group of a file. + +3. ACLs are set (and removed) using setfacl, with either the -m or -x options, respectively. + +For example, let us create a group named tecmint and add users johndoe and davenull to it: + + # groupadd tecmint + # useradd johndoe + # useradd davenull + # usermod -a -G tecmint johndoe + # usermod -a -G tecmint davenull + +And let’s verify that both users belong to supplementary group tecmint: + + # id johndoe + # id davenull + +![Verify Users](http://www.tecmint.com/wp-content/uploads/2015/04/Verify-Users.png) + +Verify Users + +Let’s now create a directory called playground within /mnt, and a file named testfile.txt inside. We will set the group owner to tecmint and change its default ugo/rwx permissions to 770 (read, write, and execute permissions granted to both the owner and the group owner of the file): + + # mkdir /mnt/playground + # touch /mnt/playground/testfile.txt + # chmod 770 /mnt/playground/testfile.txt + +Then switch user to johndoe and davenull, in that order, and write to the file: + + echo "My name is John Doe" > /mnt/playground/testfile.txt + echo "My name is Dave Null" >> /mnt/playground/testfile.txt + +So far so good. Now let’s have user gacanepa write to the file – and the write operation will, which was to be expected. + +But what if we actually need user gacanepa (who is not a member of group tecmint) to have write permissions on /mnt/playground/testfile.txt? The first thing that may come to your mind is adding that user account to group tecmint. But that will give him write permissions on ALL files were the write bit is set for the group, and we don’t want that. We only want him to be able to write to /mnt/playground/testfile.txt. + + # touch /mnt/playground/testfile.txt + # chown :tecmint /mnt/playground/testfile.txt + # chmod 777 /mnt/playground/testfile.txt + # su johndoe + $ echo "My name is John Doe" > /mnt/playground/testfile.txt + $ su davenull + $ echo "My name is Dave Null" >> /mnt/playground/testfile.txt + $ su gacanepa + $ echo "My name is Gabriel Canepa" >> /mnt/playground/testfile.txt + +![Manage User Permissions](http://www.tecmint.com/wp-content/uploads/2015/04/User-Permissions.png) + +Manage User Permissions + +Let’s give user gacanepa read and write access to /mnt/playground/testfile.txt. + +Run as root, + + # setfacl -R -m u:gacanepa:rwx /mnt/playground + +and you’ll have successfully added an ACL that allows gacanepa to write to the test file. Then switch to user gacanepa and try to write to the file again: + + $ echo "My name is Gabriel Canepa" >> /mnt/playground/testfile.txt + +To view the ACLs for a specific file or directory, use getfacl: + + # getfacl /mnt/playground/testfile.txt + +![Check ACLs of Files](http://www.tecmint.com/wp-content/uploads/2015/04/Check-ACL-of-File.png) + +Check ACLs of Files + +To set a default ACL to a directory (which its contents will inherit unless overwritten otherwise), add d: before the rule and specify a directory instead of a file name: + + # setfacl -m d:o:r /mnt/playground + +The ACL above will allow users not in the owner group to have read access to the future contents of the /mnt/playground directory. Note the difference in the output of getfacl /mnt/playground before and after the change: + +![Set Default ACL in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Set-Default-ACL-in-Linux.png) + +Set Default ACL in Linux + +[Chapter 20 in the official RHEL 7 Storage Administration Guide][3] provides more ACL examples, and I highly recommend you take a look at it and have it handy as reference. + +#### Mounting NFS Network Shares #### + +To show the list of NFS shares available in your server, you can use the showmount command with the -e option, followed by the machine name or its IP address. This tool is included in the nfs-utils package: + + # yum update && yum install nfs-utils + +Then do: + + # showmount -e 192.168.0.10 + +and you will get a list of the available NFS shares on 192.168.0.10: + +![Check Available NFS Shares](http://www.tecmint.com/wp-content/uploads/2015/04/Mount-NFS-Shares.png) + +Check Available NFS Shares + +To mount NFS network shares on the local client using the command line on demand, use the following syntax: + + # mount -t nfs -o [options] remote_host:/remote/directory /local/directory + +which, in our case, translates to: + + # mount -t nfs 192.168.0.10:/NFS-SHARE /mnt/nfs + +If you get the following error message: “Job for rpc-statd.service failed. See “systemctl status rpc-statd.service” and “journalctl -xn” for details.”, make sure the rpcbind service is enabled and started in your system first: + + # systemctl enable rpcbind.socket + # systemctl restart rpcbind.service + +and then reboot. That should do the trick and you will be able to mount your NFS share as explained earlier. If you need to mount the NFS share automatically on system boot, add a valid entry to the /etc/fstab file: + + remote_host:/remote/directory /local/directory nfs options 0 0 + +The variables remote_host, /remote/directory, /local/directory, and options (which is optional) are the same ones used when manually mounting an NFS share from the command line. As per our previous example: + + 192.168.0.10:/NFS-SHARE /mnt/nfs nfs defaults 0 0 + +#### Mounting CIFS (Samba) Network Shares #### + +Samba represents the tool of choice to make a network share available in a network with *nix and Windows machines. To show the Samba shares that are available, use the smbclient command with the -L flag, followed by the machine name or its IP address. This tool is included in the samba-client package: + +You will be prompted for root’s password in the remote host: + + # smbclient -L 192.168.0.10 + +![Check Samba Shares](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Samba-Shares.png) + +Check Samba Shares + +To mount Samba network shares on the local client you will need to install first the cifs-utils package: + + # yum update && yum install cifs-utils + +Then use the following syntax on the command line: + + # mount -t cifs -o credentials=/path/to/credentials/file //remote_host/samba_share /local/directory + +which, in our case, translates to: + + # mount -t cifs -o credentials=~/.smbcredentials //192.168.0.10/gacanepa /mnt/samba + +where smbcredentials: + + username=gacanepa + password=XXXXXX + +is a hidden file inside root’s home (/root/) with permissions set to 600, so that no one else but the owner of the file can read or write to it. + +Please note that the samba_share is the name of the Samba share as returned by smbclient -L remote_host as shown above. + +Now, if you need the Samba share to be available automatically on system boot, add a valid entry to the /etc/fstab file as follows: + + //remote_host:/samba_share /local/directory cifs options 0 0 + +The variables remote_host, /samba_share, /local/directory, and options (which is optional) are the same ones used when manually mounting a Samba share from the command line. Following the definitions given in our previous example: + + //192.168.0.10/gacanepa /mnt/samba cifs credentials=/root/smbcredentials,defaults 0 0 + +### Conclusion ### + +In this article we have explained how to set up ACLs in Linux, and discussed how to mount CIFS and NFS network shares in a RHEL 7 client. + +I recommend you to practice these concepts and even mix them (go ahead and try to set ACLs in mounted network shares) until you feel comfortable. If you have questions or comments feel free to use the form below to contact us anytime. Also, feel free to share this article through your social networks. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-configure-acls-and-mount-nfs-samba-shares/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/rhcsa-exam-create-format-resize-delete-and-encrypt-partitions-in-linux/ +[2]:http://www.tecmint.com/rhcsa-exam-manage-users-and-groups/ +[3]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Storage_Administration_Guide/ch-acls.html \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 08--Securing SSH, Setting Hostname and Enabling Network Services.md b/sources/tech/RHCSA Series/RHCSA Series--Part 08--Securing SSH, Setting Hostname and Enabling Network Services.md new file mode 100644 index 0000000000..a381b1c94a --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 08--Securing SSH, Setting Hostname and Enabling Network Services.md @@ -0,0 +1,215 @@ +RHCSA Series: Securing SSH, Setting Hostname and Enabling Network Services – Part 8 +================================================================================ +As a system administrator you will often have to log on to remote systems to perform a variety of administration tasks using a terminal emulator. You will rarely sit in front of a real (physical) terminal, so you need to set up a way to log on remotely to the machines that you will be asked to manage. + +In fact, that may be the last thing that you will have to do in front of a physical terminal. For security reasons, using Telnet for this purpose is not a good idea, as all traffic goes through the wire in unencrypted, plain text. + +In addition, in this article we will also review how to configure network services to start automatically at boot and learn how to set up network and hostname resolution statically or dynamically. + +![RHCSA: Secure SSH and Enable Network Services](http://www.tecmint.com/wp-content/uploads/2015/05/Secure-SSH-Server-and-Enable-Network-Services.png) + +RHCSA: Secure SSH and Enable Network Services – Part 8 + +### Installing and Securing SSH Communication ### + +For you to be able to log on remotely to a RHEL 7 box using SSH, you will have to install the openssh, openssh-clients and openssh-servers packages. The following command not only will install the remote login program, but also the secure file transfer tool, as well as the remote file copy utility: + + # yum update && yum install openssh openssh-clients openssh-servers + +Note that it’s a good idea to install the server counterparts as you may want to use the same machine as both client and server at some point or another. + +After installation, there is a couple of basic things that you need to take into account if you want to secure remote access to your SSH server. The following settings should be present in the `/etc/ssh/sshd_config` file. + +1. Change the port where the sshd daemon will listen on from 22 (the default value) to a high port (2000 or greater), but first make sure the chosen port is not being used. + +For example, let’s suppose you choose port 2500. Use [netstat][1] in order to check whether the chosen port is being used or not: + + # netstat -npltu | grep 2500 + +If netstat does not return anything, you can safely use port 2500 for sshd, and you should change the Port setting in the configuration file as follows: + + Port 2500 + +2. Only allow protocol 2: + +Protocol 2 + +3. Configure the authentication timeout to 2 minutes, do not allow root logins, and restrict to a minimum the list of users which are allowed to login via ssh: + + LoginGraceTime 2m + PermitRootLogin no + AllowUsers gacanepa + +4. If possible, use key-based instead of password authentication: + + PasswordAuthentication no + RSAAuthentication yes + PubkeyAuthentication yes + +This assumes that you have already created a key pair with your user name on your client machine and copied it to your server as explained here. + +- [Enable SSH Passwordless Login][2] + +### Configuring Networking and Name Resolution ### + +1. Every system administrator should be well acquainted with the following system-wide configuration files: + +- /etc/hosts is used to resolve names <---> IPs in small networks. + +Every line in the `/etc/hosts` file has the following structure: + + IP address - Hostname - FQDN + +For example, + + 192.168.0.10 laptop laptop.gabrielcanepa.com.ar + +2. `/etc/resolv.conf` specifies the IP addresses of DNS servers and the search domain, which is used for completing a given query name to a fully qualified domain name when no domain suffix is supplied. + +Under normal circumstances, you don’t need to edit this file as it is managed by the system. However, should you want to change DNS servers, be advised that you need to stick to the following structure in each line: + + nameserver - IP address + +For example, + + nameserver 8.8.8.8 + +3. 3. `/etc/host.conf` specifies the methods and the order by which hostnames are resolved within a network. In other words, tells the name resolver which services to use, and in what order. + +Although this file has several options, the most common and basic setup includes a line as follows: + + order bind,hosts + +Which indicates that the resolver should first look in the nameservers specified in `resolv.conf` and then to the `/etc/hosts` file for name resolution. + +4. `/etc/sysconfig/network` contains routing and global host information for all network interfaces. The following values may be used: + + NETWORKING=yes|no + HOSTNAME=value + +Where value should be the Fully Qualified Domain Name (FQDN). + + GATEWAY=XXX.XXX.XXX.XXX + +Where XXX.XXX.XXX.XXX is the IP address of the network’s gateway. + + GATEWAYDEV=value + +In a machine with multiple NICs, value is the gateway device, such as enp0s3. + +5. Files inside `/etc/sysconfig/network-scripts` (network adapters configuration files). + +Inside the directory mentioned previously, you will find several plain text files named. + + ifcfg-name + +Where name is the name of the NIC as returned by ip link show: + +![Check Network Link Status](http://www.tecmint.com/wp-content/uploads/2015/05/Check-IP-Address.png) + +Check Network Link Status + +For example: + +![Network Files](http://www.tecmint.com/wp-content/uploads/2015/05/Network-Files.png) + +Network Files + +Other than for the loopback interface, you can expect a similar configuration for your NICs. Note that some variables, if set, will override those present in `/etc/sysconfig/network` for this particular interface. Each line is commented for clarification in this article but in the actual file you should avoid comments: + + HWADDR=08:00:27:4E:59:37 # The MAC address of the NIC + TYPE=Ethernet # Type of connection + BOOTPROTO=static # This indicates that this NIC has been assigned a static IP. If this variable was set to dhcp, the NIC will be assigned an IP address by a DHCP server and thus the next two lines should not be present in that case. + IPADDR=192.168.0.18 + NETMASK=255.255.255.0 + GATEWAY=192.168.0.1 + NM_CONTROLLED=no # Should be added to the Ethernet interface to prevent NetworkManager from changing the file. + NAME=enp0s3 + UUID=14033805-98ef-4049-bc7b-d4bea76ed2eb + ONBOOT=yes # The operating system should bring up this NIC during boot + +### Setting Hostnames ### + +In Red Hat Enterprise Linux 7, the hostnamectl command is used to both query and set the system’s hostname. + +To display the current hostname, type: + + # hostnamectl status + +![Check System hostname in CentOS 7](http://www.tecmint.com/wp-content/uploads/2015/05/Check-System-hostname.png) + +Check System Hostname + +To change the hostname, use + + # hostnamectl set-hostname [new hostname] + +For example, + + # hostnamectl set-hostname cinderella + +For the changes to take effect you will need to restart the hostnamed daemon (that way you will not have to log off and on again in order to apply the change): + + # systemctl restart systemd-hostnamed + +![Set System Hostname in CentOS 7](http://www.tecmint.com/wp-content/uploads/2015/05/Set-System-Hostname.png) + +Set System Hostname + +In addition, RHEL 7 also includes the nmcli utility that can be used for the same purpose. To display the hostname, run: + + # nmcli general hostname + +and to change it: + + # nmcli general hostname [new hostname] + +For example, + + # nmcli general hostname rhel7 + +![Set Hostname Using nmcli Command](http://www.tecmint.com/wp-content/uploads/2015/05/nmcli-command.png) + +Set Hostname Using nmcli Command + +### Starting Network Services on Boot ### + +To wrap up, let us see how we can ensure that network services are started automatically on boot. In simple terms, this is done by creating symlinks to certain files specified in the [Install] section of the service configuration files. + +In the case of firewalld (/usr/lib/systemd/system/firewalld.service): + + [Install] + WantedBy=basic.target + Alias=dbus-org.fedoraproject.FirewallD1.service + +To enable the service: + + # systemctl enable firewalld + +On the other hand, disabling firewalld entitles removing the symlinks: + + # systemctl disable firewalld + +![Enable Service at System Boot](http://www.tecmint.com/wp-content/uploads/2015/05/Enable-Service-at-System-Boot.png) + +Enable Service at System Boot + +### Conclusion ### + +In this article we have summarized how to install and secure connections via SSH to a RHEL server, how to change its name, and finally how to ensure that network services are started on boot. If you notice that a certain service has failed to start properly, you can use systemctl status -l [service] and journalctl -xn to troubleshoot it. + +Feel free to let us know what you think about this article using the comment form below. Questions are also welcome. We look forward to hearing from you! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-series-secure-ssh-set-hostname-enable-network-services-in-rhel-7/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/20-netstat-commands-for-linux-network-management/ +[2]:http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 09--Installing, Configuring and Securing a Web and FTP Server.md b/sources/tech/RHCSA Series/RHCSA Series--Part 09--Installing, Configuring and Securing a Web and FTP Server.md new file mode 100644 index 0000000000..6a1e544de3 --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 09--Installing, Configuring and Securing a Web and FTP Server.md @@ -0,0 +1,176 @@ +RHCSA Series: Installing, Configuring and Securing a Web and FTP Server – Part 9 +================================================================================ +A web server (also known as a HTTP server) is a service that handles content (most commonly web pages, but other types of documents as well) over to a client in a network. + +A FTP server is one of the oldest and most commonly used resources (even to this day) to make files available to clients on a network in cases where no authentication is necessary since FTP uses username and password without encryption. + +The web server available in RHEL 7 is version 2.4 of the Apache HTTP Server. As for the FTP server, we will use the Very Secure Ftp Daemon (aka vsftpd) to establish connections secured by TLS. + +![Configuring and Securing Apache and FTP Server](http://www.tecmint.com/wp-content/uploads/2015/05/Install-Configure-Secure-Apache-FTP-Server.png) + +RHCSA: Installing, Configuring and Securing Apache and FTP – Part 9 + +In this article we will explain how to install, configure, and secure a web server and a FTP server in RHEL 7. + +### Installing Apache and FTP Server ### + +In this guide we will use a RHEL 7 server with a static IP address of 192.168.0.18/24. To install Apache and VSFTPD, run the following command: + + # yum update && yum install httpd vsftpd + +When the installation completes, both services will be disabled initially, so we need to start them manually for the time being and enable them to start automatically beginning with the next boot: + + # systemctl start httpd + # systemctl enable httpd + # systemctl start vsftpd + # systemctl enable vsftpd + +In addition, we have to open ports 80 and 21, where the web and ftp daemons are listening, respectively, in order to allow access to those services from the outside: + + # firewall-cmd --zone=public --add-port=80/tcp --permanent + # firewall-cmd --zone=public --add-service=ftp --permanent + # firewall-cmd --reload + +To confirm that the web server is working properly, fire up your browser and enter the IP of the server. You should see the test page: + +![Confirm Apache Web Server](http://www.tecmint.com/wp-content/uploads/2015/05/Confirm-Apache-Web-Server.png) + +Confirm Apache Web Server + +As for the ftp server, we will have to configure it further, which we will do in a minute, before confirming that it’s working as expected. + +### Configuring and Securing Apache Web Server ### + +The main configuration file for Apache is located in `/etc/httpd/conf/httpd.conf`, but it may rely on other files present inside `/etc/httpd/conf.d`. + +Although the default configuration should be sufficient for most cases, it’s a good idea to become familiar with all the available options as described in the [official documentation][1]. + +As always, make a backup copy of the main configuration file before editing it: + + # cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.$(date +%Y%m%d) + +Then open it with your preferred text editor and look for the following variables: + +- ServerRoot: the directory where the server’s configuration, error, and log files are kept. +- Listen: instructs Apache to listen on specific IP address and / or ports. +- Include: allows the inclusion of other configuration files, which must exist. Otherwise, the server will fail, as opposed to the IncludeOptional directive, which is silently ignored if the specified configuration files do not exist. +- User and Group: the name of the user/group to run the httpd service as. +- DocumentRoot: The directory out of which Apache will serve your documents. By default, all requests are taken from this directory, but symbolic links and aliases may be used to point to other locations. +- ServerName: this directive sets the hostname (or IP address) and port that the server uses to identify itself. + +The first security measure will consist of creating a dedicated user and group (i.e. tecmint/tecmint) to run the web server as and changing the default port to a higher one (9000 in this case): + + ServerRoot "/etc/httpd" + Listen 192.168.0.18:9000 + User tecmint + Group tecmint + DocumentRoot "/var/www/html" + ServerName 192.168.0.18:9000 + +You can test the configuration file with. + + # apachectl configtest + +and if everything is OK, then restart the web server. + + # systemctl restart httpd + +and don’t forget to enable the new port (and disable the old one) in the firewall: + + # firewall-cmd --zone=public --remove-port=80/tcp --permanent + # firewall-cmd --zone=public --add-port=9000/tcp --permanent + # firewall-cmd --reload + +Note that, due to SELinux policies, you can only use the ports returned by + + # semanage port -l | grep -w '^http_port_t' + +for the web server. + +If you want to use another port (i.e. TCP port 8100), you will have to add it to SELinux port context for the httpd service: + +# semanage port -a -t http_port_t -p tcp 8100 + +![Add Apache Port to SELinux Policies](http://www.tecmint.com/wp-content/uploads/2015/05/Add-Apache-Port-to-SELinux-Policies.png) + +Add Apache Port to SELinux Policies + +To further secure your Apache installation, follow these steps: + +1. The user Apache is running as should not have access to a shell: + + # usermod -s /sbin/nologin tecmint + +2. Disable directory listing in order to prevent the browser from displaying the contents of a directory if there is no index.html present in that directory. + +Edit `/etc/httpd/conf/httpd.conf` (and the configuration files for virtual hosts, if any) and make sure that the Options directive, both at the top and at Directory block levels, is set to None: + + Options None + +3. Hide information about the web server and the operating system in HTTP responses. Edit /etc/httpd/conf/httpd.conf as follows: + + ServerTokens Prod + ServerSignature Off + +Now you are ready to start serving content from your /var/www/html directory. + +### Configuring and Securing FTP Server ### + +As in the case of Apache, the main configuration file for Vsftpd `(/etc/vsftpd/vsftpd.conf)` is well commented and while the default configuration should suffice for most applications, you should become acquainted with the documentation and the man page `(man vsftpd.conf)` in order to operate the ftp server more efficiently (I can’t emphasize that enough!). + +In our case, these are the directives used: + + anonymous_enable=NO + local_enable=YES + write_enable=YES + local_umask=022 + dirmessage_enable=YES + xferlog_enable=YES + connect_from_port_20=YES + xferlog_std_format=YES + chroot_local_user=YES + allow_writeable_chroot=YES + listen=NO + listen_ipv6=YES + pam_service_name=vsftpd + userlist_enable=YES + tcp_wrappers=YES + +By using `chroot_local_user=YES`, local users will be (by default) placed in a chroot’ed jail in their home directory right after login. This means that local users will not be able to access any files outside their corresponding home directories. + +Finally, to allow ftp to read files in the user’s home directory, set the following SELinux boolean: + + # setsebool -P ftp_home_dir on + +You can now connect to the ftp server using a client such as Filezilla: + +![Check FTP Connection](http://www.tecmint.com/wp-content/uploads/2015/05/Check-FTP-Connection.png) + +Check FTP Connection + +Note that the `/var/log/xferlo`g log records downloads and uploads, which concur with the above directory listing: + +![Monitor FTP Download and Upload](http://www.tecmint.com/wp-content/uploads/2015/05/Monitor-FTP-Download-Upload.png) + +Monitor FTP Download and Upload + +Read Also: [Limit FTP Network Bandwidth Used by Applications in a Linux System with Trickle][2] + +### Summary ### + +In this tutorial we have explained how to set up a web and a ftp server. Due to the vastness of the subject, it is not possible to cover all the aspects of these topics (i.e. virtual web hosts). Thus, I recommend you also check other excellent articles in this website about [Apache][3]. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-series-install-and-secure-apache-web-server-and-ftp-in-rhel/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://httpd.apache.org/docs/2.4/ +[2]:http://www.tecmint.com/manage-and-limit-downloadupload-bandwidth-with-trickle-in-linux/ +[3]:http://www.google.com/cse?cx=partner-pub-2601749019656699:2173448976&ie=UTF-8&q=virtual+hosts&sa=Search&gws_rd=cr&ei=Dy9EVbb0IdHisASnroG4Bw#gsc.tab=0&gsc.q=apache \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 10--Yum Package Management, Automating Tasks with Cron and Monitoring System Logs.md b/sources/tech/RHCSA Series/RHCSA Series--Part 10--Yum Package Management, Automating Tasks with Cron and Monitoring System Logs.md new file mode 100644 index 0000000000..04c7d7a29e --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 10--Yum Package Management, Automating Tasks with Cron and Monitoring System Logs.md @@ -0,0 +1,197 @@ +RHCSA Series: Yum Package Management, Automating Tasks with Cron and Monitoring System Logs – Part 10 +================================================================================ +In this article we will review how to install, update, and remove packages in Red Hat Enterprise Linux 7. We will also cover how to automate tasks using cron, and will finish this guide explaining how to locate and interpret system logs files with the focus of teaching you why all of these are essential skills for every system administrator. + +![Yum Package Management Cron Jobs Log Monitoring Linux](http://www.tecmint.com/wp-content/uploads/2015/05/Yum-Package-Management-Cron-Job-Log-Monitoring-Linux.jpg) + +RHCSA: Yum Package Management, Cron Job Scheduling and Log Monitoring – Part 10 + +### Managing Packages Via Yum ### + +To install a package along with all its dependencies that are not already installed, you will use: + + # yum -y install package_name(s) + +Where package_name(s) represent at least one real package name. + +For example, to install httpd and mlocate (in that order), type. + + # yum -y install httpd mlocate + +**Note**: That the letter y in the example above bypasses the confirmation prompts that yum presents before performing the actual download and installation of the requested programs. You can leave it out if you want. + +By default, yum will install the package with the architecture that matches the OS architecture, unless overridden by appending the package architecture to its name. + +For example, on a 64 bit system, yum install package will install the x86_64 version of package, whereas yum install package.x86 (if available) will install the 32-bit one. + +There will be times when you want to install a package but don’t know its exact name. The search all or search options can search the currently enabled repositories for a certain keyword in the package name and/or in its description as well, respectively. + +For example, + + # yum search log + +will search the installed repositories for packages with the word log in their names and summaries, whereas + + # yum search all log + +will look for the same keyword in the package description and url fields as well. + +Once the search returns a package listing, you may want to display further information about some of them before installing. That is when the info option will come in handy: + + # yum info logwatch + +![Search Package Information](http://www.tecmint.com/wp-content/uploads/2015/05/Search-Package-Information.png) + +Search Package Information + +You can regularly check for updates with the following command: + + # yum check-update + +The above command will return all the installed packages for which an update is available. In the example shown in the image below, only rhel-7-server-rpms has an update available: + +![Check For Package Updates](http://www.tecmint.com/wp-content/uploads/2015/05/Check-For-Updates.png) + +Check For Package Updates + +You can then update that package alone with, + + # yum update rhel-7-server-rpms + +If there are several packages that can be updated, yum update will update all of them at once. + +Now what happens when you know the name of an executable, such as ps2pdf, but don’t know which package provides it? You can find out with `yum whatprovides “*/[executable]”`: + + # yum whatprovides “*/ps2pdf” + +![Find Package Belongs to Which Package](http://www.tecmint.com/wp-content/uploads/2015/05/Find-Package-Information.png) + +Find Package Belongs to Which Package + +Now, when it comes to removing a package, you can do so with yum remove package. Easy, huh? This goes to show that yum is a complete and powerful package manager. + + # yum remove httpd + +Read Also: [20 Yum Commands to Manage RHEL 7 Package Management][1] + +### Good Old Plain RPM ### + +RPM (aka RPM Package Manager, or originally RedHat Package Manager) can also be used to install or update packages when they come in form of standalone `.rpm` packages. + +It is often utilized with the `-Uvh` flags to indicate that it should install the package if it’s not already present or attempt to update it if it’s installed `(-U)`, producing a verbose output `(-v)` and a progress bar with hash marks `(-h)` while the operation is being performed. For example, + + # rpm -Uvh package.rpm + +Another typical use of rpm is to produce a list of currently installed packages with code>rpm -qa (short for query all): + + # rpm -qa + +![Query All RPM Packages](http://www.tecmint.com/wp-content/uploads/2015/05/Query-All-RPM-Packages.png) + +Query All RPM Packages + +Read Also: [20 RPM Commands to Install Packages in RHEL 7][2] + +### Scheduling Tasks using Cron ### + +Linux and other Unix-like operating systems include a tool called cron that allows you to schedule tasks (i.e. commands or shell scripts) to run on a periodic basis. Cron checks every minute the /var/spool/cron directory for files which are named after accounts in /etc/passwd. + +When executing commands, any output is mailed to the owner of the crontab (or to the user specified in the MAILTO environment variable in the /etc/crontab, if it exists). + +Crontab files (which are created by typing crontab -e and pressing Enter) have the following format: + +![Crontab Entries](http://www.tecmint.com/wp-content/uploads/2015/05/Crontab-Format.png) + +Crontab Entries + +Thus, if we want to update the local file database (which is used by locate to find files by name or pattern) every second day of the month at 2:15 am, we need to add the following crontab entry: + + 15 02 2 * * /bin/updatedb + +The above crontab entry reads, “Run /bin/updatedb on the second day of the month, every month of the year, regardless of the day of the week, at 2:15 am”. As I’m sure you already guessed, the star symbol is used as a wildcard character. + +After adding a cron job, you can see that a file named root was added inside /var/spool/cron, as we mentioned earlier. That file lists all the tasks that the crond daemon should run: + + # ls -l /var/spool/cron + +![Check All Cron Jobs](http://www.tecmint.com/wp-content/uploads/2015/05/Check-All-Cron-Jobs.png) + +Check All Cron Jobs + +In the above image, the current user’s crontab can be displayed either using cat /var/spool/cron/root or, + + # crontab -l + +If you need to run a task on a more fine-grained basis (for example, twice a day or three times each month), cron can also help you to do that. + +For example, to run /my/script on the 1st and 15th of each month and send any output to /dev/null, you can add two crontab entries as follows: + + 01 00 1 * * /myscript > /dev/null 2>&1 + 01 00 15 * * /my/script > /dev/null 2>&1 + +But in order for the task to be easier to maintain, you can combine both entries into one: + + 01 00 1,15 * * /my/script > /dev/null 2>&1 + +Following the previous example, we can run /my/other/script at 1:30 am on the first day of the month every three months: + + 30 01 1 1,4,7,10 * /my/other/script > /dev/null 2>&1 + +But when you have to repeat a certain task every “x” minutes, hours, days, or months, you can divide the right position by the desired frequency. The following crontab entry has the exact same meaning as the previous one: + + 30 01 1 */3 * /my/other/script > /dev/null 2>&1 + +Or perhaps you need to run a certain job on a fixed frequency or after the system boots, for example. You can use one of the following string instead of the five fields to indicate the exact time when you want your job to run: + + @reboot Run when the system boots. + @yearly Run once a year, same as 00 00 1 1 *. + @monthly Run once a month, same as 00 00 1 * *. + @weekly Run once a week, same as 00 00 * * 0. + @daily Run once a day, same as 00 00 * * *. + @hourly Run once an hour, same as 00 * * * *. + +Read Also: [11 Commands to Schedule Cron Jobs in RHEL 7][3] + +### Locating and Checking Logs ### + +System logs are located (and rotated) inside the /var/log directory. According to the Linux Filesystem Hierarchy Standard, this directory contains miscellaneous log files, which are written to it or an appropriate subdirectory (such as audit, httpd, or samba in the image below) by the corresponding daemons during system operation: + + # ls /var/log + +![Linux Log Files Location](http://www.tecmint.com/wp-content/uploads/2015/05/Linux-Log-Files.png) + +Linux Log Files Location + +Other interesting logs are [dmesg][4] (contains all messages from kernel ring buffer), secure (logs connection attempts that require user authentication), messages (system-wide messages) and wtmp (records of all user logins and logouts). + +Logs are very important in that they allow you to have a glimpse of what is going on at all times in your system, and what has happened in the past. They represent a priceless tool to troubleshoot and monitor a Linux server, and thus are often used with the `tail -f command` to display events, in real time, as they happen and are recorded in a log. + +For example, if you want to display kernel-related events, type the following command: + + # tail -f /var/log/dmesg + +Same if you want to view access to your web server: + + # tail -f /var/log/httpd/access.log + +### Summary ### + +If you know how to efficiently manage packages, schedule tasks, and where to look for information about the current and past operation of your system you can rest assure that you will not run into surprises very often. I hope this article has helped you learn or refresh your knowledge about these basic skills. + +Don’t hesitate to drop us a line using the contact form below if you have any questions or comments. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/yum-package-management-cron-job-scheduling-monitoring-linux-logs/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ +[2]:http://www.tecmint.com/20-practical-examples-of-rpm-commands-in-linux/ +[3]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/ +[4]:http://www.tecmint.com/dmesg-commands/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 11--Firewall Essentials and Network Traffic Control Using FirewallD and Iptables.md b/sources/tech/RHCSA Series/RHCSA Series--Part 11--Firewall Essentials and Network Traffic Control Using FirewallD and Iptables.md new file mode 100644 index 0000000000..fd27f4c6fc --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 11--Firewall Essentials and Network Traffic Control Using FirewallD and Iptables.md @@ -0,0 +1,191 @@ +RHCSA Series: Firewall Essentials and Network Traffic Control Using FirewallD and Iptables – Part 11 +================================================================================ +In simple words, a firewall is a security system that controls the incoming and outgoing traffic in a network based on a set of predefined rules (such as the packet destination / source or type of traffic, for example). + +![Control Network Traffic with FirewallD and Iptables](http://www.tecmint.com/wp-content/uploads/2015/05/Control-Network-Traffic-Using-Firewall.png) + +RHCSA: Control Network Traffic with FirewallD and Iptables – Part 11 + +In this article we will review the basics of firewalld, the default dynamic firewall daemon in Red Hat Enterprise Linux 7, and iptables service, the legacy firewall service for Linux, with which most system and network administrators are well acquainted, and which is also available in RHEL 7. + +### A Comparison Between FirewallD and Iptables ### + +Under the hood, both firewalld and the iptables service talk to the netfilter framework in the kernel through the same interface, not surprisingly, the iptables command. However, as opposed to the iptables service, firewalld can change the settings during normal system operation without existing connections being lost. + +Firewalld should be installed by default in your RHEL system, though it may not be running. You can verify with the following commands (firewall-config is the user interface configuration tool): + + # yum info firewalld firewall-config + +![Check FirewallD Information](http://www.tecmint.com/wp-content/uploads/2015/05/Check-FirewallD-Information.png) + +Check FirewallD Information + +and, + + # systemctl status -l firewalld.service + +![Check FirewallD Status](http://www.tecmint.com/wp-content/uploads/2015/05/Check-FirewallD-Status.png) + +Check FirewallD Status + +On the other hand, the iptables service is not included by default, but can be installed through. + + # yum update && yum install iptables-services + +Both daemons can be started and enabled to start on boot with the usual systemd commands: + + # systemctl start firewalld.service | iptables-service.service + # systemctl enable firewalld.service | iptables-service.service + +Read Also: [Useful Commands to Manage Systemd Services][1] + +As for the configuration files, the iptables service uses `/etc/sysconfig/iptables` (which will not exist if the package is not installed in your system). On a RHEL 7 box used as a cluster node, this file looks as follows: + +![Iptables Firewall Configuration](http://www.tecmint.com/wp-content/uploads/2015/05/Iptables-Rules.png) + +Iptables Firewall Configuration + +Whereas firewalld store its configuration across two directories, `/usr/lib/firewalld` and `/etc/firewalld`: + + # ls /usr/lib/firewalld /etc/firewalld + +![FirewallD Configuration](http://www.tecmint.com/wp-content/uploads/2015/05/Firewalld-configuration.png) + +FirewallD Configuration + +We will examine these configuration files further later in this article, after we add a few rules here and there. By now it will suffice to remind you that you can always find more information about both tools with. + + # man firewalld.conf + # man firewall-cmd + # man iptables + +Other than that, remember to take a look at [Reviewing Essential Commands & System Documentation – Part 1][2] of the current series, where I described several sources where you can get information about the packages installed on your RHEL 7 system. + +### Using Iptables to Control Network Traffic ### + +You may want to refer to [Configure Iptables Firewall – Part 8][3] of the Linux Foundation Certified Engineer (LFCE) series to refresh your memory about iptables internals before proceeding further. Thus, we will be able to jump in right into the examples. + +**Example 1: Allowing both incoming and outgoing web traffic** + +TCP ports 80 and 443 are the default ports used by the Apache web server to handle normal (HTTP) and secure (HTTPS) web traffic. You can allow incoming and outgoing web traffic through both ports on the enp0s3 interface as follows: + + # iptables -A INPUT -i enp0s3 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT + # iptables -A OUTPUT -o enp0s3 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT + # iptables -A INPUT -i enp0s3 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT + # iptables -A OUTPUT -o enp0s3 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT + +**Example 2: Block all (or some) incoming connections from a specific network** + +There may be times when you need to block all (or some) type of traffic originating from a specific network, say 192.168.1.0/24 for example: + + # iptables -I INPUT -s 192.168.1.0/24 -j DROP + +will drop all packages coming from the 192.168.1.0/24 network, whereas, + + # iptables -A INPUT -s 192.168.1.0/24 --dport 22 -j ACCEPT + +will only allow incoming traffic through port 22. + +**Example 3: Redirect incoming traffic to another destination** + +If you use your RHEL 7 box not only as a software firewall, but also as the actual hardware-based one, so that it sits between two distinct networks, IP forwarding must have been already enabled in your system. If not, you need to edit `/etc/sysctl.conf` and set the value of net.ipv4.ip_forward to 1, as follows: + + net.ipv4.ip_forward = 1 + +then save the change, close your text editor and finally run the following command to apply the change: + + # sysctl -p /etc/sysctl.conf + +For example, you may have a printer installed at an internal box with IP 192.168.0.10, with the CUPS service listening on port 631 (both on the print server and on your firewall). In order to forward print requests from clients on the other side of the firewall, you should add the following iptables rule: + + # iptables -t nat -A PREROUTING -i enp0s3 -p tcp --dport 631 -j DNAT --to 192.168.0.10:631 + +Please keep in mind that iptables reads its rules sequentially, so make sure the default policies or later rules do not override those outlined in the examples above. + +### Getting Started with FirewallD ### + +One of the changes introduced with firewalld are zones. This concept allows to separate networks into different zones level of trust the user has decided to place on the devices and traffic within that network. + +To list the active zones: + + # firewall-cmd --get-active-zones + +In the example below, the public zone is active, and the enp0s3 interface has been assigned to it automatically. To view all the information about a particular zone: + + # firewall-cmd --zone=public --list-all + +![List all FirewallD Zones](http://www.tecmint.com/wp-content/uploads/2015/05/View-FirewallD-Zones.png) + +List all FirewallD Zones + +Since you can read more about zones in the [RHEL 7 Security guide][4], we will only list some specific examples here. + +**Example 4: Allowing services through the firewall** + +To get a list of the supported services, use. + + # firewall-cmd --get-services + +![List All Supported Services](http://www.tecmint.com/wp-content/uploads/2015/05/List-All-Supported-Services.png) + +List All Supported Services + +To allow http and https web traffic through the firewall, effective immediately and on subsequent boots: + + # firewall-cmd --zone=MyZone --add-service=http + # firewall-cmd --zone=MyZone --permanent --add-service=http + # firewall-cmd --zone=MyZone --add-service=https + # firewall-cmd --zone=MyZone --permanent --add-service=https + # firewall-cmd --reload + +If code>–zone is omitted, the default zone (you can check with firewall-cmd –get-default-zone) is used. + +To remove the rule, replace the word add with remove in the above commands. + +**Example 5: IP / Port forwarding** + +First off, you need to find out if masquerading is enabled for the desired zone: + + # firewall-cmd --zone=MyZone --query-masquerade + +In the image below, we can see that masquerading is enabled for the external zone, but not for public: + +![Check Masquerading Status in Firewalld](http://www.tecmint.com/wp-content/uploads/2015/05/Check-masquerading.png) + +Check Masquerading Status + +You can either enable masquerading for public: + + # firewall-cmd --zone=public --add-masquerade + +or use masquerading in external. Here’s what we would do to replicate Example 3 with firewalld: + + # firewall-cmd --zone=external --add-forward-port=port=631:proto=tcp:toport=631:toaddr=192.168.0.10 + +And don’t forget to reload the firewall. + +You can find further examples on [Part 9][5] of the RHCSA series, where we explained how to allow or disable the ports that are usually used by a web server and a ftp server, and how to change the corresponding rule when the default port for those services are changed. In addition, you may want to refer to the firewalld wiki for further examples. + +Read Also: [Useful FirewallD Examples to Configure Firewall in RHEL 7][6] + +### Conclusion ### + +In this article we have explained what a firewall is, what are the available services to implement one in RHEL 7, and provided a few examples that can help you get started with this task. If you have any comments, suggestions, or questions, feel free to let us know using the form below. Thank you in advance! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/firewalld-vs-iptables-and-control-network-traffic-in-firewall/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/manage-services-using-systemd-and-systemctl-in-linux/ +[2]:http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ +[3]:http://www.tecmint.com/configure-iptables-firewall/ +[4]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html +[5]:http://www.tecmint.com/rhcsa-series-install-and-secure-apache-web-server-and-ftp-in-rhel/ +[6]:http://www.tecmint.com/firewalld-rules-for-centos-7/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 12--Automate RHEL 7 Installations Using 'Kickstart'.md b/sources/tech/RHCSA Series/RHCSA Series--Part 12--Automate RHEL 7 Installations Using 'Kickstart'.md new file mode 100644 index 0000000000..a4365e311e --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 12--Automate RHEL 7 Installations Using 'Kickstart'.md @@ -0,0 +1,142 @@ +RHCSA Series: Automate RHEL 7 Installations Using ‘Kickstart’ – Part 12 +================================================================================ +Linux servers are rarely standalone boxes. Whether it is in a datacenter or in a lab environment, chances are that you have had to install several machines that will interact one with another in some way. If you multiply the time that it takes to install Red Hat Enterprise Linux 7 manually on a single server by the number of boxes that you need to set up, this can lead to a rather lengthy effort that can be avoided through the use of an unattended installation tool known as kickstart. + +In this article we will show what you need to use kickstart utility so that you can forget about babysitting servers during the installation process. + +![Automatic Kickstart Installation of RHEL 7](http://www.tecmint.com/wp-content/uploads/2015/05/Automatic-Kickstart-Installation-of-RHEL-7.jpg) + +RHCSA: Automatic Kickstart Installation of RHEL 7 + +#### Introducing Kickstart and Automated Installations #### + +Kickstart is an automated installation method used primarily by Red Hat Enterprise Linux (and other Fedora spin-offs, such as CentOS, Oracle Linux, etc.) to execute unattended operating system installation and configuration. Thus, kickstart installations allow system administrators to have identical systems, as far as installed package groups and system configuration are concerned, while sparing them the hassle of having to manually install each of them. + +### Preparing for a Kickstart Installation ### + +To perform a kickstart installation, we need to follow these steps: + +1. Create a Kickstart file, a plain text file with several predefined configuration options. + +2. Make the Kickstart file available on removable media, a hard drive or a network location. The client will use the rhel-server-7.0-x86_64-boot.iso file, whereas you will need to make the full ISO image (rhel-server-7.0-x86_64-dvd.iso) available from a network resource, such as a HTTP of FTP server (in our present case, we will use another RHEL 7 box with IP 192.168.0.18). + +3. Start the Kickstart installation + +To create a kickstart file, login to your Red Hat Customer Portal account, and use the [Kickstart configuration tool][1] to choose the desired installation options. Read each one of them carefully before scrolling down, and choose what best fits your needs: + +![Kickstart Configuration Tool](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-Configuration-Tool.png) + +Kickstart Configuration Tool + +If you specify that the installation should be performed either through HTTP, FTP, or NFS, make sure the firewall on the server allows those services. + +Although you can use the Red Hat online tool to create a kickstart file, you can also create it manually using the following lines as reference. You will notice, for example, that the installation process will be in English, using the latin american keyboard layout and the America/Argentina/San_Luis time zone: + + lang en_US + keyboard la-latin1 + timezone America/Argentina/San_Luis --isUtc + rootpw $1$5sOtDvRo$In4KTmX7OmcOW9HUvWtfn0 --iscrypted + #platform x86, AMD64, or Intel EM64T + text + url --url=http://192.168.0.18//kickstart/media + bootloader --location=mbr --append="rhgb quiet crashkernel=auto" + zerombr + clearpart --all --initlabel + autopart + auth --passalgo=sha512 --useshadow + selinux --enforcing + firewall --enabled + firstboot --disable + %packages + @base + @backup-server + @print-server + %end + +In the online configuration tool, use 192.168.0.18 for HTTP Server and `/kickstart/tecmint.bin` for HTTP Directory in the Installation section after selecting HTTP as installation source. Finally, click the Download button at the right top corner to download the kickstart file. + +In the kickstart sample file above, you need to pay careful attention to. + + url --url=http://192.168.0.18//kickstart/media + +That directory is where you need to extract the contents of the DVD or ISO installation media. Before doing that, we will mount the ISO installation file in /media/rhel as a loop device: + + # mount -o loop /var/www/html/kickstart/rhel-server-7.0-x86_64-dvd.iso /media/rhel + +![Mount RHEL ISO Image](http://www.tecmint.com/wp-content/uploads/2015/05/Mount-RHEL-ISO-Image.png) + +Mount RHEL ISO Image + +Next, copy all the contents of /media/rhel to /var/www/html/kickstart/media: + + # cp -R /media/rhel /var/www/html/kickstart/media + +When you’re done, the directory listing and disk usage of /var/www/html/kickstart/media should look as follows: + +![Kickstart Media Files](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-media-Files.png) + +Kickstart Media Files + +Now we’re ready to kick off the kickstart installation. + +Regardless of how you choose to create the kickstart file, it’s always a good idea to check its syntax before proceeding with the installation. To do that, install the pykickstart package. + + # yum update && yum install pykickstart + +And then use the ksvalidator utility to check the file: + + # ksvalidator /var/www/html/kickstart/tecmint.bin + +If the syntax is correct, you will not get any output, whereas if there’s an error in the file, you will get a warning notice indicating the line where the syntax is not correct or unknown. + +### Performing a Kickstart Installation ### + +To start, boot your client using the rhel-server-7.0-x86_64-boot.iso file. When the initial screen appears, select Install Red Hat Enterprise Linux 7.0 and press the Tab key to append the following stanza and press Enter: + + # inst.ks=http://192.168.0.18/kickstart/tecmint.bin + +![RHEL Kickstart Installation](http://www.tecmint.com/wp-content/uploads/2015/05/RHEL-Kickstart-Installation.png) + +RHEL Kickstart Installation + +Where tecmint.bin is the kickstart file created earlier. + +When you press Enter, the automated installation will begin, and you will see the list of packages that are being installed (the number and the names will differ depending on your choice of programs and package groups): + +![Automatic Kickstart Installation of RHEL 7](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-Automatic-Installation.png) + +Automatic Kickstart Installation of RHEL 7 + +When the automated process ends, you will be prompted to remove the installation media and then you will be able to boot into your newly installed system: + +![RHEL 7 Boot Screen](http://www.tecmint.com/wp-content/uploads/2015/05/RHEL-7.png) + +RHEL 7 Boot Screen + +Although you can create your kickstart files manually as we mentioned earlier, you should consider using the recommended approach whenever possible. You can either use the online configuration tool, or the anaconda-ks.cfg file that is created by the installation process in root’s home directory. + +This file actually is a kickstart file, so you may want to install the first box manually with all the desired options (maybe modify the logical volumes layout or the file system on top of each one) and then use the resulting anaconda-ks.cfg file to automate the installation of the rest. + +In addition, using the online configuration tool or the anaconda-ks.cfg file to guide future installations will allow you to perform them using an encrypted root password out-of-the-box. + +### Conclusion ### + +Now that you know how to create kickstart files and how to use them to automate the installation of Red Hat Enterprise Linux 7 servers, you can forget about babysitting the installation process. This will give you time to do other things, or perhaps some leisure time if you’re lucky. + +Either way, let us know what you think about this article using the form below. Questions are also welcome! + +Read Also: [Automated Installations of Multiple RHEL/CentOS 7 Distributions using PXE and Kickstart][2] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/automatic-rhel-installations-using-kickstart/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://access.redhat.com/labs/kickstartconfig/ +[2]:http://www.tecmint.com/multiple-centos-installations-using-kickstart/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 13--Mandatory Access Control Essentials with SELinux in RHEL 7.md b/sources/tech/RHCSA Series/RHCSA Series--Part 13--Mandatory Access Control Essentials with SELinux in RHEL 7.md new file mode 100644 index 0000000000..1a0d08df8f --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 13--Mandatory Access Control Essentials with SELinux in RHEL 7.md @@ -0,0 +1,176 @@ +RHCSA Series: Mandatory Access Control Essentials with SELinux in RHEL 7 – Part 13 +================================================================================ +During this series we have explored in detail at least two access control methods: standard ugo/rwx permissions ([Manage Users and Groups – Part 3][1]) and access control lists ([Configure ACL’s on File Systems – Part 7][2]). + +![RHCSA Exam: SELinux Essentials and Control FileSystem Access](http://www.tecmint.com/wp-content/uploads/2015/06/SELinux-Control-File-System-Access.png) + +RHCSA Exam: SELinux Essentials and Control FileSystem Access + +Although necessary as first level permissions and access control mechanisms, they have some limitations that are addressed by Security Enhanced Linux (aka SELinux for short). + +One of such limitations is that a user can expose a file or directory to a security breach through a poorly elaborated chmod command and thus cause an unexpected propagation of access rights. As a result, any process started by that user can do as it pleases with the files owned by the user, where finally a malicious or otherwise compromised software can achieve root-level access to the entire system. + +With those limitations in mind, the United States National Security Agency (NSA) first devised SELinux, a flexible mandatory access control method, to restrict the ability of processes to access or perform other operations on system objects (such as files, directories, network ports, etc) to the least permission model, which can be modified later as needed. In few words, each element of the system is given only the access required to function. + +In RHEL 7, SELinux is incorporated into the kernel itself and is enabled in Enforcing mode by default. In this article we will explain briefly the basic concepts associated with SELinux and its operation. + +### SELinux Modes ### + +SELinux can operate in three different ways: + +- Enforcing: SELinux denies access based on SELinux policy rules, a set of guidelines that control the security engine. +- Permissive: SELinux does not deny access, but denials are logged for actions that would have been denied if running in enforcing mode. +- Disabled (self-explanatory). + +The `getenforce` command displays the current mode of SELinux, whereas `setenforce` (followed by a 1 or a 0) is used to change the mode to Enforcing or Permissive, respectively, during the current session only. + +In order to achieve persistence across logouts and reboots, you will need to edit the `/etc/selinux/config` file and set the SELINUX variable to either enforcing, permissive, or disabled: + + # getenforce + # setenforce 0 + # getenforce + # setenforce 1 + # getenforce + # cat /etc/selinux/config + +![Set SELinux Mode](http://www.tecmint.com/wp-content/uploads/2015/05/Set-SELinux-Mode.png) + +Set SELinux Mode + +Typically you will use setenforce to toggle between SELinux modes (enforcing to permissive and back) as a first troubleshooting step. If SELinux is currently set to enforcing while you’re experiencing a certain problem, and the same goes away when you set it to permissive, you can be confident you’re looking at a SELinux permissions issue. + +### SELinux Contexts ### + +A SELinux context consists of an access control environment where decisions are made based on SELinux user, role, and type (and optionally a level): + +- A SELinux user complements a regular Linux user account by mapping it to a SELinux user account, which in turn is used in the SELinux context for processes in that session, in order to explicitly define their allowed roles and levels. +- The concept of role acts as an intermediary between domains and SELinux users in that it defines which process domains and file types can be accessed. This will shield your system against vulnerability to privilege escalation attacks. +- A type defines an SELinux file type or an SELinux process domain. Under normal circumstances, processes are prevented from accessing files that other processes use, and and from accessing other processes, thus access is only allowed if a specific SELinux policy rule exists that allows it. + +Let’s see how all of that works through the following examples. + +**EXAMPLE 1: Changing the default port for the sshd daemon** + +In [Securing SSH – Part 8][3] we explained that changing the default port where sshd listens on is one of the first security measures to secure your server against external attacks. Let’s edit the `/etc/ssh/sshd_config` file and set the port to 9999: + + Port 9999 + +Save the changes, and restart sshd: + + # systemctl restart sshd + # systemctl status sshd + +![Change SSH Port](http://www.tecmint.com/wp-content/uploads/2015/05/Change-SSH-Port.png) + +Restart SSH Service + +As you can see, sshd has failed to start. But what happened? + +A quick inspection of `/var/log/audit/audit.log` indicates that sshd has been denied permissions to start on port 9999 (SELinux log messages include the word “AVC” so that they might be easily identified from other messages) because that is a reserved port for the JBoss Management service: + + # cat /var/log/audit/audit.log | grep AVC | tail -1 + +![Inspect SSH Logs](http://www.tecmint.com/wp-content/uploads/2015/05/Inspect-SSH-Logs.png) + +Inspect SSH Logs + +At this point you could disable SELinux (but don’t!) as explained earlier and try to start sshd again, and it should work. However, the semanage utility can tell us what we need to change in order for us to be able to start sshd in whatever port we choose without issues. + +Run, + + # semanage port -l | grep ssh + +to get a list of the ports where SELinux allows sshd to listen on. + +![Semanage Tool](http://www.tecmint.com/wp-content/uploads/2015/05/SELinux-Permission.png) + +Semanage Tool + +So let’s change the port in /etc/ssh/sshd_config to Port 9998, add the port to the ssh_port_t context, and then restart the service: + + # semanage port -a -t ssh_port_t -p tcp 9998 + # systemctl restart sshd + # systemctl is-active sshd + +![Semanage Add Port](http://www.tecmint.com/wp-content/uploads/2015/05/Semenage-Add-Port.png) + +Semanage Add Port + +As you can see, the service was started successfully this time. This example illustrates the fact that SELinux controls the TCP port number to its own port type internal definitions. + +**EXAMPLE 2: Allowing httpd to send access sendmail** + +This is an example of SELinux managing a process accessing another process. If you were to implement mod_security and mod_evasive along with Apache in your RHEL 7 server, you need to allow httpd to access sendmail in order to send a mail notification in the wake of a (D)DoS attack. In the following command, omit the -P flag if you do not want the change to be persistent across reboots. + + # semanage boolean -1 | grep httpd_can_sendmail + # setsebool -P httpd_can_sendmail 1 + # semanage boolean -1 | grep httpd_can_sendmail + +![Allow Apache to Send Mails](http://www.tecmint.com/wp-content/uploads/2015/05/Allow-Apache-to-Send-Mails.png) + +Allow Apache to Send Mails + +As you can tell from the above example, SELinux boolean settings (or just booleans) are true / false rules embedded into SELinux policies. You can list all the booleans with `semanage boolean -l`, and alternatively pipe it to grep in order to filter the output. + +**EXAMPLE 3: Serving a static site from a directory other than the default one** + +Suppose you are serving a static website using a different directory than the default one (`/var/www/html`), say /websites (this could be the case if you’re storing your web files in a shared network drive, for example, and need to mount it at /websites). + +a). Create an index.html file inside /websites with the following contents: + + +

SELinux test

+ + +If you do, + + # ls -lZ /websites/index.html + +you will see that the index.html file has been labeled with the default_t SELinux type, which Apache can’t access: + +![Check SELinux File Permission](http://www.tecmint.com/wp-content/uploads/2015/05/Check-File-Permssion.png) + +Check SELinux File Permission + +b). Change the DocumentRoot directive in `/etc/httpd/conf/httpd.conf` to /websites and don’t forget to update the corresponding Directory block. Then, restart Apache. + +c). Browse to `http://`, and you should get a 503 Forbidden HTTP response. + +d). Next, change the label of /websites, recursively, to the httpd_sys_content_t type in order to grant Apache read-only access to that directory and its contents: + + # semanage fcontext -a -t httpd_sys_content_t "/websites(/.*)?" + +e). Finally, apply the SELinux policy created in d): + + # restorecon -R -v /websites + +Now restart Apache and browse to `http://` again and you will see the html file displayed correctly: + +![Verify Apache Page](http://www.tecmint.com/wp-content/uploads/2015/05/08part13.png) + +Verify Apache Page + +### Summary ### + +In this article we have gone through the basics of SELinux. Note that due to the vastness of the subject, a full detailed explanation is not possible in a single article, but we believe that the principles outlined in this guide will help you to move on to more advanced topics should you wish to do so. + +If I may, let me recommend two essential resources to start with: the [NSA SELinux page][4] and the [RHEL 7 SELinux User’s and Administrator’s][5] guide. + +Don’t hesitate to let us know if you have any questions or comments. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/selinux-essentials-and-control-filesystem-access/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/rhcsa-exam-manage-users-and-groups +[2]:http://www.tecmint.com/rhcsa-exam-configure-acls-and-mount-nfs-samba-shares/ +[3]:http://www.tecmint.com/rhcsa-series-secure-ssh-set-hostname-enable-network-services-in-rhel-7/ +[4]:https://www.nsa.gov/research/selinux/index.shtml +[5]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/SELinux_Users_and_Administrators_Guide/part_I-SELinux.html \ No newline at end of file From 052047b2f0a378904493f2bfc9f42b87c6c22799 Mon Sep 17 00:00:00 2001 From: wolf <522858454@qq.com> Date: Tue, 9 Jun 2015 14:55:26 +0800 Subject: [PATCH 016/153] translating by chenzhijun --- ...o access Feedly RSS feed from the command line on Linux.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md b/sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md index 58a0841280..16dccd8f8e 100644 --- a/sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md +++ b/sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md @@ -1,3 +1,5 @@ +translating by chenzhijun + How to access Feedly RSS feed from the command line on Linux ================================================================================ In case you didn't know, [Feedly][1] is one of the most popular online news aggregation services. It offers seamlessly unified news reading experience across desktops, Android and iOS devices via browser extensions and mobile apps. Feedly took on the demise of Google Reader in 2013, quickly gaining a lot of then Google Reader users. I was one of them, and Feedly has remained my default RSS reader since then. @@ -103,4 +105,4 @@ via: http://xmodulo.com/feedly-rss-feed-command-line-linux.html [a]:http://xmodulo.com/author/nanni [1]:https://feedly.com/ [2]:https://github.com/Jarkore/Feednix -[3]:https://aur.archlinux.org/packages/feednix/ \ No newline at end of file +[3]:https://aur.archlinux.org/packages/feednix/ From d8936df91b3097514e9fe8686beef2e2b028eed0 Mon Sep 17 00:00:00 2001 From: wwy-hust Date: Tue, 9 Jun 2015 16:13:34 +0800 Subject: [PATCH 017/153] finish translation --- ... Great for Remote Editing and Much More.md | 221 ------------------ ... Great for Remote Editing and Much More.md | 214 +++++++++++++++++ 2 files changed, 214 insertions(+), 221 deletions(-) delete mode 100644 sources/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md create mode 100644 translated/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md diff --git a/sources/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md b/sources/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md deleted file mode 100644 index b54a7b158f..0000000000 --- a/sources/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md +++ /dev/null @@ -1,221 +0,0 @@ -translating by wwy-hust - -Compact Text Editors Great for Remote Editing and Much More -================================================================================ -A text editor is software used for editing plain text files. This type of software has many different uses including modifying configuration files, writing programming language source code, jotting down thoughts, or even making a grocery list. Given that editors can be used for such a diverse range of activities, it is worth spending the time finding an editor that best suites your preferences. - -Whatever the level of sophistication of the editor, they typically have a common set of functionality, such as searching/replacing text, formatting text, importing files, as well as moving text within the file. - -All of these text editors are console based applications which make them ideal for editing files on remote machines. Textadept also provides a graphical user interface, but remains fast and minimalist. - -Console based applications are also light on system resources (very useful on low spec machines), can be faster and more efficient than their graphical counterparts, they do not stop working when X needs to be restarted, and are great for scripting purposes. - -I have selected my favorite open source text editors that are frugal on system resources. - ----------- - -### Textadept ### - -![](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Textadept.png) - -Textadept is a fast, minimalist, and extensible cross-platform open source text editor for programmers. This open source application is written in a mixture of C and Lua and has been optimized for speed and minimalism over the years. - -Textadept is an ideal editor for programmers who want endless extensibility options without sacrificing speed or succumbing to code bloat and featuritis. - -There is also a version available for the terminal, which only depends on ncurses; great for editing on remote machines. - -#### Features include: #### - - -- Lightweight -- Minimal design maximizes screen real estate -- Self-contained executable – no installation necessary -- Entirely keyboard driven -- Unlimited split views (GUI version) split the editor window as many times as you like either horizontally or vertically. Please note that Textadept is not a tabbed editor -- Support for over 80 programming languages -- Powerful snippets and key commands -- Code autocompletion and API lookup -- Unparalleled extensibility -- Bookmarks -- Find and Replace -- Find in Files -- Buffer-based word completion -- Adeptsense autocomplete symbols for programming languages and display API documentation -- Themes: light, dark, and term -- Uses lexers to assign names to buffer elements like comments, strings, and keywords -- Sessions -- Snapopen -- Available modules include support for Java, Python, Ruby and recent file lists -- Conforms with the Gnome HIG Human Interface Guidelines -- Modules include support for Java, Python, Ruby and recent file lists -- Support for editing Lua code. Syntax autocomplete and LuaDoc is available for many Textadept objects as well as Lua’s standard libraries - -- Website: [foicica.com/textadept][1] -- Developer: Mitchell and contributors -- License: MIT License -- Version Number: 7.7 - ----------- - -### Vim ### - -![](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-vim.png) - -Vim is an advanced text editor that seeks to provide the power of the editor 'Vi', with a more complete feature set. - -This editor is very useful for editing programs and other plain ASCII files. All commands are given with normal keyboard characters, so those who can type with ten fingers can work very fast. Additionally, function keys can be defined by the user, and the mouse can be used. - -Vim is often called a "programmer's editor," and is so useful for programming that many consider it to be an entire Integrated Development Environment. However, this application is not only intended for programmers. Vim is highly regarded for all kinds of text editing, from composing email to editing configuration files. - -Vim's interface is based on commands given in a text user interface. Although its graphical user interface, gVim, adds menus and toolbars for commonly used commands, the software's entire functionality is still reliant on its command line mode. - -#### Features include: #### - - -- 3 modes: -- - Command mode -- - Insert mode -- - Command line mode -- Unlimited undo -- Multiple windows and buffers -- Flexible insert mode -- Syntax highlighting highlight portions of the buffer in different colors or styles, based on the type of file being edited -- Interactive commands -- - Marking a line -- - vi line buffers -- - Shift a block of code -- Block operators -- Command line history -- Extended regular expressions -- Edit compressed/archive files (gzip, bzip2, zip, tar) -- Filename completion -- Block operations -- Jump tags -- Folding text -- Indenting -- ctags and cscope intergration -- 100% vi compatibility mode -- Plugins to add/extend functionality -- Macros -- vimscript, Vim's internal scripting language -- Unicode support -- Multi-language support -- Integrated On-line help - -- Website: [www.vim.org][2] -- Developer: Bram Moolenaar -- License: GNU GPL compatible (charityware) -- Version Number: 7.4 - ----------- - -### ne ### - -![](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-ne.png) - -ne is a full screen open source text editor. It is intended to be an easier to learn alternative to vi, yet still portable across POSIX-compliant operating systems. - -ne is easy to use for the beginner, but powerful and fully configurable for the wizard, and most sparing in its resource usage. - -#### Features include: #### - - -- Three user interfaces: control keystrokes, command line, and menus; keystrokes and menus are completely configurable -- Syntax highlighting -- Full support for UTF-8 files, including multiple-column characters -- The number of documents and clips, the dimensions of the display, and the file/line lengths are limited only by the integer size of the machine -- Simple scripting language where scripts can be generated via an idiotproof record/play method -- Unlimited undo/redo capability (can be disabled with a command) -- Automatic preferences system based on the extension of the file name being edited -- Automatic completion of prefixes using words in your documents as dictionary -- File requester with completion features for easy file retrieval; -- Extended regular expression search and replace à la emacs and vi -- A very compact memory model easily load and modify very large files -- Editing of binary files - -- Website: [ne.di.unimi.it][3] -- Developer: Sebastiano Vigna (original developer). Additional features added by Todd M. Lewis -- License: GNU GPL v3 -- Version Number: 2.5 - ----------- - -### Zile ### - -![](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Zile.png) - -Zile Is Lossy Emacs (Zile) is a small Emacs clone. Zile is a customizable, self-documenting real-time display editor. Zile was written to be as similar as possible to Emacs; every Emacs user should feel comfortable with Zile. - -Zile is distinguished by a very small RAM memory footprint, of approximately 130kB, and quick editing sessions. It is 8-bit clean, allowing it to be used on any sort of file. - -#### Features include: #### - -- Small but fast and powerful -- Multi buffer editing with multi level undo -- Multi window -- Killing, yanking and registers -- Minibuffer completion -- Auto fill (word wrap) -- Registers -- Looks like Emacs. Key sequences, function and variable names are identical with Emacs's -- Killing -- Yanking -- Auto line ending detection - -- Website: [www.gnu.org/software/zile][4] -- Developer: Reuben Thomas, Sandro Sigala, David A. Capello -- License: GNU GPL v2 -- Version Number: 2.4.11 - ----------- - -### nano ### - -![](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-nano.png) - -nano is a curses-based text editor. It is a clone of Pico, the editor of the Pine email client. - -The nano project was started in 1999 due to licensing issues with the Pine suite (Pine was not distributed under a free software license), and also because Pico lacked some essential features. - -nano aims to emulate the functionality and easy-to-use interface of Pico, while offering additional functionality, but without the tight mailer integration of the Pine/Pico package. - -nano, like Pico, is keyboard-oriented, controlled with control keys. - -#### Features include: #### - -- Interactive search and replace -- Color syntax highlighting -- Go to line and column number -- Auto-indentation -- Feature toggles -- UTF-8 support -- Mixed file format auto-conversion -- Verbatim input mode -- Multiple file buffers -- Smooth scrolling -- Bracket matching -- Customizable quoting string -- Backup files -- Internationalization support -- Filename tab completion - -- Website: [nano-editor.org][5] -- Developer: Chris Allegretta, David Lawrence, Jordi Mallach, Adam Rogoyski, Robert Siemborski, Rocco Corsi, David Benbennick, Mike Frysinger -- License: GNU GPL v3 -- Version Number: 2.2.6 - --------------------------------------------------------------------------------- - -via: http://www.linuxlinks.com/article/20141011073917230/TextEditors.html - -作者:Frazer Kline -译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://foicica.com/textadept/ -[2]:http://www.vim.org/ -[3]:http://ne.di.unimi.it/ -[4]:http://www.gnu.org/software/zile/ -[5]:http://nano-editor.org/ diff --git a/translated/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md b/translated/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md new file mode 100644 index 0000000000..766f429ba0 --- /dev/null +++ b/translated/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md @@ -0,0 +1,214 @@ +ʺԶ̱༭Լ໷ļı༭ +================================================================================ +ı༭༭ıô޸ļдԴ룬һЩ뷨дһݹбֱ༭ܶ಻ͬĻֵûЩʱһʺϲõı༭ + +۱༭жôӣͨһͬĹܼ/滻ıʽıļԼļƶı + +Щı༭ǻն˵ӦãǺʺԶϱ༭ļı༭ͨҲṩһͼλû棬ɻᱣ֤ٺС + +ն˵ӦóϵͳԴҲģڵûϺãͼλ汾Ҳ졢ЧXҪʱҲֹͣ˷dzʺϱдű + +ѡһЩϲĿԴı༭ʹϵͳԴ涼dzڼ + +---------- + +### Textadept ### + +![](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Textadept.png) + +TextadeptһʺϳԱģ١Сչƽ̨ĿԴı༭ԴCLuaдͣЩٶȺСŻ + +TextadeptЩҪ޵չҲԸٶȻڴ͵ijԱǵ༭ + +Ҳһն˵İ汾ncursesʺԶϽб༭ + +#### ܰ: #### + +- +- СĻ +- ԰ִļ - 谲װ +- ȫ +- ƵķָͼGUI汾ˮƽֱķָ༭ڡעTextadeptûдļǩ +- ֶ֧80ֵı +- ǿƬο +- ԶȫAPIѯ +- ױȵչ +- ǩ +- Һ滻 +- ļв +- ڻĵʲȫ +- ıԷԶȫԼʾAPIĵĹ +- ⣺ڰն +- ʹôʷƷԪأַۡؼ +- Զ̻Ự +- ٴ +- õģ飬JavaPythonRubyͽڴļб֧ +- Gnome HIGûӿڵָ +- ֱ֧༭Lua롣﷨ԶȫLuaDocTextadeptLuaı׼⡣ + +- ַ: [foicica.com/textadept][1] +- : Mitchell and contributors +- ֤: MIT License +- 汾: 7.7 + +---------- + +### Vim ### + +![](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-vim.png) + +vimһ߼ı༭'vi'ǿ󣬲ӵиȫĹܼ + +༭Ա̺ͱ༭ASCIIļʮáеͨļַṩܹʹʮָ룬ʮֿݡ⣬ܼû壬ҿҲʹꡣ + +Vimͨ"Աı༭"ʮʺڱ̣ΪΪļɿȻǽԱVim߶Ӹı༭ӱдemail޸ļ + +VimĽӿڻıµСͼλ汾gVimΪõ˲˵͹ģʽ + +#### ܰ: #### + +- 3 ģʽ: +- - Command ģʽ +- - Insert ģʽ +- - Command line ģʽ +- Ƶij +- ںͻ +- ƽģʽ +- ༭ļʹòͬɫ﷨ +- +- - һ +- - vi л +- - ƶ +- +- ʷ +- չʽ +- ༭ѹ/ļ (gzip, bzip2, zip, tar) +- ļȫ +- ת +- ۵ı +- +- ctagscscope +- 100%viģʽ +- /չ +- +- vimscript, Vimڲű +- Unicode֧ +- ֧ +- ֧߰ + +- ַ: [www.vim.org][2] +- : Bram Moolenaar +- ֤: GNU GPL compatible (charityware) +- 汾: 7.4 + +---------- + +### ne ### + +![](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-ne.png) + +neһȫĻĿԴı༭һviѧϰviҿPOSIX-ݵϵͳбЯʹá + +ne˵ʹãҲdzǿȫõ򣬲ԴʹʮֽԼ + +#### ܰ: #### + +- ûӿڣ ƻкͲ˵Ͳ˵ +- ﷨ +- UTF-8ļȫַ֧֣ +- ĵУʾάȺļ/кųȶбţҽڻֳ +- 򵥵Ľűԣűü¼/ŵķʽ +- Ƶij/ܣͨã +- ڱ༭ļչԶԻϵͳ +- ʹĵеĴֵԶǰ׺ȫ +- õļȡ +- չʽڲҺ滻emacsvi +- dzյڴģͣڼغ޸Ĵļʱʮֿ +- ɱ༭ļ + +- ַ: [ne.di.unimi.it][3] +- : Sebastiano Vigna (original developer). Additional features added by Todd M. Lewis +- ֤: GNU GPL v3 +- 汾: 2.5 + +---------- + +### Zile ### + +![](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Zile.png) + +ZileLossy EmacsEmacs棩һС͵EmacsĿ¡档ZileһɶƵģĵʵʱʾı༭ڱдZileʱEmacsһܵСÿEmacsûZileеС + +ZileСRAMԼ130KBԼٿʼ༭8ģڱдκļ + +#### ܰ: #### + +- С͵١ǿ +- ༶ij +- ര +- ã̫ô롿 +- СĻɲȫ +- Զ (Զ) +- Ĵͼ +- EmacsСܺͱEmacsͬ +- Killing +- Yanking +- Զĩ + +- ַ: [www.gnu.org/software/zile][4] +- : Reuben Thomas, Sandro Sigala, David A. Capello +- ֤: GNU GPL v2 +- 汾: 2.4.11 + +---------- + +### nano ### + +![](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-nano.png) + +nanoǻcursesı༭PicoPineʼͻ˱༭һ̰档 + +Pine֤ϰPineδԿԴ֤ҲΪPineȱһЩҪĹܣnanoĿ1999꿪ʼ + +nanoڸPicoĹܺԣͬʱṩĹܣPine/Picoʼͻˡ + +nanoPicoһԼΪƣÿƼơ + +#### ܰ: #### + +- ʽIJҺ滻 +- ɫ﷨ +- תкźкŴ +- Զ +- ܿ +- ֧UTF-8 +- ͵ļԶת +- ģʽ +- ļ +- ƽ +- ƥ +- Զַ +- ļ +- ʻ֧ +- tabȫļ + +- ַ: [nano-editor.org][5] +- : Chris Allegretta, David Lawrence, Jordi Mallach, Adam Rogoyski, Robert Siemborski, Rocco Corsi, David Benbennick, Mike Frysinger +- ֤: GNU GPL v3 +- 汾: 2.2.6 + +-------------------------------------------------------------------------------- + +via: http://www.linuxlinks.com/article/20141011073917230/TextEditors.html + +ߣFrazer Kline +ߣ[wwy-hust](https://github.com/wwy-hust) +Уԣ[УID](https://github.com/УID) + + [LCTT](https://github.com/LCTT/TranslateProject) ԭ룬[Linuxй](http://linux.cn/) Ƴ + +[1]:http://foicica.com/textadept/ +[2]:http://www.vim.org/ +[3]:http://ne.di.unimi.it/ +[4]:http://www.gnu.org/software/zile/ +[5]:http://nano-editor.org/ From 30385454a87058b0b152370a48edc81bb22cfa65 Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Tue, 9 Jun 2015 16:45:22 +0800 Subject: [PATCH 018/153] Translating by ZTinoZ --- ...526 20 Useful Terminal Emulators for Linux.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index bafcc15d71..5d8b38e80c 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -58,14 +58,14 @@ Guake Terminal Yakuake (Yet Another Kuake) 是一款基于KDE的下拉式终端仿真器,它与Guake再功能上非常相似。它的射击构思也是受FPS游戏的启发例如Quake。 -Yakuake is basically a KDE application, which can be easily installed on KDE desktop, but if you try to install Yakuake in GNOME desktop, it will prompt you to install huge number of dependency packages. +Yakuake主要是一款KDE应用程序,它能非常轻松地安装在KDE桌面上,但是如果你试着将它安装在GNOME桌面上,你将会安装大量的依赖包。 #### Yakuake的特性 #### -- Fluently turn down from the top of your screen -- Tabbed interface -- Configurable dimensions and animation speed -- Customizable +- 从屏幕顶端弹回顺畅 +- 选项卡式界面 +- 可配置的尺寸和动画速度 +- 可定制 ![Yakuake Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Yakuake-Terminal.jpeg) @@ -75,9 +75,9 @@ Yakuake Terminal ### 5. ROXTerm ### -ROXterm is yet another lightweight terminal emulator designed to provide similar features to gnome-terminal. It was originally constructed to have lesser footprints and faster start-up time by not using the Gnome libraries and by using a independent applet to bring the configuration interface (GUI), but over the time it’s role has shifted to bringing a higher range of features for power users. +ROXterm又是一款轻量级终端仿真器,旨在提供与GNOME终端相似的特性。它原本创造出来是为了通过不使用Gnome库从而拥有更少的占用空间和更快的启动速度并使用独立的小程序来建立配置界面(GUI), 但是随着时间的流逝,它的角色就转变为给那些老牌用户带来更高一层的特性。 -However, it is more customizable than gnome-terminal and anticipated more at “power” users who make excessive use of terminals. It is easily integrated with GNOME desktop environment and provides features like drag & drop of items into terminal. +然而,它比GNOME终端更加具有可制定性并且对于那些经常使用终端的老牌用户更令人期望。它能和GNOME桌面环境完美结合并在终端中提供像拖拽项目那样的特性。 ![Roxterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Roxterm-Terminal.jpeg) @@ -264,7 +264,7 @@ rxvt unicode - [rxvt-unicode][21] -If you know any other capable Linux terminal emulators that I’ve not included in the above list, please do share with me using our comment section. +如果你知道任何其它强大的Linux终端仿真器而上文未提及,欢迎在评论中与我们分享。 -------------------------------------------------------------------------------- From 81671c6898ca1688f9266bb5d9a9e7fc939a4325 Mon Sep 17 00:00:00 2001 From: wwy Date: Tue, 9 Jun 2015 23:46:00 +0800 Subject: [PATCH 019/153] Update 20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md --- ...s Her Interview Experience on Linux 'iptables' Firewall.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md b/sources/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md index 2ba7334580..ca51791986 100644 --- a/sources/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md +++ b/sources/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md @@ -1,3 +1,5 @@ +translating by wwy-hust + Nishita Agarwal Shares Her Interview Experience on Linux ‘iptables’ Firewall ================================================================================ Nishita Agarwal, a frequent Tecmint Visitor shared her experience (Question and Answer) with us regarding the job interview she had just given in a privately owned hosting company in Pune, India. She was asked a lot of questions on a variety of topics however she is an expert in iptables and she wanted to share those questions and their answer (she gave) related to iptables to others who may be going to give interview in near future. @@ -204,4 +206,4 @@ via: http://www.tecmint.com/linux-firewall-iptables-interview-questions-and-answ 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/install-webmin-web-based-system-administration-tool-for-rhel-centos-fedora/ \ No newline at end of file +[1]:http://www.tecmint.com/install-webmin-web-based-system-administration-tool-for-rhel-centos-fedora/ From 05a0ac68326f2d3c7e72686a706f79f958e903dc Mon Sep 17 00:00:00 2001 From: wxy Date: Wed, 10 Jun 2015 09:50:01 +0800 Subject: [PATCH 020/153] PUB:20150506 Linux FAQs with Answers--How to install Shrew Soft IPsec VPN client on Linux @GOLinux --- ... to install Shrew Soft IPsec VPN client on Linux.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename {translated/tech => published}/20150506 Linux FAQs with Answers--How to install Shrew Soft IPsec VPN client on Linux.md (88%) diff --git a/translated/tech/20150506 Linux FAQs with Answers--How to install Shrew Soft IPsec VPN client on Linux.md b/published/20150506 Linux FAQs with Answers--How to install Shrew Soft IPsec VPN client on Linux.md similarity index 88% rename from translated/tech/20150506 Linux FAQs with Answers--How to install Shrew Soft IPsec VPN client on Linux.md rename to published/20150506 Linux FAQs with Answers--How to install Shrew Soft IPsec VPN client on Linux.md index abe1d3943d..56f57a5020 100644 --- a/translated/tech/20150506 Linux FAQs with Answers--How to install Shrew Soft IPsec VPN client on Linux.md +++ b/published/20150506 Linux FAQs with Answers--How to install Shrew Soft IPsec VPN client on Linux.md @@ -1,9 +1,9 @@ -Linux有问必答——Linux上如何安装Shrew Soft IPsec VPN +Linux有问必答:Linux上如何安装Shrew Soft IPsec VPN ================================================================================ -> **Question**: I need to connect to an IPSec VPN gateway. For that, I'm trying to use Shrew Soft VPN client, which is available for free. How can I install Shrew Soft VPN client on [insert your Linux distro]? -> **问题**:我需要连接到一个IPSec VPN网关,鉴于此,我尝试使用Shrew Soft VPN客户端,它是一个免费版本。我怎样才能安装Shrew Soft VPN客户端到[插入你的Linux发行版]? -市面上有许多商业VPN网关,同时附带有他们自己的专有VPN客户端软件。虽然也有许多开源的VPN服务器/客户端备选方案,但它们通常缺乏复杂的IPsec支持,比如互联网密钥交换(IKE),这是一个标准的IPsec协议,用于加固VPN密钥交换和验证安全。Shrew Soft VPN是一个免费的IPsec VPN客户端,它支持多种验证方法、密钥交换、加密以及防火墙穿越选项。 +> **问题**:我需要连接到一个IPSec VPN网关,鉴于此,我尝试使用Shrew Soft VPN客户端,它是一个免费版本。我怎样才能安装Shrew Soft VPN客户端到[某个Linux发行版]? + +市面上有许多商业VPN网关,同时附带有他们自己的专有VPN客户端软件。虽然也有许多开源的VPN服务器/客户端备选方案,但它们通常缺乏复杂的IPsec支持,比如互联网密钥交换(IKE),这是一个标准的IPsec协议,用于加固VPN密钥交换和验证安全。Shrew Soft VPN是一个免费的IPsec VPN客户端,它支持多种验证方法、密钥交换、加密以及防火墙穿透选项。 下面介绍如何安装Shrew Soft VPN客户端到Linux平台。 @@ -90,7 +90,7 @@ via: http://ask.xmodulo.com/install-shrew-soft-ipsec-vpn-client-linux.html 作者:[Dan Nanni][a] 译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From 2c5488546d748c77e004f68908dc55abd32d2fbe Mon Sep 17 00:00:00 2001 From: wxy Date: Wed, 10 Jun 2015 10:05:21 +0800 Subject: [PATCH 021/153] PUB:20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu @GOLinux --- ... Not Found' error with 'apt-get update' on old Ubuntu.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu.md (92%) diff --git a/translated/tech/20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu.md b/published/20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu.md similarity index 92% rename from translated/tech/20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu.md rename to published/20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu.md index 9880f7953f..81bf2cbbf6 100644 --- a/translated/tech/20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu.md +++ b/published/20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu.md @@ -1,4 +1,4 @@ -Linux有问必答——在旧的Ubuntu上如何修复“apt-get update”的“404 Not Found”错误 +Linux有问必答:如何更新过期版本的Ubuntu ================================================================================ > **问题**: 我的PC上安装了旧版的Ubuntu 13.04(急切的浣熊)。当我在上面运行“sudo apt-get update”时,它丢给了我一大堆“404 Not Found”错误,结果是我不能使用apt-get或aptitude来安装或更新任何软件包了。由于该错误的原因,我甚至不能将它升级到更新的版本。我怎样才能修复这个问题啊? > @@ -20,7 +20,7 @@ Linux有问必答——在旧的Ubuntu上如何修复“apt-get update”的“4 这里,通过切换到旧版本仓库提供了一个快速修复“404 Not Found”错误的便捷方式。 -首先,使用旧版本仓库替换main/security仓库,就像下面这样。 +首先,使用old-releases仓库替换main/security仓库,就像下面这样。 $ sudo sed -i -r 's/([a-z]{2}\.)?archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list $ sudo sed -i -r 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list @@ -38,7 +38,7 @@ via: http://ask.xmodulo.com/404-not-found-error-apt-get-update-ubuntu.html 作者:[Dan Nanni][a] 译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From a129fb3f088e16f22cea1e526b8126106fec8d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=AE=A6=E6=88=90?= Date: Wed, 10 Jun 2015 10:15:26 +0800 Subject: [PATCH 022/153] Update RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md --- ...--Reviewing Essential Commands and System Documentation.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md b/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md index 9b32c93453..f1ee36576d 100644 --- a/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md @@ -1,3 +1,5 @@ +translating by xiqingongzi + RHCSA Series: Reviewing Essential Commands & System Documentation – Part 1 ================================================================================ RHCSA (Red Hat Certified System Administrator) is a certification exam from Red Hat company, which provides an open source operating system and software to the enterprise community, It also provides support, training and consulting services for the organizations. @@ -310,4 +312,4 @@ via: http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-docum [7]:http://www.tecmint.com/redhat-enterprise-linux-7-installation/ [8]:http://www.tecmint.com/echo-command-in-linux/ [9]:http://www.tecmint.com/pwd-command-examples/ -[10]:http://www.tecmint.com/view-contents-of-file-in-linux/ \ No newline at end of file +[10]:http://www.tecmint.com/view-contents-of-file-in-linux/ From ba38c7e9b57a510d5c75c0aebbfe0d4d18b9eb45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=AE=A6=E6=88=90?= Date: Wed, 10 Jun 2015 10:17:41 +0800 Subject: [PATCH 023/153] =?UTF-8?q?=E3=80=90=E7=BF=BB=E8=AF=91=E4=B8=AD?= =?UTF-8?q?=E3=80=91RHCSA=20Series--Part=2001--Reviewing=20Essential=20Com?= =?UTF-8?q?mands=20and=20System=20Documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Translating By xiqingongzi RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md --- ...01--Reviewing Essential Commands and System Documentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md b/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md index f1ee36576d..0155034c35 100644 --- a/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md @@ -1,4 +1,4 @@ -translating by xiqingongzi +[translating by xiqingongzi] RHCSA Series: Reviewing Essential Commands & System Documentation – Part 1 ================================================================================ From f2a590ffb2f2712ca6f7f01c242f30b717cddcbc Mon Sep 17 00:00:00 2001 From: yajun Date: Wed, 10 Jun 2015 10:29:42 +0800 Subject: [PATCH 024/153] =?UTF-8?q?fyh=E7=94=B3=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ools for Browsing Websites and Downloading Files in Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md b/sources/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md index d291f34511..27c3e388ef 100644 --- a/sources/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md +++ b/sources/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md @@ -1,3 +1,5 @@ +fyh翻译中。。。 + 7 Command Line Tools for Browsing Websites and Downloading Files in Linux ================================================================================ In the last article, we have covered few useful tools like ‘rTorrent‘, ‘wget‘, ‘cURL‘, ‘w3m‘, and ‘Elinks‘. We got lots of response to cover few other tools of same genre, if you’ve missed the first part you can go through it.. From 5ce725050046e89248644cfcbeb9df556b612bdb Mon Sep 17 00:00:00 2001 From: KS Date: Wed, 10 Jun 2015 11:06:58 +0800 Subject: [PATCH 025/153] =?UTF-8?q?wyangsun=E7=94=B3=E8=AF=B7=E7=BF=BB?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wyangsun申请翻译 --- ...eate Own Online Shopping Store Using 'OpenCart' in Linux.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md b/sources/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md index ad673a03e0..39db75746a 100644 --- a/sources/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md +++ b/sources/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md @@ -1,3 +1,4 @@ +wyangsun翻译中 How to Create Own Online Shopping Store Using “OpenCart” in Linux ================================================================================ In the Internet world we are doing everything using a computer. Electronic Commerce aka e-commerce is one one of them. E-Commerce is nothing new and it started in the early days of ARPANET, where ARPANET used to arrange sale between students of Massachusetts Institute of Technology and Stanford Artificial Intelligence Laboratory. @@ -222,4 +223,4 @@ via: http://www.tecmint.com/create-e-commerce-online-shopping-store-using-openca [1]:http://demo.opencart.com/ [2]:http://demo.opencart.com/admin/ [3]:http://www.opencart.com/index.php?route=download/download/ -[4]:http://secure.hostgator.com/%7Eaffiliat/cgi-bin/affiliates/clickthru.cgi?id=tecmint \ No newline at end of file +[4]:http://secure.hostgator.com/%7Eaffiliat/cgi-bin/affiliates/clickthru.cgi?id=tecmint From cb19d06bd25774e7b3338929d624a322cca65cd8 Mon Sep 17 00:00:00 2001 From: Alan You <1058413893@qq.com> Date: Wed, 10 Jun 2015 13:28:18 +0800 Subject: [PATCH 026/153] Update 20150515 How to Install Percona Server on CentOS 7.md --- .../20150515 How to Install Percona Server on CentOS 7.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150515 How to Install Percona Server on CentOS 7.md b/sources/tech/20150515 How to Install Percona Server on CentOS 7.md index 03affe787e..9bfd676f92 100644 --- a/sources/tech/20150515 How to Install Percona Server on CentOS 7.md +++ b/sources/tech/20150515 How to Install Percona Server on CentOS 7.md @@ -1,3 +1,5 @@ +translating by FatJoe123 + How to Install Percona Server on CentOS 7 ================================================================================ In this article we are going to learn about percona server, an opensource drop-in replacement for MySQL and also for MariaDB. The InnoDB database engine make it very attractive and a good alternative if you need performance, reliability and a cost efficient solution @@ -185,4 +187,4 @@ via: http://linoxide.com/linux-how-to/percona-server-centos-7/ 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]:http://linoxide.com/author/carlosal/ \ No newline at end of file +[a]:http://linoxide.com/author/carlosal/ From bbf84f32ce44238355ea24e9faffa0ecfc67f35c Mon Sep 17 00:00:00 2001 From: DeadFire Date: Wed, 10 Jun 2015 14:13:35 +0800 Subject: [PATCH 027/153] =?UTF-8?q?20150610-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...urce RSS News Ticker for Linux Desktops.md | 95 ++++ ...ry Cache Buffer and Swap Space on Linux.md | 99 ++++ ... Spaces and Special Characters in Linux.md | 435 ++++++++++++++++++ ...Experience on Linux 'iptables' Firewall.md | 212 +++++++++ ...inux or Unix Commands Regular Intervals.md | 133 ++++++ 5 files changed, 974 insertions(+) create mode 100644 sources/share/20150610 Tickr Is An Open-Source RSS News Ticker for Linux Desktops.md create mode 100644 sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md create mode 100644 sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md create mode 100644 sources/tech/20150610 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md create mode 100644 sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md diff --git a/sources/share/20150610 Tickr Is An Open-Source RSS News Ticker for Linux Desktops.md b/sources/share/20150610 Tickr Is An Open-Source RSS News Ticker for Linux Desktops.md new file mode 100644 index 0000000000..638482a144 --- /dev/null +++ b/sources/share/20150610 Tickr Is An Open-Source RSS News Ticker for Linux Desktops.md @@ -0,0 +1,95 @@ +Tickr Is An Open-Source RSS News Ticker for Linux Desktops +================================================================================ +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/rss-tickr.jpg) + +**Latest! Latest! Read all about it!** + +Alright, so the app we’re highlighting today isn’t quite the binary version of an old newspaper seller — but it is a great way to have the latest news brought to you, on your desktop. + +Tick is a GTK-based news ticker for the Linux desktop that scrolls the latest headlines and article titles from your favourite RSS feeds in horizontal strip that you can place anywhere on your desktop. + +Call me Joey Calamezzo; I put mine on the bottom TV news station style. + +“Over to you, sub-heading.” + +### RSS — Remember That? ### + +“Thanks paragraph ending.” + +In an era of push notifications, social media, and clickbait, cajoling us into reading the latest mind-blowing, humanity saving listicle ASAP, RSS can seem a bit old hat. + +For me? Well, RSS lives up to its name of Really Simple Syndication. It’s the easiest, most manageable way to have news come to me. I can manage and read stuff when I want; there’s no urgency to view lest the tweet vanish into the stream or the push notification vanish. + +The beauty of Tickr is in its utility. You can have a constant stream of news trundling along the bottom of your screen, which you can passively glance at from time to time. + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/tickr-close-up-750x58.jpg) + +There’s no pressure to ‘read’ or ‘mark all read’ or any of that. When you see something you want to read you just click it to open it in a web browser. + +### Setting it Up ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/tickr-rss-settings.jpg) + +Although Tickr is available to install from the Ubuntu Software Centre it hasn’t been updated for a long time. Nowhere is this sense of abandonment more keenly felt than when opening the unwieldy and unintuitive configuration panel. + +To open it: + +1. Right click on the Tickr bar +1. Go to Edit > Preferences +1. Adjust the various settings + +Row after row of options and settings, few of which seem to make sense at first. But poke and prod around and you’ll controls for pretty much everything, including: + +- Set scrolling speed +- Choose behaviour when mousing over +- Feed update frequency +- Font, including font sizes and color +- Separator character (‘delineator’) +- Position of Tickr on screen +- Color and opacity of Tickr bar +- Choose how many articles each feed displays + +One ‘quirk’ worth mentioning is that pressing the ‘Apply’ only updates the on-screen Tickr to preview changes. For changes to take effect when you exit the Preferences window you need to click ‘OK’. + +Getting the bar to sit flush on your display can also take a fair bit of tweaking, especially on Unity. + +Press the “full width button” to have the app auto-detect your screen width. By default when placed at the top or bottom it leaves a 25px gap (the app was created back in the days of GNOME 2.x desktops). After hitting the top or bottom buttons just add an extra 25 pixels to the input box compensate for this. + +Other options available include: choose which browser articles open in; whether Tickr appears within a regular window frame; whether a clock is shown; and how often the app checks feed for articles. + +#### Adding Feeds #### + +Tickr comes with a built-in list of over 30 different feeds, ranging from technology blogs to mainstream news services. + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/feed-picker-750x398.jpg) + +You can select as many of these as you like to show headlines in the on screen ticker. If you want to add your own feeds you can: – + +1. Right click on the Tickr bar +1. Go to File > Open Feed +1. Enter Feed URL +1. Click ‘Add/Upd’ button +1. Click ‘OK (select)’ + +To set how many items from each feed shows in the ticker change the “Read N items max per feed” in the other preferences window. + +### Install Tickr in Ubuntu 14.04 LTS and Up ### + +So that’s Tickr. It’s not going to change the world but it will keep you abreast of what’s happening in it. + +To install it in Ubuntu 14.04 LTS or later head to the Ubuntu Software Centre but clicking the button below. + +- [Click to install Tickr form the Ubuntu Software Center][1] + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/06/tickr-open-source-desktop-rss-news-ticker + +作者:[Joey-Elijah Sneddon][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:apt://tickr \ No newline at end of file diff --git a/sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md b/sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md new file mode 100644 index 0000000000..e668e5d9ec --- /dev/null +++ b/sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md @@ -0,0 +1,99 @@ +How to Clear RAM Memory Cache, Buffer and Swap Space on Linux +================================================================================ +Like any other operating system, GNU/Linux has implemented a memory management efficiently and even more than that. But if any process is eating away your memory and you want to clear it, Linux provides a way to flush or clear ram cache. + +![Clear RAM Cache and Swap in Linux](http://www.tecmint.com/wp-content/uploads/2015/05/Clear-RAM-Cache-in-Linux.jpg) + +### How to Clear Cache in Linux? ### + +Every Linux System has three options to clear cache without interrupting any processes or services. + +1. Clear PageCache only. + + # sync; echo 1 > /proc/sys/vm/drop_caches + +2. Clear dentries and inodes. + + # sync; echo 2 > /proc/sys/vm/drop_caches + +3. Clear PageCache, dentries and inodes. + + # sync; echo 3 > /proc/sys/vm/drop_caches + +Explanation of above command. + +sync will flush the file system buffer. Command Separated by `“;”` run sequentially. The shell wait for each command to terminate before executing the next command in the sequence. As mentioned in kernel documentation, writing to drop_cache will clean cache without killing any application/service, [command echo][1] is doing the job of writing to file. + +If you have to clear the disk cache, the first command is safest in enterprise and production as `“...echo 1 > ….”` will clear the PageCache only. It is not recommended to use third option above `“...echo 3 >”` in production until you know what you are doing, as it will clear PageCache, dentries and inodes. + +**Is it a good idea to free Buffer and Cache in Linux that might be used by Linux Kernel?** + +When you are applying various settings and want to check, if it is actually implemented specially on I/O-extensive benchmark, then you may need to clear buffer cache. You can drop cache as explained above without rebooting the System i.e., no downtime required. + +Linux is designed in such a way that it looks into disk cache before looking onto the disk. If it finds the resource in the cache, then the request doesn’t reach the disk. If we clean the cache, the disk cache will be less useful as the OS will look for the resource on the disk. + +Moreover it will also slow the system for a few seconds while the cache is cleaned and every resource required by OS is loaded again in the disk-cache. + +Now we will be creating a shell script to auto clear RAM cache daily at 2PM via a cron scheduler task. Create a shell script clearcache.sh and add the following lines. + + #!/bin/bash + # Note, we are using "echo 3", but it is not recommended in production instead use "echo 1" + echo "echo 3 > /proc/sys/vm/drop_caches" + +Set execute permission on the clearcache.sh file. + + # chmod 755 clearcache.sh + +Now you may call the script whenever you required to clear ram cache. + +Now set a cron to clear RAM cache everyday at 2PM. Open crontab for editing. + + # crontab -e + +Append the below line, save and exit to run it at 2PM daily. + + 0 3 * * * /path/to/clearcache.sh + +For more details on how to cron a job you may like to check our article on [11 Cron Scheduling Jobs][2]. + +**Is it good idea to auto clear RAM cache on production server?** + +No! it is not. Think of a situation when you have scheduled the script to clear ram cache everyday at 2PM. Everyday at 2PM the script is executed and it flushes your RAM cache. One day for whatsoever reason, may be more than expected users are online on your website and seeking resource from your server. + +At the same time scheduled script run and clears everything in cache. Now all the user are fetching data from disk. It will result in server crash and corrupt the database. So clear ram-cache only when required,and known your foot steps, else you are a Cargo Cult System Administrator. + +#### How to Clear Swap Space in Linux? #### + +If you want to clear Swap space, you may like to run the below command. + + # swapoff -a && swapon -a + +Also you may add above command to a cron script above, after understanding all the associated risk. + +Now we will be combining both above commands into one single command to make a proper script to clear RAM Cache and Swap Space. + + # echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared' + + OR + + su -c 'echo 3 >/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared' + +After testing both above command, we will run command “free -h” before and after running the script and will check cache. + +![Clear RAM Cache and Swap Space](http://www.tecmint.com/wp-content/uploads/2015/05/Clear-RAM-Cache.gif) + +That’s all for now, if you liked the article, don’t forget to provide us with your valuable feedback in the comments to let us know, what you think is it a good idea to clear ram cache and buffer in production and Enterprise? + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/ + +作者:[Avishek Kumar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/echo-command-in-linux/ +[2]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/ \ No newline at end of file diff --git a/sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md b/sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md new file mode 100644 index 0000000000..03bbb69005 --- /dev/null +++ b/sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md @@ -0,0 +1,435 @@ +How to Manipulate Filenames Having Spaces and Special Characters in Linux +================================================================================ +We come across files and folders name very regularly. In most of the cases file/folder name are related to the content of the file/folder and starts with number and characters. Alpha-Numeric file name are pretty common and very widely used, but this is not the case when we have to deal with file/folder name that has special characters in them. + +**Note**: We can have files of any type but for simplicity and easy implementation we will be dealing with Text file (.txt), throughout the article. + +Example of most common file names are: + + abc.txt + avi.txt + debian.txt + ... + +Example of numeric file names are: + + 121.txt + 3221.txt + 674659.txt + ... + +Example of Alpha-Numeric file names are: + + eg84235.txt + 3kf43nl2.txt + 2323ddw.txt + ... + +Examples of file names that has special character and is not very common: + + #232.txt + #bkf.txt + #bjsd3469.txt + #121nkfd.txt + -2232.txt + -fbjdew.txt + -gi32kj.txt + --321.txt + --bk34.txt + ... + +One of the most obvious question here is – who on earth create/deal with files/folders name having a Hash `(#)`, a semi-colon `(;)`, a dash `(-)` or any other special character. + +I Agree to you, that such file names are not common still your shell should not break/give up when you have to deal with any such file names. Also speaking technically every thing be it folder, driver or anything else is treated as file in Linux. + +### Dealing with file that has dash (-) in it’s name ### + +Create a file that starts with a dash `(-)`, say -abx.txt. + + $ touch -abc.txt + +#### Sample Output #### + + touch: invalid option -- 'b' + Try 'touch --help' for more information. + +The reason for above error, that shell interprets anything after a dash `(-)`, as option, and obviously there is no such option, hence is the error. + +To resolve such error, we have to tell the Bash shell (yup this and most of the other examples in the article is for BASH) not to interpret anything after special character (here dash), as option. + +There are two ways to resolve this error as: + + $ touch -- -abc.txt [Option #1] + $ touch ./-abc.txt [Option #2] + +You may verify the file thus created by both the above ways by running commands ls or [ls -l][1] for long listing. + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 11:05 -abc.txt + +To edit the above file you may do: + + $ nano -- -abc.txt + or + $ nano ./-abc.txt + +**Note**: You may replace nano with any other editor of your choice say vim as: + + $ vim -- -abc.txt + or + $ vim ./-abc.txt + +Similarly to move such file you have to do: + + $ mv -- -abc.txt -a.txt + or + $ mv -- -a.txt -abc.txt + +and to Delete this file, you have to do: + + $ rm -- -abc.txt + or + $ rm ./-abc.txt + +If you have lots of files in a folder the name of which contains dash, and you want to delete all of them at once, do as: + + $ rm ./-* + +**Important to Note:** + +1. The same rule as discussed above follows for any number of hypen in the name of the file and their occurrence. Viz., -a-b-c.txt, ab-c.txt, abc-.txt, etc. + +2. The same rule as discussed above follows for the name of the folder having any number of hypen and their occurrence, except the fact that for deleting the folder you have to use ‘rm -rf‘ as: + + $ rm -rf -- -abc + or + $ rm -rf ./-abc + +### Dealing with files having HASH (#) in the name ### + +The symbol `#` has a very different meaning in BASH. Anything after a `#` is interpreted as comment and hence neglected by BASH. + +**Understand it using examples:** + +create a file #abc.txt. + + $ touch #abc.txt + +#### Sample Output #### + + touch: missing file operand + Try 'touch --help' for more information. + +The reason for above error, that Bash is interpreting #abc.txt a comment and hence ignoring. So the [command touch][2] has been passed without any file Operand, and hence is the error. + +To resolve such error, you may ask BASH not to interpret # as comment. + + $ touch ./#abc.txt + or + $ touch '#abc.txt' + +and verify the file just created as: + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 12:14 #abc.txt + +Now create a file the name of which contains # anywhere except at the begging. + + $ touch ./a#bc.txt + $ touch ./abc#.txt + + or + $ touch 'a#bc.txt' + $ touch 'abc#.txt' + +Run ‘ls -l‘ to verify it: + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 12:16 a#bc.txt + -rw-r--r-- 1 avi avi 0 Jun 8 12:16 abc#.txt + +What happens when you create two files (say a and #bc) at once: + + $ touch a.txt #bc.txt + +Verify the file just created: + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 12:18 a.txt + +Obvious from the above example it only created file ‘a‘ and file ‘#bc‘ has been ignored. To execute the above situation successfully we can do, + + $ touch a.txt ./#bc.txt + or + $ touch a.txt '#bc.txt' + +and verify it as: + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 12:20 a.txt + -rw-r--r-- 1 avi avi 0 Jun 8 12:20 #bc.txt + +You can move the file as: + + $ mv ./#bc.txt ./#cd.txt + or + $ mv '#bc.txt' '#cd.txt' + +Copy it as: + + $ cp ./#cd.txt ./#de.txt + or + $ cp '#cd.txt' '#de.txt' + +You may edit it as using your choice of editor as: + + $ vi ./#cd.txt + or + $ vi '#cd.txt' + +---------- + + $ nano ./#cd.txt + or + $ nano '#cd.txt' + +And Delete it as: + + $ rm ./#bc.txt + or + $ rm '#bc.txt' + +To delete all the files that has hash (#) in the file name, you may use: + + # rm ./#* + +### Dealing with files having semicolon (;) in its name ### + +In case you are not aware, semicolon acts as a command separator in BASH and perhaps other shell as well. Semicolon lets you execute several command in one go and acts as separator. Have you ever deal with any file name having semicolon in it? If not here you will. + +Create a file having semi-colon in it. + + $ touch ;abc.txt + +#### Sample Output #### + + touch: missing file operand + Try 'touch --help' for more information. + bash: abc.txt: command not found + +The reason for above error, that when you run the above command BASH interpret touch as a command but could not find any file operand before semicolon and hence it reports error. It also reports another error that ‘abc.txt‘ command not found, only because after semicolon BASH was expecting another command and ‘abc.txt‘, is not a command. + +To resolve such error, tell BASH not to interpret semicolon as command separator, as: + + $ touch ./';abc.txt' + or + $ touch ';abc.txt' + +**Note**: We have enclosed the file name with single quote ''. It tells BASH that ; is a part of file name and not command separator. + +Rest of the action (viz., copy, move, delete) on the file and folder having semicolon in its name can be carried out straight forward by enclosing the name in single quote. + +### Dealing with other special characters in file/folder name ### + +#### Plus Sign (+) in file name #### + +Don’t requires anything extra, just do it normal way, as simple file name as shown below. + + $ touch +12.txt + +#### Dollar sign ($) in file name #### + +You have to enclose file name in single quote, as we did in the case of semicolon. Rest of the things are straight forward.. + + $ touch '$12.txt' + +#### Percent (%) in file name #### + +You don’t need to do anything differently, treat it as normal file. + + $ touch %12.txt + +#### Asterisk (*) in file name #### + +Having Asterisk in file name don’t change anything and you can continue using it as normal file. + + $ touch *12.txt + +Note: When you have to delete a file that starts with *, Never use following commands to delete such files. + + $ rm * + or + $ rm -rf * + +Instead use, + + $ rm ./*.txt + +#### Exclamation mark (!) in file name #### + +Just Enclose the file name in single quote and rest of the things are same. + + $ touch '!12.txt' + +#### At Sign (@) in file name #### + +Nothing extra, treat a filename having At Sign as nonrmal file. + + $ touch '@12.txt' + +#### ^ in file name #### + +No extra attention required. Use a file having ^ in filename as normal file. + + $ touch ^12.txt + +#### Ampersand (&) in file name #### + +Filename should be enclosed in single quotes and you are ready to go. + + $ touch '&12.txt' + +#### Parentheses () in file name #### + +If the file name has Parenthesis, you need to enclose filename with single quotes. + + $ touch '(12.txt)' + +#### Braces {} in file name #### + +No Extra Care needed. Just treat it as just another file. + + $ touch {12.txt} + +#### Chevrons <> in file name #### + +A file name having Chevrons must be enclosed in single quotes. + + $ touch '<12.txt>' + +#### Square Brackets [ ] in file name #### + +Treat file name having Square Brackets as normal files and you need not take extra care of it. + + $ touch [12.txt] + +#### Under score (_) in file name #### + +They are very common and don’t require anything extra. Just do what you would have done with a normal file. + + $ touch _12.txt + +#### Equal-to (=) in File name #### + +Having an Equal-to sign do not change anything, you can use it as normal file. + + $ touch =12.txt + +#### Dealing with back slash (\) #### + +Backslash tells shell to ignore the next character. You have to enclose file name in single quote, as we did in the case of semicolon. Rest of the things are straight forward. + + $ touch '\12.txt' + +#### The Special Case of Forward Slash #### + +You cannot create a file the name of which includes a forward slash (/), until your file system has bug. There is no way to escape a forward slash. + +So if you can create a file such as ‘/12.txt’ or ‘b/c.txt’ then either your File System has bug or you have Unicode support, which lets you create a file with forward slash. In this case the forward slash is not a real forward slash but a Unicode character that looks alike a forward slash. + +#### Question Mark (?) in file name #### + +Again, an example where you don’t need to put any special attempt. A file name having Question mark can be treated in the most general way. + + $ touch ?12.txt + +#### Dot Mark (.) in file name #### + +The files starting with dot `(.)` are very special in Linux and are called dot files. They are hidden files generally a configuration or system files. You have to use switch ‘-a‘ or ‘-A‘ with ls command to view such files. + +Creating, editing, renaming and deleting of such files are straight forward. + + $ touch .12.txt + +Note: In Linux you may have as many dots `(.)` as you need in a file name. Unlike other system dots in file name don’t means to separate name and extension. You can create a file having multiple dots as: + + $ touch 1.2.3.4.5.6.7.8.9.10.txt + +and check it as: + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 14:32 1.2.3.4.5.6.7.8.9.10.txt + +#### Comma (,) in file name #### + +You can have comma in a file name, as many as you want and you Don’t requires anything extra. Just do it normal way, as simple file name. + + $ touch ,12.txt + or + $ touch ,12,.txt + +#### Colon (:) in File name #### + +You can have colon in a file name, as many as you want and you Don’t requires anything extra. Just do it normal way, as simple file name. + + $ touch :12.txt + or + $ touch :12:.txt + +#### Having Quotes (single and Double) in file name #### + +To have quotes in file name, we have to use the rule of exchange. I.e, if you need to have single quote in file name, enclose the file name with double quotes and if you need to have double quote in file name, enclose it with single quote. + + $ touch "15'.txt" + + and + + $ touch '15”.txt' + +#### Tilde (~) in file name #### + +Some Editors in Linux like emacs create a backup file of the file being edited. The backup file has the name of the original file plus a tilde at the end of the file name. You can have a file that name of which includes tilde, at any location simply as: + + $ touch ~1a.txt + or + $touch 2b~.txt + +#### White Space in file name #### + +Create a file the name of which has space between character/word, say “hi my name is avishek.txt”. + +It is not a good idea to have file name with spaces and if you have to distinct readable name, you should use, underscore or dash. However if you have to create such a file, you have to use backward slash which ignores the next character to it. To create above file we have to do it this way.. + + $ touch hi\ my\ name\ is\ avishek.txt + + hi my name is avishek.txt + +I have tried covering all the scenario you may come across. Most of the above implementation are explicitly for BASH Shell and may not work in other shell. + +If you feel that I missed something (that is very common and human nature), you may include your suggestion in the comments below. Keep Connected, Keep Commenting. Stay Tuned and connected! Like and share us and help us get spread! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/manage-linux-filenames-with-special-characters/ + +作者:[Avishek Kumar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/15-basic-ls-command-examples-in-linux/ +[2]:http://www.tecmint.com/8-pratical-examples-of-linux-touch-command/ \ No newline at end of file diff --git a/sources/tech/20150610 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md b/sources/tech/20150610 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md new file mode 100644 index 0000000000..455b994975 --- /dev/null +++ b/sources/tech/20150610 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md @@ -0,0 +1,212 @@ +Nishita Agarwal Shares Her Interview Experience on Linux ‘iptables’ Firewall +================================================================================ +Nishita Agarwal, a frequent Tecmint Visitor shared her experience (Question and Answer) with us regarding the job interview she had just given in a privately owned hosting company in Pune, India. She was asked a lot of questions on a variety of topics however she is an expert in iptables and she wanted to share those questions and their answer (she gave) related to iptables to others who may be going to give interview in near future. + +![Linux Firewall Iptables Interview Questions](http://www.tecmint.com/wp-content/uploads/2015/05/Linux-iptables-Interview-Questions.jpg) + +All the questions and their Answer are rewritten based upon the memory of Nishita Agarwal. + +> “Hello Friends! My name is **Nishita Agarwal**. I have Pursued Bachelor Degree in Technology. My area of Specialization is UNIX and Variants of UNIX (BSD, Linux) fascinates me since the time I heard it. I have 1+ years of experience in storage. I was looking for a job change which ended with a hosting company in Pune, India.” + +Here is the collection of what I was asked during the Interview. I’ve documented only those questions and their answer that were related to iptables based upon my memory. Hope this will help you in cracking your Interview. + +**1. Have you heard of iptables and firewall in Linux? Any idea of what they are and for what it is used?** + +> **Answer** : I’ve been using iptables for quite long time and I am aware of both iptables and firewall. Iptables is an application program mostly written in C Programming Language and is released under GNU General Public License. Written for System administration point of view, the latest stable release if iptables 1.4.21.iptables may be considered as firewall for UNIX like operating system which can be called as iptables/netfilter, more accurately. The Administrator interact with iptables via console/GUI front end tools to add and define firewall rules into predefined tables. Netfilter is a module built inside of kernel that do the job of filtering. +> +> Firewalld is the latest implementation of filtering rules in RHEL/CentOS 7 (may be implemented in other distributions which I may not be aware of). It has replaced iptables interface and connects to netfilter. + +**2. Have you used some kind of GUI based front end tool for iptables or the Linux Command Line?** + +> **Answer** : Though I have used both the GUI based front end tools for iptables like Shorewall in conjugation of [Webmin][1] in GUI and Direct access to iptables via console.And I must admit that direct access to iptables via Linux console gives a user immense power in the form of higher degree of flexibility and better understanding of what is going on in the background, if not anything other. GUI is for novice administrator while console is for experienced. + +**3. What are the basic differences between between iptables and firewalld?** + +> **Answer** : iptables and firewalld serves the same purpose (Packet Filtering) but with different approach. iptables flush the entire rules set each time a change is made unlike firewalld. Typically the location of iptables configuration lies at ‘/etc/sysconfig/iptables‘ whereas firewalld configuration lies at ‘/etc/firewalld/‘, which is a set of XML files.Configuring a XML based firewalld is easier as compared to configuration of iptables, however same task can be achieved using both the packet filtering application ie., iptables and firewalld. Firewalld runs iptables under its hood along with it’s own command line interface and configuration file that is XML based and said above. + +**4. Would you replace iptables with firewalld on all your servers, if given a chance?** + +> **Answer** : I am familiar with iptables and it’s working and if there is nothing that requires dynamic aspect of firewalld, there seems no reason to migrate all my configuration from iptables to firewalld.In most of the cases, so far I have never seen iptables creating an issue. Also the general rule of Information technology says “why fix if it is not broken”. However this is my personal thought and I would never mind implementing firewalld if the Organization is going to replace iptables with firewalld. + +**5. You seems confident with iptables and the plus point is even we are using iptables on our server.** + +What are the tables used in iptables? Give a brief description of the tables used in iptables and the chains they support. + +> **Answer** : Thanks for the recognition. Moving to question part, There are four tables used in iptables, namely they are: +> +> - Nat Table +> - Mangle Table +> - Filter Table +> - Raw Table +> +> Nat Table : Nat table is primarily used for Network Address Translation. Masqueraded packets get their IP address altered as per the rules in the table. Packets in the stream traverse Nat Table only once. ie., If a packet from a jet of Packets is masqueraded they rest of the packages in the stream will not traverse through this table again. It is recommended not to filter in this table. Chains Supported by NAT Table are PREROUTING Chain, POSTROUTING Chain and OUTPUT Chain. +> +> Mangle Table : As the name suggests, this table serves for mangling the packets. It is used for Special package alteration. It can be used to alter the content of different packets and their headers. Mangle table can’t be used for Masquerading. Supported chains are PREROUTING Chain, OUTPUT Chain, Forward Chain, INPUT Chain, POSTROUTING Chain. +> +> Filter Table : Filter Table is the default table used in iptables. It is used for filtering Packets. If no rules are defined, Filter Table is taken as default table and filtering is done on the basis of this table. Supported Chains are INPUT Chain, OUTPUT Chain, FORWARD Chain. +> +> Raw Table : Raw table comes into action when we want to configure packages that were exempted earlier. It supports PREROUTING Chain and OUTPUT Chain. + +**6. What are the target values (that can be specified in target) in iptables and what they do, be brief!** + +> **Answer** : Following are the target values that we can specify in target in iptables: +> +> - ACCEPT : Accept Packets +> - QUEUE : Paas Package to user space (place where application and drivers reside) +> - DROP : Drop Packets +> - RETURN : Return Control to calling chain and stop executing next set of rules for the current Packets in the chain. + + +**7. Lets move to the technical aspects of iptables, by technical I means practical.** + +How will you Check iptables rpm that is required to install iptables in CentOS?. + +> **Answer** : iptables rpm are included in standard CentOS installation and we do not need to install it separately. We can check the rpm as: +> +> # rpm -qa iptables +> +> iptables-1.4.21-13.el7.x86_64 +> +> If you need to install it, you may do yum to get it. +> +> # yum install iptables-services + +**8. How to Check and ensure if iptables service is running?** + +> **Answer** : To check the status of iptables, you may run the following command on the terminal. +> +> # service status iptables [On CentOS 6/5] +> # systemctl status iptables [On CentOS 7] +> +> If it is not running, the below command may be executed. +> +> ---------------- On CentOS 6/5 ---------------- +> # chkconfig --level 35 iptables on +> # service iptables start +> +> ---------------- On CentOS 7 ---------------- +> # systemctl enable iptables +> # systemctl start iptables +> +> We may also check if the iptables module is loaded or not, as: +> +> # lsmod | grep ip_tables + +**9. How will you review the current Rules defined in iptables?** + +> **Answer** : The current rules in iptables can be review as simple as: +> +> # iptables -L +> +> Sample Output +> +> Chain INPUT (policy ACCEPT) +> target prot opt source destination +> ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED +> ACCEPT icmp -- anywhere anywhere +> ACCEPT all -- anywhere anywhere +> ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> +> Chain FORWARD (policy ACCEPT) +> target prot opt source destination +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> +> Chain OUTPUT (policy ACCEPT) +> target prot opt source destination + +**10. How will you flush all iptables rules or a particular chain?** + +> **Answer** : To flush a particular iptables chain, you may use following commands. +> +> +> # iptables --flush OUTPUT +> +> To Flush all the iptables rules. +> +> # iptables --flush + +**11. Add a rule in iptables to accept packets from a trusted IP Address (say 192.168.0.7)** + +> **Answer** : The above scenario can be achieved simply by running the below command. +> +> # iptables -A INPUT -s 192.168.0.7 -j ACCEPT +> +> We may include standard slash or subnet mask in the source as: +> +> # iptables -A INPUT -s 192.168.0.7/24 -j ACCEPT +> # iptables -A INPUT -s 192.168.0.7/255.255.255.0 -j ACCEPT + +**12. How to add rules to ACCEPT, REJECT, DENY and DROP ssh service in iptables.** + +> **Answer** : Hoping ssh is running on port 22, which is also the default port for ssh, we can add rule to iptables as: +> +> To ACCEPT tcp packets for ssh service (port 22). +> +> # iptables -A INPUT -s -p tcp --dport 22 -j ACCEPT +> +> To REJECT tcp packets for ssh service (port 22). +> +> # iptables -A INPUT -s -p tcp --dport 22 -j REJECT +> +> To DENY tcp packets for ssh service (port 22). +> +> +> # iptables -A INPUT -s -p tcp --dport 22 -j DENY +> +> To DROP tcp packets for ssh service (port 22). +> +> +> # iptables -A INPUT -s -p tcp --dport 22 -j DROP + +**13. Let me give you a scenario. Say there is a machine the local ip address of which is 192.168.0.6. You need to block connections on port 21, 22, 23, and 80 to your machine. What will you do?** + +> **Answer** : Well all I need to use is the ‘multiport‘ option with iptables followed by port numbers to be blocked and the above scenario can be achieved in a single go as. +> +> # iptables -A INPUT -s 192.168.0.6 -p tcp -m multiport --dport 21,22,23,80 -j DROP +> +> The written rules can be checked using the below command. +> +> # iptables -L +> +> Chain INPUT (policy ACCEPT) +> target prot opt source destination +> ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED +> ACCEPT icmp -- anywhere anywhere +> ACCEPT all -- anywhere anywhere +> ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> DROP tcp -- 192.168.0.6 anywhere multiport dports ssh,telnet,http,webcache +> +> Chain FORWARD (policy ACCEPT) +> target prot opt source destination +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> +> Chain OUTPUT (policy ACCEPT) +> target prot opt source destination + +**Interviewer** : That’s all I wanted to ask. You are a valuable employee we won’t like to miss. I will recommend your name to the HR. If you have any question you may ask me. + +As a candidate I don’t wanted to kill the conversation hence keep asking about the projects I would be handling if selected and what are the other openings in the company. Not to mention HR round was not difficult to crack and I got the opportunity. + +Also I would like to thank Avishek and Ravi (whom I am a friend since long) for taking the time to document my interview. + +Friends! If you had given any such interview and you would like to share your interview experience to millions of Tecmint readers around the globe? then send your questions and answers to admin@tecmint.com or you may submit your interview experience using following form. + +- [Share Your Interview Experience][2] + +Thank you! Keep Connected. Also let me know if I could have answered a question more correctly than what I did. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-firewall-iptables-interview-questions-and-answers/ + +作者:[Avishek Kumar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/install-webmin-web-based-system-administration-tool-for-rhel-centos-fedora/ +[2]:https://docs.google.com/a/tecmint.com/forms/d/1jfu1Kg8_qToqvyi6pOT1HQb0dAFvRE-Yc_aOkj0RoSg/viewform \ No newline at end of file diff --git a/sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md b/sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md new file mode 100644 index 0000000000..65d844a296 --- /dev/null +++ b/sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md @@ -0,0 +1,133 @@ +watch - Repeat Linux / Unix Commands Regular Intervals +================================================================================ +A server administrator needs to maintain the system and keep it updated and safe. A number of intrusion attempts may happen every day. There are some other activities that maintain their log. These logs are updated regularly. In order to check these updates, the commands are executed repeatedly. For example, for simply reading a file, commands like head, tail, cat etc are used. These commands need to be executed repeatedly. The watch command can be used to repeat a command at regular intervals. + +### Watch Command ### + +Watch is a simple command, with a few options. The basic syntax of watch command is: + + watch [-dhvt] [-n ] [--differences[=cumulative]] [--help] [--interval=] [--no-title] [--version] + +Watch command runs the command specified to it after every 2 seconds by default. This time is counted between the completion of command and beginning of next execution. As a simple example, watch command can be used to watch the log updates, The updates are appended at the end of the file, so tail command can be used with watch to see the updates to the file. This command continues to run until you hit CTRL + C to return to the prompt. + +### Examples ### + +> Keep an eye on errors/notices/warning being generated at run time every couple of seconds. + + watch tail /var/log/messages + +![tail messages](http://blog.linoxide.com/wp-content/uploads/2015/06/1.png) + +> Keep an eye on disk usage after specified time interval. + + watch df -h + +![df -h](http://blog.linoxide.com/wp-content/uploads/2015/06/2.png) + +> It is very important for administrators to keep an eye on high I/O wait causing disk operations especially the Mysql transactions. + + watch mysqladmin processlist + +![processlist](http://blog.linoxide.com/wp-content/uploads/2015/06/3.png) + +> Keep an eye on server load and uptime at runtime. + + watch uptime + +![uptime](http://blog.linoxide.com/wp-content/uploads/2015/06/10.png) + +> Keep an eye on queue size for Exim at the time a cron is run to send notices to subscribers. + + watch exim -bpc + +![exim -bpc](http://blog.linoxide.com/wp-content/uploads/2015/06/9.png) + +### 1) Iteration delay ### + + watch [-n ] + +The default interval between the commands can be changed with -n switch. The following command will run the tail command after 5 seconds: + + watch -n 5 date + +![date 5 seconds](http://blog.linoxide.com/wp-content/uploads/2015/06/4b.png) + +### 2) Successive output comparison ### + +If you use -d option with watch command, it will highlight the differences between the first command output to every next command output cumulatively. + + watch [-d or --differences[=cumulative]] + +#### Example1 #### + +Let’s see the successive time outputs extracted using following watch command and observe how the difference is highlighted. + + watch -n 15 -d date + +First time date is capture when command is executed, the next iteration will be repeated after 15 seconds. + +![Difference A](http://blog.linoxide.com/wp-content/uploads/2015/06/6.png) + +Upon the execution of next iteration, it can be seen that all output is exactly same except the seconds have increased from 14 to 29 which is highlighted. + +![Difference A](http://blog.linoxide.com/wp-content/uploads/2015/06/6b.png) + +#### Example 2 #### + +Let’s experience in difference between two successive outputs of “uptime” command repeated by watch. + + watch -n 20 -d uptime + +![uptime](http://blog.linoxide.com/wp-content/uploads/2015/06/10.png) + +Now the difference between the time is highlighted as well as the three load snapshots as well. + +![10b](http://blog.linoxide.com/wp-content/uploads/2015/06/10b.png) + +### 3) Output without title ### + +If you don’t want to display extra details about the iteration delay and actual command run by watch then –t switch can be used. + + watch [-t or --no-title] + +Let’s see the output of following command as an example. + + watch -t date + +![watch without title](http://blog.linoxide.com/wp-content/uploads/2015/06/7t.png) + +### Watch help ### + +Brief details of the watch command can be found by typing the following command in SSH. + + watch -h [or --help] + +![watch help](http://blog.linoxide.com/wp-content/uploads/2015/06/8h.png) + +### Watch version ### + +Run the following command in SSH terminal to check the version of watch. + + watch -v [--version] + +![version](http://blog.linoxide.com/wp-content/uploads/2015/06/11.png) + +**BUGS** + +Unfortunately, upon terminal resize, the screen will not be correctly repainted until the next scheduled update. All --differences highlight-ing is lost on that update as well. + +### Summary ### + +Watch is a very powerful utility for system administrators because it can be used to monitor, logs, operations, performance and throughput of the system at run time. One can easily format and delay the output of watch utility. Any Linux command / utility or script and be supplied to watch for desired and continuous output. + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-command/linux-watch-command/ + +作者:[Aun Raza][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/arunrz/ \ No newline at end of file From 618e7ccd3f2125f3e8c922f63514a0a405d5be53 Mon Sep 17 00:00:00 2001 From: DeadFire Date: Wed, 10 Jun 2015 15:49:30 +0800 Subject: [PATCH 028/153] =?UTF-8?q?20150610-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... pagespeed on Ubuntu 15.04 Vivid Vervet.md | 129 ++++++++++ ...0150610 How to secure your Linux server.md | 233 ++++++++++++++++++ ... Install Android Studio on Ubuntu 15.04.md | 65 +++++ 3 files changed, 427 insertions(+) create mode 100644 sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md create mode 100644 sources/tech/20150610 How to secure your Linux server.md create mode 100644 sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md diff --git a/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md b/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md new file mode 100644 index 0000000000..e98bb00523 --- /dev/null +++ b/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md @@ -0,0 +1,129 @@ +How to Install nginx and google pagespeed on Ubuntu 15.04 (Vivid Vervet) +================================================================================ +Nginx (engine-x) is a open source and high performance HTTP server, reverse proxy and IMAP/POP3 proxy server. The outstanding features of Nginx are: stability, rich feature set, simple configuration and low resource consumption. Nginx is being used by some of the largest websites on the internet and is gaining more and more popularity in the webmaster community. This tutorials shows how to build a nginx .deb package for Ubuntu 15.04 from source that has Google pagespeed module compiled in. + + +Pagespeed is a web server module developed by Google to speed up a website response times, optimize html and reduce the page load time. ngx_pagespeed features include : + +- Image optimization: stripping meta-data, dynamic resizing, recompression. +- CSS & JavaScript minification, concatenation, inlining, and outlining. +- Small resource inlining. +- Deferring image and JavaScript loading. +- HTML rewriting. +- Cache lifetime extension. + +see more [https://developers.google.com/speed/pagespeed/module/][1]. + +### Prerequisites ### + +Ubuntu Server 15.04 64 bit +root privileges + +What we will do in this tutorial : + +- Install the prerequisite packages. +- Installing nginx with ngx_pagespeed. +- Testing. + +#### Install the prerequisite packages #### + +sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev + +#### Installing nginx with ngx_pagespeed #### + +**Step 1 - Adding nginx repository** + + vim /etc/apt/sources.list.d/nginx.list + +add the line: + + deb http://nginx.org/packages/ubuntu/ trusty nginx + deb-src http://nginx.org/packages/ubuntu/ trusty nginx + +Update your repository: + + sudo apt-get update + +note : if you get the messege : GPG error [...] NO_PUBKEY [...] bla bla + +please add the the key: + + sudo sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYNUMBER + sudo apt-get update + +**Step 2 - Download nginx 1.8 from ubuntu repository** + + sudo su + cd ~ + mkdir -p ~/new/nginx_source/ + cd ~/new/nginx_source/ + apt-get source nginx + apt-get build-dep nginx + +**Step 3 - Download Pagespeed** + + cd ~ + mkdir -p ~/new/ngx_pagespeed/ + cd ~/new/ngx_pagespeed/ + ngx_version=1.9.32.3 + wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${ngx_version}-beta.zip + unzip release-${ngx_version}-beta.zip + + cd ngx_pagespeed-release-1.9.32.3-beta/ + wget https://dl.google.com/dl/page-speed/psol/${ngx_version}.tar.gz + tar -xzf 1.9.32.3.tar.gz + +**Step 4 - Configure nginx to build with Pagespeed** + + cd ~/new/nginx_source/nginx-1.8.0/debin/ + vim rules + +add the module under CFLAGS `.configure` : + + --add-module=../../ngx_pagespeed/ngx_pagespeed-release-1.9.32.3-beta \ + +![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/1.png) + +![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/2.png) + +**Step 5 - Build nginx package and Install** + + cd ~/new/nginx_source/nginx-1.8.0/ + dpkg-buildpackage -b + +The dpkg-buildpackage command will build the nginx.deb under ~/new/ngix_source/ Once package building is complete, please look in the directory: + + cd ~/new/ngix_source/ + ls + +![nginx builded with pagespeed](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/3.png) + +And then install nginx. + + dpkg -i nginx_1.8.0-1~trusty_amd64.deb + +![Install nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/4.png) + +#### Testing #### + +Run nginx -V to see the ngx_pagespeed was builted with nginx. + + nginx -V + +![nginx -V](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/5.png) + +### Conclusion ### + +The nginx web server there is a stable and fast open source http server that supports a variety of modules for optimization. One of these modules is the 'PageSpeed module' which is developed by google. Unlike apache, nginx modules are not dynamically loadable, so you have to select the desired modules before you build the nginx package. + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-install-nginx-and-google-pagespeed-on-ubuntu-15-04/#step-build-nginx-package-and-install + +作者:Muhammad Arul +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://developers.google.com/speed/pagespeed/module/ \ No newline at end of file diff --git a/sources/tech/20150610 How to secure your Linux server.md b/sources/tech/20150610 How to secure your Linux server.md new file mode 100644 index 0000000000..1668dae934 --- /dev/null +++ b/sources/tech/20150610 How to secure your Linux server.md @@ -0,0 +1,233 @@ +How to secure your Linux server +================================================================================ +> A server is made up of so many different components that makes it hard to offer one solution for everyone's needs. This articles tries to cover some useful tips and tricks to help you keep your server and users protected. + +No doubt improving server security is one of the most important things system administrators should always look for. This of course has been a topic of many different articles, blogs and forum threads. + +A server is made up of so many different components that makes it hard to offer one solution for everyone’s needs. This articles tries to cover some useful tips and tricks to help you keep your server and users protected. + +There are a few things that every system administrator should know and there is no way to talk about security without mentioning: + +- Keep your system **up to date** +- Change passwords frequently – use numeric, alphabetical and non-alphabetical symbols +- Give users the **minimum** permissions they need to do their job. +- Install only packages that you really need + +Here comes the more interesting part: + +### Change default SSH port ### + +The first thing that I would like to change when setting up a new server is the default SSH port. This simple change can save your server from thousands of brute force attempts. + +To change the default SSH port, open your sshd_config: + + sudo vim /etc/ssh/sshd_config + +Find the following line: + + #Port 22 + +The “#” symbol means that this line is a comment. Remove the # symbol then change the port to a number of your choice. The port number should not be larger than 65535. Make sure not to use any port already used by your system or other services. You can see a list of commonly used ports in [Wikipedia][1]. For the purpose of this article I will use: + + Port 16543 + +Now save the file and close it for a moment. + +Next important step is to: + +### Use SSH Keys ### + +It is extremely important to use SSH keys when accessing the server over SSH. This adds additional protection and ensure that only people who have the key can access the server. + +To generate SSH key on your local computer run: + + ssh-keygen -t rsa + +You will receive an output asking you to setup the file name where the key should be written as well as setup a password: + + Generating public/private rsa key pair. + Enter file in which to save the key (/root/.ssh/id_rsa): my_key + Enter passphrase (empty for no passphrase): + Enter same passphrase again: + Your identification has been saved in my_key. + Your public key has been saved in my_key.pub. + The key fingerprint is: + SHA256:MqD/pzzTRsCjZb6mpfjyrr5v1pJLBcgprR5tjNoI20A + +When compete, you will have two files: + +my_key + +my_key.pub + +Now copy the my_key.pub to ~/.ssh/authorized_keys + + cp my_key.pub ~/.ssh/authorized_keys + +Now upload your key on the server by using: + + scp -P16543 authorized_keys user@yourserver-ip:/home/user/.ssh/ + +Now you can access the server from the same local machine without having to enter any password. + +### Disable password authentication for SSH ### + +Now that we have SSH keys, it is safe to disable the password authentication for SSH. Open again the sshd_config file and set the following changes: + + ChallengeResponseAuthentication no + PasswordAuthentication no + UsePAM no + +### Disable Root login ### + +The next important step is to disable direct access with root user. Instead you should use sudo or su to perform administrative jobs. To do this you will need to add a new user that has root privileges. To do this you will need to edit the sudoers file located in: + + /etc/sudoers/ + +You may edit that file with command such as **visudo**. I would recommend you using this command as it will check the file for any syntax errors prior closing the file. This is useful if you have wrongly edited the file. + +Now to give root privileges to a user. For the purpose of this tutorial I will use user **sysadmin**. Make sure you are using an existing user on your system when you edit your own file. Now find the following line: + + root ALL=(ALL) ALL + +Copy that line and paste it below. In the new line change “root” with “sysadmin”. You should now have these two lines: + + root ALL=(ALL) ALL + sysadmin ALL=(ALL) ALL + +I would like to explain what each of the options in the above line represents: + + (1) root (2)ALL=(3)(ALL) (4)ALL + +(1) User + +(2) Terminal from which user can use sudo + +(3) Which users User may act as + +(4) Which commands he may use + + +You can use this settings to give access to users to some of the system tools. + +At this point it is safe to save your file. + +To disable direct root access over SSH open again the **sshd_config** file and find the following line: + + #PermitRootLogin yes + +and change it to: + + PermitRootLogin no + +Now save the file and restart the sshd daemon so the changes can take effect. Simply run the following command: + + sudo /etc/init.d/sshd restart + +### Setup firewall ### + +A firewall can help you block incoming and outgoing ports as well as block brute force login attempts. I like using SCF (Config Server Firewall) as it a powerful solution that uses iptables, it’s easy to manage and has a web interface for people who don’t like typing too many commands. + +To install CSF access your server and navigate to: + + cd /usr/local/src/ + +Then execute the following commands as root: + + wget https://download.configserver.com/csf.tgz + tar -xzf csf.tgz + csf + sh install.sh + +You will need to wait for the installer to finish its job. We will edit CSF configuration by editing: + + /etc/csf/csf.conf + +By default CSF will be started in testing mode. You will need to set it to product by changing the “TESTING” value to 0 + + TESTING = "0" + +Next thing you can edit are the allowed ports on your server. For that purpose find the following section of the csf.conf file and modify the ports per your needs: + + # Allow incoming TCP ports + TCP_IN = "20,21,25,53,80,110,143,443,465,587,993,995,16543" + # Allow outgoing TCP ports + TCP_OUT = "20,21,22,25,53,80,110,113,443,587,993,995,16543" + # Allow incoming UDP ports + UDP_IN = "20,21,53" + # Allow outgoing UDP ports + # To allow outgoing traceroute add 33434:33523 to this list + UDP_OUT = "20,21,53,113,123" + +Setup these per your requirements. I would recommend you using only the ports you need and avoiding allowing huge ranges of ports. Additionally you can avoid using the unsecured services unsecured ports. For example instead of allowing the default SMTP port 25 you can only allow ports 465 and 587 for outgoing emails. + +**IMPORTANT**: Do not forget to allow your customized SSH port. + +It is important to allow your IP address so it will never get blocked. Such IP addresses can be defined in: + + /etc/csf/csf.ignore + +The blocked IP address will appear in: + + /etc/csf/csf.deny + +When you have finished making changes – restart csf with: + + sudo /etc/init.d/csf restart + +Just to show you how useful CSF is I will show you part of csf.deny on one of my servers: + + 211.216.48.205 # lfd: (sshd) Failed SSH login from 211.216.48.205 (KR/Korea, Republic of/-): 5 in the last 3600 secs - Fri Mar 6 00:30:35 2015 + 103.41.124.53 # lfd: (sshd) Failed SSH login from 103.41.124.53 (HK/Hong Kong/-): 5 in the last 3600 secs - Fri Mar 6 01:06:46 2015 + 103.41.124.42 # lfd: (sshd) Failed SSH login from 103.41.124.42 (HK/Hong Kong/-): 5 in the last 3600 secs - Fri Mar 6 01:59:04 2015 + 103.41.124.26 # lfd: (sshd) Failed SSH login from 103.41.124.26 (HK/Hong Kong/-): 5 in the last 3600 secs - Fri Mar 6 02:48:26 2015 + 109.169.74.58 # lfd: (sshd) Failed SSH login from 109.169.74.58 (GB/United Kingdom/mail2.algeos.com): 5 in the last 3600 secs - Fri Mar 6 03:49:03 2015 + +The IP addresses that performed the brute force login attempt got blocked and they will not bother me again. + +#### Lock accounts #### + +In case an account is not going to be used for a long period of time you can lock it in order to prevent access to it. You can do this with: + + passwd -l accountName + +Account can still be used by the root user. + +### Know your services ### + +The whole idea of a server is to provide access to different services. Limit those to only the ones you need and disable the unused ones. This will not only free some resources, but will make your server a little bit more secured. For example if you are running a headless server you will definitely not need X display or a desktop environment. If there are no Windows network shares, you can safely disable Samba. + +You can use the commands below to see which services are started upon system boot: + + chkconfig --list | grep "3:on" + +If your system runs with **systemd**: + + systemctl list-unit-files --type=service | grep enabled + +To disable a service you can use commands such as: + + chkconfig service off + systemctl disable service + +In the above example change “service” with the name of the actual service you wish to stop. Here is an example: + + chkconfig httpd off + systemctl disable httpd + +### Conclusion ### + +This article was meant to cover some of the general security steps you can take to start securing your server. You can always take additional actions to increase the server protection. Remember that it is your responsibility to keep your server secured and make the wise decision while doing it. Unfortunately there is no easy way to do this and the “perfect” setup requires lots of time and tests until you achieve the desired result. + +-------------------------------------------------------------------------------- + +via: http://www.linuxveda.com/2015/06/03/secure-linux-server/ + +作者:[Marin Todorow][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxveda.com/author/marin_todorov/ +[1]:http://en.wikipedia.org/wiki/Port_%28computer_networking%29#Common_port_numbers \ No newline at end of file diff --git a/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md b/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md new file mode 100644 index 0000000000..a570a83174 --- /dev/null +++ b/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md @@ -0,0 +1,65 @@ +Install Android Studio on Ubuntu 15.04 +================================================================================ +Android Studio is the official IDE for Android application development, based on IntelliJ IDEA. + +### Android Studio Features ### + +Flexible Gradle-based build system +Build variants and multiple apk file generation +Code templates to help you build common app features +Rich layout editor with support for drag and drop theme editing +lint tools to catch performance, usability, version compatibility, and other problems +ProGuard and app-signing capabilities +Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine +And much more + +### Install Android Studio on Ubuntu 15.04 ### + +Flexible Gradle-based build system +Build variants and multiple apk file generation +Code templates to help you build common app features +Rich layout editor with support for drag and drop theme editing +lint tools to catch performance, usability, version compatibility, and other problems +ProGuard and app-signing capabilities +Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine +And much more + +### Install Android Studio on Ubuntu 15.04 ### + +Open the terminal and run the following commands + + sudo apt-add-repository ppa:paolorotolo/android-studio + sudo apt-get update + sudo apt-get install android-studio + +If you want to add Android Studio to the launcher use the following procedure + +Open Android Studio, click on Configure -> Create Desktop Entry. This should create an entry on the dash + +### Screenshots ### + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/12.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/23.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/31.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/41.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/5.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/6.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/7.png) + +-------------------------------------------------------------------------------- + +via: http://www.ubuntugeek.com/install-android-studio-on-ubuntu-15-04.html + +作者:[ruchi][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.ubuntugeek.com/author/ubuntufix \ No newline at end of file From 3ec806c2c11898c91b9fe310e977968a3079c8fe Mon Sep 17 00:00:00 2001 From: Alan You <1058413893@qq.com> Date: Wed, 10 Jun 2015 15:59:51 +0800 Subject: [PATCH 029/153] Update 20150515 How to Install Percona Server on CentOS 7.md --- ...w to Install Percona Server on CentOS 7.md | 42 ++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/sources/tech/20150515 How to Install Percona Server on CentOS 7.md b/sources/tech/20150515 How to Install Percona Server on CentOS 7.md index 9bfd676f92..141649b4fa 100644 --- a/sources/tech/20150515 How to Install Percona Server on CentOS 7.md +++ b/sources/tech/20150515 How to Install Percona Server on CentOS 7.md @@ -1,13 +1,23 @@ translating by FatJoe123 - +如何在CentOS 7上安装Percona Server How to Install Percona Server on CentOS 7 ================================================================================ +在这篇文章中我们将了解关于Percona Server,一个开源简易的MySQL,MariaDB的替代。InnoDB的数据库引擎使得Percona Server非常有吸引力,如果你需要的高性能,高可靠性和高性价比的解决方案,它将是一个很好的选择。 In this article we are going to learn about percona server, an opensource drop-in replacement for MySQL and also for MariaDB. The InnoDB database engine make it very attractive and a good alternative if you need performance, reliability and a cost efficient solution - +在接下来的文节中将涵盖在CentOS的7 Percona的服务器的安装,以及备份当前数据,配置的步骤和如何恢复备份。 In the following sections I am going to cover the installation of the percona server on the CentOS 7, I will also cover the steps needed to make backup of your current data, configuration and how to restore your backup. +###目录### ### Table of contents ### +1.什么是Percona,为什么使用它 +2.备份你的数据库 +3.删除之前的SQL服务器 +4.使用二进制包安装Percona +5.配置Percona +6. +7.恢复你的备份 + 1. What is and why use percona 1. Backup your databases 1. Remove previous SQL server @@ -16,52 +26,74 @@ In the following sections I am going to cover the installation of the percona se 1. Securing your environment 1. Restore your backup +### 1.什么是Percona,为什么使用它 ### 1. What is and why use Percona ### +Percona是一个开源简易的MySQL,MariaDB数据库的替代,它是MYSQL的一个分支,相当多的改进和独特的功能使得它比MYSQL更可靠,性能更强,速度更快,它与MYSQL完全兼容,在Oracle的MYSQL与Percona之间你甚至都可以使用复制命令。 Percona is an opensource alternative to the MySQL and MariaDB databases, it's a fork of the MySQL with many improvements and unique features that makes it more reliable, powerful and faster than MySQL, and yet is fully compatible with it, you can even use replication between Oracle's MySQL and Percona. - +#### 在Percona中独特的功能 #### #### Features exclusive to Percona #### +-分段自适应哈希搜索 +-快速校验算法 +-缓冲池预加载 +-支持FlashCache - Partitioned Adaptive Hash Search - Fast Checksum Algorithm - Buffer Pool Pre-Load - Support for FlashCache +#### MySQL企业版和Percona的特定功能 #### #### MySQL Enterprise and Percona specific features #### +-从不同的服务器导入表 +-PAM认证 +-审计日志 +-线程池 + - Import Tables From Different Servers - PAM authentication - Audit Log - Threadpool +现在,你肯定很兴奋地看到这些好的东西整理在一起,我们将告诉你如何安装和做些的Percona Server的基本配置。 Now that you are pretty excited to see all these good things together, we are going show you how to install and do basic configuration of Percona Server. +### 2. 备份你的数据库 ### ### 2. Backup your databases ### +接下来,在命令行下使用SQL命令创建一个mydatabases.sql文件来重建/恢复salesdb和employeedb数据库,重命名数据库以便反映你的设置,如果没有安装MYSQL跳过此步 The following, command creates a mydatabases.sql file with the SQL commands to recreate/restore salesdb and employeedb databases, replace the databases names to reflect your setup, skip if this is a brand new setup mysqldump -u root -p --databases employeedb salesdb > mydatabases.sql +复制当前的配置文件,如果你没有安装MYSQL也可跳过 Copy the current configuration file, you can also skip this in fresh setups cp my.cnf my.cnf.bkp +### 3.删除之前的SQL服务器 ### ### 3. Remove your previous SQL Server ### +停止MYSQL/MariaDB如果它们还在运行 Stop the MySQL/MariaDB if it's running. systemctl stop mysql.service - + +卸载MariaDB和MYSQL Uninstall MariaDB and MySQL yum remove MariaDB-server MariaDB-client MariaDB-shared mysql mysql-server +移动重命名在/var/lib/mysql当中的MariaDB文件,这比仅仅只是移除更为安全快速,这就像2级即时备份。:) Move / Rename the MariaDB files in **/var/lib/mysql**, it's a safer and faster than just removing, it's like a 2nd level instant backup. :) mv /var/lib/mysql /var/lib/mysql_mariadb - + +### 4.使用二进制包安装Percona ### ### 4. Installing Percona binaries ### +你可以在众多Percona安装方法中选择,在CentOS中使用Yum或者RPM包安装通常是更好的选择 You can choose from a number of options on how to install Percona, in a CentOS system it's generally a better idea to use yum or RPM, so these are the way that are covered by this article, compiling and install from sources are not covered by this article. Installing from Yum repository: From b38abdc36214c0e843efc00f233a2841534e8de3 Mon Sep 17 00:00:00 2001 From: Alan You <1058413893@qq.com> Date: Wed, 10 Jun 2015 17:47:43 +0800 Subject: [PATCH 030/153] Update 20150515 How to Install Percona Server on CentOS 7.md --- .../20150515 How to Install Percona Server on CentOS 7.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150515 How to Install Percona Server on CentOS 7.md b/sources/tech/20150515 How to Install Percona Server on CentOS 7.md index 141649b4fa..1ac8d71901 100644 --- a/sources/tech/20150515 How to Install Percona Server on CentOS 7.md +++ b/sources/tech/20150515 How to Install Percona Server on CentOS 7.md @@ -93,19 +93,24 @@ Move / Rename the MariaDB files in **/var/lib/mysql**, it's a safer and faster t ### 4.使用二进制包安装Percona ### ### 4. Installing Percona binaries ### -你可以在众多Percona安装方法中选择,在CentOS中使用Yum或者RPM包安装通常是更好的选择 +你可以在众多Percona安装方法中选择,在CentOS中使用Yum或者RPM包安装通常是更好的主意,所以这些是本文介绍的方式,下载源文件编译后安装在本文中并没有介绍。 + You can choose from a number of options on how to install Percona, in a CentOS system it's generally a better idea to use yum or RPM, so these are the way that are covered by this article, compiling and install from sources are not covered by this article. +从Yum仓库中安装: Installing from Yum repository: +首先,你需要用这个设置的Percona的Yum库: First you need to set the Percona's Yum repository with this: yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm +接下来安装Percona: And then install Percona with: yum install Percona-Server-client-56 Percona-Server-server-56 +上面的命令安装Percona的服务器和客户端,共享库,可能需要Perl和Perl模块,如DBI::MySQL的,如果尚未安装,以及其他依赖的需要。 The above command installs Percona server and clients, shared libraries, possibly Perl and perl modules such as DBI::MySQL, if that are not already installed, and also other dependencies as needed. Installing from RPM package: From 996528087d801c0ca2efd9dff573f996eb4d6814 Mon Sep 17 00:00:00 2001 From: NearTan Date: Wed, 10 Jun 2015 19:16:07 +0800 Subject: [PATCH 031/153] Update 20150610 Install Android Studio on Ubuntu 15.04.md --- .../tech/20150610 Install Android Studio on Ubuntu 15.04.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md b/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md index a570a83174..a77a50ebcf 100644 --- a/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md +++ b/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md @@ -1,3 +1,5 @@ +NearTan 翻译中 + Install Android Studio on Ubuntu 15.04 ================================================================================ Android Studio is the official IDE for Android application development, based on IntelliJ IDEA. @@ -62,4 +64,4 @@ via: http://www.ubuntugeek.com/install-android-studio-on-ubuntu-15-04.html 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]:http://www.ubuntugeek.com/author/ubuntufix \ No newline at end of file +[a]:http://www.ubuntugeek.com/author/ubuntufix From 41748dc3df8c962939557c4ffca1a8b7318ef79a Mon Sep 17 00:00:00 2001 From: NearTan Date: Wed, 10 Jun 2015 19:17:25 +0800 Subject: [PATCH 032/153] Update 20150610 Install Android Studio on Ubuntu 15.04.md --- sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md b/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md index a77a50ebcf..c7fc919743 100644 --- a/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md +++ b/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md @@ -1,4 +1,4 @@ -NearTan 翻译中 +translating by NearTan Install Android Studio on Ubuntu 15.04 ================================================================================ From 133c3df3e9f7bd2a2a4a041fcf88d5726c8a2516 Mon Sep 17 00:00:00 2001 From: yajun Date: Wed, 10 Jun 2015 19:44:38 +0800 Subject: [PATCH 033/153] =?UTF-8?q?=20=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Websites and Downloading Files in Linux.md | 154 ------------------ ...Websites and Downloading Files in Linux.md | 149 +++++++++++++++++ 2 files changed, 149 insertions(+), 154 deletions(-) delete mode 100644 sources/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md create mode 100644 translated/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md diff --git a/sources/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md b/sources/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md deleted file mode 100644 index 27c3e388ef..0000000000 --- a/sources/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md +++ /dev/null @@ -1,154 +0,0 @@ -fyh翻译中。。。 - -7 Command Line Tools for Browsing Websites and Downloading Files in Linux -================================================================================ -In the last article, we have covered few useful tools like ‘rTorrent‘, ‘wget‘, ‘cURL‘, ‘w3m‘, and ‘Elinks‘. We got lots of response to cover few other tools of same genre, if you’ve missed the first part you can go through it.. - -- [5 Command Line Tools for Downloading Files and Browsing Websites][1] - -This article aims at making you aware of several other Linux command Line browsing and downloading applications, which will help you to browse and download files within the Linux shell. - -### 1. links ### - -Links is an open source web browser written in C programming Language. It is available for all major platforms viz., Linux, Windows, OS X and OS/2. This browser is text based as well as graphical. The text based links web browser is shipped by most of the standard Linux distributions by default. If links is not installed in your system by default you may install it from the repo. Elinks is a fork of links. - - # apt-get install links - # yum install links - -After installing links, you can browse any websites within the terminal as shown below in the screen cast.. - - # links www.tecmint.com - -Use UP and DOWN arrow keys to navigate. Right arrow Key on a link will redirect you to that link and Left arrow key will bring you back to the last page. To QUIT press q. - -Here is how it seems to access Tecmint using links tool. - -![](http://www.tecmint.com/wp-content/uploads/2015/04/links-browse-websites-terminal.gif) - -If you are interested in installing GUI of links, you may need to download latest source tarball (i.e. version 2.9) from [http://links.twibright.com/download/][2]. - -Alternatively, you may use following wget command to download and install as suggested below. - - # wget http://links.twibright.com/download/links-2.9.tar.gz - # tar -xvf links-2.9.tar.gz - # cd links-2.9 - # ./configure –enable-graphics - # make - # make install - -**Note**: You need to install packages (libpng, libjpeg, TIFF library, SVGAlib, XFree86, C Compiler and make), if not already installed to successfully compile the package. - -### 2. links2 ### - -Links2 is a graphical web browser version of Twibright Labs Links web browser. This browser has support for mouse and clicks. Designed specially for speed without any CSS support, fairly good HTML and JavaScript support with limitations. - -To install links2. - - # apt-get install links2 - # yum install links2 - -### 3. lynx ### - -A text based web browser released under GNU GPLv2 license and written in ISO C. lynx is highly configurable web browser and Savior for many SYSAdmin. It has the reputation of being the oldest web browser that is being used and still actively developed. - -To install lynx. - - # apt-get install lynx - # yum install lynx - -After installing lynx, type the following command to browse the website as shown below in the screen cast.. - - # lynx www.tecmint.com - -![](http://www.tecmint.com/wp-content/uploads/2015/04/lynx-commandline-web-browsing.gif) - -If you are interested in knowing a bit more about links and lynx web browser, you may like to visit the below link: - -- [Web Browsing with Lynx and Links Command Line Tools][3] - -### 4. youtube-dl ### - -youtube-dl is a platform independent application which can be used to download videos from youtube and a few other sites. Written primarily in python and released under GNU GPL License, the application works out of the box. (Since youtube don’t allow you to download videos, it may be illegal to use it. Check the laws before you start using this.) - -To install youtube-dl. - - # apt-get install youtube-dl - # yum install youtube-dl - -After installing, try to download files from the Youtube site, as shown in the below screen cast. - - # youtube-dl https://www.youtube.com/watch?v=ql4SEy_4xws - -![](http://www.tecmint.com/wp-content/uploads/2015/04/download-youtube-videos-from-terminal.gif) - -If you are interested in knowing more about youtube-dl you may like to visit the below link: - -- [YouTube-DL – A Command Line Youtube Video Downloader for Linux][4] - -### 5. fetch ### - -It is a command utility for unix-like operating system that is used for URL retrieval. It supports a lot of options like fetching ipv4 only address, ipv6 only address, no redirect, exit after successful file retrieval request, retry, etc. - -Fetch can be Downloaded and installed from the link below - -- [http://sourceforge.net/projects/fetch/?source=typ_redirect][5] - -But before you compile and run it, you should install HTTP Fetcher. Download HTTP Fetcher from the link below. - -- [http://sourceforge.net/projects/http-fetcher/?source=typ_redirect][6] - -### 6. Axel ### - -Axel is a command-line based download accelerator for Linux. Axel makes it possible to download a file at much faster speed through single connection request for multiple copies of files in small chunks through multiple http and ftp connections. - -To install Axel. - - # apt-get install axel - # yum install axel - -After axel installed, you may use following command to download any given file, as shown in the screen cast. - - # axel http://mirror.cse.iitk.ac.in/archlinux/iso/2015.04.01/archlinux-2015.04.01-dual.iso - -![](http://www.tecmint.com/wp-content/uploads/2015/04/download-accelarator-for-linux.gif) - -### 7. aria2 ### - -aria2 is a command-line based download utility that is lightweight and support multi-protocol (HTTP, HTTPS, FTP, BitTorrent and Metalink). It can use metalinks files to simultaneously download ISO files from more than one server. It can serve as a Bit torrent client as well. - -To install aria2. - - # apt-get install aria2 - # yum install aria2 - -Once aria2 installed, you can fire up the following command to download any given file… - - # aria2c http://cdimage.debian.org/debian-cd/7.8.0/multi-arch/iso-cd/debian-7.8.0-amd64-i386-netinst.iso - -![Aria2: Command Line Download Manager for Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Download-Files-in-Terminal.gif) -Aria2: Command Line Download Manager for Linux - -If you’re interested to know more at aria2 and their switches, read the following article. - -- [Aria2 – A Multi-Protocol Command-Line Download Manager for Linux][7] - -That’s all for now. I’ll be here again with another interesting topic you people will love to read. Till then stay tuned and connected to Tecmint. Don’t forget to provide us with your valuable feedback in the comments below. Like and share us and help us get spread. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/command-line-web-browser-download-file-in-linux/ - -作者:[Avishek Kumar][a] -译者:[wangjiezhe](https://github.com/wangjiezhe) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/linux-command-line-tools-for-downloading-files/ -[2]:http://links.twibright.com/download/ -[3]:http://www.tecmint.com/command-line-web-browsers/ -[4]:http://www.tecmint.com/install-youtube-dl-command-line-video-download-tool/ -[5]:http://sourceforge.net/projects/fetch/?source=typ_redirect -[6]:http://sourceforge.net/projects/http-fetcher/?source=typ_redirect -[7]:http://www.tecmint.com/install-aria2-a-multi-protocol-command-line-download-manager-in-rhel-centos-fedora/ diff --git a/translated/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md b/translated/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md new file mode 100644 index 0000000000..0d73e957de --- /dev/null +++ b/translated/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md @@ -0,0 +1,149 @@ +Linux中7个用来浏览网页和下载文件的命令 +================================================================================ +上一篇文章中,我们提到了`rTorrent`、`wget`、`cURL`、`w3m`、`Elinks`等几个有用的工具,很多人回信说还有其它几个类似的工具也值得讨论,所以就有了这篇文章。如果错过了第一部分的讨论,可以通过下面的链接来回顾。 + +- [5个下载文件和浏览网页的命令行工具][1] + +这篇文章介绍了Linux下用于浏览网页和下载文件的其它几个命令行工具。 + +### 1. links ### + +Links是用C语言写的一个开源web浏览器,支持包括Linux、Windows、OS X和OS/2在内的所有主流平台。它提供了基于文本和图形界面两种版本。大多数标准的Linux发行版都默认包含了基于文本的版本。如果您的发行版中默认没有安装links,可以通过包管理工具进行安装。Elinks是links的一个衍生版本。 + + # apt-get install links + # yum install links + +安装完成后,您可以像下图中那样使用命令浏览任意网页。 + + # links www.tecmint.com + +在links中,可以使用键盘上的上下箭头键进行浏览。在超链接上按下右箭头会打开它,按下左箭头会返回到上一页面,按q键退出。 + +下图展示了如何使用links访问Tecmint的网站。 + +![](http://www.tecmint.com/wp-content/uploads/2015/04/links-browse-websites-terminal.gif) + +如何你想安装links的图形界面版本,可能需要从[http://links.twibright.com/download/][2]下载最新的版本tarball(version 2.9)的源代码。 + +同样,也可以像下面那样使用wget下载安装。 + + # wget http://links.twibright.com/download/links-2.9.tar.gz + # tar -xvf links-2.9.tar.gz + # cd links-2.9 + # ./configure –enable-graphics + # make + # make install + +**注意**:links源代码的编译需要安装libpng, libjpeg, TIFF library, SVGAlib, XFree86, C Compiler and make这几个包。 + +### 2. links2 ### + +Links是Twibright实验室编写的web浏览器,而Links2是基于它的一个图形化版本。Links2支持鼠标点击,设计强调速度,不支持任何CSS,在一定程度上很好地支持了HTML和JavaScript。 + +通过下面的命令安装Links2。 + + # apt-get install links2 + # yum install links2 + +### 3. lynx ### + +lynx是一个基于文本的web浏览器,使用GNU GPLv2协议发布,用ISO C编写。lynx是一个可高度配置的web浏览器,是许多系统管理员的救世主,有最悠久的web浏览器之称,并且至今仍然处在积极开发中。 + +通过下面的命令安装lyns。 + + # apt-get install lynx + # yum install lynx + +安装完成后,可以像下图中那样使用这个命令浏览网页。 + + # lynx www.tecmint.com + +![](http://www.tecmint.com/wp-content/uploads/2015/04/lynx-commandline-web-browsing.gif) + +如果你想对links和lyns了解更多,可以访问下面的链接。 + +- [使用Lynx和Links命令浏览网页][3] + +### 4. youtube-dl ### + +youtube-dl是一个跨平台的应用,可以用来下载youtube和另外几个网站上的视频。它主要使用python开发,使用GNU GPL协议发布,并且超越了法律约束。(youtube不允许用户下载视频,因此使用youtube-dl可能会导致违法。使用该工具之前请您仔细阅读相关法律。) + +使用如下命令安装youtube-dl。 + + # apt-get install youtube-dl + # yum install youtube-dl + +安装完成后,可以用如下命令像图中那样从youtube网站下载视频。 + + # youtube-dl https://www.youtube.com/watch?v=ql4SEy_4xws + +![](http://www.tecmint.com/wp-content/uploads/2015/04/download-youtube-videos-from-terminal.gif) + +如果你想对youtube-dl了解更多,可以访问如下链接。 + +- [YouTube-DL – Linux下的youtube视频下载工具][4] + +### 5. fetch ### + +fetch是类unix系统下的一个检索URL的命令,支持许多选项,例如只检索ipv4或ipv6地址,无重定向,检索请求成功时退出,自动重试等。 + +fetch可以从通过下面的链接下载和安装。 + +- [http://sourceforge.net/projects/fetch/?source=typ_redirect][5] + +编译安装之前,需要安装HTTP Fetcher,可以通过下面的链接下载。 + +- [http://sourceforge.net/projects/http-fetcher/?source=typ_redirect][6] + +### 6. Axel ### + +Axel是Linux下的一个基于命令行的下载加速器,可以对请求使用多线程和多个http和ftp连接加速。 + +使用下面的命令安装Axel。 + + # apt-get install axel + # yum install axel + +Axel安装完成后,可以像下图那样使用这个命令下载任意文件。 + + # axel http://mirror.cse.iitk.ac.in/archlinux/iso/2015.04.01/archlinux-2015.04.01-dual.iso + +![](http://www.tecmint.com/wp-content/uploads/2015/04/download-accelarator-for-linux.gif) + +### 7. aria2 ### + +aria2是一个轻量级的基于命令行的下载工具,并且支持多种协议((HTTP, HTTPS, FTP, BitTorrent以及Metalink)。它可以使用.metalinks文件从多台服务器同时下载ISO文件。 + +使用下面的命令安装aria2。 + + # apt-get install aria2 + # yum install aria2 + +aria2安装完成后,可以像下图那样运行这个命令下载任意文件。 + + # aria2c http://cdimage.debian.org/debian-cd/7.8.0/multi-arch/iso-cd/debian-7.8.0-amd64-i386-netinst.iso + +![Aria2: Linux的命令行下载工具 ](http://www.tecmint.com/wp-content/uploads/2015/04/Download-Files-in-Terminal.gif) + +Aria2: Linux命令行下载工具 + +目前就这么多了。稍后咱们讨论另一个有意思的话题。请保持联系,常来Tecmint逛逛。别忘了在评论中给我们提供您的宝贵反馈,您的喜爱和分享帮助我们不断前行。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/command-line-web-browser-download-file-in-linux/ + +作者:[Avishek Kumar][a] +译者:[fyh](https://github.com/fyh) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/linux-command-line-tools-for-downloading-files/ +[2]:http://links.twibright.com/download/ +[3]:http://www.tecmint.com/command-line-web-browsers/ +[4]:http://www.tecmint.com/install-youtube-dl-command-line-video-download-tool/ +[5]:http://sourceforge.net/projects/fetch/?source=typ_redirect +[6]:http://sourceforge.net/projects/http-fetcher/?source=typ_redirect +[7]:http://www.tecmint.com/install-aria2-a-multi-protocol-command-line-download-manager-in-rhel-centos-fedora/ From 880c256f67ea55fc53fdd3a8c9684d647421e71b Mon Sep 17 00:00:00 2001 From: NearTan Date: Wed, 10 Jun 2015 20:34:00 +0800 Subject: [PATCH 034/153] translated --- ... Install Android Studio on Ubuntu 15.04.md | 67 ------------------- ... Install Android Studio on Ubuntu 15.04.md | 67 +++++++++++++++++++ 2 files changed, 67 insertions(+), 67 deletions(-) delete mode 100644 sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md create mode 100644 translated/tech/20150610 Install Android Studio on Ubuntu 15.04.md diff --git a/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md b/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md deleted file mode 100644 index c7fc919743..0000000000 --- a/sources/tech/20150610 Install Android Studio on Ubuntu 15.04.md +++ /dev/null @@ -1,67 +0,0 @@ -translating by NearTan - -Install Android Studio on Ubuntu 15.04 -================================================================================ -Android Studio is the official IDE for Android application development, based on IntelliJ IDEA. - -### Android Studio Features ### - -Flexible Gradle-based build system -Build variants and multiple apk file generation -Code templates to help you build common app features -Rich layout editor with support for drag and drop theme editing -lint tools to catch performance, usability, version compatibility, and other problems -ProGuard and app-signing capabilities -Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine -And much more - -### Install Android Studio on Ubuntu 15.04 ### - -Flexible Gradle-based build system -Build variants and multiple apk file generation -Code templates to help you build common app features -Rich layout editor with support for drag and drop theme editing -lint tools to catch performance, usability, version compatibility, and other problems -ProGuard and app-signing capabilities -Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine -And much more - -### Install Android Studio on Ubuntu 15.04 ### - -Open the terminal and run the following commands - - sudo apt-add-repository ppa:paolorotolo/android-studio - sudo apt-get update - sudo apt-get install android-studio - -If you want to add Android Studio to the launcher use the following procedure - -Open Android Studio, click on Configure -> Create Desktop Entry. This should create an entry on the dash - -### Screenshots ### - -![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/12.png) - -![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/23.png) - -![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/31.png) - -![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/41.png) - -![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/5.png) - -![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/6.png) - -![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/7.png) - --------------------------------------------------------------------------------- - -via: http://www.ubuntugeek.com/install-android-studio-on-ubuntu-15-04.html - -作者:[ruchi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.ubuntugeek.com/author/ubuntufix diff --git a/translated/tech/20150610 Install Android Studio on Ubuntu 15.04.md b/translated/tech/20150610 Install Android Studio on Ubuntu 15.04.md new file mode 100644 index 0000000000..25fe29e043 --- /dev/null +++ b/translated/tech/20150610 Install Android Studio on Ubuntu 15.04.md @@ -0,0 +1,67 @@ + +在Ubuntu 15.04下安装Android Studio +PS 原MD文件有大段重复并且排版错误,译者已修复 +================================================================================ + +Android Studio是官方为了Android应用开发者而发布的IDE,它基于IntelliJ的IDEA。 + +### Android Studio的功能 ### + +灵活的基于Gradle的建构系统 + +针对不同手机编译多个版本的apk + +代码模板功能构建出各种常用的应用 + +支持拖动编辑主题的富布局编辑器 + +lint工具可以捕捉到应用的性能、可用性、版本冲突或者其他问题 + +代码混淆和应用签名功能 + +内置 Google Cloud Platform 的支持,可以轻易的融入Google Cloud Messaging 和 App Engine支持 + +还有更多 + + + +### 在 Ubuntu 15.04 上安装 Android Studio ### + +打开terminal,输入以下命令 + + sudo apt-add-repository ppa:paolorotolo/android-studio + sudo apt-get update + sudo apt-get install android-studio + + +如果要把Android Studio添加到启动栏,你需要如下操作 + +打开Android Studio,点击Configure选择Create Desktop Entry,这样Android Studio应该在dash中创建快捷方式了。 + +### 截图 ### + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/12.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/23.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/31.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/41.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/5.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/6.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/05/7.png) + +-------------------------------------------------------------------------------- + +via: http://www.ubuntugeek.com/install-android-studio-on-ubuntu-15-04.html + +作者:[ruchi][a] +译者:[NearTan](https://github.com/NearTan) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.ubuntugeek.com/author/ubuntufix \ No newline at end of file From c91ab0dbc81d1fda805d4fdd5bef0ba4ab73ca1b Mon Sep 17 00:00:00 2001 From: wxy Date: Wed, 10 Jun 2015 23:49:37 +0800 Subject: [PATCH 035/153] PUB:20150515 Basic Networking Commands with Docker Containers @geekpi --- ...working Commands with Docker Containers.md | 108 ++++++++++++++++++ ...working Commands with Docker Containers.md | 106 ----------------- 2 files changed, 108 insertions(+), 106 deletions(-) create mode 100644 published/20150515 Basic Networking Commands with Docker Containers.md delete mode 100644 translated/tech/20150515 Basic Networking Commands with Docker Containers.md diff --git a/published/20150515 Basic Networking Commands with Docker Containers.md b/published/20150515 Basic Networking Commands with Docker Containers.md new file mode 100644 index 0000000000..fd81249f10 --- /dev/null +++ b/published/20150515 Basic Networking Commands with Docker Containers.md @@ -0,0 +1,108 @@ +基础的Docker容器网络命令 +================================================================================ +各位好,今天我们将学习一些Docker容器的基础命令。Docker 是一个开源项目,提供了一个可以打包、装载和运行任何应用的轻量级容器的开放平台。它没有语言支持、框架和打包系统的限制,从小型的家用电脑到高端服务器,在何时何地都可以运行。它可以使部署和扩展web应用程序、数据库和后端服务像搭积木一样容易,而不依赖特定技术栈或提供商。Docker适用于网络环境,它正应用于数据中心、ISP和越来越多的网络服务。 + +因此,这里有一些你在管理Docker容器的时候会用到的一些命令。 + +### 1. 找到Docker接口 ### + +Docker默认会创建一个名为docker0的网桥接口作为连接外部世界的基础。运行中的docker容器直接连接到网桥接口docker0。默认上,docker会分配172.17.42.1/16给docker0,它是所有运行中的容器ip地址的子网。找到Docker接口的ip地址非常简单。要找出docker0网桥接口和连接到网桥上的docker容器,我们可以在安装了docker的终端或者shell中运行ip命令。 + + # ip a + +![Docker Interface](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-interface.png) + +### 2. 得到Docker容器的ip地址 ### + +如我们上面读到的,docker在宿主机中创建了一个叫docker0的网桥接口。在我们创建一个新的docker容器时,它自动被默认分配了一个在该子网范围内的ip地址。因此,要检测运行中的Docker容器的ip地址,我们需要进入一个正在运行的容器并用下面的命令检查ip地址。首先,我们运行一个新的容器并进入其中。如果你已经有一个正在运行的容器,你可以跳过这个步骤。 + + # docker run -it ubuntu + +现在,我们可以运行ip a来得到容器的ip地址了。 + + # ip a + +![Docker Container IP](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-container-ip.png) + +### 3. 映射暴露的端口 ### + +要映射配置在Dockerfile的暴露端口到宿主机的高位端口,我们只需用下面带上-P标志的命令。这会打开docker容器的随机端口并映射到Dockerfile中定义的端口。下面是使用-P来打开/暴露定义的端口的例子。 + + # docker run -itd -P httpd + +![Mapping Expose Port](http://blog.linoxide.com/wp-content/uploads/2015/05/mapping-expose-port.png) + +上面的命令会映射容器的端口到 httpd 容器的 Dockerfile 中定义的80端口上。我们用下面的命令来查看正在运行的容器暴露的端口。 + + # docker ps + +并且可以用下面的curl命令来检查。 + + # curl http://localhost:49153 + +![Curl Exposed Port](http://blog.linoxide.com/wp-content/uploads/2015/05/curl-exposed-port-e1431034586219.png) + +### 4. 映射到特定的端口上 ### + +我们也可以映射暴露端口或者docker容器端口到我们指定的端口上。要实现这个,我们用-p标志来定义我们所需的端口。这里是我们的一个例子。 + + # docker run -itd -p 8080:80 httpd + +上面的命令会映射(宿主机的)8080端口到(容器的)80上。我们可以运行curl来检查这点。 + + # curl http://localhost:8080 + +![Mapping Specific Port](http://blog.linoxide.com/wp-content/uploads/2015/05/mapping-specific-port.png) + +### 5. 创建自己的网桥 ### + +要给容器创建一个自定义的IP地址,在本篇中我们会创建一个名为br0的新网桥。要分配需要的ip地址,我们需要在运行docker的宿主机中运行下面的命令。 + + # stop docker.io + # ip link add br0 type bridge + # ip addr add 172.30.1.1/20 dev br0 + # ip link set br0 up + # docker -d -b br0 + +![Creating Bridge Interface](http://blog.linoxide.com/wp-content/uploads/2015/05/creating-bridge-interface.png) + +创建完docker网桥之后,我们要让docker的守护进程知道它。 + + # echo 'DOCKER_OPTS="-b=br0"' >> /etc/default/docker + # service docker.io start + +![Adding Interface to Docker](http://blog.linoxide.com/wp-content/uploads/2015/05/adding-interface-to-docker.png) + +到这里,桥接后的接口将会分配给容器在桥接子网内的新ip地址。 + +### 6. 链接到另外一个容器上 ### + +我们可以用Docker将一个容器连接到另外一个上。我们可以在不同的容器上运行不同的程序,并且相互连接或链接。链接允许容器间相互连接并从一个容器上安全地传输信息给另一个容器。要做到这个,我们可以使用--link标志。首先,我们使用--name标志来标示training/postgres镜像。 + + # docker run -d --name db training/postgres + +![Running db Container](http://blog.linoxide.com/wp-content/uploads/2015/05/running-db-container.png) + +完成之后,我们将容器db与training/webapp链接来形成新的叫web的容器。 + + # docker run -d -P --name web --link db:db training/webapp python app.py + +![linking two containers](http://blog.linoxide.com/wp-content/uploads/2015/05/linking-two-containers.png) + +### 总结 ### + +Docker网络很神奇也好玩,我们可以对docker容器做很多事情。我们可以把玩这些简单而基础的docker网络命令。docker的网络是非常先进的,我们可以用它做很多事情。 + +如果你有任何的问题、建议、反馈请在下面的评论栏写下来以便于我们我们可以提升或者更新文章的内容。谢谢! 玩得开心!:-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/networking-commands-docker-containers/ + +作者:[Arun Pyasi][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ diff --git a/translated/tech/20150515 Basic Networking Commands with Docker Containers.md b/translated/tech/20150515 Basic Networking Commands with Docker Containers.md deleted file mode 100644 index d4b90aa7f2..0000000000 --- a/translated/tech/20150515 Basic Networking Commands with Docker Containers.md +++ /dev/null @@ -1,106 +0,0 @@ -关于Docker容器的基础网络命令 -================================================================================ -各位好,今天我们将学习一些Docker容器的基础命令。Docker是一个提供了开放平台来打包、发布并以一个轻量级容器运行任意程序的开放平台。它没有语言支持、框架或者打包系统的限制,可在任何时间、任何地方在小到家用电脑大到高端服务器上运行。这使得在部署和扩展网络应用、数据库和终端服务时不依赖于特定的栈或者提供商。Docker注定是用于网络的如它正应用于数据中心、ISP和越来越多的网络服务。 - -因此,这里有一些你在管理Docker容器的时候会用到的一些命令。 - -### 1. 找到Docker接口 ### - -Docker默认会创建一个名为docker0的网桥接口来连接外部的世界。docker容器运行时直接连接到网桥接口docker0。默认上,docker会分配172.17.42.1/16给docker0,它是所有运行容器ip地址的子网。得到Docker接口的ip地址非常简单。要找出docker0网桥接口和连接到网桥上的docker容器,我们可以在终端或者安装了docker的shell中运行ip命令。 - - # ip a - -![Docker Interface](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-interface.png) - -### 2. 得到Docker容器的ip地址 ### - -如我们上面读到的,docker在主机中创建了一个叫docker0的网桥接口。如我们创建一个心的docker容器一样,它自动被默认分配了一个在子网范围内的ip地址。因此,要检测运行中的Docker容器的ip地址,我们需要进入一个正在运行的容器并用下面的命令检查ip地址。首先,我们运行一个新的容器并进入。如果你已经有一个正在运行的容器,你可以跳过这个步骤。 - - # docker run -it ubuntu - -现在,我们可以运行ip a来得到容器的ip地址了。 - - # ip a - -![Docker Container IP](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-container-ip.png) - -### 3. 映射暴露的端口 ### - -要映射配置在Dockerfile的暴露端口,我们只需用下面带上-P标志的命令。这会打开docker容器的随机端口并映射到Dockerfile中定义的端口。下面是使用-P来打开/映射定义的端口的例子。 - - # docker run -itd -P httpd - -![Mapping Expose Port](http://blog.linoxide.com/wp-content/uploads/2015/05/mapping-expose-port.png) - -上面的命令会映射Dockerfile中定义的httpd 80端口到容器的端口上。我们用下面的命令来查看正在运行的容器暴露的端口。 - - # docker ps - -并且可以用下面的curl命令来检查。 - - # curl http://localhost:49153 - -![Curl Exposed Port](http://blog.linoxide.com/wp-content/uploads/2015/05/curl-exposed-port-e1431034586219.png) - -### 4. 映射到特定的端口上 ### - -我们也可以映射暴露端口或者docker容器端口到我们指定的端口上。要实现这个,我们用-p标志来定义我们的需要。这里是我们的一个例子。 - - # docker run -itd -p 8080:80 httpd - -上面的命令会映射8080端口到80上。我们可以运行curl来检查这点。 - - # curl http://localhost:8080 - -![Mapping Specific Port](Curl Exposed Port) - -### 5. 创建自己的网桥 ### - -要给容器创建一个自定义的IP地址,在本篇中我们会创建一个名为bro的新网桥。要分配需要的ip地址,我们需要在运行docker的主机中运行下面的命令。 - - # stop docker.io - # ip link add br0 type bridge - # ip addr add 172.30.1.1/20 dev br0 - # ip link set br0 up - # docker -d -b br0 - -![Creating Bridge Interface](http://blog.linoxide.com/wp-content/uploads/2015/05/creating-bridge-interface.png) - -创建完docker网桥之后,我们要让docker的守护进程知道它。 - - # echo 'DOCKER_OPTS="-b=br0"' >> /etc/default/docker - # service docker.io start - -![Adding Interface to Docker](http://blog.linoxide.com/wp-content/uploads/2015/05/adding-interface-to-docker.png) - -到这里,桥接后的接口将会分配给容器新的在桥接子网内的ip地址。 - -### 6. 链接到另外一个容器上 ### - -我们可以用Dokcer连接一个容器到另外一个上。我们可以在不容的容器上运行不同的程序,并且相互连接或链接。链接允许容器间相互连接并安全地从一个容器上传输信息给另一个容器。要做到这个,我们可以使用--link标志。首先,我们使用--name标志来表示training/postgres镜像。 - - # docker run -d --name db training/postgres - -![Running db Container](http://blog.linoxide.com/wp-content/uploads/2015/05/running-db-container.png) - -完成之后,我们将容器db与training/webapp链接来形成新的叫web的容器。 - - # docker run -d -P --name web --link db:db training/webapp python app.py - -![linking two containers](http://blog.linoxide.com/wp-content/uploads/2015/05/linking-two-containers.png) - -### 总结 ### - -Docker网络很神奇也好玩,因为有我们可以对docker容器做很多事情。这里有些简单和基础的我们可以把玩docker网络命令。docker的网络是非常高级的。我们可以用它做很多事情。如果你有任何的问题、建议、反馈请在下面的评论栏写下来以便于我们我们可以提升或者更新文章的内容。谢谢! 玩得开心!:-) - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-how-to/networking-commands-docker-containers/ - -作者:[Arun Pyasi][a] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ From 1c4dbb48cc7b7ae59fbead08a63160fb59192620 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 11 Jun 2015 00:02:31 +0800 Subject: [PATCH 036/153] PUB:20150511 Fix Various Update Errors In Ubuntu 14.04 @GOLinux --- ...0511 Fix Various Update Errors In Ubuntu 14.04.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename {translated/tech => published}/20150511 Fix Various Update Errors In Ubuntu 14.04.md (90%) diff --git a/translated/tech/20150511 Fix Various Update Errors In Ubuntu 14.04.md b/published/20150511 Fix Various Update Errors In Ubuntu 14.04.md similarity index 90% rename from translated/tech/20150511 Fix Various Update Errors In Ubuntu 14.04.md rename to published/20150511 Fix Various Update Errors In Ubuntu 14.04.md index 3780b4f948..085869bde6 100644 --- a/translated/tech/20150511 Fix Various Update Errors In Ubuntu 14.04.md +++ b/published/20150511 Fix Various Update Errors In Ubuntu 14.04.md @@ -1,8 +1,8 @@ -修复Ubuntu 14.04中各种更新错误 +Ubuntu 更新错误修复大全 ================================================================================ ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/09/Fix_Ubuntu_Update_Error.jpeg) -在Ubuntu更新中,谁没有碰见个错误?在Ubuntu和其它基于Ubuntu的Linux发行版中,更新错误很常见,也为数不少。这些错误出现的原因多种多样,修复起来也很简单。在本文中,我们将见到Ubuntu中各种类型频繁发生的更新错误以及它们的修复方法。 +在Ubuntu更新中,谁没有碰见个错误?在Ubuntu和其它基于Ubuntu的Linux发行版中,更新错误是一个共性的错误,也经常发生。这些错误出现的原因多种多样,修复起来也很简单。在本文中,我们将见到Ubuntu中各种类型频繁发生的更新错误以及它们的修复方法。 ### 合并列表问题 ### @@ -38,7 +38,7 @@ 下载仓库信息失败的另外一种类型是由于PPA过时导致的。通常,当你运行更新管理器,并看到这样的错误时: -![](Th other type of failed to download repository information error is because of outdated PPA. Usually, when you run Update Manager and see an error like this:) +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2013/04/Failed-to-download-repository-information-Ubuntu-13.04.png) 你可以运行sudo apt-get update来查看哪个PPA更新失败,你可以把它从源列表中删除。你可以按照这个截图指南来[修复下载仓库信息失败错误][3]。 @@ -48,7 +48,7 @@ ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/09/Ubuntu_Update_error.jpeg) -该错误很容易修复,只需修改软件源为主服务器即可。转到软件和更新,在那里你可以修改下载服务器为主服务器: +该错误很容易修复,只需修改软件源为主服务器即可。转到“软件和更新”,在那里你可以修改下载服务器为主服务器: ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/09/Change_server_Ubuntu.jpeg) @@ -78,7 +78,7 @@ 你可以在这里查找到更多详细内容[加载共享库时发生错误][6]。 -### 无法获取锁/var/cache/apt/archives/lock ### +### 无法获取锁 /var/cache/apt/archives/lock ### 在另一个程序在使用APT时,会发生该错误。假定你正在Ubuntu软件中心安装某个东西,然后你又试着在终端中运行apt。 @@ -135,7 +135,7 @@ via: http://itsfoss.com/fix-update-errors-ubuntu-1404/ 作者:[Abhishek][a] 译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From d00240269dfae5b99c65514ae39ce77b5bd1e92a Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 11 Jun 2015 00:15:27 +0800 Subject: [PATCH 037/153] PUB:20150512 A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux @GOLinux --- ...me, Load Average and RAM Usage in Linux.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) rename {translated/tech => published}/20150512 A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux.md (60%) diff --git a/translated/tech/20150512 A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux.md b/published/20150512 A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux.md similarity index 60% rename from translated/tech/20150512 A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux.md rename to published/20150512 A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux.md index 58eb9f18ca..723cf72ddf 100644 --- a/translated/tech/20150512 A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux.md +++ b/published/20150512 A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux.md @@ -1,21 +1,22 @@ -Linux中用于监控网络、磁盘使用、开机时间、平均负载和内存使用率的shell脚本 +一个Linux中用于监控的简易shell脚本 ================================================================================ -系统管理员的任务真的很艰难,因为他/她必须监控服务器、用户、日志,还得创建备份,等等等等。对于大多数重复性的任务,大多数管理员都会写一个自动化脚本来日复一日重复这些任务。这里,我们已经写了一个shell脚本给大家,用来自动化完成系统管理员所要完成的常规任务,这可能在多数情况下,尤其是对于新手而言十分有用,他们能通过该脚本获取到大多数的他们想要的信息,包括系统、网络、用户、负载、内存、主机、内部IP、外部IP、开机时间等。 +系统管理员的任务真的很艰难,因为他/她必须监控服务器、用户、日志,还得创建备份,等等等等。对于大多数重复性的任务,大多数管理员都会写一个自动化脚本来日复一日地重复这些任务。这里,我们已经写了一个shell脚本给大家,用来自动化完成系统管理员所要完成的常规任务,这可能在多数情况下,尤其是对于新手而言十分有用,他们能通过该脚本获取到大多数的他们想要的信息,包括系统、网络、用户、负载、内存、主机、内部IP、外部IP、开机时间等。 我们已经注意并进行了格式化输出(在一定程度上哦)。此脚本不包含任何恶意内容,并且它能以普通用户帐号运行。事实上,我们也推荐你以普通用户运行该脚本,而不是root。 ![Linux Server Health Monitoring](http://www.tecmint.com/wp-content/uploads/2015/05/Linux-Health-Monitoring.png) -监控Linux系统健康的Shell脚本 -你可以通过给Tecmint和脚本作者合适的积分,获得自由使用/修改/再分发下面代码的权利。我们已经试着在一定程度上自定义了输出结果,除了要求的输出内容外,其它内容都不会生成。我们也已经试着使用了那些Linux系统中通常不使用的变量,这些变量可能也是自由代码。 +*监控Linux系统健康的Shell脚本* + +在保留Tecmint和脚本作者应得荣誉的前提下,可以自由使用/修改/再分发下面代码。我们已经试着在一定程度上自定义了输出结果,除了要求的输出内容外,其它内容都不会生成。我们也已经试着使用了那些Linux系统中通常不使用的变量,这些变量应该是可以随便用的。 #### 最小系统要求 #### -你所需要的一切,就是一台正常运转的Linux盒子。 +你所需要的一切,就是一台正常运转的Linux机器。 #### 依赖性 #### -对于一个标准的Linux发行版,使用此包时没有任何依赖。此外,该脚本不需要root权限来执行。但是,如果你想要安装,则必须输入一次root密码。 +对于一个标准的Linux发行版,使用此软件包不需任何依赖。此外,该脚本不需要root权限来执行。但是,如果你想要安装,则必须输入一次root密码。 #### 安全性 #### @@ -30,16 +31,16 @@ Linux中用于监控网络、磁盘使用、开机时间、平均负载和内存 强烈建议你以普通用户身份安装该脚本,而不是root。安装过程中会询问root密码,并且在需要的时候安装必要的组件。 -要安装`“tecmint_monitor.sh”`脚本,只需像下面这样使用-i(安装)选项就可以了。 +要安装“`tecmint_monitor.sh`”脚本,只需像下面这样使用-i(安装)选项就可以了。 - /tecmint_monitor.sh -i + ./tecmint_monitor.sh -i 在提示你输入root密码时输入该密码。如果一切顺利,你会看到像下面这样的安装成功信息。 Password: Congratulations! Script Installed, now run monitor Command -安装完毕后,你可以通过在任何位置,以任何用户调用命令`‘monitor’`来运行该脚本。如果你不喜欢安装,你需要在每次运行时输入路径。 +安装完毕后,你可以在任何位置,以任何用户调用命令`‘monitor’`来运行该脚本。如果你不喜欢安装,你需要在每次运行时输入路径。 # ./Path/to/script/tecmint_monitor.sh @@ -49,7 +50,7 @@ Linux中用于监控网络、磁盘使用、开机时间、平均负载和内存 ![TecMint Monitor Script in Action](http://www.tecmint.com/wp-content/uploads/2015/05/TecMint-Monitor-Script.gif) -你一运行命令,就会获得下面这些各种各样和系统相关的信息: +你运行命令就会获得下面这些各种各样和系统相关的信息: - 互联网连通性 - 操作系统类型 @@ -78,9 +79,9 @@ Linux中用于监控网络、磁盘使用、开机时间、平均负载和内存 ### 小结 ### -该脚本在一些机器上可以开机即用,这一点我已经检查过。相信对于你而言,它也会正常工作。如果你们发现了什么毛病,可以在评论中告诉我。这个脚本还不是结束,这仅仅是个开始。从这里开始,你可以将它提升到任何等级。如果你想要编辑脚本,将它带入一个更深的层次,尽管随意去做吧,别忘了给我们合适的积分,也别忘了把你更新后的脚本拿出来和我们分享哦,这样,我们也能通过给你合适的积分来更新此文。 +该脚本在一些机器上可以开机即用,这一点我已经检查过。相信对于你而言,它也会正常工作。如果你们发现了什么毛病,可以在评论中告诉我。这个脚本还不完善,这仅仅是个开始。从这里开始,你可以将它改进到任何程度。如果你想要编辑脚本,将它带入一个更深的层次,尽管随意去做吧,别忘了给我们应的的荣誉,也别忘了把你更新后的脚本拿出来和我们分享哦,这样,我们也会更新此文来给你应得的荣誉。 -别忘了和我们分享你的想法或者脚本,我们会在这儿帮助你。谢谢你们给予的所有挚爱。保持连线,不要走开哦。 +别忘了和我们分享你的想法或者脚本,我们会在这儿帮助你。谢谢你们给予的所有挚爱。继续浏览,不要走开哦。 -------------------------------------------------------------------------------- @@ -88,7 +89,7 @@ via: http://www.tecmint.com/linux-server-health-monitoring-script/ 作者:[Avishek Kumar][a] 译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From 30c2f196d396c6dee08de1ac3ee65325a5b0887e Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 11 Jun 2015 00:42:49 +0800 Subject: [PATCH 038/153] PUB:20150527 How to Kill Linux Processes or Unresponsive Applications Using 'xkill' Command @geekpi --- ...sive Applications Using 'xkill' Command.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) rename {translated/tech => published}/20150527 How to Kill Linux Processes or Unresponsive Applications Using 'xkill' Command.md (70%) diff --git a/translated/tech/20150527 How to Kill Linux Processes or Unresponsive Applications Using 'xkill' Command.md b/published/20150527 How to Kill Linux Processes or Unresponsive Applications Using 'xkill' Command.md similarity index 70% rename from translated/tech/20150527 How to Kill Linux Processes or Unresponsive Applications Using 'xkill' Command.md rename to published/20150527 How to Kill Linux Processes or Unresponsive Applications Using 'xkill' Command.md index 20211ab6bf..91127c7e74 100644 --- a/translated/tech/20150527 How to Kill Linux Processes or Unresponsive Applications Using 'xkill' Command.md +++ b/published/20150527 How to Kill Linux Processes or Unresponsive Applications Using 'xkill' Command.md @@ -1,8 +1,9 @@ -如何使用xkill命令傻点Linux进程/未响应的程序 +如何使用xkill命令杀掉Linux进程/未响应的程序 ================================================================================ + 我们如何在Linux中杀掉一个资源/进程?很明显我们会找出资源的pid然后用kill命令。 -更准确一点,我们可以找到资源(这里就是terminal)的PID: +说的更明白一点,我们可以找到某个资源(比如terminal)的PID: $ ps -A | grep -i terminal @@ -14,7 +15,7 @@ kill命令会发送一个信号给该pid的进程。 -另外一个方法是我们可以使用pkill命令,它可以基于进程的名字或者其他的属性来杀掉进程。同样我们要杀掉一个叫terminal的进程可以这么做: +另外一个方法是我们可以使用pkill命令,它可以基于进程的名字或者其他的属性来杀掉进程。同样我们要杀掉一个叫terminal的进程可以这么做: $ pkill terminal @@ -22,15 +23,15 @@ kill命令会发送一个信号给该pid的进程。 pkill看上去更加容易上手,因为你你不用找出进程的pid。但是如果你要对系统做更好的控制,那么没有什么可以打败'kill'。使用kill命令可以更好地审视你要杀掉的进程。 -我们已经有一篇覆盖了[kill、pkill和killall命令][1]间细节的指导了。 +我们已经有一篇覆盖了[kill、pkill和killall命令][1]细节的指导了。 对于那些运行X Server的人而言,有另外一个工具称为xkill可以将进程从X Window中杀掉而不必传递它的名字或者pid。 -xkill工具强制X server关闭于它客户端之间的联系,这可以让X resource关闭这个客户端。xkill是X11工具集中一个非常容易上手的杀掉无用窗口的工具。 +xkill工具强制X server关闭与它的客户程序之间的联系,其结果就是X resource关闭了这个客户程序。xkill是X11工具集中一个非常容易上手的杀掉无用窗口的工具。 -它支持的选项如在同时运行多个X Server时使用-display选项后面跟上显示号连接到指定的X server,使用-all(并不建议)杀掉所有在屏幕上的所遇顶层窗口,同时将帧(-frame)也计算在内。 +它支持的选项如在同时运行多个X Server时使用-display选项后面跟上显示号连接到指定的X server,使用-all(并不建议)杀掉所有在屏幕上的所有顶层窗口,以及帧(-frame)参数。 -要得到所有的客户端你可以运行: +要列出所有的客户程序你可以运行: $ xlsclients @@ -46,12 +47,11 @@ xkill工具强制X server关闭于它客户端之间的联系,这可以让X re 如果后面没有跟上资源id,xkill会将鼠标指针变成一个特殊符号,类似于“X”。只需在你要杀掉的窗口上点击,它就会杀掉它与server端的通信,这个程序就被杀掉了。 - $ xkill ![Xkill Command](http://www.tecmint.com/wp-content/uploads/2015/05/Xkill.png) -使用xkill杀掉进程 +*使用xkill杀掉进程* 需要注意的是xkill并不能保证它的通信会被成功杀掉/退出。大多数程序会在与服务端的通信被关闭后杀掉。然而仍有少部分会继续运行。 @@ -63,7 +63,7 @@ xkill工具强制X server关闭于它客户端之间的联系,这可以让X re **我需要在linux命令行中使用xkill么** -不是,你不必在命令行中运行xkill。你可以设置一个快捷键,并用它来调用xkill。 +不是,你不必非在命令行中运行xkill。你可以设置一个快捷键,并用它来调用xkill。 下面是如何在典型的gnome3桌面中设置键盘快捷键。 @@ -71,13 +71,13 @@ xkill工具强制X server关闭于它客户端之间的联系,这可以让X re ![Gnome Settings](http://www.tecmint.com/wp-content/uploads/2015/05/22.png) -Gnome 设置 +*Gnome 设置* ![Add Shortcut Key](http://www.tecmint.com/wp-content/uploads/2015/05/31.png) -添加快捷键 +*添加快捷键* -下次你要杀掉X资源只要用组合键就行了(Ctrl+Alt+Shift+x),你看到你的鼠标变成x了。点击想要杀掉的x资源就行了。 +下次你要杀掉一个X资源只要用组合键就行了(Ctrl+Alt+Shift+x),你看到你的鼠标变成x了。点击想要杀掉的x资源就行了。 -------------------------------------------------------------------------------- @@ -85,9 +85,9 @@ via: http://www.tecmint.com/kill-processes-unresponsive-programs-in-ubuntu/ 作者:[Avishek Kumar][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/how-to-kill-a-process-in-linux/ +[1]:https://linux.cn/article-2116-1.html From 3845863c321c307e2f8796bc523c5c64c2ab15cf Mon Sep 17 00:00:00 2001 From: yajun Date: Thu, 11 Jun 2015 09:12:18 +0800 Subject: [PATCH 039/153] =?UTF-8?q?fyh=E7=94=B3=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20141211 Open source all over the world.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20141211 Open source all over the world.md b/sources/talk/20141211 Open source all over the world.md index bd306edd5a..1ef32bf1de 100644 --- a/sources/talk/20141211 Open source all over the world.md +++ b/sources/talk/20141211 Open source all over the world.md @@ -1,3 +1,5 @@ +fyh 翻译中。。。 + Open source all over the world ================================================================================ ![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BUS_OpenSourceExperience_520x292_cm.png) From ed235a6fd2837786aa4b3e4dbe79fe678c8a954d Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 11 Jun 2015 09:38:35 +0800 Subject: [PATCH 040/153] translating --- ...nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md b/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md index e98bb00523..dd3478c903 100644 --- a/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md +++ b/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md @@ -1,3 +1,5 @@ +translating----geekpi + How to Install nginx and google pagespeed on Ubuntu 15.04 (Vivid Vervet) ================================================================================ Nginx (engine-x) is a open source and high performance HTTP server, reverse proxy and IMAP/POP3 proxy server. The outstanding features of Nginx are: stability, rich feature set, simple configuration and low resource consumption. Nginx is being used by some of the largest websites on the internet and is gaining more and more popularity in the webmaster community. This tutorials shows how to build a nginx .deb package for Ubuntu 15.04 from source that has Google pagespeed module compiled in. @@ -126,4 +128,4 @@ via: https://www.howtoforge.com/tutorial/how-to-install-nginx-and-google-pagespe 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 -[1]:https://developers.google.com/speed/pagespeed/module/ \ No newline at end of file +[1]:https://developers.google.com/speed/pagespeed/module/ From 4efcae369ed64e3575dcb54e7e51511f284c1ffb Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 11 Jun 2015 10:06:26 +0800 Subject: [PATCH 041/153] PUB:20150512 45 Zypper Commands to Manage 'Suse' Linux Package Management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zhangboyue 翻译的不错! --- ... Manage 'Suse' Linux Package Management.md | 150 +++++++++--------- 1 file changed, 78 insertions(+), 72 deletions(-) rename {translated/tech => published}/20150512 45 Zypper Commands to Manage 'Suse' Linux Package Management.md (89%) diff --git a/translated/tech/20150512 45 Zypper Commands to Manage 'Suse' Linux Package Management.md b/published/20150512 45 Zypper Commands to Manage 'Suse' Linux Package Management.md similarity index 89% rename from translated/tech/20150512 45 Zypper Commands to Manage 'Suse' Linux Package Management.md rename to published/20150512 45 Zypper Commands to Manage 'Suse' Linux Package Management.md index efa807f2f3..0280635408 100644 --- a/translated/tech/20150512 45 Zypper Commands to Manage 'Suse' Linux Package Management.md +++ b/published/20150512 45 Zypper Commands to Manage 'Suse' Linux Package Management.md @@ -1,14 +1,14 @@ -45 个用于 ‘Suse‘ Linux 包管理的 Zypper 命令 +用于 ‘Suse‘ Linux 包管理的 Zypper 命令大全 ====================================================================== -SUSE( Software and System Entwicklung,即软件和系统开发。其中‘entwicklung‘是德语,意为开发)Linux是 Novell 公司在 Linux 内核基础上发布的操作系统。SUSE Linux 有两个发行分支。其中之一名为 OpenSUSE,这是一款自由而且免费的操作系统。该系统由开源社区开发维护,支持一些最新版本的应用软件,其最新的稳定版本为 13.2。 +SUSE( Software and System Entwicklung,即软件和系统开发。其中‘entwicklung‘是德语,意为开发)Linux 是由 Novell 公司在 Linux 内核基础上建立的操作系统。SUSE Linux 有两个发行分支。其中之一名为 openSUSE,这是一款自由而且免费的操作系统 (free as in speech as well as free as in wine)。该系统由开源社区开发维护,支持一些最新版本的应用软件,其最新的稳定版本为 13.2。 -另外一个分支是SUSE Linux 企业版。该分支是一个为企业及商业化产品设计的 Linux 发行版,包含了大量的企业应用以及适用于商业产品生产环境的特性。其最新的稳定版本为 12。 +另外一个分支是 SUSE Linux 企业版。该分支是一个为企业及商业化产品设计的 Linux 发行版,包含了大量的企业应用以及适用于商业产品生产环境的特性。其最新的稳定版本为 12。 以下的链接包含了安装企业版 SUSE Linux 服务器的详细信息。 - [如何安装企业版 SUSE Linux 12][1] -Zypper 和 Yast 是 SUSE Linux 平台上的软件包管理工具,他们的底层使用了 RPM(译者注:RPM 最初指 Redhat Pacakge Manager ,现普遍解释为递归短语 RPM Package Manager 的缩写)。 +Zypper 和 Yast 是 SUSE Linux 平台上的软件包管理工具,他们的底层使用了 RPM(LCTT 译者注:RPM 最初指 Redhat Pacakge Manager ,现普遍解释为递归短语 RPM Package Manager 的缩写)。 Yast(Yet another Setup Tool )是 OpenSUSE 以及企业版 SUSE 上用于系统管理、设置和配置的工具。 @@ -16,21 +16,21 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS 本文将介绍实际应用中常见的一些Zypper命令。这些命令用来进行安装、更新、删除等任何软件包管理器所能够胜任的工作。 -**重要** : 切记所有的这些指令都将在系统全局范围内产生影响,所以必须以 root 身份执行,否则命令将失败。 +**重要** : 切记所有的这些命令都将在系统全局范围内产生影响,所以必须以 root 身份执行,否则命令将失败。 ### 获取基本的 Zypper 帮助信息 ### -1. 不带任何选项的执行 zypper, 将输出该命令的全局选项以及子命令列表(译者注:全局选项,global option,控制台命令的输入分为可选参数和位置参数两大类。按照习惯,一般可选参数称为选项'option',而位置参数称为参数 'argument')。 +1. 不带任何选项的执行 zypper, 将输出该命令的全局选项以及子命令列表(LCTT 译者注:全局选项,global option,控制台命令的输入分为可选参数和位置参数两大类。按照习惯,一般可选参数称为选项'option',而位置参数称为参数 'argument')。 -
%>  zypper
+    
#  zypper
         Usage:
         zypper [--global-options]
2. 获取一个具体的子命令的帮助信息,比如 'in' (install),可以执行下面的命令 -
%> zypper help in
+
# zypper help in
或者 -
%> zypper help install
+    
# zypper help install
     install (in) [options] {capability | rpm_file_uri}
     
     Install packages with specified capabilities or RPM files with specified
@@ -96,7 +96,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 4. 获取一个模式包的信息(以 lamp_server 为例)。
 
-    
%> zypper info -t pattern lamp_server
+    
# zypper info -t pattern lamp_server
     
     Loading repository data...
     Reading installed packages...
@@ -136,9 +136,9 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 5. 开启一个Zypper Shell 的会话。
 
-    
 %>zypper shell 
+
# zypper shell 
或者 -
 %>zypper sh 
+
# zypper sh 
zypper> help
       Usage:
@@ -151,9 +151,9 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 6. 使用 'zypper repos' 或者 'zypper lr' 来列举所有已定以的软件库。
 
-    
%> zypper repos
+
# zypper repos
或者 -
%> zypper lr
+    
# zypper lr
       | Alias                     | Name                               | Enabled | Refresh
     --+---------------------------+------------------------------------+---------+--------
     1 | openSUSE-13.2-0           | openSUSE-13.2-0                    | Yes     | No
@@ -183,7 +183,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 8. 根据优先级列举软件库。
 
-    
%> zypper lr -P
+    
# zypper lr -P
       | Alias                     | Name                               | Enabled | Refresh | Priority
     --+---------------------------+------------------------------------+---------+---------+---------
     1 | openSUSE-13.2-0           | openSUSE-13.2-0                    | Yes     | No      |   99
@@ -200,9 +200,9 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 9. 使用 'zypper refresh' or 'zypper ref' 来刷新 zypper 软件库。
 
-    
%> zypper refresh 
+
# zypper refresh 
或者 -
%> zypper ref
+    
# zypper ref
     Repository 'openSUSE-13.2-0' is up to date.
     Repository 'openSUSE-13.2-Debug' is up to date.
     Repository 'openSUSE-13.2-Non-Oss' is up to date.
@@ -213,13 +213,13 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 10. 刷新一个指定的软件库(以 'repo-non-oss' 为例 )。
 
-    
%> zypper refresh repo-non-oss
+    
# zypper refresh repo-non-oss
     Repository 'openSUSE-13.2-Non-Oss' is up to date.
     Specified repositories have been refreshed. 
11. 强制更新一个软件库(以 'repo-non-oss' 为例 )。 -
%> zypper ref -f repo-non-oss 
+    
# zypper ref -f repo-non-oss 
     Forcing raw metadata refresh
     Retrieving repository 'openSUSE-13.2-Non-Oss' metadata ............................................................[done]
     Forcing building of repository cache
@@ -230,9 +230,9 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 本文中我们使用‘zypper modifyrepo‘ 或者 ‘zypper mr‘ 来关闭或者开启 zypper 软件库。
 
-12. 在关闭一个软件库之前,我们需要知道在 zypper中,每一个软件库有一个唯一的标示数字与之关联,该数字用于打开或者关闭与之相联系的软件库。假设我们需要关闭 'repo-oss' 软件库,那么我们可以通过以下的法来获得该软件库的标志数字。
+12. 在关闭一个软件库之前,我们需要知道在 zypper 中,每一个软件库有一个唯一的标示数字与之关联,该数字用于打开或者关闭与之相联系的软件库。假设我们需要关闭 'repo-oss' 软件库,那么我们可以通过以下的法来获得该软件库的标志数字。
 
-    
%> zypper lr
+    
# zypper lr
       | Alias                     | Name                               | Enabled | Refresh
     --+---------------------------+------------------------------------+---------+--------
     1 | openSUSE-13.2-0           | openSUSE-13.2-0                    | Yes     | No
@@ -246,23 +246,23 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
     9 | repo-update-non-oss       | openSUSE-13.2-Update-Non-Oss       | Yes     | Yes
从以上输出的列表中我们可以看到 'repo-oss' 库的标示数字是 6,因此通过以下的命令来关闭该库。 -
%> zypper mr -d 6
+    
# zypper mr -d 6
     Repository 'repo-oss' has been successfully disabled.
13. 如果需要再次开启软件库 ‘repo-oss‘, 接上例,与之相关联的标示数字为 6。 -
%> zypper mr -e 6
+    
# zypper mr -e 6
     Repository 'repo-oss' has been successfully enabled.
14. 针对某一个软件库(以 'repo-non-oss' 为例 )开启自动刷新( auto-refresh )和 rpm 缓存,并设置该软件库的优先级,比如85。 -
%> zypper mr -rk -p 85 repo-non-oss
+    
# zypper mr -rk -p 85 repo-non-oss
     Repository 'repo-non-oss' priority has been left unchanged (85)
     Nothing to change for repository 'repo-non-oss'.
15. 对所有的软件库关闭 rpm 文件缓存。 -
%> zypper mr -Ka
+    
# zypper mr -Ka
     RPM files caching has been disabled for repository 'openSUSE-13.2-0'.
     RPM files caching has been disabled for repository 'repo-debug'.
     RPM files caching has been disabled for repository 'repo-debug-update'.
@@ -274,7 +274,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
     RPM files caching has been disabled for repository 'repo-update-non-oss'.
16. 对所有的软件库开启 rpm 文件缓存。 -
 zypper mr -ka
+    
# zypper mr -ka
     RPM files caching has been enabled for repository 'openSUSE-13.2-0'.
     RPM files caching has been enabled for repository 'repo-debug'.
     RPM files caching has been enabled for repository 'repo-debug-update'.
@@ -285,8 +285,8 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
     RPM files caching has been enabled for repository 'repo-update'.
     RPM files caching has been enabled for repository 'repo-update-non-oss'.
-17. 关闭远程库的rpm 文件缓存 -
%> zypper mr -Kt
+17. 关闭远程库的 rpm 文件缓存
+    
# zypper mr -Kt
     RPM files caching has been disabled for repository 'repo-debug'.
     RPM files caching has been disabled for repository 'repo-debug-update'.
     RPM files caching has been disabled for repository 'repo-debug-update-non-oss'.
@@ -297,7 +297,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
     RPM files caching has been disabled for repository 'repo-update-non-oss'.
18. 开启远程软件库的 rpm 文件缓存。 -
%> zypper mr -kt
+    
# zypper mr -kt
     RPM files caching has been enabled for repository 'repo-debug'.
     RPM files caching has been enabled for repository 'repo-debug-update'.
     RPM files caching has been enabled for repository 'repo-debug-update-non-oss'.
@@ -313,7 +313,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 19. 增加一个新的软件库( 以 “http://download.opensuse.org/update/12.3/” 为例 )。
 
-    
%>  zypper ar http://download.opensuse.org/update/11.1/ update
+    
# zypper ar http://download.opensuse.org/update/11.1/ update
     Adding repository 'update' .............................................................................................................................................................[done]
     Repository 'update' successfully added
     Enabled     : Yes
@@ -323,14 +323,14 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 20. 更改一个软件库的名字,这将仅仅改变软件库的别名。 命令 'zypper namerepo' 或者 'zypperr nr' 可以胜任此工作。例如更改标示数字为10的软件库的名字为 'upd8',或者说将标示数字为10的软件库的别名改为 'upd8',可以使用下面的命令。
 
-    
%> zypper nr 10 upd8
+    
# zypper nr 10 upd8
     Repository 'update' renamed to 'upd8'.
#### 删除软件库 #### 21. 删除一个软件库。要从系统删除一个软件库可以使 'zypper removerepo' 或者 'zypper rr'。例如以下的命令可以删除软件库 'upd8' -
%> zypper rr upd8
+    
# zypper rr upd8
     # Removing repository 'upd8' .........................................................................................[done]
     Repository 'upd8' has been removed.
@@ -339,7 +339,8 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS #### 用 zypper 安装一个软件包 #### 22. 在 zypper 中,我们可以通过软件包的功能名称来安装一个软件包。以 Firefox 为例,以下的命令可以用来安装该软件包。 -
%> zypper in MozillaFirefox
+
+    
# zypper in MozillaFirefox
     Loading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -370,8 +371,9 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
     Retrieving: hicolor-icon-theme-0.13-2.1.2.noarch.rpm ...................................................................................................................................[done]
     Retrieving package sound-theme-freedesktop-0.8-7.1.2.noarch                                                                                            (3/128), 372.6 KiB (460.3 KiB unpacked) 
-23. 安装指定版本号的软件包,(以 gcc 5.1 为例)。 -
 %>zypper in 'gcc<5.1'
+23. 安装指定版本号的软件包,(以 gcc 5.1 为例)。
+
+    
# zypper in 'gcc<5.1'
     Loading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -385,7 +387,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 24. 为特定的CPU架构安装软件包(以兼容 i586 的 gcc 为例)。
 
-    
%> zypper in gcc.i586
+    
# zypper in gcc.i586
     Loading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -403,7 +405,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
  
 25. 为特定的CPU架构安装指定版本号的软件包(以兼容 i586 且版本低于5.1的 gcc 为例)
 
-    
%> zypper in 'gcc.i586<5.1'
+    
# zypper in 'gcc.i586<5.1'
     Loading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -418,8 +420,9 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
     In cache libatomic1-gcc49-4.9.0+r211729-2.1.7.x86_64.rpm                                           (2/13),  14.3 KiB ( 26.1 KiB unpacked)
     In cache libgomp1-gcc49-4.9.0+r211729-2.1.7.x86_64.rpm                                             (3/13),  41.1 KiB ( 90.7 KiB unpacked) 
-26. 从指定的软件库里面安装一个软件包,例如从 amarok 中安装 libxine。 -
%> zypper in amarok upd:libxine1
+26. 从指定的软件库里面安装一个软件包,例如从 amarok 中安装 libxine。
+
+    
# zypper in amarok upd:libxine1
     Loading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -431,7 +434,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 27. 通过指定软件包的名字安装软件包。
 
-    
%> zypper in -n git
+    
# zypper in -n git
     Loading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -451,8 +454,9 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
     Overall download size: 15.6 MiB. Already cached: 0 B  After the operation, additional 56.7 MiB will be used.
     Continue? [y/n/? shows all options] (y): y 
-28. 通过通配符来安装软件包,例如,安装所有 php5 的软件包。 -
%> zypper in php5*
+28. 通过通配符来安装软件包,例如,安装所有 php5 的软件包。
+
+    
# zypper in php5*
     Loading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -484,9 +488,9 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
       do not install php5-pear-Horde_Pdf-2.0.1-6.1.3.noarch
     ....
-29. 使用模式名称(模式名称是一类软件包的名字)来批量安装软件包 +29. 使用模式名称(模式名称是一类软件包的名字)来批量安装软件包。 -
%> zypper in -t pattern lamp_server
+    
# zypper in -t pattern lamp_server
     ading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -506,7 +510,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
     Overall download size: 7.2 MiB. Already cached: 1.2 MiB  After the operation, additional 34.7 MiB will be used.
     Continue? [y/n/? shows all options] (y): 
-30. 使用一行命令安转一个软件包同时卸载另一个软件包,例如在安装 nano 的同时卸载 vi +30. 使用一行命令安装一个软件包同时卸载另一个软件包,例如在安装 nano 的同时卸载 vi
# zypper in nano -vi
     Loading repository data...
@@ -530,7 +534,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 31. 使用 zypper 安装 rpm 软件包。
 
-    
%> zypper in teamviewer*.rpm
+    
# zypper in teamviewer*.rpm
     Loading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -552,9 +556,9 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 32. 命令 ‘zypper remove‘ 和 ‘zypper rm‘ 用于卸载软件包。例如卸载 apache2:
 
-    
%> zypper remove apache2 
+
# zypper remove apache2 
或者 -
%> zypper rm apache2
+    
# zypper rm apache2
     Loading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -572,9 +576,9 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 33. 更新所有的软件包,可以使用 ‘zypper update‘ 或者 ‘zypper up‘。
 
-    
%> zypper up 
+
# zypper up 
或者 -
%> zypper update
+    
# zypper update
 
     Loading repository data...
     Reading installed packages...
@@ -591,9 +595,9 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
     Nothing to do.
-35. 安装一个软件库,例如 ariadb,如果该库存在则更新之。 +35. 安装一个软件库,例如 mariadb,如果该库存在则更新之。 -
%> zypper in mariadb
+    
# zypper in mariadb
     Loading repository data...
     Reading installed packages...
     'mariadb' is already installed.
@@ -608,7 +612,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 36. 安装某一个软件包的源文件及其依赖关系,例如 mariadb。
 
-    
%> zypper si mariadb
+    
# zypper si mariadb
     Reading installed packages...
     Loading repository data...
     Resolving package dependencies...
@@ -626,7 +630,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 37. 仅为某一个软件包安装源文件,例如 mariadb
 
-    
%> zypper in -D mariadb
+    
# zypper in -D mariadb
     Loading repository data...
     Reading installed packages...
     'mariadb' is already installed.
@@ -637,7 +641,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 38. 仅为某一个软件包安装依赖关系,例如 mariadb
 
-    
%> zypper si -d mariadb
+    
# zypper si -d mariadb
     Reading installed packages...
     Loading repository data...
     Resolving package dependencies...
@@ -653,11 +657,11 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
     Overall download size: 33.7 MiB. Already cached: 129.5 KiB  After the operation, additional 144.3 MiB will be used.
     Continue? [y/n/? shows all options] (y): y
-#### Zypper in Scripts and Applications #### +#### 在脚本和应用中调用 Zypper (非交互式) #### 39. 安装一个软件包,并且在安装过程中跳过与用户的交互, 例如 mariadb。 -
%> zypper --non-interactive in mariadb
+    
# zypper --non-interactive in mariadb
     Loading repository data...
     Reading installed packages...
     'mariadb' is already installed.
@@ -668,7 +672,7 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 40. 卸载一个软件包,并且在卸载过程中跳过与用户的交互,例如 mariadb
 
-    
%> zypper --non-interactive rm mariadb
+    
# zypper --non-interactive rm mariadb
     Loading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -681,18 +685,18 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
     Continue? [y/n/? shows all options] (y): y
     (1/1) Removing mariadb-10.0.13-2.6.1 .............................................................................[done] 
-41. 将 zypper 输出用 XML 格式打印。 +41. 以 XML 格式显示 zypper 的输出。 -
%> zypper --xmlout
+    
# zypper --xmlout
       Usage:
     	zypper [--global-options]  [--command-options] [arguments]
 
       Global Options
     ....
-42. 禁止详细信息输出到屏幕。 +42. 在安装过程中禁止详细信息输出到屏幕。 -
%> zypper --quiet in mariadb
+    
# zypper --quiet in mariadb
     The following NEW package is going to be installed:
       mariadb
 
@@ -703,10 +707,11 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 43. 在卸载过程中禁止详细信息输出到屏幕
 
-    
%> zypper --quiet rm mariadb 
+
# zypper --quiet rm mariadb 
-44. 自动地同意版权或者协议。 -
%> zypper patch --auto-agree-with-licenses
+44. 自动地同意版权或者协议。
+
+    
# zypper patch --auto-agree-with-licenses
     Loading repository data...
     Reading installed packages...
     Resolving package dependencies...
@@ -717,15 +722,15 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 45. 以下指令可以用来清理Zypper缓存。
 
-    
%> zypper clean
+    
# zypper clean
     All repositories have been cleaned up.
-如果需要一次性地清理元数据以及软件包缓存,可以通过 -all/-a 选项来达到目的 +如果需要一次性地清理元数据以及软件包缓存,可以通过 -all 或 -a 选项来达到目的 -
%> zypper clean -a
+    
# zypper clean -a
     All repositories have been cleaned up.
-46. 查看 Zypper 的历史信息。籍由 Zypper 所有的软件包管理动作,包括安装、更新以及卸载都会在 /var/log/zypp/history中保留历史信息。可以通过 cat 来查看此文件,或者通过过滤器来筛选希望看到的信息。 +46. 查看 Zypper 的历史信息。任何通过 Zypper 进行的软件包管理动作,包括安装、更新以及卸载都会在 /var/log/zypp/history中保留历史信息。可以通过 cat 来查看此文件,或者通过过滤器来筛选希望看到的信息。
 cat /var/log/zypp/history
     2015-05-07 15:43:03|install|boost-license1_54_0|1.54.0-10.1.3|noarch||openSUSE-13.2-0|0523b909d2aae5239f9841316dafaf3a37b4f096|
@@ -742,7 +747,8 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 #### 使用 Zypper 进行SUSE系统升级 ####
 
-47. 可以使用 Zypper 命令的 'dist-upgrade' 选项来将当前的SUSE Linux升级至最新版本。
+47. 可以使用 Zypper 命令的 'dist-upgrade' 选项来将当前的 SUSE Linux 升级至最新版本。
+
     
# zypper dist-upgrade
     You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
     Building repository 'openSUSE-13.2-0' cache .....................................................................[done]
@@ -755,11 +761,11 @@ Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUS
 
 --------------------------------------------------------------------------------
 
-原文地址: http://www.tecmint.com/zypper-commands-to-manage-suse-linux-package-management/
+via: http://www.tecmint.com/zypper-commands-to-manage-suse-linux-package-management/
 
 作者:[Avishek Kumar][a]
 译者:[张博约](https://github.com/zhangboyue)
-校对:[校对者ID](https://github.com/校对者ID)
+校对:[wxy](https://github.com/wxy)
 
 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
 

From c7510e2e6a2fb55db65dcfdfa5dbb0df98cbd730 Mon Sep 17 00:00:00 2001
From: wxy 
Date: Thu, 11 Jun 2015 10:35:29 +0800
Subject: [PATCH 042/153] PUB:20150518 70 Expected Shell Scripting Interview
 Questions and Answers

@ictlyh
---
 ...ripting Interview Questions and Answers.md | 301 +++++++++---------
 1 file changed, 159 insertions(+), 142 deletions(-)
 rename {translated/tech => published}/20150518 70 Expected Shell Scripting Interview Questions and Answers.md (50%)

diff --git a/translated/tech/20150518 70 Expected Shell Scripting Interview Questions and Answers.md b/published/20150518 70 Expected Shell Scripting Interview Questions and Answers.md
similarity index 50%
rename from translated/tech/20150518 70 Expected Shell Scripting Interview Questions and Answers.md
rename to published/20150518 70 Expected Shell Scripting Interview Questions and Answers.md
index b5ccd63e0a..9b0201d51e 100644
--- a/translated/tech/20150518 70 Expected Shell Scripting Interview Questions and Answers.md	
+++ b/published/20150518 70 Expected Shell Scripting Interview Questions and Answers.md	
@@ -1,14 +1,14 @@
-70 个可能的 Shell 脚本面试问题及解答
+Shell 脚本面试问题大全
 ================================================================================
-我们为你的面试准备选择了 70 个可能的 shell 脚面问题及解答。了解脚本或至少知道基础知识对系统管理员来说至关重要,它也有助于你在工作环境中自动完成很多任务。在过去的几年里,我们注意到所有的 linux 工作职位都要求脚本技能。
+我们为你的面试准备选择了 70 个你可能遇到的 shell 脚面问题及解答。了解脚本或至少知道基础知识对系统管理员来说至关重要,它也有助于你在工作环境中自动完成很多任务。在过去的几年里,我们注意到所有的 linux 工作职位都要求脚本技能。
 
 ### 1) 如何向脚本传递参数 ? ###
 
-./script argument
+	./script argument
 
 **例子** : 显示文件名称脚本
 
-./show.sh file1.txt
+	./show.sh file1.txt
 
     cat show.sh
     #!/bin/bash
@@ -16,12 +16,11 @@
 
 ### 2) 如何在脚本中使用参数 ? ###
 
-第一个参数: $1,
-第二个参数 : $2
+第一个参数 : $1,第二个参数 : $2
 
 例子 : 脚本会复制文件(arg1) 到目标地址(arg2)
 
-./copy.sh file1.txt /tmp/
+	./copy.sh file1.txt /tmp/
 
     cat copy.sh
     #!/bin/bash
@@ -29,127 +28,129 @@
 
 ### 3) 如何计算传递进来的参数 ? ###
 
-$#
+	$#
 
 ### 4) 如何在脚本中获取脚本名称 ? ###
 
-$0
+	$0
 
 ### 5) 如何检查之前的命令是否运行成功 ? ###
 
-$?
+	$?
 
 ### 6) 如何获取文件的最后一行 ? ###
 
-tail -1
+	tail -1
 
 ### 7) 如何获取文件的第一行 ? ###
 
-head -1
+	head -1
 
 ### 8) 如何获取一个文件每一行的第三个元素 ? ###
 
-awk '{print $3}'
+	awk '{print $3}'
 
-### 9) 假如第一个等于 FIND,如何获取文件中每行的第二个元素 ###
+### 9) 假如文件中每行第一个元素是 FIND,如何获取第二个元素 ###
 
-awk '{ if ($1 == "FIND") print $2}'
+	awk '{ if ($1 == "FIND") print $2}'
 
 ### 10) 如何调试 bash 脚本 ###
 
-Add -xv to #!/bin/bash
 
-例子
+将 -xv 参数加到 #!/bin/bash 后
 
-#!/bin/bash –xv
+例子:
+
+	#!/bin/bash –xv
 
 ### 11) 举例如何写一个函数 ? ###
 
-function example {
-echo "Hello world!"
-}
+	function example {
+	echo "Hello world!"
+	}
 
-### 12) 如何向 string 添加 string ? ###
+### 12) 如何向连接两个字符串 ? ###
 
-V1="Hello"
-V2="World"
-V3=$V1+$V2
-echo $V3
+	V1="Hello"
+	V2="World"
+	V3=$V1+$V2
+	echo $V3
 
-Output
+输出
 
-Hello+World
+	Hello+World
 
 ### 13) 如何进行两个整数相加 ? ###
 
-V1=1
-V2=2
-V3=$V1+$V2
-echo $V3
+	V1=1
+	V2=2
+	V3=$V1+$V2
+	echo $V3
 
-Output
-3
+输出
+
+	3
 
 ### 14) 如何检查文件系统中是否存在某个文件 ? ###
 
-if [ -f /var/log/messages ]
-then
-echo "File exists"
-fi
+	if [ -f /var/log/messages ]
+	then
+	echo "File exists"
+	fi
 
 ### 15) 写出 shell 脚本中所有循环语法 ? ###
 
-#### for loop : ####
+#### for 循环 : ####
 
-for i in $( ls ); do
-echo item: $i
-done
+	for i in $( ls ); do
+	echo item: $i
+	done
 
-#### while loop : ####
+#### while 循环 : ####
 
-#!/bin/bash
-COUNTER=0
-while [ $COUNTER -lt 10 ]; do
-echo The counter is $COUNTER
-let COUNTER=COUNTER+1
-done
+	#!/bin/bash
+	COUNTER=0
+	while [ $COUNTER -lt 10 ]; do
+	echo The counter is $COUNTER
+	let COUNTER=COUNTER+1
+	done
 
-#### untill oop : ####
+#### until 循环 : ####
 
-#!/bin/bash
-COUNTER=20
-until [ $COUNTER -lt 10 ]; do
-echo COUNTER $COUNTER
-let COUNTER-=1
-done
+	#!/bin/bash
+	COUNTER=20
+	until [ $COUNTER -lt 10 ]; do
+	echo COUNTER $COUNTER
+	let COUNTER-=1
+	done
 
 ### 16) 每个脚本开始的 #!/bin/sh 或 #!/bin/bash 表示什么意思 ? ###
 
-这一行说明要使用的 shell。#!/bin/bash 表示脚本使用 /bin/bash。对于 python 脚本,就是 #!/usr/bin/python
+这一行说明要使用的 shell。#!/bin/bash 表示脚本使用 /bin/bash。对于 python 脚本,就是 #!/usr/bin/python。(LCTT译注:这一行称之为[释伴行](https://linux.cn/article-3664-1.html)。)
 
 ### 17) 如何获取文本文件的第 10 行 ? ###
 
-head -10 file|tail -1
+	head -10 file|tail -1
 
 ### 18) bash 脚本文件的第一个符号是什么 ###
 
-#
+	#
 
 ### 19) 命令:[ -z "" ] && echo 0 || echo 1 的输出是什么 ###
 
-0
+	0
 
 ### 20) 命令 “export” 有什么用 ? ###
 
-使变量在子 shell 中公有
+使变量在子 shell 中可用。
 
 ### 21) 如何在后台运行脚本 ? ###
 
-在脚本后面添加 “&”
+在脚本后面添加 “&”。
 
 ### 22) "chmod 500 script" 做什么 ? ###
 
-使脚本所有者拥有可执行权限
+使脚本所有者拥有可执行权限。
 
 ### 23) ">" 做什么 ? ###
 
@@ -157,8 +158,8 @@ head -10 file|tail -1
 
 ### 24) & 和 && 有什么区别 ###
 
-& - 希望脚本在后台运行的时候使用它
-&& - 当第一个脚本成功完成才执行命令/脚本的时候使用它
+- & - 希望脚本在后台运行的时候使用它
+- && - 当前一个脚本成功完成才执行后面的命令/脚本的时候使用它
 
 ### 25) 什么时候要在 [ condition ] 之前使用 “if” ? ###
 
@@ -166,81 +167,87 @@ head -10 file|tail -1
 
 ### 26) 命令: name=John && echo 'My name is $name' 的输出是什么 ###
 
-My name is $name
+	My name is $name
 
 ### 27) bash shell 脚本中哪个符号用于注释 ? ###
 
-#
+	#
 
 ### 28) 命令: echo ${new:-variable} 的输出是什么 ###
 
-variable
+	variable
 
 ### 29)  ' 和 " 引号有什么区别 ? ###
 
-' - 当我们不希望把变量转换为值的时候使用它。
-" - 会计算所有变量的值并用值代替。
+- ' - 当我们不希望把变量转换为值的时候使用它。
+- " - 会计算所有变量的值并用值代替。
 
-### 30) 如何在脚本文件中重定向标准输入输出流到 log.txt 文件 ? ###
+### 30) 如何在脚本文件中重定向标准输出和标准错误流到 log.txt 文件 ? ###
 
-在脚本文件中添加 "exec >log.txt 2>&1" 命令
+在脚本文件中添加 "exec >log.txt 2>&1" 命令。
 
-### 31) 如何只用 echo 命令获取 string 变量的一部分 ? ###
+### 31) 如何只用 echo 命令获取字符串变量的一部分 ? ###
+
+	echo ${variable:x:y}
+	x - 起始位置
+	y - 长度
 
-echo ${variable:x:y}
-x - 起始位置
-y - 长度
 例子:
-variable="My name is Petras, and I am developer."
-echo ${variable:11:6} # 会显示 Petras
 
-### 32) 如果给定字符串 variable="User:123:321:/home/dir" 如何只用 echo 命令获取 home_dir ? ###
+	variable="My name is Petras, and I am developer."
+	echo ${variable:11:6} # 会显示 Petras
+
+### 32) 如果给定字符串 variable="User:123:321:/home/dir",如何只用 echo 命令获取 home_dir ? ###
+
+	echo ${variable#*:*:*:}
 
-echo ${variable#*:*:*:}
 或
-echo ${variable##*:}
+
+	echo ${variable##*:}
 
 ### 33) 如何从上面的字符串中获取 “User”  ? ###
 
-echo ${variable%:*:*:*}
+	echo ${variable%:*:*:*}
+
 或
-echo ${variable%%:*}
+
+	echo ${variable%%:*}
 
 ### 34) 如何使用 awk 列出 UID 小于 100 的用户 ? ###
 
-awk -F: '$3<100' /etc/passwd
+	awk -F: '$3<100' /etc/passwd
 
 ### 35) 写程序为用户计算主组数目并显示次数和组名 ###
 
-cat /etc/passwd|cut -d: -f4|sort|uniq -c|while read c g
-do
-{ echo $c; grep :$g: /etc/group|cut -d: -f1;}|xargs -n 2
-done
+	cat /etc/passwd|cut -d: -f4|sort|uniq -c|while read c g
+	do
+	{ echo $c; grep :$g: /etc/group|cut -d: -f1;}|xargs -n 2
+	done
 
-### 36) 如何在 bash shell 中更改标注域分隔符为 ":" ? ###
+### 36) 如何在 bash shell 中更改标准的域分隔符为 ":" ? ###
 
-IFS=":"
+	IFS=":"
 
 ### 37) 如何获取变量长度 ? ###
 
-${#variable}
+	${#variable}
 
 ### 38) 如何打印变量的最后 5 个字符 ? ###
 
-echo ${variable: -5}
+	echo ${variable: -5}
 
 ### 39) ${variable:-10} 和 ${variable: -10} 有什么区别? ###
 
-${variable:-10} - 如果之前没有给 variable 赋值则输出 10
-${variable: -10} - 输出 variable 的最后 10 个字符
+- ${variable:-10} - 如果之前没有给 variable 赋值则输出 10
+- ${variable: -10} - 输出 variable 的最后 10 个字符
 
 ### 40) 如何只用 echo 命令替换字符串的一部分 ? ###
 
-echo ${variable//pattern/replacement}
+	echo ${variable//pattern/replacement}
 
 ### 41) 哪个命令将命令替换为大写 ? ###
 
-tr '[:lower:]' '[:upper:]'
+	tr '[:lower:]' '[:upper:]'
 
 ### 42) 如何计算本地用户数目 ? ###
 
@@ -250,141 +257,151 @@ cat /etc/passwd|wc -l
 
 ### 43) 不用 wc 命令如何计算字符串中的单词数目 ? ###
 
-set ${string}
-echo $#
+	set ${string}
+	echo $#
 
 ### 44)  "export $variable" 或 "export variable" 哪个正确 ? ###
 
-export variable
+	export variable
 
 ### 45) 如何列出第二个字母是 a 或 b 的文件 ? ###
 
-ls -d ?[ab]*
+	ls -d ?[ab]*
 
 ### 46) 如何将整数 a 加到 b 并赋值给 c ? ###
 
-c=$((a+b))
+	c=$((a+b))
+
 或
-c=`expr $a + $b`
+
+	c=`expr $a + $b`
+
 或
-c=`echo "$a+$b"|bc`
+
+	c=`echo "$a+$b"|bc`
 
 ### 47) 如何去除字符串中的所有空格 ? ###
 
-echo $string|tr -d " "
+	echo $string|tr -d " "
 
-### 48) 重写命令输出变量转换为复数的句子: item="car"; echo "I like $item" ? ###
+### 48) 重写这个命令,将输出变量转换为复数: item="car"; echo "I like $item" ? ###
 
-item="car"; echo "I like ${item}s"
+	item="car"; echo "I like ${item}s"
 
 ### 49) 写出输出数字 0 到 100 中 3 的倍数(0 3 6 9 …)的命令 ? ###
 
-for i in {0..100..3}; do echo $i; done
+	for i in {0..100..3}; do echo $i; done
+	
 或
-for (( i=0; i<=100; i=i+3 )); do echo "Welcome $i times"; done
+
+	for (( i=0; i<=100; i=i+3 )); do echo "Welcome $i times"; done
 
 ### 50) 如何打印传递给脚本的所有参数 ? ###
 
-echo $*
+	echo $*
+
 或
-echo $@
+
+	echo $@
 
 ### 51)  [ $a == $b ] 和 [ $a -eq $b ] 有什么区别 ###
 
-[ $a == $b ] - 用于字符串比较
-[ $a -eq $b ] - 用于数字比较
+- [ $a == $b ] - 用于字符串比较
+- [ $a -eq $b ] - 用于数字比较
 
 ### 52) = 和 == 有什么区别 ###
 
-= - 用于为变量复制
-== - 用于字符串比较
+- = - 用于为变量复制
+- == - 用于字符串比较
 
 ### 53) 写出测试 $a 是否大于 12 的命令 ? ###
 
-[ $a -gt 12 ]
+	[ $a -gt 12 ]
 
 ### 54) 写出测试 $b 是否小于等于 12 的命令 ? ###
 
-[ $b -le 12 ]
+	[ $b -le 12 ]
 
 ### 55) 如何检查字符串是否以字母 "abc" 开头 ? ###
 
-[[ $string == abc* ]]
+	[[ $string == abc* ]]
 
 ### 56) [[ $string == abc* ]] 和 [[ $string == "abc*" ]] 有什么区别 ###
 
-[[ $string == abc* ]] - 检查字符串是否以字母 abc 开头
-[[ $string == "abc* " ]] - 检查字符串是否完全等于 abc*
+- [[ $string == abc* ]] - 检查字符串是否以字母 abc 开头
+- [[ $string == "abc*" ]] - 检查字符串是否完全等于 abc*
 
 ### 57) 如何列出以 ab 或 xy 开头的用户名 ? ###
 
-egrep "^ab|^xy" /etc/passwd|cut -d: -f1
+	egrep "^ab|^xy" /etc/passwd|cut -d: -f1
 
 ### 58) bash 中 $! 表示什么意思 ? ###
 
-后台最近命令的 PID
+后台最近执行命令的 PID.
 
 ### 59) $? 表示什么意思 ? ###
 
-前台最近命令的结束状态
+前台最近命令的结束状态。
 
 ### 60) 如何输出当前 shell 的 PID ? ###
 
-echo $$
+	echo $$
 
 ### 61) 如何获取传递给脚本的参数数目 ? ###
 
-echo $#
+	echo $#
+	
+(LCTT 译注:和第3题重复了。)
 
 ### 62) $* 和 $@ 有什么区别 ###
 
-$* - 以一个字符串形式输出所有传递到脚本的参数
-$@ - 以 $IFS 为分隔符列出所有传递到脚本中的参数
+- $* - 以一个字符串形式输出所有传递到脚本的参数
+- $@ - 以 $IFS 为分隔符列出所有传递到脚本中的参数
 
 ### 63) 如何在 bash 中定义数组 ? ###
 
-array=("Hi" "my" "name" "is")
+	array=("Hi" "my" "name" "is")
 
 ### 64) 如何打印数组的第一个元素 ? ###
 
-echo ${array[0]}
+	echo ${array[0]}
 
 ### 65) 如何打印数组的所有元素 ? ###
 
-echo ${array[@]}
+	echo ${array[@]}
 
 ### 66) 如何输出所有数组索引 ? ###
 
-echo ${!array[@]}
+	echo ${!array[@]}
 
 ### 67) 如何移除数组中索引为 2 的元素 ? ###
 
-unset array[2]
+	unset array[2]
 
 ### 68) 如何在数组中添加 id 为 333 的元素 ? ###
 
-array[333]="New_element"
+	array[333]="New_element"
 
 ### 69) shell 脚本如何获取输入的值 ? ###
 
 a) 通过参数
 
-./script param1 param2
+	./script param1 param2
 
 b) 通过 read 命令
 
-read -p "Destination backup Server : " desthost
+	read -p "Destination backup Server : " desthost
 
 ### 70) 在脚本中如何使用 "expect" ? ###
 
-/usr/bin/expect << EOD
-spawn rsync -ar ${line} ${desthost}:${destpath}
-expect "*?assword:*"
-send "${password}\r"
-expect eof
-EOD
+	/usr/bin/expect << EOD
+	spawn rsync -ar ${line} ${desthost}:${destpath}
+	expect "*?assword:*"
+	send "${password}\r"
+	expect eof
+	EOD
 
-好运 !! 如果你有任何疑问或者问题需要解答都可以在下面的评论框中写下来。让我们知道这对你的面试有所帮助:-)
+祝你好运 !! 如果你有任何疑问或者问题需要解答都可以在下面的评论框中写下来。让我们知道这对你的面试有所帮助:-)
 
 --------------------------------------------------------------------------------
 
@@ -392,7 +409,7 @@ via: http://linoxide.com/linux-shell-script/shell-scripting-interview-questions-
 
 作者:[Petras Liumparas][a]
 译者:[ictlyh](https://github.com/ictlyh)
-校对:[校对者ID](https://github.com/校对者ID)
+校对:[wxy](https://github.com/wxy)
 
 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
 

From 11d5fad50e5e7e4336a4392deb010cb1117da8fd Mon Sep 17 00:00:00 2001
From: wi-cuckoo 
Date: Thu, 11 Jun 2015 11:19:58 +0800
Subject: [PATCH 043/153] translated wi-cuckoo

---
 ...lobally Recognized Linux Certifications.md | 173 ------------------
 ...lobally Recognized Linux Certifications.md | 172 +++++++++++++++++
 2 files changed, 172 insertions(+), 173 deletions(-)
 delete mode 100644 sources/share/20150604 12 Globally Recognized Linux Certifications.md
 create mode 100644 translated/share/20150604 12 Globally Recognized Linux Certifications.md

diff --git a/sources/share/20150604 12 Globally Recognized Linux Certifications.md b/sources/share/20150604 12 Globally Recognized Linux Certifications.md
deleted file mode 100644
index 4ec185770b..0000000000
--- a/sources/share/20150604 12 Globally Recognized Linux Certifications.md	
+++ /dev/null
@@ -1,173 +0,0 @@
-translating wi-cuckoo
-12 Globally Recognized Linux Certifications
-================================================================================
-Hi everyone, today we'll learn about some of the very precious globally recognized Linux Certifications. Linux Certifications are the certification programme hosted by different Linux Professional Institutes across the globe. Linux Certifications allows Linux Professionals to get easily enrolled with the Linux related jobs in servers, companies, etc. Linux Certifications enables how much a person is expertise in that respective field of Linux. There are pretty many Linux Professional Institutes providing different Linux Certifications. But there are some few well recognized Linux Certification Programmes running across the globe which are at high priority while getting a job in companies where we need to manage servers, virtualizations, installations, configurations, application support and other stuffs with Linux Operating System. With the increment of servers running Linux Operating System throughout the globe, the demand of Linux Professional are increasing. For better authenticated and authorized Linux Professional, better and renowned Certifications are always at higher priority by the companies across the globe.
-
-Here are some globally recognized Linux Certifications that we'll discuss about.
-
-### 1. CompTIA Linux+ ###
-
-CompTIA Linux+ is a Linux Certification programme hosted by LPI "Linux Professional Institute" providing knowledge all over the world. It provides knowledge on Linux which enables to produce a bunch of Linux related Professional jobs like Linux Administrators, Junior Network Administrators, Systems Administrators, Linux Database Administrators and Web Administrators. If anyone is aware of installing and maintaining Linux Operating System, this course will help to meet the certification requirements and prepare for the exam by providing with a broad awareness of Linux operating systems. The main objective of CompTIA Linux+ Certification by LPI is to provide the certificate holders enough knowledge on a critical knowledge of installation, operation, administration and troubleshooting devices. We can earn three industry-recognized certifications for the cost, time, and effort of one, by completing the CompTIA Linux+ powered by LPI certification, we can automatically receive the **LPI LPIC-1** and the **SUSE Certified Linux Administrator (CLA)** certifications.
-
-- **Certification Codes** : LX0-103 and LX0-104 (launches March 30, 2015) OR  LX0-101 and LX0-102
-- Number of questions: 60 questions per exam
-- Type of Questions: Multiple choice
-- Length of test period: 90 minutes
-- Prerequisites: A+, Network+ and at least 12 months of Linux administration experience
-- Passing score: 500 (on a scale of 200-800)
-- Languages: English. Coming soon on German, Portuguese (Brazilian), Traditional Chinese, Spanish.
-- Validity: Valid till 3 Years after certified.
-
-**Note**: Exams from different series cannot be combined. If you start with LX0-101, you MUST take LX0-102 to complete your certification. The same applies for the LX0-103 and LX0-104 series. The LX0-103 and LX0-104 series is an update to the LX0-101 and LX0-102 series.
-
-### 2. LPIC ###
-
-LPIC stands for Linux Professional Institute Certification which is a Linux certification programme by Linux Professional Institute. It is a multi level certification program which requires passing of a number (usually two) certification exams for each level. There are three levels of certification which includes Junior Level Certification **LPIC-1**, Advanced Level Certification **LPIC-2** and Senior Level Certification **LPIC-3**. The first two certification aims on **Linux System Administration** whereas the final certification aims on several specialties including Virtualization and Security. To become **LPIC-3** certified, a candidate with an active **LPIC-1** and **LPIC-2** certification must pass at least one of 300 Mixed Environment, 303 Security and 304 Virtualization and High Availability.  LPIC-1 certification is designed in such a way that the certification holder will be able to install, maintain, configure tasks running Linux with command line interface with basic networking where as LPIC-2 certification validates candidate to administer small to medium–sized mixed networks. LPIC-3 certification is designed for enterprise-level Linux professional and represents the highest level of professional, distribution-neutral Linux certification within the industry.
-
-- **Certification Codes** : LPIC-1 (101 and 102), LPIC-2 (201 and 202) and LPIC-3 (300, 303 or 304)
-- Type of Questions: 60 Multiple choice questions
-- Length of Test Period: 90 minutes
-- Prerequisites: None, Linux Essentials is recommended
-- Passing Score: 500 (on a scale of 200-800)
-- Languages: LPIC-1: English, German, Italian, Portuguese (Brazilian), Spanish (Modern), Chinese (Simplified), Chinese (Traditional), Japanese
-- LPIC-2: English, German, Portuguese (Brazilian), Japanese
-- LPIC-3: English, Japanese
-- Validity: Valid till 5 years of Retirement.
-
-### 3. Oracle Linux OCA ###
-
-Oracle Certified Associate (OCA) is designed for the individuals who are interested for a strong foundation of knowledge to implement and administer the Oracle Linux Operating System. This certification expertise individuals on the Oracle Linux distribution that's fully optimized for Oracle products and for running on Oracle's engineered systems including Oracle Exadata Database Machine, Oracle Exalytics In-Memory Machine, Oracle Exalogic Elastic Cloud, and Oracle Database Appliance. Oracle Linux's Unbreakable Enterprise Kernel delivers extreme performance, advanced scalability and reliability for enterprise applications. The OCA certification covers objectives such as managing local disk devices, managing file systems, installing and removing Solaris packages and patches, performing system boot procedures and system processes. It is initial step in achievement of flagship of OCP credential. This certification was formerly known as Sun Certified Solaris Associate (SCSAS).
-
-- **Certification Codes** : OCA
-- Type of Questions: 75 Multiple choice questions
-- Length of Test Period: 120 minutes
-- Prerequisites: None
-- Passing Score: 64%
-- Validity: Never Expires
-
-### 4. Oracle Linux OCP ###
-
-Oracle Certified Professional (OCP) is the certification provided by Oracle Corporation for Oracle Linux which covers more advanced knowledge and skills of an Oracle Linux Administrator. It covers knowledge such as configuring network interfaces, managing swap configurations, crash dumps, managing applications, databases and core files. OCP certification is benchmark of technical expertise and professional skill needed for developing, implementing, and managing applications, middleware and databases widely in enterprise. Job opportunities for Oracle Linux OCP are increased depending on job market and economy. It is designed such a way that the certificate holder has the ability to perform security administration, prepare Oracle Linux system for Oracle database, troubleshoot problems and perform corrective action, install software packages, installing and configuring kernel modules, maintain swap space, perform User and Group administration, creating file systems, configuring logical volume manager (LVM), file sharing services and more.
-
-- **Certification Codes** : OCP
-- Type of Questions: 60 to 80 Multiple choice questions
-- Length of Test Period: 120 minutes
-- Prerequisites: Oracle Linux OCA
-- Passing Score: 64%
-- Validity: Never Expires
-
-### 5. RHCSA ###
-
-RHCSA is a certification programme by Red Hat Incorporation as Red Hat Certified System Administrator. RHCSAs are the person who has the skill, and ability to perform core system administrations in the renowned Red Hat Linux environments. It is an initial entry-level certification programme that focuses on actual competencies at system administration, including installation and configuration of a Red Hat Linux system and attaching it to a live network running network services. A Red Hat Certified System Administrator (RHCSA) is able to understand and use essential tools for handling files, directories, command-line environments, and documentation, operate running systems, including booting into different run levels, identifying processes, starting and stopping virtual machines, and controlling services, configure local storage using partitions and logical volumes, create and configure file systems and file system attributes, such as permissions, encryption, access control lists, and network file systemsm, deploy, configure, and maintain systems, including software installation, update, and core services, manage users and groups, including use of a centralized directory for authentication, security, including basic firewall and SELinux configuration. One should be RHCSA certified to gain RHCE and other certifications.
-
-- **Certification Codes** : RHCSA
-- Course Codes: RH124, RH134 and RH199
-- Exam Codes: EX200
-- Length of Test Period: 21-22 hours depending on the elective course choosen.
-- Prerequisites: None. Better if has some fundamental knowledge of Linux.
-- Passing Score: 210 out of 300 points (70%)
-- Validity: 3 years
-
-### 6. RHCE ###
-
-RHCE, also known as Red Hat Certified Engineer is a mid to advanced level certification programme for Red Hat Certified System Administrator (RHCSA) who wants to acquire additional skills and knowledge required of a senior system administrator responsible for Red Hat Enterprise Linux. RHCE has the ability, knowledge and skills of configuring static routes, packet filtering, and network address translation, setting kernel runtime parameters, configuring an Internet Small Computer System Interface (iSCSI) initiator, producing and delivering reports on system utilization, using shell scripting to automate system maintenance tasks, configuring system logging, including remote logging, system to provide networking services including HTTP/HTTPS, File Transfer Protocol (FTP), network file system (NFS), server message block (SMB), Simple Mail Transfer Protocol (SMTP), secure shell (SSH) and Network Time Protocol (NTP) and more. RHCSAs who wish to earn a more senior-level credential and who have completed System Administration I, II, and II, or who have completed the RHCE Rapid Track Course is recommended to go for RHCE certification.
-
-- **Certification Codes** : RHCE
-- Course Codes: RH124, RH134, RH254 and RH199
-- Exam Codes: EX200 and EX300
-- Length of Test Period: 21-22 hours depending on the elective course choosen.
-- Prerequisites: A RHCSA credential
-- Passing Score: 210 out of 300 (70%)
-- Validity: 3 years
-
-### 7. RHCA ###
-
-RHCA stands for Red Hat Certified Architect which is a certification programme by Red Hat Incorporation. It focuses on actual competencies at system administration, including installation and configuration of a Red Hat Linux system and attaching it to a live network running network services. RHCA is the highest level of certification of all the Red Hat Certifications. Candidates are required to choose the concentration they wish to focus on or can choose any combination of eligible Red Hat certifications to create a custom concentration of their own. There are three main concentration Datacenter, Cloud and Application Platform. RHCA with the concentration of Datacenter has the skills and ability to work, manage a datacenter whereas with the concentration of Cloud has the ability create, configure and manage private, hybrid clouds, cloud application platforms, flexible storage solutions using Red Hat Enterprise Linux Platform. RHCA with the concentration of Application Platform includes skills like installing, configuring and managing Red Hat JBoss Enterprise Application Platform and applications, cloud application platforms and hybrid cloud environments with OpenShift Enterprise by Red Hat and federating data from multiple sources using Red Hat JBoss Data Virtualization.
-
-- **Certification Codes** : RHCA
-- Course Codes: CL210,CL220,CL280, RH236, RH318,RH401,RH413, RH436,RH442,JB248 and JB450
-- Exam Codes: EX333, EX401, EX423 or EX318, EX436 and EX442
-- Length of Test Period: 21-22 hours depending on the elective course choosen.
-- Prerequisites: Active RHCE credential
-- Passing Score: 210 out of 300 (70%)
-- Validity: 3 years
-
-### 8. SUSE CLA ###
-
-SUSE Certified Linux Administrator (SUSE CLA) is a initialcertification by SUSE which focuses on daily administration tasks in SUSE Linux Enterprise Server environments. To gain SUSE CLA certification, it is not necessary to perform the course work, one has to pass the examination to get certified. SUSE CLA are capable and has skills to use Linux Desktop, locate and use help resources, manage Linux File System, work with the Linux Shell and Command Line, install SLE 11 SP22, manage system installation, hardware, backup and recovery, administer Linux with YaST, linux processes and services, storage, configure network, remote access, monitor SLE 11 SP2, automate tasks and manage user access and security. We can gain dual certificates of SUSE CLA and LPIC-1 and CompTIA Linux powered by LPI as SUSE, Linux Professional Institute and CompTIA have teamed up to offer you the chance to earn three Linux certifications.
-
-- **Certification Codes** : SUSE CLA
-- Course Codes: 3115, 3116
-- Exam Codes:  050-720, 050-710
-- Type of Questions: multiple choice exams
-- Length of Test Period: 90 minutes
-- Prerequisites: None
-- Passing Score: 512
-
-### 9. SUSE CLP ###
-
-SUSE Certified Linux Professional (CLP) is a certification programme for the one who is interested to gain more seniority and professionalism in SUSE Linux Enterprise Servers. SUSE CLP is the next step after receiving the SUSE CLA certificate. One should pass the examination and should have certification of CLA to gain the certification of CLP thought the candidate has passed the examination of CLP. SUSE CLP certified person has the skills and ability of installing and configuring SUSE Linux Enterprise Server 11 systems, maintaining the file system, managing softwarepackages, processes, printing, configuring fundamental network services, samba, web servers, using IPv6 and creating and running bash shell scripts.
-
-- **Certification Codes** : SUSE CLP
-- Course Codes: 3115, 3116 and 3117
-- Exam Codes: 050-721, 050-697
-- Type of Test: hands on
-- Length of Test Period: 180 minute practicum
-- Prerequisites: SUSE CLA Certified
-
-### 10. SUSE CLE ###
-
-SUSE Certified Linux Engineer (CLE) is an engineer level advanced certification for those candidates who have passed the examination of CLE. To acquire a CLE certificate, one should gain the certificates of SUSE CLA and SUSE CLP. The candidate gaining the CLE certification has the skills of architecting complex SUSE Linux Enterprise Server environments. CLE certified person has the skill to configure fundamental networking services, manage printing, configure and use Open LDAP, samba, web servers, IPv6, perform Health Check and Performance Tuning, create and execute Shell Scripts, deploy SUSE Linux Enterprise, virtualization with Xen and more.
-
-- **Certification Codes** : SUSE CLE
-- Course Codes: 3107
-- Exam Codes: 050-723
-- Type of Test: hands on
-- Length of Test Period: 120 minute practicum
-- Prerequisites: SUSE CLP 10 or 11 Certified
-
-### 11. LFCS ###
-
-Linux Foundation Certified System Admin (LFCS) certified candidates possesses knowledge on the use of Linux and using Linux with the terminal environment. LFCS is a certification programme by Linux Foundation for system administrators and engineers working with the Linux operating system. The Linux Foundation collaborated with industry experts and the Linux kernel community to identify the core domains and the critical skills, knowledge and abilities applicable for the certification. LFCS certified candidates has the skills, knowledge and ability of editing and manipulating text files on the command line, managing and troubleshooting File Systems and Storage, assembling partitions as LVM devices, configuring SWAP partitions, managing networked filesystems, managing user accounts, permissions and ownerships, maintaining security, creating and executing bash shell scripts, installing, upgrading, removing software packages and more.
-
-- **Certification Codes** : LFCS
-- Course Codes: LFS201, LFS220 (Optional)
-- Exam Codes: LFCS exam
-- Length of Test Period: 2 hours
-- Prerequisites: None.
-- Passing Score: 74%
-- Languages: English
-- Validity: 2 years
-
-### 12. LFCE ###
-
-Linux Foundation Certified Engineer (LFCE), a certification for Linux Engineers by Linux Foundation. LFCE certified candidates possesses a wider range of skills on Linux than LFCS. It is a engineer-level advanced certification programme. The LFCE certified candidates possesses skills and abilities of Network Administraton like configuring network services, configuring packet filtering, monitor network performance, IP traffics, configuring filesystems and file services, network filesystems, install, update packages from the repositories, managing network security, configuring iptables, http services, proxy servers, email servers and many more. It is believed that LFCE is pretty difficult to pass and study than LFCS as its advanced engineering level certification programme.
-
-- **Certification Codes** : LFCE
-- Course Codes: LFS230
-- Exam Codes: LFCE exam
-- Length of Test Period: 2 hours
-- Prerequisites: LFCS certified.
-- Passing Score: 72%
-- Languages: English
-- Validity: 2 years
-
-### Facts we found (This is only our views) ###
-
-Recent surveys conducted on different top recruitment agency,  says 80% of linux job profile preferred Redhat certification. If you are a student / newbie and want to learn linux then we prefer Linux Foundation Certifications as its getting much popular or CompTIA Linux would be also a choice. If you already know oracle or suse or working on their products then would prefer oracle / suse linux or if you working in an company these certification might enhance your career growth :-)
-
-### Conclusion ###
-
-There are thousands of big companies in this world running servers and mainframes running Linux Operating System, to handle, configure and work on those servers there is always a need of highly qualified and certified Linux Technical/Professional. These globally recognized Linux certificates has a big role of someones career in Linux. The companies around the world running Linux and wanting Linux Engineers, System Administrators and ethusiasts chooses one who has gained certificates and has good score in the related field of Linux. Globally recognized certifications are highly essential for excellence in the profession and career in Linux, so preparing best for the examination and getting the certification is a good choice for building career in Linux. If you have any questions, comments, feedback please do write on the comment box below and let us know what stuffs needs to be added or improved. Thank You! :-)
-
---------------------------------------------------------------------------------
-
-via: http://linoxide.com/linux-how-to/12-globally-recognized-linux-certifications/
-
-作者:[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/
diff --git a/translated/share/20150604 12 Globally Recognized Linux Certifications.md b/translated/share/20150604 12 Globally Recognized Linux Certifications.md
new file mode 100644
index 0000000000..2be4e9df7d
--- /dev/null
+++ b/translated/share/20150604 12 Globally Recognized Linux Certifications.md	
@@ -0,0 +1,172 @@
+12个全球认可的Linux认证
+================================================================================
+大家好,今天我们将会认识一些非常有价值的全球认可的Linux认证。Linux认证是不同Linux专业机构在全球范围内进行的认证程序。Linux认证可以让Linux专业人才很容易获得Linux相关的工作,在服务器或者公司等等这些地方。Linux认证评估一个人在Linux的各个领域里的专业程度。有很多不错的Linux专业机构提供不同的Linux认证。但是全球仅有少数被十分认可的Linux认证,在公司谋取一份工作时含金量很高,这些工作包括管理服务器,虚拟化,安装系统与软件,配置程序,应用支持和其他Linux操作系统相关的东西。随着全球使用Linux操作系统的服务器的增长,拉动了对于Linux专业人才的需求。为了更好的证明Linux专业技术,公司进行的著名的认证一直有着更高的优先级,在全球看来。
+
+这里是一些全球认可的Linux认证,我们接下来将会一一讨论。
+
+### 1. CompTIA Linxu+ ###
+
+CompTIA Linux+ 是LPI“Linux Professional Institute”主办的一个Linux认证,在全世界范围内提供培训。其提供的Linux相关知识,使得产生了一大批Linux相关专业的工作,如Linux管理员,高级网络管理员,系统管理员,Linux数据库管理员和网页管理员。如果任何人想从事安装和维护Linux操作系统,该课程会帮助达到认证要求,并且通过提供对Linux系统更宽阔的认识,能够为考试做好准备。LPI的CompTIA Linux+认证的主要目的就是,提供给证书持有者足够扎实的知识,关于安装软件,操作,管理和设备排障的。我们可以用一定的费用,时间和努力,,完成CompTIA Linux+,赢得三个业内认可的证书,我们可以自动收到**LPI LPIC-1**和**SUSE Certified Linux Administrator (CLA)**证书。
+
+- ** 认证代码** : LX0-103和LX0-104 (2015年三月30日启动)或者LX0-101和LX0-102
+- 题目数量:一次考试60道题
+- 题目类型:多选
+- 考试时长:90分钟
+- 要求:A+,Network+,并且有至少12个月的Linux管理经历
+- 分数线:500 (对于200-800的范围来说)
+- 语言:英语,将来会有德语,葡萄牙语,汉语,西班牙。
+- 有效期:认证后三年有效
+
+**注意**:不同系列的考试不能交叉。如果你考的是LX0-101,那么你必须考LX0-102完成认证。同样的,你必须考完LX0-103和LX0-104。LX0-103和LX0-104是LX0-101和LX0-102的升级版。
+
+### 2. LPIC ###
+
+LPIC,全称Linux专业委员会认证,是Linux专业委员会的一个Linux认证程序。这是一个多层次的认证程序,要求在每个级别通过一系列(通常是两个)的认证考试。该认证有三个层次,包括初级水平认证 **LPIC-1** ,高级水平认证 **LPIC-2**和最高水平认证 **LPIC-3**。前两个认证侧重于 **Linux系统管理**,而最后一个认证侧重一些专业技能,包括虚拟化和安全。为了得到 **LPIC-3** 认证,一个持有 **LPIC-1** 与**LPIC-2** 的考生必须通过300复杂环境测试,303安全测试,304虚拟化测试和高可用性的其中一个。**LPIC-1**认证按照证书持有者可以通过运行Linux,使用命令行界面和基本的网络知识安装,维护,配置任务而设计,LPIC-2验证考生很少的管理知识,主要是中型混合网络方面。LPIC-3认证按照企业级别的Linux专业技能设计,代表了最高的专业水平(==最后这句不知道如何翻译==)
+
+- **认证代码**:LPIC-1(101和102),LPIC-2(201和202)和LPIC-3(300,303或者304)
+- 题目类型:60个多项选择
+- 考试时长:90分钟
+- 要求:Linux基础
+- 分数线:500(在200-800的范围内)
+- 语言:LPIC-1:英语,德语,意大利语,葡萄牙语,西班牙语(现代),汉语(简体),汉语(繁体),日语
+- LPIC-2:英语,德语,葡萄牙语,日语
+- LPIC-3:英语,日语
+- 有效期:退休之后五年内仍然有效
+
+### 3.Oracle Linux OCA ###
+
+Oracle联合认证(OCA)为个人而定制,那些对部署和管理Oracle Linux操作系统且想证明知识牢固感兴趣的人。该认证专业知识仅仅是在Oracle Linux发行版上,这个系统完全是为Oracle产品特别剪裁的,为了运行在Oracle设计的系统上面,包括Oracle Exadata数据库机器,Oracle Exalytics 内存中机器,Oracle Exalogic 均衡云,和Oracle数据库应用。Oracle Linux稳定的企业级内核对于企业应用表现突出,高扩展性和稳定性。OCA认证覆盖如管理本地磁盘设备,文件系统,安装和移除Solaris包与补丁,协调系统启动过程和系统进程方面。这是达到OCP证书佼佼者的第一步。OCA认证以其前身为Sun Certified Solaris Associate(SCSAS)而为人所知。
+
+- **认证代码**:OCA
+- 题目类型:75道多项选择
+- 考试时长:120分钟
+- 要求:无
+- 分数线:64%
+- 有效期:永远有效
+
+### 4. Oracle Linux OCP ###
+
+Oracle Certified Professional(OCP),时Oracle公司为Oracle Linux提供的一个认证,覆盖更多的进阶知识和技能,对于一个Oracle Linux管理员来说。它囊括的知识有配置网络接口,映射交换配置,清理垃圾,管理软件、数据库和核心文件。OCP认证是技术性专业知识和专业技能的基准测试,这些知识与技能需要在公司里广泛用于开发,部署和管理应用,中间设备和数据库。Oracle Linux OCP的工作机会在增长,得益于工作市场和经济。根据考试纲领,证书持有者有能力胜任安全管理,为Oracle 数据库准备Oracle Linux系统,排除故障,安装软件包,安装和配置内核模块,维护交换空间,完成用户和组管理,创建文件系统,配置逻辑卷管理(LVM)、文件分享服务等等。
+
+- **认证代码**:OCP
+- 题目类型:60至80道多项选择题
+- 考试时长:120分钟
+- 要求:Oracle Linux OCA
+- 分数线:64%
+- 有效期:永远有效
+
+### 5. RHCSA ###
+
+RHCSA是红帽公司作为红帽认证系统工程师推出的一个认证程序。RHCSAs指一些拥有技能和能力在著名的红帽Linux环境下完成核心系统管理的人。这是一个入门级的认证程序,关注在系统管理上的实际胜任能力,包括安装、配置一个红帽Linux系统,接入一个可用的网络运行网络服务。一个红帽认证的系统管理员可以理解和使用基本的工具,用以处理文件,目录,命令行环境和文档,操作运行中的系统,包括以不同的启动级别启动,标记进程,开启和停止虚拟机和控制服务,使用分区和逻辑卷配置本地存储,部署配置和维护系统,包括软件安装、更新和核心服务,管理用户和组,包括使用一个中心的目录用于验证,安全性工作,包括基本的基本防火墙和SELinux配置。要获得RHCE和其他认证,首先得认证过RHCSA。
+
+- **认证代码**:RHCSA
+- 课程代码:RH124,RH134和RH199
+- 考试代码:EX200
+- 考试时长:21-22小时,取决于选择的课程
+- 要求:无。有一些Linux基础知识更好
+- 分数线:300总分,210过(70%)
+- 有效期:3年
+
+### 6. RHCE ###
+
+RHCE,也叫做红帽认证工程师,是一个中到高级水平的认证程序,为一些红帽认证系统管理员(RHCSA),想学习一个负责红帽企业Linux的高级系统管理员要求的额外技能和知识而开设的,RHCE有能力,知识和技能配置静态的路由,包过滤,网络地址转换(NAT),设定内核运行参数,配置一个互联网小型计算机系统接口(ISCSI)初始化程序,产生并推送系统使用的报告,使用shell脚本自动完成系统维护任务,配置系统登入,包括远程登录,提供网络服务如HTTP/HTTPS,文件传输协议(FTP),网络文件系统(NFS),服务信息块(SMB),简单邮件传输协议(SMTP),安全shell(SSH)和网络时间协议(NTP)等等。RHCSAs希望获得更多高级水平的认证,并且已经完成系统管理员I,II和III,或者RHCE认证建议的RHCE快速跟进课程。
+
+- **认证代码**:RHCE
+- 课程代码:RH124,RH134,RH254和RH199
+- 考试代码:EX200和EX300
+- 考试时长:21-22个小时,取决于所选课程
+- 要求:一个RHCSA证书
+- 分数线:300总分,210过(70%)
+- 有效期:3年
+
+### 7. RHCA ###
+
+RHCA就是红帽认证架构师,是红帽公司的一个认证程序。它的关注点在系统管理的实际能力,包括安装和配置一个红帽Linux系统,并加入到一个可用网络中运行网络服务。RHCA是所有红帽认证中最高水平的认证。考生需要选择他们希望关注的集合,或者选择合格的红帽认证的任意组合,以此来创建一个他们自己的集合。这里有三个主要的集合,数据中心,云和应用平台。精通数据中心集合的RHCA能够运行,管理数据中心,而熟悉云的可以创建,配置和管理私有的,混合的云,云应用平台以及使用红帽企业Linux平台的灵活存储方案。精通应用平台集合的RHCA拥有技能如安装,配置和管理红帽JBoss企业应用平台和应用,云应用平台和混合云环境,借助红帽的OpenShift企业版,使用红帽JBoss数据虚拟化技术从多个资源里组合数据。
+
+- **认证代码**:RHCA
+- 课程代码:CL210,CL220.CL280,RH236,RH318,RH413,RH436,RH442,JB248和JB450
+- 考试代码:EX333,EX401,EX423或者EX318,EX436和EX442
+- 考试时长:21-22个小时,取决于所选课程
+- 要求:未过期的RHCE证书
+- 分数线:300总分,210过(70%)
+- 有效期:3年
+
+### 8. SUSE CLA ###
+
+SUSE认证Linux管理员(SUSE CLA)是SUSE推出的一个初级认证,关注点在SUSE Linux企业服务器环境下的日常任务管理。为了获得SUSE CLA认证,完成课程任务不是必须的,你不得不通过考试获得认证。SUSE CLA有能力,也有技术去使用Linux桌面,定位并利用帮助资源,管理Linux文件系统,用Linux Shell和命令行工作,安装SLE 11 SP22,管理系统安装,硬件,备份和恢复,用YaST管理Linux,Linux进程和服务,存储,配置网络,远程接入,SLE 11 SP2模拟器,任务自动化和管理用户访问和安全工作。我们可以同时获得LPI的SUSE CLA,LPIC-1和CompTIA Linux,因为SUSE,Linux Professional Institute和CompATI合作提供给你这个机会,去获得三个Linux认证。
+
+- **认证代码**:SUSE CLA
+- 课程代码:3115,3116
+- 考试代码:050-720,050-710
+- 问题类型:多项选择
+- 考试时长:90分钟
+- 要求:无
+- 分数线:512
+
+### 9. SUSE CLP ###
+
+SUSE认证Linux专业人员(CLP)是一个认证程序,为那些希望获得关于SUSE Linux企业服务器更多高级且专业的知识的人而服务。SUSE CLP是通过SUSE CLA认证后的下一步。一个人应该通过CLA的考试并拥有证书,然后才能获得CLP的认证,通过完成CLP的考试。通过SUSE CLP认证的人员有能力完成安装和配置SUSE Linux企业服务器11系统,维护文件系统,管理软件包,进程,打印,使用IPv6配置基础网络服务,samba,网页服务器,创建和运行bash shell脚本。
+
+- **认证代码**:SUSE CLP
+- 课程代码:3115,3116和3117
+- 考试代码:050-721,050-697
+- 考试类型:手写
+- 考试时长:180分钟
+- 要求:SUSE CLA 认证
+
+### 10. SUSE CLE ###
+
+SUSE认证Linux工程师(CLE)是一个工程师级别的高级认证,为那些已经通过CLE考试的人准备。为了获得CLE认证,人们需要获得SUSE CLA和CLP的认证。获得CLE认证的人员拥有架设复杂SUSE Linux企业服务器环境的技能。CLE认证过的人可以配置基本的网络服务,管理打印,配置和使用Open LDAP,samba,IPv6,完成健康检测和(这里不知道),创建和执行shell脚本,部署SUSE Linux企业板,通过Xen实现虚拟化等等。
+
+- **认证代码**:SUSE CLE
+- 课程代码:3107
+- 考试代码:050-723
+- 考试类型:手写
+- 考试时长:120分钟
+- 要求:SUSE CLP 10或者11证书
+
+### 11. LFCS ###
+
+Linux基金会认证系统管理员(LFCS)认证考生Linux使用中拥有的知识和通过终端环境使用Linux。LFCS是Linux基金会的一个认证程序,为使用Linux操作系统工作的系统管理员和工程师准备。Linux基金会联合工业级专家,Linux内核社区,测试考生扎实的技能,知识和应用能力。通过LFCS认证的人员拥有一些技能,知识和能力,包括在命令行下编辑和操作文件,管理和处理文件系统与存储的错误,聚合分区作为LVM设备,配置SWAP分区,管理网络文件系统,管理用户帐号,权限和属组,创建并执行bash shell脚本,安装,升级,移除软件包等等。
+
+- **认证代码**:LFCS
+- 课程代码:LFCS201,LFCS220(可选)
+- 考试代码:LFCS 考试
+- 考试时长:2小时
+- 要求:无
+- 分数线:74%
+- 语言:英语
+- 有效期:两年
+
+### 12. LFCE ###
+
+Linux基金会认证工程师(LFCE),是Linux基金会为Linux工程师推出的认证。通过LFCE认证的人员拥有一个对于Linux较宽范围的技能,相比于LFCS。这是一个工程师级别的高级认证程序。LFCE认证的人具备一些网络管理方面的技能和能力,如配置网络服务,包过滤,网络运行模拟器,IP连通,配置文件系统和文件服务,网络文件系统,从仓库安装,升级软件包,管理网络安全,配置iptables,http服务,代理服务,邮件服务等等。由于其为高级工程级别的认证程序,所以普遍认为相比LFCS,学习和通过的难度更大些。
+
+- **认证代码**:LFCE
+- 课程代码:LFS230
+- 考试代码:LFCE 考试
+- 考试时长:2小时
+- 要求:认证过LFCS
+- 分数线:72%
+- 语言:英语
+- 有效期:2年
+
+### 我们发现的情况(这仅仅是我们的观点)###
+
+最近的调查表明,在不同的高端招聘代理中,称80%的Linux工作描述更倾向于红帽的认证。如果你是一个学生/新手,并且想学习Linux,那么我们建议选择越来越流行的Linux基金会认证,或者CompTIA Linux也可以是一个选择。如果你已经知道了oracle或suse,或者在他们的产品上工作,那oracle/suse的认证会更好些,如果你在一个公司工作了,这些认证会对你的职业生涯成长有帮助:-)
+
+### 总结 ###
+
+在这个世界上,成千上万的大公司正在运行跑着Linux操作系统的服务器和主框架,为了在这些服务器上管理,配置和工作,总是存在对Linux技术/专业知识高度认证的需求。这些国际上承认的认证对某些人在Linux的职业生涯扮演很重要的角色。全世界范围内的这些公司运行着Linux,需要Linux工程师,系统管理员和已经获得认证且在Linux相关领域干得不错的有热情的人员。全球认可的Linux认证,对于专业知识和职业生涯的辉煌都是很基础的,所以好好准备考试并获得认证,对于在Linux建立职业生涯是一个很好的选择。如果你有任何问题,想法,反馈,请写在下方的评论框里,让我们好知道哪些东西需要添加或者改进。谢谢!:-)
+
+--------------------------------------------------------------------------------
+
+via: http://linoxide.com/linux-how-to/12-globally-recognized-linux-certifications/
+
+作者:[Arun Pyasi][a]
+译者:[译者ID](https://github.com/wi-cuckoo)
+校对:[校对者ID](https://github.com/校对者ID)
+
+本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
+
+[a]:http://linoxide.com/author/arunp/

From 660cf367aa2bb66458f163ac4aa21ec95cd215ec Mon Sep 17 00:00:00 2001
From: sevenot 
Date: Thu, 11 Jun 2015 12:49:10 +0800
Subject: [PATCH 044/153] sevenot translated

---
 ...nts in 2014--download the Annual Report.md | 34 ----------
 ...nts in 2014--download the Annual Report.md | 66 +++++++++++++++++++
 2 files changed, 66 insertions(+), 34 deletions(-)
 delete mode 100644 sources/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md
 create mode 100644 translated/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md

diff --git a/sources/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md b/sources/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md
deleted file mode 100644
index 28b0a76083..0000000000
--- a/sources/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md	
+++ /dev/null
@@ -1,34 +0,0 @@
-sevenot translating
-Read about The Document Foundation achievements in 2014: download the Annual Report! 
-================================================================================
-![](https://documentfoundation.files.wordpress.com/2015/06/tdf-report.jpg)
-
-TDF ReportThe Document Foundation (TDF) is proud to announce its 2014 Annual Report, which can be downloaded from the following link: [http://tdf.io/report2014][1] (3.2 MB PDF). The version with HD images can be downloaded from [http://tdf.io/report2014hq][2] (15.9 MB PDF).
-
-TDF Annual Report starts with a Review of 2014, with highlights about TDF and LibreOffice, and a summary of financials and budget.
-
-Community, Projects & Events covers the LibreOffice Conference 2014 in Bern, Certification, Website and QA, Hackfests in Brussels, Gran Canaria, Paris, Boston and Tolouse, Native-Language Projects, Infrastructure, Documentation, Marketing and Design.
-
-Software, Development & Code reports about the activities of the Engineering Steering Committee, LibreOffice Development, the Document Liberation Project and LibreOffice on Android.
-
-The last section focuses on People, starting with Top Contributors, followed by TDF Staff, the Board of Directors and the Membership Committee, the Board of Trustees, or the body of TDF Members, and the Advisory Board.
-
-TDF 2014 Annual Report has been edited by Sophie Gautier, Alexander Werner, Christian Lohmaier, Florian Effenberger, Italo Vignoli and Robinson Tryon, and designed by Barak Paz, with the help of the fantastic LibreOffice community.
-
-To allow the widest distribution of the document, this is released with a CC BY 3.0 DE License, unless otherwise noted, to TDF Members and free software advocates worldwide.
-
-[The German version of TDF Annual Report is available from [http://tdf.io/bericht2014][3]].
-
---------------------------------------------------------------------------------
-
-via: http://blog.documentfoundation.org/2015/06/03/read-about-the-document-foundation-achievements-in-2014-download-the-annual-report/
-
-作者:italovignoli
-译者:[译者ID](https://github.com/译者ID)
-校对:[校对者ID](https://github.com/校对者ID)
-
-本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
-
-[1]:https://wiki.documentfoundation.org/File:TDF2014AnnualReport.pdf
-[2]:https://wiki.documentfoundation.org/File:TDF2014AnnualReportHQ.pdf
-[3]:https://wiki.documentfoundation.org/File:TDF2014AnnualReportDE.pdf
\ No newline at end of file
diff --git a/translated/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md b/translated/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md
new file mode 100644
index 0000000000..de309b6994
--- /dev/null
+++ b/translated/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md	
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+Thu Jun 11 12:41:59 2015
+
+AbiWord
+Thu Jun 11 11:14:11 2015
+
+application/x-abiword
+
+
+
+
+
+
+
+
+
+
+
+
+

sevenot translated

+

下载年度报告,了解The Document Foundation2014年的成果

+

================================================================================

+

![](https://documentfoundation.files.wordpress.com/2015/06/tdf-report.jpg)

+

+

+

TDF ReportThe Document Foundation (TDF)郑重地发布了2014年度报告,你可以点击这里下载: [http://tdf.io/report2014][1] (3.2 MB PDF)。高清质量的可以点击这里下载 [http://tdf.io/report2014hq][2] (15.9 MB PDF)。

+

+

TDF年度报告中,以回顾2014年开始了这篇报告,其中包括了TDF和LibreOffice的精彩集锦,并且总结了财务情况和预算。

+

+

该报告涉及到项目和活动的会议包括:2014年在伯尔尼的LibreOffice大会,在布鲁塞尔、大加那利岛、巴黎、波士顿和土鲁斯的认证项目,网站与质量保证,Hackfests项目,本土语言项目,基础设施,文档项目,市场设计与营销。

+

+

该报告涉及到的软件开发活动和代码包括:工程指导委员会的活动,LibreOffice的开发,文档解放项目,LibreOffice的安卓移植。

+

+

报告的最后一部分则把焦点对准了那些做出了极大贡献的人们,他们是TDF的工作人员,董事会成员,委员会成员,委托组织成员,TDF的核心成员和咨询委员会成员。

+

+

TDF 2014年度报告的编辑工作由Sophie Gautier, Alexander Werner, Christian Lohmaier, Florian Effenberger, Italo Vignoli 和 Robinson Tryon完成,由Barak Paz设计样式,Libreoffice社区协助完成。

+

+

+

为了使该文档分布达到最大程度的分布,采用了CC3 认证发布,除非特殊标注,TDF成员和自由软件基金会拥有其所有权。

+

[德语版年度报告下载请点击[http://tdf.io/bericht2014][3]].

+

+

--------------------------------------------------------------------------------

+

+

via: http://blog.documentfoundation.org/2015/06/03/read-about-the-document-foundation-achievements-in-2014-download-the-annual-report/

+

+

作者:italovignoli

+

译者:[sevenot(https://github.com/sevenot)

+

校对:[校对者ID](https://github.com/校对者ID)

+

+

本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出

+

+

[1]:https://wiki.documentfoundation.org/File:TDF2014AnnualReport.pdf

+

[2]:https://wiki.documentfoundation.org/File:TDF2014AnnualReportHQ.pdf

+

[3]:https://wiki.documentfoundation.org/File:TDF2014AnnualReportDE.pdf

+
+
From 954e63a85dd68a3f570298b506bac53ec959c555 Mon Sep 17 00:00:00 2001 From: sevenot Date: Thu, 11 Jun 2015 12:56:27 +0800 Subject: [PATCH 045/153] sevenot translated --- ...nts in 2014--download the Annual Report.md | 99 +++++++------------ 1 file changed, 34 insertions(+), 65 deletions(-) diff --git a/translated/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md b/translated/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md index de309b6994..678abbb6fd 100644 --- a/translated/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md +++ b/translated/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md @@ -1,66 +1,35 @@ - - - - - - - - - +sevenot translated +下载年度报告,了解The Document Foundation2014年的成果 +================================================================================ +![](https://documentfoundation.files.wordpress.com/2015/06/tdf-report.jpg) - -Thu Jun 11 12:41:59 2015 - -AbiWord -Thu Jun 11 11:14:11 2015 - -application/x-abiword - - - - - - - - - - - -
-

sevenot translated

-

下载年度报告,了解The Document Foundation2014年的成果

-

================================================================================

-

![](https://documentfoundation.files.wordpress.com/2015/06/tdf-report.jpg)

-

-

-

TDF ReportThe Document Foundation (TDF)郑重地发布了2014年度报告,你可以点击这里下载: [http://tdf.io/report2014][1] (3.2 MB PDF)。高清质量的可以点击这里下载 [http://tdf.io/report2014hq][2] (15.9 MB PDF)。

-

-

TDF年度报告中,以回顾2014年开始了这篇报告,其中包括了TDF和LibreOffice的精彩集锦,并且总结了财务情况和预算。

-

-

该报告涉及到项目和活动的会议包括:2014年在伯尔尼的LibreOffice大会,在布鲁塞尔、大加那利岛、巴黎、波士顿和土鲁斯的认证项目,网站与质量保证,Hackfests项目,本土语言项目,基础设施,文档项目,市场设计与营销。

-

-

该报告涉及到的软件开发活动和代码包括:工程指导委员会的活动,LibreOffice的开发,文档解放项目,LibreOffice的安卓移植。

-

-

报告的最后一部分则把焦点对准了那些做出了极大贡献的人们,他们是TDF的工作人员,董事会成员,委员会成员,委托组织成员,TDF的核心成员和咨询委员会成员。

-

-

TDF 2014年度报告的编辑工作由Sophie Gautier, Alexander Werner, Christian Lohmaier, Florian Effenberger, Italo Vignoli 和 Robinson Tryon完成,由Barak Paz设计样式,Libreoffice社区协助完成。

-

-

-

为了使该文档分布达到最大程度的分布,采用了CC3 认证发布,除非特殊标注,TDF成员和自由软件基金会拥有其所有权。

-

[德语版年度报告下载请点击[http://tdf.io/bericht2014][3]].

-

-

--------------------------------------------------------------------------------

-

-

via: http://blog.documentfoundation.org/2015/06/03/read-about-the-document-foundation-achievements-in-2014-download-the-annual-report/

-

-

作者:italovignoli

-

译者:[sevenot(https://github.com/sevenot)

-

校对:[校对者ID](https://github.com/校对者ID)

-

-

本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出

-

-

[1]:https://wiki.documentfoundation.org/File:TDF2014AnnualReport.pdf

-

[2]:https://wiki.documentfoundation.org/File:TDF2014AnnualReportHQ.pdf

-

[3]:https://wiki.documentfoundation.org/File:TDF2014AnnualReportDE.pdf

-
-
+ +TDF ReportThe Document Foundation (TDF)郑重地发布了2014年度报告,你可以点击这里下载: [http://tdf.io/report2014][1] (3.2 MB PDF)。高清质量的可以点击这里下载 [http://tdf.io/report2014hq][2] (15.9 MB PDF)。 + +TDF年度报告中,以回顾2014年开始了这篇报告,其中包括了TDF和LibreOffice的精彩集锦,并且总结了财务情况和预算。 + +该报告涉及到项目和活动的会议包括:2014年在伯尔尼的LibreOffice大会,在布鲁塞尔、大加那利岛、巴黎、波士顿和土鲁斯的认证项目,网站与质量保证,Hackfests项目,本土语言项目,基础设施,文档项目,市场设计与营销。 + +该报告涉及到的软件开发活动和代码包括:工程指导委员会的活动,LibreOffice的开发,文档解放项目,LibreOffice的安卓移植。 + +报告的最后一部分则把焦点对准了那些做出了极大贡献的人们,他们是TDF的工作人员,董事会成员,委员会成员,委托组织成员,TDF的核心成员和咨询委员会成员。 + +TDF 2014年度报告的编辑工作由Sophie Gautier, Alexander Werner, Christian Lohmaier, Florian Effenberger, Italo Vignoli 和 Robinson Tryon完成,由Barak Paz设计样式,Libreoffice社区协助完成。 + + +为了使该文档分布达到最大程度的分布,采用了CC3 认证发布,除非特殊标注,TDF成员和自由软件基金会拥有其所有权。 +[德语版年度报告下载请点击[http://tdf.io/bericht2014][3]]. + +-------------------------------------------------------------------------------- + +via: http://blog.documentfoundation.org/2015/06/03/read-about-the-document-foundation-achievements-in-2014-download-the-annual-report/ + +作者:italovignoli +译者:[sevenot](https://github.com/sevenot) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://wiki.documentfoundation.org/File:TDF2014AnnualReport.pdf +[2]:https://wiki.documentfoundation.org/File:TDF2014AnnualReportHQ.pdf +[3]:https://wiki.documentfoundation.org/File:TDF2014AnnualReportDE.pdf \ No newline at end of file From 75b5b2a55e5f1ba3495734483d7bec62d2e18472 Mon Sep 17 00:00:00 2001 From: KS Date: Thu, 11 Jun 2015 13:57:41 +0800 Subject: [PATCH 046/153] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...hopping Store Using 'OpenCart' in Linux.md | 224 ++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 translated/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md diff --git a/translated/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md b/translated/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md new file mode 100644 index 0000000000..e506f76f7c --- /dev/null +++ b/translated/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md @@ -0,0 +1,224 @@ +如何在linux中用“OpenCart”创建自己的在线商店 +================================================================================ +在网络世界我们用电脑做所有事情。用电子设备完成的商务也叫电子商务即是其中之一。电子商务并不是什么新鲜事,它起源于早期的阿帕网,阿帕网用来安排麻省理工学院和斯坦福大学人工智能实验室学生之间的拍卖。 + +最近出现了上百家电子商务网站也就是, Flipcart, eBay, Alibaba, Zappos, IndiaMART, Amazon, 等等。你想制作自己的亚马逊和Flipcart这样基于web的应用程序服务器吗?如果是!这个文章正适合你。 + +Opencart是一个免费开源的使用PHP语言的电子商务程序,它可以用来开发一个购物车系统类似于亚马逊和Flipcart。如果你想在线卖你的产品或想在关门时为你的客户提供服务Opencart是给你准备的。你可以使用可靠和专业Opencart应用程序建立一个成功的网上商店(网上商家)。 + +### OpenCart 网页面板演示 ### + +- 商店前端 – [http://demo.opencart.com/][1] +- 管理登陆 – [http://demo.opencart.com/admin/][2] + + ------------------ 管理 登陆 ------------------ + 用户名: demo + 密码: demo + +#### Opencart的特点 #### + +Opencart是一个符合所有在线商家需求的应用程序。您可以使用它的所有特性(见下文)制作自己的电子商务网站。 + +- 它是一个免费的(如啤酒)和开源(如言论)应用GNU GPL许可下发布。 +- 一切都是有据可查的,意味着你不需到要谷歌喊救命。 +- 自由生活的时间支持和更新。 +- 无限数量的类别、产品和制造商的支持。 +- 一切都是基于模板的。 +- 支持多语言和多币种。它确保你的产品遍及全球。 +- 内置产品评论和评级功能。 +- 可下载的产品(即电子书)支持 +- 自动调整图像的支持。 +- 功能,如多税率(如各种国家),查看相关产品,资料页,装船重量计算,使用折扣优惠券,等等是默认实现的。 +- 内置的备份和恢复工具。 +- 实施搜索引擎优化。 +- 发票打印,也支持错误日志和销售报告。 + +#### 系统需求 #### + +- Web 服务器 (Apache HTTP服务器的首选) +- PHP (5.2 或以上). +- 数据库 (首选MySQL但是我用MariaDB). + +#### PHP需要的库和模块 #### + +这些扩展必须在您的系统上安装并启用确保web服务器上安装Opencart正确 + +- Curl +- Zip +- Zlib +- GD Library +- Mcrypt +- Mbstrings + +### 第一步: 安装 Apache, PHP 和 MariaDB ### + +1. 像我说的,OpenCart需要一定的技术要求比如在系统上安装Apache,PHP扩展和数据库(MySQL或MariaDB),为了运行Opencart正常。 + +让我们使用命令行安装Apache,PHP和MariaDB。 + +**安装 Apache** + + # apt-get install apache2 (在基于Debian系统上) + # yum install httpd (在基于RedHat系统上) + +**安装 PHP and Extensions** + + # apt-get install php5 libapache2-mod-php5 php5-curl php5-mcrypt (在基于Debian系统上) + # yum install php php-mysql php5-curl php5-mcrypt (在基于RedHat系统上) + +**安装 MariaDB** + + # apt-get install mariadb-server mariadb-client (在基于Debian系统上) + # yum install mariadb-server mariadb (在基于RedHat系统上) + +2. 在安装所有需要上面的东西后, you can start the Apache and MariaDB services using following commands. + + ------------------- 在基于Debian系统上 ------------------- + # systemctl restart apache2.service + # systemctl restart mariadb.service + + + ------------------- 在基于RedHat系统上 ------------------- + # systemctl restart httpd.service + # systemctl restart mariadb.service + +### 第二步: 下载和设置 OpenCart ### + +3. 最新版本的OpenCart(2.0.2.0)可以从[OpenCart website][3]或直接从github获得。 + +作为一种选择,你可以使用wget命令直接从github库下载最新版本的OpenCart,如下所示。 + + # wget https://github.com/opencart/opencart/archive/master.zip + +4. 下载压缩文件后,拷贝到Apache工作目录下(例如/var/www/html)然后解压缩master.zip文件。 + + # cp master.zip /var/www/html/ + # cd /var/www/html + # unzip master.zip + +5. 提取‘master.zip’文件后,切换到提取目录下然后移动upload目录到应用程序的根文件夹(opencart-master) + + # cd opencart-master + # mv -v upload/* ../opencart-master/ + +6. 现在需要重命名或复制OpenCart配置文件如下所示。 + + # cp /var/www/html/opencart-master/admin/config-dist.php /var/www/html/opencart-master/admin/config.php + # cp /var/www/html/opencart-master/config-dist.php /var/www/html/opencart-master/config.php + +7. 下一步,设置/var/www/html/opencart-master的文件和文件夹正确的权限。您需要提供RWX权限给文件和文件夹,用递归方式。 + + # chmod 777 -R /var/www/html/opencart-master + +**重要**: 设置权限777可能是危险的,所以一旦你完成所有设置,递归恢复755权限到上层的文件夹。 + +### 第三步: 创建 OpenCart 数据库 ### + +8. 下一步是创建一个数据库(例如opencartdb)电子商务网站数据库来存储数据。连接到数据库服务器并创建一个数据库,用户和正确的权限授予用户完全控制数据库。 + + # mysql -u root -p + CREATE DATABASE opencartdb; + CREATE USER 'opencartuser'@'localhost' IDENTIFIED BY 'mypassword'; + GRANT ALL PRIVILEDGES ON opencartdb.* TO 'opencartuser'@'localhost' IDENTIFIED by 'mypassword'; + +### 第四步: OpenCart 网站安装 ### + +9. 一旦所有设置正确,到web浏览器地址栏输入`http://`访问OpenCart web安装。 + +点击“继续”,同意许可证协议。 + +![Accept OpenCart License](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-License.png) + +同意OpenCart许可证 + +10. 下一个屏幕是安装前检查服务器设置,查看服务器所需的所有模块安装正确并且有OpenCart文件的权限。 + +如果有红色标志突出显示#1或#2,这意味着你需要在服务器上正确安装这些组件满足web服务器的要求。 + +如果有红色标志突出显示#3或#4,这意味着你的文件有问题。如果一切正确配置您应该看到所有绿色标志是可见的(见下面),你可以按“继续”。 + +![Server Requirement Check](http://www.tecmint.com/wp-content/uploads/2015/05/Server-Checkup.png) + +服务器需求检查 + +11. 在下一个屏幕上输入数据库证书如数据库驱动程序,主机名、用户名、密码、数据库。你不应该改动数据库端口和前缀,除非你知道你在做什么。 + +另外输入管理员账号的用户名,密码和邮箱地址。注意这些凭据将用于root登录到Opencart管理面板,所以保证它的安全。完成后单击继续! + +![OpenCart Database Details](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Database.png) + +OpenCart数据库详情 + +12. 下一个屏幕显示的信息如“Installation Complete”与“Ready to Start Selling”为结束行。还警告说,删除安装目录,所有需要这个目录安装的设置已经完成。 + +![OpenCart Installation Completes](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Installation-Completes.png) + +OpenCart安装完成 + +删除安装目录,你可以执行下面的命令。 + + # rm -rf /var/www/html/opencart-master/install + +### 第四步: 进入OpenCart页管理 ### + +13. 现在打开浏览器到`http:///opencart-master/`然后你会看到类似下面的截屏。 + +![OpenCart Product Showcase](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart.jpg) + +OpenCart产品示例 + +14. 为了登陆到Opencart管理面板,你需要浏览http:///opencart-master/admin然后填写通行证,同时设置它启动。 + +![OpenCart Admin Login](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Admin-Login.png) + +OpenCart管理登陆 + +15. 如果全部OK你应该可以看到Opencart的控制台。 + +![OpenCart Dashboard](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Dashboard.png) + +OpenCart控制台 + +在管理控制台可以建立很多选项如类别,产品选择,制造商、下载、评论,信息,扩展安装,运输,付款选项,订单总数、礼品券、贝宝、优惠券、子公司、营销、邮件、设计和设置,错误日志,内置分析等等。 + +#### 测试工具之后? #### + +如果您已经测试了应用程序和发现它可定制,灵活,坚如磐石,易于维护和使用,您可能需要一个好的主机托管提供商托管OpenCart应用,保持在线24 x7的支持。尽管有很多选项,我们建议Hostgator主机提供商。(广告硬植-.-!) + +Hostgator是以服务和特性出名的域名注册和虚拟机托管提供商。它为你提供无限的磁盘空间,无限带宽,易于安装(一键安装脚本),99.9%的正常运行时间,荣获24x7x365技术支持和45天退款保证,这意味着如果你不喜欢这个产品和服务在45天内拿回你的采购费,注意这45天是一个长的测试时间。 + +所以如果你有什么想卖的你可以自由做它(我的意思是自由,想到你会花在获得物理存储成本,然后比较其与虚拟商店建立成本。你会觉得它的自由)。 + +**注**: 当你从Hostgator购买虚拟主机(和/或域名)你将获得一个**25%折扣**。这只提供给Tecmint网站的读者。 + +你所要做的就是在购买虚拟机支付时输入优惠码“**TecMint025**”。付款预览截屏优惠码以供参考用。 + +![Hostgator 25% Discount - TecMint025](http://www.tecmint.com/wp-content/uploads/2015/05/Hostgator-Discount-Code.png) + +[Sign up for Hostgator][4] (折扣码: TecMint025) + +**注**: 还值得一提的,每个你从Hostgator购买的虚拟机托管OpenCart,我们将得到少量的佣金,只是为了保持Tecmint存活 (通过支付带宽和托管服务器)。 + +所以如果你使用上面的代码买它,你得到折扣,我们会得到少量收入。还要注意,你不会支付任何额外的,事实上你支付的账单总额将减少25%。 + +### 总结 ### + +OpenCart是一个开箱可用的应用。它易于安装,您可以选择选择最适合的模板,添加你的产品然后你就成为了一个在线店主。 + +很多社区的扩展(免费和付费)使它丰富。这是一个美妙的应用为那些想要建立一个保持24X7小时用户可访问的虚拟商店。让我知道你的应用程序的经验。欢迎任何建议和反馈。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/create-e-commerce-online-shopping-store-using-opencart-in-linux/ + +作者:[Avishek Kumar][a] +译者:[wyangsun](https://github.com/wyangsun) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://demo.opencart.com/ +[2]:http://demo.opencart.com/admin/ +[3]:http://www.opencart.com/index.php?route=download/download/ +[4]:http://secure.hostgator.com/%7Eaffiliat/cgi-bin/affiliates/clickthru.cgi?id=tecmint From 40f692373ad058da8febb3ebfd43044a7623a1f0 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 11 Jun 2015 14:06:53 +0800 Subject: [PATCH 047/153] PUB:20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands @wwy-hust --- ...of Symbol or Operator in Linux Commands.md | 214 ++++++++++++++++++ ...of Symbol or Operator in Linux Commands.md | 193 ---------------- 2 files changed, 214 insertions(+), 193 deletions(-) create mode 100644 published/20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands.md delete mode 100644 translated/tech/20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands.md diff --git a/published/20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands.md b/published/20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands.md new file mode 100644 index 0000000000..e647b452c7 --- /dev/null +++ b/published/20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands.md @@ -0,0 +1,214 @@ +在Linux命令行下令人惊叹的惊叹号(!) +================================================================================ +`'!'`符号在Linux中不但可以用作否定符号,还可以用来从历史命令记录中取出命令或不加修改的执行之前运行的命令。下面的所有命令都已经在Bash Shell中经过确切地检验。尽管我没有试过,但大多都不能在别的Shell中运行。这里我们介绍下Linux命令行中符号`'!'`那惊人和奇妙的用法。 + +### 1. 使用数字从历史命令列表中找一条命令来执行 ### + +您也许没有意识到您可以从历史命令列表(之前已经执行的命令集)中找出一条来运行。首先,通过"history"命令查找之前命令的序号。 + + $ history + +![使用history命令找到最后执行的命令](http://www.tecmint.com/wp-content/uploads/2015/05/history-Command.gif) + +*使用history命令找到最后执行的命令* + +现在,只需要使用历史命令输出中显示在该命令前面的数字便可以运行这个命令。例如,运行一个在`history`输出中编号是1551的命令。 + + $ !1551 + +![使用命令ID来执行最后运行的命令](http://www.tecmint.com/wp-content/uploads/2015/05/Run-Commands-By-number.gif) + +*使用命令ID来执行最后运行的命令* + +这样,编号为1551的命令(上面的例子是[top命令][1])便运行了。这种通过ID号来执行之前的命令的方式很有用,尤其是在这些命令都很长的情况下。您只需要使用**![history命令输出的序号]**便可以调用它。 + +### 2. 运行之前的倒数第二个、第七个命令等 ### + +您可以以另一种方式来运行之前执行的命令,通过使用-1代表最后的命令,-2代表倒数第二个命令,-7代表倒数第七个命令等。 + +首先使用history命令来获得执行过的命令的列表。**history命令的执行很有必要**,因为您可以通过它来确保没有`rm command > file`或其他会导致危险的命令。接下来执行倒数第六个、第八个、第十个命令。 + + $ history + $ !-6 + $ !-8 + $ !-10 + +![通过负数序号运行之前执行的命令](http://www.tecmint.com/wp-content/uploads/2015/05/3.gif) + +*通过负数序号运行之前执行的命令* + +### 3. 传递最后执行的命令的参数,以方便的运行新的命令 ### + +我需要显示`/home/$USER/Binary/firefox`文件夹的内容,因此我执行: + + $ ls /home/$USER/Binary/firefox + +接下来,我意识到我应该执行'ls -l'来查看哪个文件是可执行文件。因此我应该重新输入整个命令么?不,我不需要。我仅需要在新的命令中带上最后的参数,类似: + + $ ls -l !$ + +这里`!$`将把最后执行的命令的参数传递到这个新的命令中。 + +![将上一个命令的参数传递给新命令](http://www.tecmint.com/wp-content/uploads/2015/05/4.gif) + +*将上一个命令的参数传递给新命令* + +### 4. 如何使用!来处理两个或更多的参数 ### + +比如说我在桌面创建了一个文本文件file1.txt。 + + $ touch /home/avi/Desktop/1.txt + +然后在cp命令中使用绝对路径将它拷贝到`/home/avi/Downloads`。 + + $ cp /home/avi/Desktop/1.txt /home/avi/downloads + +这里,我们给cp命令传递了两个参数。第一个是`/home/avi/Desktop/1.txt`,第二个是`/home/avi/Downloads`。让我们分别处理他们,使用`echo [参数]`来打印两个不同的参数。 + + $ echo "1st Argument is : !^" + $ echo "2nd Argument is : !cp:2" + +注意第一个参数可以使用`"!^"`进行打印,其余的命令可以通过`"![命令名]:[参数编号]"`打印。 + +在上面的例子中,第一个命令是`cp`,第二个参数也需要被打印。因此是`"!cp:2"`,如果任何命令比如xyz运行时有5个参数,而您需要获得第四个参数,您可以使用`"!xyz:4"`。所有的参数都可以通过`"!*"`来获得。 + +![处理两个或更多的参数](http://www.tecmint.com/wp-content/uploads/2015/05/5.gif) + +*处理两个或更多的参数* + +### 5. 以关键字为基础执行上个的命令 ### + +我们可以以关键字为基础执行上次执行的命令。可以从下面的例子中理解: + + $ ls /home > /dev/null [命令1] + $ ls -l /home/avi/Desktop > /dev/null [命令2] + $ ls -la /home/avi/Downloads > /dev/null [命令3] + $ ls -lA /usr/bin > /dev/null [命令4] + +上面我们使用了同样的命令(ls),但有不同的开关和不同的操作文件夹。而且,我们还将输出传递到`/dev/null`,我们并未显示输出,因而终端依旧很干净。 + +现在以关键字为基础执行上个的命令。 + + $ ! ls [命令1] + $ ! ls -l [命令2] + $ ! ls -la [命令3] + $ ! ls -lA [命令4] + +检查输出,您将惊奇发现您仅仅使用关键字`ls`便执行了您已经执行过的命令。 + +![以关键字为基础执行命令](http://www.tecmint.com/wp-content/uploads/2015/05/6.gif) + +*以关键字为基础执行命令* + +(LCTT 译注:澄清一下,这种用法会按照命令名来找到最后匹配的命令,不会匹配参数。所以上述执行的四个命令都是执行了 `ls -lA /usr/bin > /dev/null`,并增加了新的参数而已。) + +### 6. !!操作符的威力 ### + +您可以使用`(!!)`运行/修改您上个运行的命令。它将附带一些修改/调整并调用上个命令。让我给您展示一些实际情境。 + +昨天我运行了一行脚本来获得我的私有IP,因此我执行了: + + $ ip addr show | grep inet | grep -v 'inet6'| grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d/ + +接着,我突然发现我需要将上面脚本的输出重定向到一个ip.txt的文件,因此,我该怎么办呢?我该重新输入整个命令并重定向到一个文件么?一个简单的解决方案是使用向上光标键并添加`'> ip.txt'`来将输出重定向到文件。 + + $ ip addr show | grep inet | grep -v 'inet6'| grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d/ > ip.txt + +在这里要感谢救世主"向上光标键"。现在,考虑下面的情况,这次我运行了下面这一行脚本。 + + $ ifconfig | grep "inet addr:" | awk '{print $2}' | grep -v '127.0.0.1' | cut -f2 -d: + +一旦我运行了这个脚本,Bash提示符便返回了错误消息`"bash: ifconfig: command not found"`。原因并不难猜,我运行了本应以root权限的运行的命令。 + +所以,怎么解决呢?以root用户登录并且再次键入整个命令就太麻烦了!而且向上导航键也不管用了(LCTT 译注:当你以新的用户身份登录了,是不能用向上光标键找到之前的另外一个用户的命令历史的)。因此,我们需要调用`"!!"`(去掉引号),它将为那个用户调用上个命令。 + + $ su -c !! root + +这里su是用来切换到root用户的,`-c`用来以某用户运行特定的命令,最重要的部分是`!!`,它将被替换为上次运行的命令。当然!您需要提供root密码。 + +![!!操作符的威力](http://www.tecmint.com/wp-content/uploads/2015/05/7.gif) + +*!!操作符的威力* + +我通常在下面的情景中使用`!!`。 + +当我用普通用户来运行apt-get,我通常收到提示说我没有权限来执行。 + + $ apt-get upgrade && apt-get dist-upgrade + +好吧,有错误。但别担心,使用下面的命令来成功的执行... + + $ su -c !! + +同样的适用于: + + $ service apache2 start + +或 + + $ /etc/init.d/apache2 start + +或 + + $ systemctl start apache2 + +普通用户不被授权执行那些任务,这样相当于我运行: + + $ su -c 'service apache2 start' + +或 + + $ su -c '/etc/init.d/apache2 start' + +或 + + $ su -c 'systemctl start apache2' + +(LCTT 译注:使用`!!`之前,一定要确认你执行的是什么命令!另外,在 root 身份下,千万不要养成使用它的习惯,因为你总是会在不合适的目录执行不合适的命令!) + +### 7.运行一个影响所有除了![FILE_NAME]的文件命令 ### + +`!`(逻辑非)能用来对除了`'!'`后的文件的所有的文件/扩展名执行命令。 + +A.从文件夹移除所有文件,2.txt除外。 + + $ rm !(2.txt) + +B.从文件夹移除所有的文件类型,pdf类型除外。 + + $ rm !(*.pdf) + +### 8.检查某个文件夹(比如/home/avi/Tecmint)是否存在?并打印 ### + +这里,我们使用`'! -d'`来验证文件夹是否存在,当文件夹不存在时,将使用其后跟随AND操作符`(&&)`进行打印,当文件夹存在时,将使用OR操作符`(||)`进行打印。 + +逻辑上,当`[ ! -d /home/avi/Tecmint ]`的输出为0时,它将执行AND逻辑符后面的内容,否则,它将执行OR逻辑符`(||)`后面的内容。 + + $ [ ! -d /home/avi/Tecmint ] && printf '\nno such /home/avi/Tecmint directory exist\n' || printf '\n/home/avi/Tecmint directory exist\n' + +### 9.检查某文件夹是否存在?如果不存在则退出该命令 ### + +类似于上面的情况,但这里当期望的文件夹不存在时,该命令会退出。 + + $ [ ! -d /home/avi/Tecmint ] && exit + +### 10.如果您的home文件夹内不存在一个文件夹(比方说test),则创建它 ### + +这是脚本语言中的一个常用的实现,当期望的文件夹不存在时,创建一个。 + + [ ! -d /home/avi/Tecmint ] && mkdir /home/avi/Tecmint + +这便是全部了。如果您知道或偶尔遇到其他值得了解的`'!'`使用方法,请您在反馈的地方给我们提建议。保持联系! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/mysterious-uses-of-symbol-or-operator-in-linux-commands/ + +作者:[Avishek Kumar][a] +译者:[wwy-hust](https://github.com/wwy-hust) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/12-top-command-examples-in-linux/ diff --git a/translated/tech/20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands.md b/translated/tech/20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands.md deleted file mode 100644 index 4225cf9bb4..0000000000 --- a/translated/tech/20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands.md +++ /dev/null @@ -1,193 +0,0 @@ -10!Linux¾˺÷ -================================================================================ -`'!'`Linuxв񶨷ţʷ¼ȡ򲻼޸ĵִ֮ǰеѾBash Shellоȷеؼ顣ûԹ඼ڱShellСǽLinuxз`'!'`Ǿ˺÷ - -### 1. ʹִʷбһִ ### - -ҲûʶԴʷб֮ǰѾִеҳһСȣͨ"history"֮ǰš - - $ history - -![ʹhistoryҵִе](http://www.tecmint.com/wp-content/uploads/2015/05/history-Command.gif) - -ڣֻҪʹʷʾڸǰֱ磬һ`history`б1551 - - $ !1551 - -![ʹIDִе](http://www.tecmint.com/wp-content/uploads/2015/05/Run-Commands-By-number.gif) - -Ϊ1551[top][1]ˡͨIDִ֮ǰķʽãЩܳ¡ֻҪʹ**![history]**Ե - -### 2. ֮ǰĵڶ߸ ### - -һַʽ֮ǰִеͨʹ-1-2ڶ-7߸ȡ - -ʹhistoryִйбhistoryִкбҪΪͨȷû`rm command > file`ᵼΣյִеڰ˸ʮ - - $ history - $ !-6 - $ !-8 - $ !-10 - -![֮ͨǰִе](http://www.tecmint.com/wp-content/uploads/2015/05/3.gif) -֮ͨǰִе - -### 3. ݲԷµ ### - -Ҫʾ`/home/$USER/Binary/firefox`ļеݣִУ - - $ ls /home/$USER/Binary/firefox - -ʶӦִ'ls -l'鿴ĸļǿִļӦôҲҪҽҪµдIJƣ - - $ ls -l !$ - -`!$`ִеIJݵµС - -![һIJݸ](http://www.tecmint.com/wp-content/uploads/2015/05/4.gif) -һIJݸ - -### 4. ʹ!IJ ### - -˵洴һıļfile1.txt - - $ touch /home/avi/Desktop/1.txt - -Ȼcpʹþ·`/home/avi/Downloads` - - $ cp /home/avi/Desktop/1.txt /home/avi/downloads - -ڣǸcpһ`/home/avi/Desktop/1.txt`ڶ`/home/avi/Downloads`Ƿֱǣʹ`echo [arguments]`ӡͬIJ - - $ echo "1st Argument is : !^" - $ echo "2nd Argument is : !cp:2" - -עһʹ`"!^"`дӡͨ`"![]:[]"`ӡ - -Уһ`cp`ڶҲҪӡ`"!cp:2"`κxyzʱ5Ҫõĸʹ`"!xyz:4"`еIJͨ`"!*"`á - -![IJ](http://www.tecmint.com/wp-content/uploads/2015/05/5.gif) -IJ - -### 5. ԹؼΪִϸ ### - -ǿԹؼΪִϴִеԴ⣺ - - $ ls /home > /dev/null [1] - $ ls -l /home/avi/Desktop > /dev/null [2] - $ ls -la /home/avi/Downloads > /dev/null [3] - $ ls -lA /usr/bin > /dev/null [4] - -ʹͬlsвͬĿغͲͬIJļСңǻݵ`/dev/null`Dzδնɺܸɾ - -ԹؼΪִϸ - - $ ! ls [1] - $ ! ls -l [2] - $ ! ls -la [3] - $ ! ls -lA [4] - -淢ʹùؼ`ls`ִѾִй - -![ԹؼΪִ](http://www.tecmint.com/wp-content/uploads/2015/05/6.gif) -ԹؼΪִ - -### 6. !! ### - -ʹ`(!!)`/޸ϸеһЩ޸/ϸҸչʾһЩʵ龳 - -һнűҵ˽IPִˣ - - $ ip addr show | grep inet | grep -v 'inet6'| grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d/ - -ţͻȻҪűضһip.txtļˣҸôأҸضһļôһ򵥵Ľʹϵ`'> ip.txt'`ضļ - - $ ip addr show | grep inet | grep -v 'inet6'| grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d/ > ip.txt - -л"ϵ"ڣһнű - - $ ifconfig | grep "inet addr:" | awk '{print $2}' | grep -v '127.0.0.1' | cut -f2 -d: - -һűBashʾ㷵˴Ϣ`"bash: ifconfig: command not found"`ԭ򲢲Ѳ£˱ӦrootȨ޵е - -ԣôأǺrootû¼ٴμϵҲˡˣҪ`"!!"`ȥţΪǸûϸ - - $ su -c "!!" root - -suлrootûģ`-c`ijûضҪIJ`!!`滻ΪϴеԵģҪṩroot롣 - -![!!](http://www.tecmint.com/wp-content/uploads/2015/05/7.gif) -!! - -ͨ龰ʹ`!!` - -1.ͨûapt-getͨյʾ˵ûȨִС - - $ apt-get upgrade && apt-get dist-upgrade - -ðɣд󡣵ģʹɹִ... - - $ su -c !! - -ͬڣ - - $ service apache2 start - - $ /etc/init.d/apache2 start - - $ systemctl start apache2 - -ͨûȨִЩУ - - $ su -c 'service apache2 start' - - $ su -c '/etc/init.d/apache2 start' - - $ su -c 'systemctl start apache2' - -### 7.һӰг![FILE_NAME]ļ ### - -`!`߼ǣԳ`'!'`ļеļ/չִ - -A.ļƳļ2.txt⡣ - - $ rm !(2.txt) - -B.ļƳеļͣpdfͳ⡣ - - $ rm !(*.pdf) - -### 8.ijļУ/home/avi/TecmintǷڣӡ ### - -ʹ`'! -d'`֤ļǷڣļвʱʹAND`(&&)`дӡļдʱʹOR`(||)`дӡ - -߼ϣ`[ ! -d /home/avi/Tecmint ]`Ϊ0ʱִAND߼ݣִOR߼`(||)`ݡ - - $ [ ! -d /home/avi/Tecmint ] && printf '\nno such /home/avi/Tecmint directory exist\n' || printf '\n/home/avi/Tecmint directory exist\n' - -### 9.ijļǷڣ˳ ### - -ﵱļвʱ˳ - - $ [ ! -d /home/avi/Tecmint ] && exit - -### 10.homeļڲһļУȷ˵test򴴽 ### - -ǽűеһõʵ֣ļвʱһ - - [ ! -d /home/avi/Tecmint ] && mkdir /home/avi/Tecmint - -ȫˡ֪żֵ˽`'!'`ʹ÷ڷĵطὨ顣ϵ - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/mysterious-uses-of-symbol-or-operator-in-linux-commands/ - -ߣ[Avishek Kumar][a] -ߣ[wwy-hust](https://github.com/wwy-hust) -Уԣ[УID](https://github.com/УID) - - [LCTT](https://github.com/LCTT/TranslateProject) ԭ룬[Linuxй](https://linux.cn/) Ƴ - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/12-top-command-examples-in-linux/ From 975930de11954ad1ee4c0bfb9363dcfd660f22ce Mon Sep 17 00:00:00 2001 From: KayGuoWhu Date: Thu, 11 Jun 2015 14:13:11 +0800 Subject: [PATCH 048/153] translating --- sources/tech/20150610 How to secure your Linux server.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20150610 How to secure your Linux server.md b/sources/tech/20150610 How to secure your Linux server.md index 1668dae934..51246cbfcb 100644 --- a/sources/tech/20150610 How to secure your Linux server.md +++ b/sources/tech/20150610 How to secure your Linux server.md @@ -1,3 +1,4 @@ +[translating by KayGuoWhu] How to secure your Linux server ================================================================================ > A server is made up of so many different components that makes it hard to offer one solution for everyone's needs. This articles tries to cover some useful tips and tricks to help you keep your server and users protected. From 3e0051983a2f51ffb51fdbd37da7004a50bdec4b Mon Sep 17 00:00:00 2001 From: wi-cuckoo Date: Thu, 11 Jun 2015 14:24:41 +0800 Subject: [PATCH 049/153] translating wi-cuckoo --- sources/share/20150527 3 Open Source Python Shells.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/share/20150527 3 Open Source Python Shells.md b/sources/share/20150527 3 Open Source Python Shells.md index c510096670..65102bd1bc 100644 --- a/sources/share/20150527 3 Open Source Python Shells.md +++ b/sources/share/20150527 3 Open Source Python Shells.md @@ -1,3 +1,4 @@ +translating wi-cuckoo 3 Open Source Python Shells ================================================================================ Python is a high-level, general-purpose, structured, powerful, open source programming language that is used for a wide variety of programming tasks. It features a fully dynamic type system and automatic memory management, similar to that of Scheme, Ruby, Perl, and Tcl, avoiding many of the complexities and overheads of compiled languages. The language was created by Guido van Rossum in 1991, and continues to grow in popularity. @@ -96,4 +97,4 @@ via: http://www.linuxlinks.com/article/20150523032756576/PythonShells.html [1]:http://www.bpython-interpreter.org/ [2]:http://ipython.org/ -[3]:http://www.dreampie.org/ \ No newline at end of file +[3]:http://www.dreampie.org/ From f453d731320e5be89e8b7e791c8810d970fe1162 Mon Sep 17 00:00:00 2001 From: KS Date: Thu, 11 Jun 2015 14:31:19 +0800 Subject: [PATCH 050/153] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...hopping Store Using 'OpenCart' in Linux.md | 226 ------------------ 1 file changed, 226 deletions(-) delete mode 100644 sources/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md diff --git a/sources/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md b/sources/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md deleted file mode 100644 index 39db75746a..0000000000 --- a/sources/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md +++ /dev/null @@ -1,226 +0,0 @@ -wyangsun翻译中 -How to Create Own Online Shopping Store Using “OpenCart” in Linux -================================================================================ -In the Internet world we are doing everything using a computer. Electronic Commerce aka e-commerce is one one of them. E-Commerce is nothing new and it started in the early days of ARPANET, where ARPANET used to arrange sale between students of Massachusetts Institute of Technology and Stanford Artificial Intelligence Laboratory. - -These days there are some 100’s of E-Commerce site viz., Flipcart, eBay, Alibaba, Zappos, IndiaMART, Amazon, etc. Have you thought of making your own Amazon and Flipcart like web-based Application Server? If yes! This article is for you. - -Opencart is a free and open source E-Commerce Application written in PHP, which can be used to develop a shopping cart system similar to Amazon and Flipcart. If you want to sell your products online or want to serve your customers even when you are closed Opencart is for you. You can build a successful online store (for online merchants) using reliable and professional Opencart Application. - -### OpenCart Web Panel Demo ### - -- Store Front – [http://demo.opencart.com/][1] -- Admin Login – [http://demo.opencart.com/admin/][2] - - ------------------ Admin Login ------------------ - Username: demo - Password: demo - -#### Features of Opencart #### - -Opencart is an application that meets all the requirements of an online merchant. It has all the features (see below) using which you can make your own E-Commerce Website. - -- It is a Free (as in beer) and Open Source (as in speech) Application released under GNU GPL License. -- Everything is well documented, means you don’t need to Google and shout for help. -- Free Life time support and updates. -- Unlimited number of categories, Products and manufacturer supported. -- Everything is Template based. -- Multi-Language and Multi-Currency Supported. It ensures your product gets a global reach. -- Built-in Product Review and Rating Features. -- Downloadable Products (viz., ebook) supported. -- Automatic Image Resizing supported. -- Features like Multi tax Rates (as in various country), Viewing Related Products, Information Page, Shipping Weight Calculation, Availing Discount Coupons, etc are well implemented by default. -- Built-in Backup and Restore tools. -- Well implemented SEO. -- Invoice Printing, Error Log and sales report are supported as well. - -#### System Requirements #### - -- Web Server (Apache HTTP Server Preferred) -- PHP (5.2 and above). -- Database (MySQLi Preferred but I am using MariaDB). - -#### Required PHP Libraries and Modules #### - -These extensions must be installed and enabled on your system to install Opencart properly on the web server. - -- Curl -- Zip -- Zlib -- GD Library -- Mcrypt -- Mbstrings - -### Step 1: Installing Apache, PHP and MariaDB ### - -1. As I said, OpenCart requires certain technical requirements such as Apache, PHP with extensions and Database (MySQL or MariaDB) to be installed on the system, in order to run Opencart properly. - -Let’s install Apache, PHP and MariaDB using following Command. - -**Install Apache** - - # apt-get install apache2 (On Debian based Systems) - # yum install httpd (On RedHat based Systems) - -**Install PHP and Extensions** - - # apt-get install php5 libapache2-mod-php5 php5-curl php5-mcrypt (On Debian based Systems) - # yum install php php-mysql php5-curl php5-mcrypt (On RedHat based Systems) - -**Install MariaDB** - - # apt-get install mariadb-server mariadb-client (On Debian based Systems) - # yum install mariadb-server mariadb (On RedHat based Systems) - -2. After installing all the above required things, you can start the Apache and MariaDB services using following commands. - - ------------------- On Debian based Systems ------------------- - # systemctl restart apache2.service - # systemctl restart mariadb.service - ----------- - - ------------------- On RedHat based Systems ------------------- - # systemctl restart httpd.service - # systemctl restart mariadb.service - -### Step 2: Downloading and Setting OpenCart ### - -3. The most recent version of OpenCart (2.0.2.0) can be obtained from [OpenCart website][3] or directly from github. - -Alternatively, you may use following wget command to download the latest version of OpenCart directly from github repository as shown below. - - # wget https://github.com/opencart/opencart/archive/master.zip - -4. After downloading zip file, copy to Apache Working directory (i.e. /var/www/html) and unzip the master.zip file. - - # cp master.zip /var/www/html/ - # cd /var/www/html - # unzip master.zip - -5. After extracting ‘master.zip‘ file, cd to extracted directory and move the content of upload directory to the root of the application folder (opencart-master). - - # cd opencart-master - # mv -v upload/* ../opencart-master/ - -6. Now you need to rename or copy OpenCart configuration files as shown below. - - # cp /var/www/html/opencart-master/admin/config-dist.php /var/www/html/opencart-master/admin/config.php - # cp /var/www/html/opencart-master/config-dist.php /var/www/html/opencart-master/config.php - -7. Next, set correct Permissions to the files and folders of /var/www/html/opencart-master. You need to provide RWX permission to all the files and folders there, recursively. - - # chmod 777 -R /var/www/html/opencart-master - -**Important**: Setting permission 777 may be dangerous, so as soon as you finish setting up everything, revert back to permission 755 recursively on the above folder. - -### Step 3: Creating OpenCart Database ### - -8. Next step is to create a database (say opencartdb) for the E-Commerce site to store data on the database. Connect to databaser server and create a database, user and grant correct privileges on the user to have full control over the database. - - # mysql -u root -p - CREATE DATABASE opencartdb; - CREATE USER 'opencartuser'@'localhost' IDENTIFIED BY 'mypassword'; - GRANT ALL PRIVILEDGES ON opencartdb.* TO 'opencartuser'@'localhost' IDENTIFIED by 'mypassword'; - -### Step 4: OpenCart Web Installation ### - -9. Once everything set correctly, navigate to the web browser and type `http://` to access the OpenCart web installation. - -Click ‘CONTINUE‘ to Agree the License Agreement. - -![Accept OpenCart License](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-License.png) - -Accept OpenCart License - -10. The next screen is Pre-installation Server Setup Check, to see that the server has all the required modules are installed properly and have correct permission on the OpenCart files. - -If any red marks are highlighted on #1 or #2, that means you need to install those components properly on the server to meet web server requirements. - -If there are any red marks on #3 or #4, that means there is issue with your files. If everything is correctly configured you should see all green marks are visible (as seen below), you may press “Continue“. - -![Server Requirement Check](http://www.tecmint.com/wp-content/uploads/2015/05/Server-Checkup.png) - -Server Requirement Check - -11. On the next screen enter your Database Credentials like Database Driver, Hostname, User-name, Password, database. You should not touch db_port and Prefix, until and unless you know what you are doing. - -Also Enter User_name, Password and Email Address for Administrative account. Note these credentials will be used for logging in to Opencart Admin Panel as root, so keep it safe. Click continue when done! - -![OpenCart Database Details](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Database.png) - -OpenCart Database Details - -12. The next screen shows message like “Installation Complete” with the Tag Line Ready to Start Selling. Also it warns to delete the installation directory, as everything required to setup using this directory has been accomplished. - -![OpenCart Installation Completes](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Installation-Completes.png) - -OpenCart Installation Completes - -To Remove install directory, you may like to run the below command. - - # rm -rf /var/www/html/opencart-master/install - -### Step 4: Access OpenCart Web and Admin ### - -13. Now point your browser to `http:///opencart-master/` and you would see something like the below screenshot. - -![OpenCart Product Showcase](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart.jpg) - -OpenCart Product Showcase - -14. In order to login to Opencart Admin Panel, point your browser to http:///opencart-master/admin and fill the Admin Credentials you input, while setting it up. - -![OpenCart Admin Login](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Admin-Login.png) - -OpenCart Admin Login - -15. If everything ok! You should be able to see the Admin Dashboard of Opencart. - -![OpenCart Dashboard](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Dashboard.png) - -OpenCart Dashboard - -Here in Admin Dashboard you may set up a lots of options like categories, product, options, Manufacturers, Downloads, Review, Information, Extension Installer, Shipping, Payment options, order totals, gift voucher, Paypal, Coupons, Affiliates, marketing, mails, Design and Settings, Error logs, in-built analytics and what not. - -#### What after testing the tools? #### - -If you have already tested the Application and finds it customizable, flexible, Rock Solid, Easy to maintain and use, you may need a good hosting provider to host OpenCart application, that remains live 24X7 support. Though there are a lot of options for hosting providers we recommend Hostgator. - -Hostgator is a Domain Registrant and Hosting Provider that is very well known for the service and feature it provides. It Provides you with UNLIMITED Disk Space, UNLIMITED Bandwidth, Easy to install (1-click install script), 99.9% Uptime, Award winning 24x7x365 Technical Support and 45 days money back guarantee, which means if you didn’t like the product and service you get your money back within 45 days of purchasing and mind it 45 days is a long time to Test. - -So if you have something to sell you can do it for free (by free I mean, Think of the cost you would spend on getting a physical store and then compare it with virtual store setting-up cost. You will feel its free). - -**Note**: When you buy hosting (and/or Domain) from Hostgator you will get a **Flat 25% OFF**. This offer is valid only for the readers of Tecmint Site. - -All you have to do is to Enter Promocode “**TecMint025**” during the payment of hosting. For reference see the preview of payment screen with promo code. - -![Hostgator 25% Discount - TecMint025](http://www.tecmint.com/wp-content/uploads/2015/05/Hostgator-Discount-Code.png) - -[Sign up for Hostgator][4] (Coupon code: TecMint025) - -**Note**: Also worth mentioning, that for each hosting you buy from Hostgator to host OpenCart, we will get a small amount of commission, just to keep Tecmint Live (by Paying Bandwidth and hosting charges of server). - -So If you buy it using the above code, you get discount and we will get a small amount. Also note that you won’t pay anything extra, infact you will be paying 25% less on total bill. - -### Conclusion ### - -OpenCart is an application that performs out-of-the box. It is easy to install and you have the option to choose best suited templates, add your products and you become an online merchant. - -A lots of community made extensions(free and paid) makes it rich. It is a wonderful application for those who want to setup a virtual store and remain accessible to their customer 24X7. Let me know yours experience with the application. Any suggestion and feedback is welcome as well. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/create-e-commerce-online-shopping-store-using-opencart-in-linux/ - -作者:[Avishek Kumar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://demo.opencart.com/ -[2]:http://demo.opencart.com/admin/ -[3]:http://www.opencart.com/index.php?route=download/download/ -[4]:http://secure.hostgator.com/%7Eaffiliat/cgi-bin/affiliates/clickthru.cgi?id=tecmint From 1fd642f5a94c97c450fcf984f3f4c9df971ed553 Mon Sep 17 00:00:00 2001 From: NearTan Date: Thu, 11 Jun 2015 14:40:06 +0800 Subject: [PATCH 051/153] translated --- ...irectionally from Command Line Using 'Speedtest-CLI' Tool.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md b/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md index a0c77c21f9..45372c86fd 100644 --- a/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md +++ b/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md @@ -1,3 +1,5 @@ +translating by NearTan + How to Test Your Internet Speed Bidirectionally from Command Line Using ‘Speedtest-CLI’ Tool ================================================================================ We always need to check the speed of the Internet connection at home and office. What we do for this? Go to websites like Speedtest.net and begin test. It loads JavaScript in the web browser and then select best server based upon ping and output the result. It also uses a Flash player to produce graphical results. From ea056f5703a2e9e68db505fa144fc8565fd0e23f Mon Sep 17 00:00:00 2001 From: NearTan Date: Thu, 11 Jun 2015 14:41:10 +0800 Subject: [PATCH 052/153] translating --- ...irectionally from Command Line Using 'Speedtest-CLI' Tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md b/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md index 45372c86fd..601a89151d 100644 --- a/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md +++ b/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md @@ -1,4 +1,4 @@ -translating by NearTan +translating by NearTan How to Test Your Internet Speed Bidirectionally from Command Line Using ‘Speedtest-CLI’ Tool ================================================================================ From ebdc92f3840ad4e29976dbac5a6193001880b30e Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 11 Jun 2015 15:24:45 +0800 Subject: [PATCH 053/153] PUB:20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @wyangsun https://linux.cn/article-5609-1.html 翻译的不错,有些细节需要校对。另外必要时,应该将英文习惯的倒装语句换成中文习惯。 --- ...hopping Store Using 'OpenCart' in Linux.md | 226 ++++++++++++++++++ ...hopping Store Using 'OpenCart' in Linux.md | 224 ----------------- 2 files changed, 226 insertions(+), 224 deletions(-) create mode 100644 published/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md delete mode 100644 translated/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md diff --git a/published/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md b/published/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md new file mode 100644 index 0000000000..e726ca1100 --- /dev/null +++ b/published/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md @@ -0,0 +1,226 @@ +如何在linux中用“OpenCart”创建自己的在线商店 +================================================================================ +在网络世界我们可以用电脑做所有事情,电子商务(e-commerce)即是其中之一。电子商务并不是什么新鲜事,它起源于早期的阿帕网,当时就出现了麻省理工学院和斯坦福大学人工智能实验室的学生之间的交易。 + +近些年出现了上百家电子商务网站,如 Flipcart, eBay, Alibaba, Zappos, IndiaMART, Amazon, 等等。你想做一个自己的亚马逊和Flipcart这样的基于web的应用程序服务器吗?如果是!这个文章正适合你。 + +Opencart是一个免费开源的使用PHP语言编写的电子商务程序,它可以用来架设一个类似于亚马逊和Flipcart的购物车系统。如果你想在线卖你的产品或想在关门时为你的客户提供服务,Opencart就是给你准备的。你可以使用可靠和专业Opencart应用程序建立一个成功的网上商店(网上商家)。 + +### OpenCart 网页面板演示 ### + +- 商店前端 – [http://demo.opencart.com/][1] +- 管理登录 – [http://demo.opencart.com/admin/][2] + +-- + ------------------ 管理登录 ------------------ + + 用户名: demo + 密码: demo + +#### Opencart的特点 #### + +Opencart是一个符合所有在线商家需求的应用程序。它具备您用来制作自己的电子商务网站的所有特性(见下文)。 + +- 它是一个免费(如啤酒般免费)而开源(如言论般自由)的应用,在GNU GPL许可下发布。 +- 每个东西都有完善的文档,你不需要到谷歌喊救命。 +- 任意时间的支持和更新。 +- 支持无限数量的类别、产品和制造商。 +- 一切都是基于模板的。 +- 支持多语言和多币种。它确保你的产品遍及全球。 +- 内置产品评论和评级功能。 +- 支持可下载的产品(即电子书)。 +- 支持自动缩放图像。 +- 类似多税率(许多国家都是这样)、查看相关产品、资料页、装船重量计算,使用折扣优惠券,等等功能默认都有了。 +- 内置的备份和恢复工具。 +- 搜索引擎优化做的很好。 +- 发票打印、错误日志和销售报告等都做的很好。 + +#### 系统需求 #### + +- Web 服务器 (首选 Apache HTTP服务器) +- PHP (5.2 或以上) +- 数据库 (首选MySQL,但是我这里用的是MariaDB) + +#### PHP需要的库和模块 #### + +这些扩展必须在您的系统上安装并启用,才能确保Opencart正确安装在web服务器上 + +- Curl +- Zip +- Zlib +- GD Library +- Mcrypt +- Mbstrings + +### 第一步: 安装 Apache、 PHP 和 MariaDB ### + +1. 像我说的,OpenCart需要一定的技术要求,比如在系统上安装Apache,PHP扩展和数据库(MySQL或MariaDB),才能正常运行Opencart。 + + 让我们使用命令行安装Apache,PHP和MariaDB。 + + **安装 Apache** + + # apt-get install apache2 (在基于Debian系统上) + # yum install httpd (在基于RedHat系统上) + + **安装 PHP and Extensions** + + # apt-get install php5 libapache2-mod-php5 php5-curl php5-mcrypt (在基于Debian系统上) + # yum install php php-mysql php5-curl php5-mcrypt (在基于RedHat系统上) + + **安装 MariaDB** + + # apt-get install mariadb-server mariadb-client (在基于Debian系统上) + # yum install mariadb-server mariadb (在基于RedHat系统上) + +2. 在安装所有需要上面的东西后,你可以使用如下命令启动 Apache 和 MariaDB 服务。 + + ------------------- 在基于Debian系统上 ------------------- + # systemctl restart apache2.service + # systemctl restart mariadb.service + + -- + ------------------- 在基于RedHat系统上 ------------------- + # systemctl restart httpd.service + # systemctl restart mariadb.service + +### 第二步:下载和设置 OpenCart ### + +3. 最新版本的OpenCart(2.0.2.0)可以从[OpenCart 网站][3]下载,或直接从github获得。 + + 作为一种选择,你可以使用wget命令直接从github库下载最新版本的OpenCart,如下所示。 + + # wget https://github.com/opencart/opencart/archive/master.zip + +4. 下载压缩文件后,拷贝到Apache工作目录下(例如/var/www/html)然后解压缩master.zip文件。 + + # cp master.zip /var/www/html/ + # cd /var/www/html + # unzip master.zip + +5. 提取‘master.zip’文件后,切换到提取目录下,然后移动upload目录到应用程序的根文件夹(opencart-master) + + # cd opencart-master + # mv -v upload/* ../opencart-master/ + +6. 现在需要重命名或复制OpenCart配置文件,如下所示。 + + # cp /var/www/html/opencart-master/admin/config-dist.php /var/www/html/opencart-master/admin/config.php + # cp /var/www/html/opencart-master/config-dist.php /var/www/html/opencart-master/config.php + +7. 下一步,设置/var/www/html/opencart-master的文件和文件夹正确的权限。您需要提供RWX权限给文件和文件夹,用递归方式。 + + # chmod 777 -R /var/www/html/opencart-master + + **重要**: 设置权限777可能是危险的,所以一旦你完成所有设置,递归恢复755权限到上层的文件夹。 + +### 第三步: 创建 OpenCart 数据库 ### + +8. 下一步是给你的电子商务网站创建一个数据库(比如叫做 opencartdb)来存储数据。连接到数据库服务器并创建一个数据库和用户,并授予用户正确的权限以完全控制该数据库。 + + # mysql -u root -p + CREATE DATABASE opencartdb; + CREATE USER 'opencartuser'@'localhost' IDENTIFIED BY 'mypassword'; + GRANT ALL PRIVILEDGES ON opencartdb.* TO 'opencartuser'@'localhost' IDENTIFIED by 'mypassword'; + +### 第四步: OpenCart 网站安装 ### + +9. 一旦所有设置正确,到web浏览器地址栏输入`http://`访问OpenCart web安装。 + + 点击“继续”,同意许可证协议。 + + ![Accept OpenCart License](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-License.png) + + *同意OpenCart许可证* + +10. 下一个屏幕是安装前服务器设置检查,查看服务器所需的所有模块是否安装正确并且有OpenCart文件的权限。 + + 如果在第1和2区域有红色标志突出显示,这意味着你需要在服务器上正确安装这些组件满足web服务器的要求。 + + 如果在第3和4区域有红色标志突出显示,这意味着你的文件有问题。如果一切正确配置您应该看到所有都是绿色标志(见下面),你可以按“继续”。 + + ![Server Requirement Check](http://www.tecmint.com/wp-content/uploads/2015/05/Server-Checkup.png) + + *服务器需求检查* + +11. 在下一个屏幕上输入数据库凭证信息,如数据库驱动类型、主机名、用户名、密码、数据库。你不应该改动数据库端口和前缀,除非你知道你在做什么。 + + 另外输入管理员账号的用户名、密码和邮箱地址。注意这些凭证将用于管理员登录到Opencart管理面板,所以保证它的安全。完成后单击继续! + + ![OpenCart Database Details](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Database.png) + + *OpenCart数据库详情* + +12. 下一个屏幕显示的信息如“Installation Complete”和“Ready to Start Selling”。这里还警告说,要记得删除安装目录,所有需要这个目录安装的设置已经完成。 + + ![OpenCart Installation Completes](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Installation-Completes.png) + + *OpenCart安装完成* + + 删除安装目录,你可以执行下面的命令。 + + # rm -rf /var/www/html/opencart-master/install + +### 第四步: 进入OpenCart 及其管理界面 ### + +13. 现在打开浏览器到`http:///opencart-master/`然后你会看到类似下面的截屏。 + + ![OpenCart Product Showcase](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart.jpg) + + *OpenCart产品示例* + +14. 要登录到Opencart管理面板,你需要浏览`http:///opencart-master/admin`然后填写之前设置的凭证。 + + ![OpenCart Admin Login](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Admin-Login.png) + + *OpenCart管理登录* + +15. 如果全部OK你应该可以看到Opencart的控制台。 + + ![OpenCart Dashboard](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Dashboard.png) + + *OpenCart控制台* + + 在管理控制台可以设置很多选项,如类别、产品、选择、制造商、下载、评论、信息、扩展安装、运输、付款选项、订单总数、礼品券、贝宝、优惠券、子公司、营销、邮件、设计风格和设置、错误日志、内置分析等等。 + +#### 测试了这个工具之后呢? #### + +如果您已经测试了这个应用程序,就会发现它可定制、灵活、稳定、易于维护和使用,您可能需要一个好的主机托管提供商托管你的OpenCart应用,以便保持24 x7的在线支持。尽管有很多选择,我们建议Hostgator主机提供商。(广告硬植-.-!,以下硬广和 LCTT 无关~) + +Hostgator是以服务和功能出名的域名注册和虚拟机托管提供商。它为你提供无限的磁盘空间、无限带宽、易于安装(一键安装脚本)、99.9%的正常运行时间、荣获24x7x365技术支持和45天退款保证,这意味着如果你不喜欢这个产品和服务就可以在45天内拿回你的采购费,注意这45天是一个长的测试时间。 + +所以如果你有什么想卖的你可以免费地去做了(我的意思是免费,想想你会花在实体存储上的费用,然后比较其与建设虚拟商店的成本。你就会感受到它的免费了)。 + +**注**: 当你从Hostgator购买虚拟主机(和/或域名)你将获得一个**25%折扣**。这只提供给Tecmint网站的读者。 + +你所要做的就是在购买虚拟机支付时输入优惠码“**TecMint025**”。付款预览截屏优惠码以供参考用。 + +![Hostgator 25% Discount - TecMint025](http://www.tecmint.com/wp-content/uploads/2015/05/Hostgator-Discount-Code.png) + +*[注册 Hostgator][4] (折扣码: TecMint025)* + +**注**: 还值得一提的,每个你从Hostgator购买的托管OpenCart的虚拟机,我们将得到少量的佣金,只是为了保持Tecmint存活 (通过支付带宽和托管服务器)。 + +所以如果你使用上面的代码买它,你得到折扣,我们会得到少量收入。还要注意,你不会支付任何额外的费用,事实上你支付的账单总额将减少25%。 + +### 总结 ### + +OpenCart是一个开箱可用的应用。它易于安装,您可以选择选择最适合的模板,添加你的产品然后你就成为了一个在线店主。 + +很多社区开发的扩展(有免费和付费的)使它变得丰富。这是一个给那些想要建立一个保持24X7小时用户可访问的虚拟商店的美妙应用。让我们知道你对这个应用程序的体验吧。欢迎任何建议和反馈。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/create-e-commerce-online-shopping-store-using-opencart-in-linux/ + +作者:[Avishek Kumar][a] +译者:[wyangsun](https://github.com/wyangsun) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://demo.opencart.com/ +[2]:http://demo.opencart.com/admin/ +[3]:http://www.opencart.com/index.php?route=download/download/ +[4]:http://secure.hostgator.com/%7Eaffiliat/cgi-bin/affiliates/clickthru.cgi?id=tecmint diff --git a/translated/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md b/translated/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md deleted file mode 100644 index e506f76f7c..0000000000 --- a/translated/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md +++ /dev/null @@ -1,224 +0,0 @@ -如何在linux中用“OpenCart”创建自己的在线商店 -================================================================================ -在网络世界我们用电脑做所有事情。用电子设备完成的商务也叫电子商务即是其中之一。电子商务并不是什么新鲜事,它起源于早期的阿帕网,阿帕网用来安排麻省理工学院和斯坦福大学人工智能实验室学生之间的拍卖。 - -最近出现了上百家电子商务网站也就是, Flipcart, eBay, Alibaba, Zappos, IndiaMART, Amazon, 等等。你想制作自己的亚马逊和Flipcart这样基于web的应用程序服务器吗?如果是!这个文章正适合你。 - -Opencart是一个免费开源的使用PHP语言的电子商务程序,它可以用来开发一个购物车系统类似于亚马逊和Flipcart。如果你想在线卖你的产品或想在关门时为你的客户提供服务Opencart是给你准备的。你可以使用可靠和专业Opencart应用程序建立一个成功的网上商店(网上商家)。 - -### OpenCart 网页面板演示 ### - -- 商店前端 – [http://demo.opencart.com/][1] -- 管理登陆 – [http://demo.opencart.com/admin/][2] - - ------------------ 管理 登陆 ------------------ - 用户名: demo - 密码: demo - -#### Opencart的特点 #### - -Opencart是一个符合所有在线商家需求的应用程序。您可以使用它的所有特性(见下文)制作自己的电子商务网站。 - -- 它是一个免费的(如啤酒)和开源(如言论)应用GNU GPL许可下发布。 -- 一切都是有据可查的,意味着你不需到要谷歌喊救命。 -- 自由生活的时间支持和更新。 -- 无限数量的类别、产品和制造商的支持。 -- 一切都是基于模板的。 -- 支持多语言和多币种。它确保你的产品遍及全球。 -- 内置产品评论和评级功能。 -- 可下载的产品(即电子书)支持 -- 自动调整图像的支持。 -- 功能,如多税率(如各种国家),查看相关产品,资料页,装船重量计算,使用折扣优惠券,等等是默认实现的。 -- 内置的备份和恢复工具。 -- 实施搜索引擎优化。 -- 发票打印,也支持错误日志和销售报告。 - -#### 系统需求 #### - -- Web 服务器 (Apache HTTP服务器的首选) -- PHP (5.2 或以上). -- 数据库 (首选MySQL但是我用MariaDB). - -#### PHP需要的库和模块 #### - -这些扩展必须在您的系统上安装并启用确保web服务器上安装Opencart正确 - -- Curl -- Zip -- Zlib -- GD Library -- Mcrypt -- Mbstrings - -### 第一步: 安装 Apache, PHP 和 MariaDB ### - -1. 像我说的,OpenCart需要一定的技术要求比如在系统上安装Apache,PHP扩展和数据库(MySQL或MariaDB),为了运行Opencart正常。 - -让我们使用命令行安装Apache,PHP和MariaDB。 - -**安装 Apache** - - # apt-get install apache2 (在基于Debian系统上) - # yum install httpd (在基于RedHat系统上) - -**安装 PHP and Extensions** - - # apt-get install php5 libapache2-mod-php5 php5-curl php5-mcrypt (在基于Debian系统上) - # yum install php php-mysql php5-curl php5-mcrypt (在基于RedHat系统上) - -**安装 MariaDB** - - # apt-get install mariadb-server mariadb-client (在基于Debian系统上) - # yum install mariadb-server mariadb (在基于RedHat系统上) - -2. 在安装所有需要上面的东西后, you can start the Apache and MariaDB services using following commands. - - ------------------- 在基于Debian系统上 ------------------- - # systemctl restart apache2.service - # systemctl restart mariadb.service - - - ------------------- 在基于RedHat系统上 ------------------- - # systemctl restart httpd.service - # systemctl restart mariadb.service - -### 第二步: 下载和设置 OpenCart ### - -3. 最新版本的OpenCart(2.0.2.0)可以从[OpenCart website][3]或直接从github获得。 - -作为一种选择,你可以使用wget命令直接从github库下载最新版本的OpenCart,如下所示。 - - # wget https://github.com/opencart/opencart/archive/master.zip - -4. 下载压缩文件后,拷贝到Apache工作目录下(例如/var/www/html)然后解压缩master.zip文件。 - - # cp master.zip /var/www/html/ - # cd /var/www/html - # unzip master.zip - -5. 提取‘master.zip’文件后,切换到提取目录下然后移动upload目录到应用程序的根文件夹(opencart-master) - - # cd opencart-master - # mv -v upload/* ../opencart-master/ - -6. 现在需要重命名或复制OpenCart配置文件如下所示。 - - # cp /var/www/html/opencart-master/admin/config-dist.php /var/www/html/opencart-master/admin/config.php - # cp /var/www/html/opencart-master/config-dist.php /var/www/html/opencart-master/config.php - -7. 下一步,设置/var/www/html/opencart-master的文件和文件夹正确的权限。您需要提供RWX权限给文件和文件夹,用递归方式。 - - # chmod 777 -R /var/www/html/opencart-master - -**重要**: 设置权限777可能是危险的,所以一旦你完成所有设置,递归恢复755权限到上层的文件夹。 - -### 第三步: 创建 OpenCart 数据库 ### - -8. 下一步是创建一个数据库(例如opencartdb)电子商务网站数据库来存储数据。连接到数据库服务器并创建一个数据库,用户和正确的权限授予用户完全控制数据库。 - - # mysql -u root -p - CREATE DATABASE opencartdb; - CREATE USER 'opencartuser'@'localhost' IDENTIFIED BY 'mypassword'; - GRANT ALL PRIVILEDGES ON opencartdb.* TO 'opencartuser'@'localhost' IDENTIFIED by 'mypassword'; - -### 第四步: OpenCart 网站安装 ### - -9. 一旦所有设置正确,到web浏览器地址栏输入`http://`访问OpenCart web安装。 - -点击“继续”,同意许可证协议。 - -![Accept OpenCart License](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-License.png) - -同意OpenCart许可证 - -10. 下一个屏幕是安装前检查服务器设置,查看服务器所需的所有模块安装正确并且有OpenCart文件的权限。 - -如果有红色标志突出显示#1或#2,这意味着你需要在服务器上正确安装这些组件满足web服务器的要求。 - -如果有红色标志突出显示#3或#4,这意味着你的文件有问题。如果一切正确配置您应该看到所有绿色标志是可见的(见下面),你可以按“继续”。 - -![Server Requirement Check](http://www.tecmint.com/wp-content/uploads/2015/05/Server-Checkup.png) - -服务器需求检查 - -11. 在下一个屏幕上输入数据库证书如数据库驱动程序,主机名、用户名、密码、数据库。你不应该改动数据库端口和前缀,除非你知道你在做什么。 - -另外输入管理员账号的用户名,密码和邮箱地址。注意这些凭据将用于root登录到Opencart管理面板,所以保证它的安全。完成后单击继续! - -![OpenCart Database Details](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Database.png) - -OpenCart数据库详情 - -12. 下一个屏幕显示的信息如“Installation Complete”与“Ready to Start Selling”为结束行。还警告说,删除安装目录,所有需要这个目录安装的设置已经完成。 - -![OpenCart Installation Completes](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Installation-Completes.png) - -OpenCart安装完成 - -删除安装目录,你可以执行下面的命令。 - - # rm -rf /var/www/html/opencart-master/install - -### 第四步: 进入OpenCart页管理 ### - -13. 现在打开浏览器到`http:///opencart-master/`然后你会看到类似下面的截屏。 - -![OpenCart Product Showcase](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart.jpg) - -OpenCart产品示例 - -14. 为了登陆到Opencart管理面板,你需要浏览http:///opencart-master/admin然后填写通行证,同时设置它启动。 - -![OpenCart Admin Login](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Admin-Login.png) - -OpenCart管理登陆 - -15. 如果全部OK你应该可以看到Opencart的控制台。 - -![OpenCart Dashboard](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Dashboard.png) - -OpenCart控制台 - -在管理控制台可以建立很多选项如类别,产品选择,制造商、下载、评论,信息,扩展安装,运输,付款选项,订单总数、礼品券、贝宝、优惠券、子公司、营销、邮件、设计和设置,错误日志,内置分析等等。 - -#### 测试工具之后? #### - -如果您已经测试了应用程序和发现它可定制,灵活,坚如磐石,易于维护和使用,您可能需要一个好的主机托管提供商托管OpenCart应用,保持在线24 x7的支持。尽管有很多选项,我们建议Hostgator主机提供商。(广告硬植-.-!) - -Hostgator是以服务和特性出名的域名注册和虚拟机托管提供商。它为你提供无限的磁盘空间,无限带宽,易于安装(一键安装脚本),99.9%的正常运行时间,荣获24x7x365技术支持和45天退款保证,这意味着如果你不喜欢这个产品和服务在45天内拿回你的采购费,注意这45天是一个长的测试时间。 - -所以如果你有什么想卖的你可以自由做它(我的意思是自由,想到你会花在获得物理存储成本,然后比较其与虚拟商店建立成本。你会觉得它的自由)。 - -**注**: 当你从Hostgator购买虚拟主机(和/或域名)你将获得一个**25%折扣**。这只提供给Tecmint网站的读者。 - -你所要做的就是在购买虚拟机支付时输入优惠码“**TecMint025**”。付款预览截屏优惠码以供参考用。 - -![Hostgator 25% Discount - TecMint025](http://www.tecmint.com/wp-content/uploads/2015/05/Hostgator-Discount-Code.png) - -[Sign up for Hostgator][4] (折扣码: TecMint025) - -**注**: 还值得一提的,每个你从Hostgator购买的虚拟机托管OpenCart,我们将得到少量的佣金,只是为了保持Tecmint存活 (通过支付带宽和托管服务器)。 - -所以如果你使用上面的代码买它,你得到折扣,我们会得到少量收入。还要注意,你不会支付任何额外的,事实上你支付的账单总额将减少25%。 - -### 总结 ### - -OpenCart是一个开箱可用的应用。它易于安装,您可以选择选择最适合的模板,添加你的产品然后你就成为了一个在线店主。 - -很多社区的扩展(免费和付费)使它丰富。这是一个美妙的应用为那些想要建立一个保持24X7小时用户可访问的虚拟商店。让我知道你的应用程序的经验。欢迎任何建议和反馈。 - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/create-e-commerce-online-shopping-store-using-opencart-in-linux/ - -作者:[Avishek Kumar][a] -译者:[wyangsun](https://github.com/wyangsun) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://demo.opencart.com/ -[2]:http://demo.opencart.com/admin/ -[3]:http://www.opencart.com/index.php?route=download/download/ -[4]:http://secure.hostgator.com/%7Eaffiliat/cgi-bin/affiliates/clickthru.cgi?id=tecmint From 7b9c3ca11bb8d9d31d3322748e9e26ab72309812 Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Thu, 11 Jun 2015 16:52:32 +0800 Subject: [PATCH 054/153] Translating by ZTinoZ --- ... 20 Useful Terminal Emulators for Linux.md | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index 5d8b38e80c..4ff7820781 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -87,7 +87,7 @@ Roxterm Terminal ### 6. Eterm ### -Eterm is a lightest color terminal emulator designed as a replacement for xterm. It is developed with a Freedom of Choice ideology, leaving as much power, flexibility, and freedom as workable in the hands of the user. +Eterm是最轻量级的一款彩色终端仿真器,是作为xterm的替代品而被设计出来。它是以一种选择自由的思想、避免臃肿、灵活性和自由在用户手中是触手可及的理念而开发出来的。 ![Eterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Eterm-Terminal.jpeg) @@ -97,7 +97,7 @@ Eterm Terminal ### 7. Rxvt ### -Rxvt stands for extended virtual terminal is a color terminal emulator application for Linux intended as an xterm replacement for power users who don’t need to have a feature such as Tektronix 4014 emulation and toolkit-style configurability. +代表着扩展虚拟终端的Rxvt是一款彩色终端仿真器,为那些不需要一些特性例如Tektronix 4014仿真和toolkit-style可配置性的老牌用户而生的xterm的替代品。 ![Rxvt Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Rxvt-Terminal.jpeg) @@ -118,6 +118,7 @@ wterm Terminal ### 9. LXTerminal ### LXTerminal is a default VTE-based terminal emulator for LXDE (Lightweight X Desktop Environment) without any unnecessary dependency. The terminal has got some nice features such as. + LXTerminal Features - Multiple tabs support @@ -133,19 +134,20 @@ lxterminal Terminal ### 10. Konsole ### -Konsole is yet another powerful KDE based free terminal emulator was originally created by Lars Doelle. -Konsole Features +Konsole是另一款强大的基于KDE的免费终端仿真器,最初由Lars Doelle创造。 -- Multiple Tabbed terminals. -- Translucent backgrounds. -- Support for Split-view mode. -- Directory and SSH bookmarking. -- Customizable color schemes. -- Customizable key bindings. -- Notification alerts about activity in a terminal. -- Incremental search -- Support for Dolphin file manager -- Export of output in plain text or HTML format. +Konsole的特性 + +- 多标签式终端 +- 半透明背景 +- 支持拆分视图模式 +- 目录和SSH书签化 +- 可定制的颜色设计 +- 可定制的按键绑定 +- 终端中的活动通知警告 +- 增量搜索 +- 支持Dolphin文件管理器 +- 普通文本和HTML格式输出出口 ![Konsole Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Konsole-Terminal.jpeg) From 4f22be057f2d3f09c6d74769ce31e4b7cc348a9e Mon Sep 17 00:00:00 2001 From: chenzhijun <522858454@qq.com> Date: Thu, 11 Jun 2015 18:51:23 +0800 Subject: [PATCH 055/153] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...RSS feed from the command line on Linux.md | 108 ------------------ 1 file changed, 108 deletions(-) delete mode 100644 sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md diff --git a/sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md b/sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md deleted file mode 100644 index 16dccd8f8e..0000000000 --- a/sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md +++ /dev/null @@ -1,108 +0,0 @@ -translating by chenzhijun - -How to access Feedly RSS feed from the command line on Linux -================================================================================ -In case you didn't know, [Feedly][1] is one of the most popular online news aggregation services. It offers seamlessly unified news reading experience across desktops, Android and iOS devices via browser extensions and mobile apps. Feedly took on the demise of Google Reader in 2013, quickly gaining a lot of then Google Reader users. I was one of them, and Feedly has remained my default RSS reader since then. - -While I appreciate the sleek interface of Feedly's browser extensions and mobile apps, there is yet another way to access Feedly: Linux command-line. That's right. You can access Feedly's news feed from the command line. Sounds geeky? Well, at least for system admins who live on headless servers, this can be pretty useful. - -Enter [Feednix][2]. This open-source software is a Feedly's unofficial command-line client written in C++. It allows you to browse Feedly's news feed in ncurses-based terminal interface. By default, Feednix is linked with a console-based browser called w3m to allow you to read articles within a terminal environment. You can choose to read from your favorite web browser though. - -In this tutorial, I am going to demonstrate how to install and configure Feednix to access Feedly from the command line. - -### Install Feednix on Linux ### - -You can build Feednix from the source using the following instructions. At the moment, the "Ubuntu-stable" branch of the official Github repository has the most up-to-date code. So let's use this branch to build it. - -As prerequisites, you will need to install a couple of development libraries, as well as w3m browser. - -#### Debian, Ubuntu or Linux Mint #### - - $ sudo apt-get install git automake g++ make libncursesw5-dev libjsoncpp-dev libcurl4-gnutls-dev w3m - $ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git - $ cd Feednix - $ ./autogen.sh - $ ./configure - $ make - $ sudo make install - -#### Fedora #### - - $ sudo yum groupinstall "C Development Tools and Libraries" - $ sudo yum install gcc-c++ git automake make ncurses-devel jsoncpp-devel libcurl-devel w3m - $ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git - $ cd Feednix - $ ./autogen.sh - $ ./configure - $ make - $ sudo make install - -Arch Linux - -On Arch Linux, you can easily install Feednix from [AUR][3]. - -### Configure Feednix for the First Time ### - -After installing it, launch Feednix as follows. - - $ feednix - -The first time you run Feednix, it will pop up a web browser window, where you need to sign up to create a Feedly's user ID and its corresponding developer access token. If you are running Feednix in a desktop-less environment, open a web browser on another computer, and go to https://feedly.com/v3/auth/dev. - -![](https://farm8.staticflickr.com/7427/15825106524_42883b3e32_b.jpg) - -Once you sign in, you will see your Feedly user ID generated. - -![](https://www.flickr.com/photos/xmodulo/15827565143/) - -To retrieve an access token, you need to follow the token link sent to your email address in your browser. Only then will you see the window showing your user ID, access token, and its expiration date. Be aware that access token is quite long (more than 200 characters). The token appears in a horizontally scrollable text box, so make sure to copy the whole access token string. - -![](https://farm9.staticflickr.com/8605/16446685812_9098df494b_b.jpg) - -Paste your user ID and access token into the Feednix' command-line prompt. - - [Enter User ID] >> XXXXXX - [Enter token] >> YYYYY - -After successful authentication, you will see an initial Feednix screen with two panes. The left-side "Categories" pane shows a list of news categories, while the right-side "Posts" pane displays a list of news articles in the current category. - -![](https://farm8.staticflickr.com/7412/16421639256_deb8e2d276_c.jpg) - -### Read News in Feednix ### - -Here I am going to briefly describe how to access Feedly via Feednix. - -#### Navigate Feednix #### - -As I mentioned, the top screen of Feednix consists of two panes. To switch focus between the two panes, use TAB key. To move up and down the list within a pane, use 'j' and 'k' keys, respectively. These keyboard shorcuts are obviously inspired by Vim text editor. - -#### Read an Article #### - -To read a particular article, press 'o' key at the current article. It will invoke w2m browser, and load the article inside the browser. Once you are done reading, press 'q' to quit the browser, and come back to Feednix. If your environment can open a web browser, you can press 'O' to load an article on your default web browser such as Firefox. - -![](https://farm8.staticflickr.com/7406/16445870201_b98e8da6d9_b.jpg) - -#### Subscribe to a News Feed #### - -You can add any arbitrary RSS news feed to your Feedly account from Feednix interface. To do so, simply press 'a' key. This will show "[ENTER FEED]:" prompt at the bottom of the screen. After typing the RSS feed, go ahead and fill in the name of the feed and its preferred category. - -![](https://farm8.staticflickr.com/7324/16421639296_b52ed3c52e_c.jpg) - -#### Summary #### - -As you can see, Feednix is a quite convenient and easy-to-use command-line RSS reader. If you are a command-line junkie as well as a regular Feedly user, Feednix is definitely worth trying. I have been communicating with the creator of Feednix, Jarkore, to troubleshoot some issue. As far as I can tell, he is very active in responding to bug reports and fixing bugs. I encourage you to try out Feednix and let him know your feedback. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/feedly-rss-feed-command-line-linux.html - -作者:[Dan Nanni][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://xmodulo.com/author/nanni -[1]:https://feedly.com/ -[2]:https://github.com/Jarkore/Feednix -[3]:https://aur.archlinux.org/packages/feednix/ From a4b62ed2496de9eee4c69a4de326dc170423cf35 Mon Sep 17 00:00:00 2001 From: chenzhijun <522858454@qq.com> Date: Thu, 11 Jun 2015 18:52:06 +0800 Subject: [PATCH 056/153] finish translate --- ...RSS feed from the command line on Linux.md | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md diff --git a/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md b/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md new file mode 100644 index 0000000000..15fd76f291 --- /dev/null +++ b/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md @@ -0,0 +1,123 @@ +如何在Linux命令行下获取Feedly上的RSS新闻 +================================================================================ + +也许的先告诉你一声,Feedly 是世界上最流行的在线新闻聚合服务之一;它提供了无缝地统一的新闻阅读体验,你可以使用电脑的浏览器扩展,Android 和 iOS 设备上的移动应用程序等来体验Feedly。Feedly 在2013年Google Reader 停用后,迅速的获得了一大批Google Reader的用户。我就是他们之中的一位。从这以后,Feedly就一直是我的默认RSS(简易信息聚合)阅读器 +除了我非常喜欢的Feedly浏览器扩展和手机上的Feedly程序,这里还有一种途径来获取Feedly:Linux command-line (Linux命令行) +对的。你可以用命令行来获取Feedly上的新闻概要。 + +听起来非常傻?但是对于那些在服务器上工作的系统管理员来说,这是非常有用的。 +点击进入[Feednix][2]. 这个用c++编写的开源软件是Feedly的非官方命令行客户端。它允许你浏览Feedly的新闻在一个基于字符的终端界面(例如:bash)。默认模式下,Feednix 连接了一个基于控制台的浏览器,这个浏览器的名字叫w3m,允许你在命令行终端的环境下阅读文章。当然你也可以选择使用你喜欢的网页浏览器。在这个教程中,我准备示范以下怎样在命令行下安装和配置Feednix 来获取获取Feedly。 + +### 在Linux下安装Feednix ### + +你可以通过以下的步骤从源代码中安装Feednix。同时,在github的Ubuntu分区里面Ubuntu-stable(Ubuntu稳定版本)的分支上有最新的Feednix源代码。现在让我们开始吧: +作为必要组件,你需要安装一组开发包,和w3m浏览器(文字式页面浏览器)。 + +#### 在Debian,Ubuntu 和Linux Mint 操作 #### + + $ sudo apt-get install git automake g++ make libncursesw5-dev libjsoncpp-dev libcurl4-gnutls-dev w3m + $ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git + $ cd Feednix + $ ./autogen.sh + $ ./configure + $ make + $ sudo make install + + +#### 在Fedora 下操作 #### + + $ sudo yum groupinstall "C Development Tools and Libraries" + $ sudo yum install gcc-c++ git automake make ncurses-devel jsoncpp-devel libcurl-devel w3m + $ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git + $ cd Feednix + $ ./autogen.sh + $ ./configure + $ make + $ sudo make install + +Arch Linux + +在Arch Linux发行版下, 你可以非常容易的安装Feednix 从 [AUR][3]. + + +### 配置Feednix ### + +在安装完软件后,用下面的命令启动Feednix + + $ feednix + +如果你是第一次运行Feddnix,它会弹出一个网页浏览器窗口,在这个窗口里,你需要登陆来创建一个Feedly的账户ID和相应的开发人员密钥。 + +如果你是在无桌面环境下运行Feednix,先在另外一台电脑上打开一个网页,进入到网站:https://feedly.com/v3/auth/dev. + +![](https://farm8.staticflickr.com/7427/15825106524_42883b3e32_b.jpg) + +一旦你登陆,你对应的Feedly账户ID就生成了。 + +![](https://www.flickr.com/photos/xmodulo/15827565143/) + +为了验证密钥,你需要在浏览器上允许验证密钥的链接发送你的邮箱。之后就会在浏览器窗口显示你的用户ID,密钥,和密钥的有效期。 +请注意密钥的长度是非常超过200个字符的。所以密钥显示在一个带有垂直滚动条的文书框内,请确保把整个密钥的长度复制下来。 + +![](https://farm9.staticflickr.com/8605/16446685812_9098df494b_b.jpg) + +向下面这样,把你的用户ID和密钥输入到Feddnix的命令行提示下: + + [Enter User ID] >> XXXXXX + [Enter token] >> YYYYY + +成功授权后,你会在屏幕上见到一个初始化的有两个窗格的Feednix界面 + +左边的标题为“Categories”窗格,显示了一个新闻分类栏;右边“Posts”窗格显示了当前类别的新闻文章 + +![](https://farm8.staticflickr.com/7412/16421639256_deb8e2d276_c.jpg) + + +### 用Feednix读文章 ### + +这里我想简要描叙一下怎样通过Feednix来访问Feedly。 + + +#### Feednix界面 #### + +向我之前提过的,Feednix窗口包含了两个窗格。想在两个窗口之间进行切换的话,可以使用"TAB"健。在一个窗格内,想上下移动选择可以使用"j"和"k"。 +这些快捷健明显是受到了使用Vim编辑器的人启发。 + +#### 阅读文章 #### + +想阅读一些有特色的文章,可以在选定的文章上使用"o"健。它会调用w2m浏览器,并且在浏览器里面加载文章。 +一旦你读完之后,可以使用"q"健来推出当前W2m浏览器,并且返回到Feednix. +如果你的电脑环境允许打开一个网页浏览器,你可以按"0"健来在你默认的网页浏览器里面家在文章,比如使用Firefox. + + +![](https://farm8.staticflickr.com/7406/16445870201_b98e8da6d9_b.jpg) + + +#### 订阅新闻 #### + +你可以通过Feednix来为你的Feedly账户增加任何一种RSS新闻。 +要这么做,仅仅只需要按下"a"键,它会显示一个"[ENTER FEED]:"的提示在屏幕上,然后按下"ENTER" +在选择完RSS新闻后,继续为它编写分组信息和分类。 + +![](https://farm8.staticflickr.com/7324/16421639296_b52ed3c52e_c.jpg) + +#### 总结 #### + + +现在你知道了吧, Feednix 是一个非常友好的并且容易使用的命令行RSS阅读器。如果你是重度依赖命令行的用户或者是一个Feedly用户,Feednix 是肯定值得去尝试的。 +我经常和Feednix的开发者Jarkore交流来解决一些问题。我想说,对于bug的报告和修复他非常的积极。 +鼓励大家来试用Feednix,并且给他(Jarkore)一些回馈。 +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/feedly-rss-feed-command-line-linux.html + +作者:[Dan Nanni][a] +译者:[译者ID](https://github.com/chenzhijun) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:https://feedly.com/ +[2]:https://github.com/Jarkore/Feednix +[3]:https://aur.archlinux.org/packages/feednix/ From ced1ee3cab2939f996a8ed8aff6516b5a5d5dce2 Mon Sep 17 00:00:00 2001 From: wolf <522858454@qq.com> Date: Thu, 11 Jun 2015 19:08:41 +0800 Subject: [PATCH 057/153] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 标题。 我是我想了好久, 但是总觉得有的不达人意。 校对员能帮忙翻译一下吗? How to access Feedly RSS feed from the command line on Linux RSS是一种基于XML标准的协议; Feedly 是RSS阅读器 --- ...access Feedly RSS feed from the command line on Linux.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md b/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md index 15fd76f291..59cd1b97e6 100644 --- a/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md +++ b/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md @@ -1,7 +1,7 @@ -如何在Linux命令行下获取Feedly上的RSS新闻 +如何从Linux命令行获取基于RSS协议的Feedly新闻信息 ================================================================================ -也许的先告诉你一声,Feedly 是世界上最流行的在线新闻聚合服务之一;它提供了无缝地统一的新闻阅读体验,你可以使用电脑的浏览器扩展,Android 和 iOS 设备上的移动应用程序等来体验Feedly。Feedly 在2013年Google Reader 停用后,迅速的获得了一大批Google Reader的用户。我就是他们之中的一位。从这以后,Feedly就一直是我的默认RSS(简易信息聚合)阅读器 +也许你并不知道,Feedly --世界上最流行的在线新闻聚合服务之一;它提供了无缝地统一的新闻阅读体验,你可以使用电脑的浏览器扩展,Android 和 iOS 设备上的移动应用程序等来体验Feedly。Feedly 在2013年Google Reader 停用后,迅速的获得了一大批Google Reader的用户。我就是他们之中的一位。从这以后,Feedly就一直是我的默认RSS(简易信息聚合)阅读器 除了我非常喜欢的Feedly浏览器扩展和手机上的Feedly程序,这里还有一种途径来获取Feedly:Linux command-line (Linux命令行) 对的。你可以用命令行来获取Feedly上的新闻概要。 @@ -112,7 +112,7 @@ Arch Linux via: http://xmodulo.com/feedly-rss-feed-command-line-linux.html 作者:[Dan Nanni][a] -译者:[译者ID](https://github.com/chenzhijun) +译者:[chenzhijun](https://github.com/chenzhijun) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 From f624eedbfd890054d9ede42a768c074701120b1e Mon Sep 17 00:00:00 2001 From: wolf <522858454@qq.com> Date: Thu, 11 Jun 2015 19:11:23 +0800 Subject: [PATCH 058/153] Update 20150209 How to access Feedly RSS feed from the command line on Linux.md --- ... to access Feedly RSS feed from the command line on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md b/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md index 59cd1b97e6..4109ceb947 100644 --- a/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md +++ b/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md @@ -1,4 +1,4 @@ -如何从Linux命令行获取基于RSS协议的Feedly新闻信息 +从Linux命令行获取基于RSS协议的Feedly上信息 ================================================================================ 也许你并不知道,Feedly --世界上最流行的在线新闻聚合服务之一;它提供了无缝地统一的新闻阅读体验,你可以使用电脑的浏览器扩展,Android 和 iOS 设备上的移动应用程序等来体验Feedly。Feedly 在2013年Google Reader 停用后,迅速的获得了一大批Google Reader的用户。我就是他们之中的一位。从这以后,Feedly就一直是我的默认RSS(简易信息聚合)阅读器 From 2e29b9bdeb8c5f00bd93ba43bee28fc5b15bff13 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 11 Jun 2015 21:06:25 +0800 Subject: [PATCH 059/153] translated --- ... pagespeed on Ubuntu 15.04 Vivid Vervet.md | 131 ------------------ ... pagespeed on Ubuntu 15.04 Vivid Vervet.md | 129 +++++++++++++++++ 2 files changed, 129 insertions(+), 131 deletions(-) delete mode 100644 sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md create mode 100644 translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md diff --git a/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md b/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md deleted file mode 100644 index dd3478c903..0000000000 --- a/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md +++ /dev/null @@ -1,131 +0,0 @@ -translating----geekpi - -How to Install nginx and google pagespeed on Ubuntu 15.04 (Vivid Vervet) -================================================================================ -Nginx (engine-x) is a open source and high performance HTTP server, reverse proxy and IMAP/POP3 proxy server. The outstanding features of Nginx are: stability, rich feature set, simple configuration and low resource consumption. Nginx is being used by some of the largest websites on the internet and is gaining more and more popularity in the webmaster community. This tutorials shows how to build a nginx .deb package for Ubuntu 15.04 from source that has Google pagespeed module compiled in. - - -Pagespeed is a web server module developed by Google to speed up a website response times, optimize html and reduce the page load time. ngx_pagespeed features include : - -- Image optimization: stripping meta-data, dynamic resizing, recompression. -- CSS & JavaScript minification, concatenation, inlining, and outlining. -- Small resource inlining. -- Deferring image and JavaScript loading. -- HTML rewriting. -- Cache lifetime extension. - -see more [https://developers.google.com/speed/pagespeed/module/][1]. - -### Prerequisites ### - -Ubuntu Server 15.04 64 bit -root privileges - -What we will do in this tutorial : - -- Install the prerequisite packages. -- Installing nginx with ngx_pagespeed. -- Testing. - -#### Install the prerequisite packages #### - -sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev - -#### Installing nginx with ngx_pagespeed #### - -**Step 1 - Adding nginx repository** - - vim /etc/apt/sources.list.d/nginx.list - -add the line: - - deb http://nginx.org/packages/ubuntu/ trusty nginx - deb-src http://nginx.org/packages/ubuntu/ trusty nginx - -Update your repository: - - sudo apt-get update - -note : if you get the messege : GPG error [...] NO_PUBKEY [...] bla bla - -please add the the key: - - sudo sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYNUMBER - sudo apt-get update - -**Step 2 - Download nginx 1.8 from ubuntu repository** - - sudo su - cd ~ - mkdir -p ~/new/nginx_source/ - cd ~/new/nginx_source/ - apt-get source nginx - apt-get build-dep nginx - -**Step 3 - Download Pagespeed** - - cd ~ - mkdir -p ~/new/ngx_pagespeed/ - cd ~/new/ngx_pagespeed/ - ngx_version=1.9.32.3 - wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${ngx_version}-beta.zip - unzip release-${ngx_version}-beta.zip - - cd ngx_pagespeed-release-1.9.32.3-beta/ - wget https://dl.google.com/dl/page-speed/psol/${ngx_version}.tar.gz - tar -xzf 1.9.32.3.tar.gz - -**Step 4 - Configure nginx to build with Pagespeed** - - cd ~/new/nginx_source/nginx-1.8.0/debin/ - vim rules - -add the module under CFLAGS `.configure` : - - --add-module=../../ngx_pagespeed/ngx_pagespeed-release-1.9.32.3-beta \ - -![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/1.png) - -![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/2.png) - -**Step 5 - Build nginx package and Install** - - cd ~/new/nginx_source/nginx-1.8.0/ - dpkg-buildpackage -b - -The dpkg-buildpackage command will build the nginx.deb under ~/new/ngix_source/ Once package building is complete, please look in the directory: - - cd ~/new/ngix_source/ - ls - -![nginx builded with pagespeed](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/3.png) - -And then install nginx. - - dpkg -i nginx_1.8.0-1~trusty_amd64.deb - -![Install nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/4.png) - -#### Testing #### - -Run nginx -V to see the ngx_pagespeed was builted with nginx. - - nginx -V - -![nginx -V](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/5.png) - -### Conclusion ### - -The nginx web server there is a stable and fast open source http server that supports a variety of modules for optimization. One of these modules is the 'PageSpeed module' which is developed by google. Unlike apache, nginx modules are not dynamically loadable, so you have to select the desired modules before you build the nginx package. - --------------------------------------------------------------------------------- - -via: https://www.howtoforge.com/tutorial/how-to-install-nginx-and-google-pagespeed-on-ubuntu-15-04/#step-build-nginx-package-and-install - -作者:Muhammad Arul -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[1]:https://developers.google.com/speed/pagespeed/module/ diff --git a/translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md b/translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md new file mode 100644 index 0000000000..91d16acb00 --- /dev/null +++ b/translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md @@ -0,0 +1,129 @@ +如何在Ubuntu 15.04(Vivid Vervet)中安装nginx和google pagespeed +================================================================================ +Nginx (engine-x)是一个开源高性能http、反向代理和IMAP/POP3代理服务器。nginx杰出的功能有:稳定、丰富的功能集、简单的配置和低资源消耗。nginx被用于一些高性能网站并在站长之间变得越来越流行。本教程会从源码构建一个带有google paespeed模块用于Ubuntu 15.04中的.deb包。 + + +pagespeed是一个由google开发的web服务器模块来加速网站响应时间、优化html和减少页面加载时间。ngx_pagespeed的功能如下: + +- 图像优化:去除meta数据、动态剪裁、重压缩。 +- CSS与JavaScript 放大、串联、内联、外联。 +- 小资源内联 +- 延迟图像与JavaScript加载 +- HTML重写。 +- 缓存生命期插件 + +更多请见 [https://developers.google.com/speed/pagespeed/module/][1]. + +### 预备要求 ### + +Ubuntu Server 15.04 64位 +root 权限 + +本篇我们将要: + +- 安装必备包 +- 安装带ngx_pagespeed的nginx +- 测试 + +#### 安装必备包 #### + +sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev + +#### 安装带ngx_pagespeed的nginx #### + +**第一步 - 添加nginx仓库** + + vim /etc/apt/sources.list.d/nginx.list + +加入下面的行: + + deb http://nginx.org/packages/ubuntu/ trusty nginx + deb-src http://nginx.org/packages/ubuntu/ trusty nginx + +更新仓库: + + sudo apt-get update + +注意:如果你看到信息:GPG error [...] NO_PUBKEY [...] 等等 + +请添加key: + + sudo sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYNUMBER + sudo apt-get update + +**第二步 - 从仓库下载nginx 1.8** + + sudo su + cd ~ + mkdir -p ~/new/nginx_source/ + cd ~/new/nginx_source/ + apt-get source nginx + apt-get build-dep nginx + +**第三步 - 下载Pagespeed** + + cd ~ + mkdir -p ~/new/ngx_pagespeed/ + cd ~/new/ngx_pagespeed/ + ngx_version=1.9.32.3 + wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${ngx_version}-beta.zip + unzip release-${ngx_version}-beta.zip + + cd ngx_pagespeed-release-1.9.32.3-beta/ + wget https://dl.google.com/dl/page-speed/psol/${ngx_version}.tar.gz + tar -xzf 1.9.32.3.tar.gz + +**第三步 - 配置nginx来编译Pagespeed** + + cd ~/new/nginx_source/nginx-1.8.0/debin/ + vim rules + +在CFLAGS `.configure`下添加模块: + + --add-module=../../ngx_pagespeed/ngx_pagespeed-release-1.9.32.3-beta \ + +![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/1.png) + +![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/2.png) + +**第五步 - 打包nginx包并安装** + + cd ~/new/nginx_source/nginx-1.8.0/ + dpkg-buildpackage -b + +dpkg-buildpackage会编译 ~/new/ngix_source/成nginx.deb。打包完成后,看一下目录: + + cd ~/new/ngix_source/ + ls + +![nginx builded with pagespeed](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/3.png) + +接着安装nginx。 + + dpkg -i nginx_1.8.0-1~trusty_amd64.deb + +![Install nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/4.png) + +#### 测试 #### + +运行nginx -V测试nginx是否已经自带ngx_pagespeed。 + + nginx -V + +![nginx -V](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/5.png) + +### 总结 ### + +稳定、快速、开源的nginx支持许多不同的优化模块。这其中之一是google开发的‘pagespeed’。不像apache,nginx模块不是动态加载的,因此你必须在编译之前就选择完需要的模块。 + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-install-nginx-and-google-pagespeed-on-ubuntu-15-04/#step-build-nginx-package-and-install + +作者:Muhammad Arul +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://developers.google.com/speed/pagespeed/module/ From d7ad1dd0602030b16f9a4a97287369c806a834da Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 11 Jun 2015 21:09:22 +0800 Subject: [PATCH 060/153] Revert "translated" This reverts commit 2e29b9bdeb8c5f00bd93ba43bee28fc5b15bff13. --- ... pagespeed on Ubuntu 15.04 Vivid Vervet.md | 131 ++++++++++++++++++ ... pagespeed on Ubuntu 15.04 Vivid Vervet.md | 129 ----------------- 2 files changed, 131 insertions(+), 129 deletions(-) create mode 100644 sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md delete mode 100644 translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md diff --git a/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md b/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md new file mode 100644 index 0000000000..dd3478c903 --- /dev/null +++ b/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md @@ -0,0 +1,131 @@ +translating----geekpi + +How to Install nginx and google pagespeed on Ubuntu 15.04 (Vivid Vervet) +================================================================================ +Nginx (engine-x) is a open source and high performance HTTP server, reverse proxy and IMAP/POP3 proxy server. The outstanding features of Nginx are: stability, rich feature set, simple configuration and low resource consumption. Nginx is being used by some of the largest websites on the internet and is gaining more and more popularity in the webmaster community. This tutorials shows how to build a nginx .deb package for Ubuntu 15.04 from source that has Google pagespeed module compiled in. + + +Pagespeed is a web server module developed by Google to speed up a website response times, optimize html and reduce the page load time. ngx_pagespeed features include : + +- Image optimization: stripping meta-data, dynamic resizing, recompression. +- CSS & JavaScript minification, concatenation, inlining, and outlining. +- Small resource inlining. +- Deferring image and JavaScript loading. +- HTML rewriting. +- Cache lifetime extension. + +see more [https://developers.google.com/speed/pagespeed/module/][1]. + +### Prerequisites ### + +Ubuntu Server 15.04 64 bit +root privileges + +What we will do in this tutorial : + +- Install the prerequisite packages. +- Installing nginx with ngx_pagespeed. +- Testing. + +#### Install the prerequisite packages #### + +sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev + +#### Installing nginx with ngx_pagespeed #### + +**Step 1 - Adding nginx repository** + + vim /etc/apt/sources.list.d/nginx.list + +add the line: + + deb http://nginx.org/packages/ubuntu/ trusty nginx + deb-src http://nginx.org/packages/ubuntu/ trusty nginx + +Update your repository: + + sudo apt-get update + +note : if you get the messege : GPG error [...] NO_PUBKEY [...] bla bla + +please add the the key: + + sudo sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYNUMBER + sudo apt-get update + +**Step 2 - Download nginx 1.8 from ubuntu repository** + + sudo su + cd ~ + mkdir -p ~/new/nginx_source/ + cd ~/new/nginx_source/ + apt-get source nginx + apt-get build-dep nginx + +**Step 3 - Download Pagespeed** + + cd ~ + mkdir -p ~/new/ngx_pagespeed/ + cd ~/new/ngx_pagespeed/ + ngx_version=1.9.32.3 + wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${ngx_version}-beta.zip + unzip release-${ngx_version}-beta.zip + + cd ngx_pagespeed-release-1.9.32.3-beta/ + wget https://dl.google.com/dl/page-speed/psol/${ngx_version}.tar.gz + tar -xzf 1.9.32.3.tar.gz + +**Step 4 - Configure nginx to build with Pagespeed** + + cd ~/new/nginx_source/nginx-1.8.0/debin/ + vim rules + +add the module under CFLAGS `.configure` : + + --add-module=../../ngx_pagespeed/ngx_pagespeed-release-1.9.32.3-beta \ + +![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/1.png) + +![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/2.png) + +**Step 5 - Build nginx package and Install** + + cd ~/new/nginx_source/nginx-1.8.0/ + dpkg-buildpackage -b + +The dpkg-buildpackage command will build the nginx.deb under ~/new/ngix_source/ Once package building is complete, please look in the directory: + + cd ~/new/ngix_source/ + ls + +![nginx builded with pagespeed](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/3.png) + +And then install nginx. + + dpkg -i nginx_1.8.0-1~trusty_amd64.deb + +![Install nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/4.png) + +#### Testing #### + +Run nginx -V to see the ngx_pagespeed was builted with nginx. + + nginx -V + +![nginx -V](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/5.png) + +### Conclusion ### + +The nginx web server there is a stable and fast open source http server that supports a variety of modules for optimization. One of these modules is the 'PageSpeed module' which is developed by google. Unlike apache, nginx modules are not dynamically loadable, so you have to select the desired modules before you build the nginx package. + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-install-nginx-and-google-pagespeed-on-ubuntu-15-04/#step-build-nginx-package-and-install + +作者:Muhammad Arul +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://developers.google.com/speed/pagespeed/module/ diff --git a/translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md b/translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md deleted file mode 100644 index 91d16acb00..0000000000 --- a/translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md +++ /dev/null @@ -1,129 +0,0 @@ -如何在Ubuntu 15.04(Vivid Vervet)中安装nginx和google pagespeed -================================================================================ -Nginx (engine-x)是一个开源高性能http、反向代理和IMAP/POP3代理服务器。nginx杰出的功能有:稳定、丰富的功能集、简单的配置和低资源消耗。nginx被用于一些高性能网站并在站长之间变得越来越流行。本教程会从源码构建一个带有google paespeed模块用于Ubuntu 15.04中的.deb包。 - - -pagespeed是一个由google开发的web服务器模块来加速网站响应时间、优化html和减少页面加载时间。ngx_pagespeed的功能如下: - -- 图像优化:去除meta数据、动态剪裁、重压缩。 -- CSS与JavaScript 放大、串联、内联、外联。 -- 小资源内联 -- 延迟图像与JavaScript加载 -- HTML重写。 -- 缓存生命期插件 - -更多请见 [https://developers.google.com/speed/pagespeed/module/][1]. - -### 预备要求 ### - -Ubuntu Server 15.04 64位 -root 权限 - -本篇我们将要: - -- 安装必备包 -- 安装带ngx_pagespeed的nginx -- 测试 - -#### 安装必备包 #### - -sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev - -#### 安装带ngx_pagespeed的nginx #### - -**第一步 - 添加nginx仓库** - - vim /etc/apt/sources.list.d/nginx.list - -加入下面的行: - - deb http://nginx.org/packages/ubuntu/ trusty nginx - deb-src http://nginx.org/packages/ubuntu/ trusty nginx - -更新仓库: - - sudo apt-get update - -注意:如果你看到信息:GPG error [...] NO_PUBKEY [...] 等等 - -请添加key: - - sudo sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYNUMBER - sudo apt-get update - -**第二步 - 从仓库下载nginx 1.8** - - sudo su - cd ~ - mkdir -p ~/new/nginx_source/ - cd ~/new/nginx_source/ - apt-get source nginx - apt-get build-dep nginx - -**第三步 - 下载Pagespeed** - - cd ~ - mkdir -p ~/new/ngx_pagespeed/ - cd ~/new/ngx_pagespeed/ - ngx_version=1.9.32.3 - wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${ngx_version}-beta.zip - unzip release-${ngx_version}-beta.zip - - cd ngx_pagespeed-release-1.9.32.3-beta/ - wget https://dl.google.com/dl/page-speed/psol/${ngx_version}.tar.gz - tar -xzf 1.9.32.3.tar.gz - -**第三步 - 配置nginx来编译Pagespeed** - - cd ~/new/nginx_source/nginx-1.8.0/debin/ - vim rules - -在CFLAGS `.configure`下添加模块: - - --add-module=../../ngx_pagespeed/ngx_pagespeed-release-1.9.32.3-beta \ - -![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/1.png) - -![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/2.png) - -**第五步 - 打包nginx包并安装** - - cd ~/new/nginx_source/nginx-1.8.0/ - dpkg-buildpackage -b - -dpkg-buildpackage会编译 ~/new/ngix_source/成nginx.deb。打包完成后,看一下目录: - - cd ~/new/ngix_source/ - ls - -![nginx builded with pagespeed](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/3.png) - -接着安装nginx。 - - dpkg -i nginx_1.8.0-1~trusty_amd64.deb - -![Install nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/4.png) - -#### 测试 #### - -运行nginx -V测试nginx是否已经自带ngx_pagespeed。 - - nginx -V - -![nginx -V](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/5.png) - -### 总结 ### - -稳定、快速、开源的nginx支持许多不同的优化模块。这其中之一是google开发的‘pagespeed’。不像apache,nginx模块不是动态加载的,因此你必须在编译之前就选择完需要的模块。 - --------------------------------------------------------------------------------- - -via: https://www.howtoforge.com/tutorial/how-to-install-nginx-and-google-pagespeed-on-ubuntu-15-04/#step-build-nginx-package-and-install - -作者:Muhammad Arul -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[1]:https://developers.google.com/speed/pagespeed/module/ From cf572298718cd959d853e3c7201775baf97a8f56 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 11 Jun 2015 21:12:23 +0800 Subject: [PATCH 061/153] translated --- ... pagespeed on Ubuntu 15.04 Vivid Vervet.md | 131 ------------------ ... pagespeed on Ubuntu 15.04 Vivid Vervet.md | 129 +++++++++++++++++ 2 files changed, 129 insertions(+), 131 deletions(-) delete mode 100644 sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md create mode 100644 translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md diff --git a/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md b/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md deleted file mode 100644 index dd3478c903..0000000000 --- a/sources/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md +++ /dev/null @@ -1,131 +0,0 @@ -translating----geekpi - -How to Install nginx and google pagespeed on Ubuntu 15.04 (Vivid Vervet) -================================================================================ -Nginx (engine-x) is a open source and high performance HTTP server, reverse proxy and IMAP/POP3 proxy server. The outstanding features of Nginx are: stability, rich feature set, simple configuration and low resource consumption. Nginx is being used by some of the largest websites on the internet and is gaining more and more popularity in the webmaster community. This tutorials shows how to build a nginx .deb package for Ubuntu 15.04 from source that has Google pagespeed module compiled in. - - -Pagespeed is a web server module developed by Google to speed up a website response times, optimize html and reduce the page load time. ngx_pagespeed features include : - -- Image optimization: stripping meta-data, dynamic resizing, recompression. -- CSS & JavaScript minification, concatenation, inlining, and outlining. -- Small resource inlining. -- Deferring image and JavaScript loading. -- HTML rewriting. -- Cache lifetime extension. - -see more [https://developers.google.com/speed/pagespeed/module/][1]. - -### Prerequisites ### - -Ubuntu Server 15.04 64 bit -root privileges - -What we will do in this tutorial : - -- Install the prerequisite packages. -- Installing nginx with ngx_pagespeed. -- Testing. - -#### Install the prerequisite packages #### - -sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev - -#### Installing nginx with ngx_pagespeed #### - -**Step 1 - Adding nginx repository** - - vim /etc/apt/sources.list.d/nginx.list - -add the line: - - deb http://nginx.org/packages/ubuntu/ trusty nginx - deb-src http://nginx.org/packages/ubuntu/ trusty nginx - -Update your repository: - - sudo apt-get update - -note : if you get the messege : GPG error [...] NO_PUBKEY [...] bla bla - -please add the the key: - - sudo sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYNUMBER - sudo apt-get update - -**Step 2 - Download nginx 1.8 from ubuntu repository** - - sudo su - cd ~ - mkdir -p ~/new/nginx_source/ - cd ~/new/nginx_source/ - apt-get source nginx - apt-get build-dep nginx - -**Step 3 - Download Pagespeed** - - cd ~ - mkdir -p ~/new/ngx_pagespeed/ - cd ~/new/ngx_pagespeed/ - ngx_version=1.9.32.3 - wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${ngx_version}-beta.zip - unzip release-${ngx_version}-beta.zip - - cd ngx_pagespeed-release-1.9.32.3-beta/ - wget https://dl.google.com/dl/page-speed/psol/${ngx_version}.tar.gz - tar -xzf 1.9.32.3.tar.gz - -**Step 4 - Configure nginx to build with Pagespeed** - - cd ~/new/nginx_source/nginx-1.8.0/debin/ - vim rules - -add the module under CFLAGS `.configure` : - - --add-module=../../ngx_pagespeed/ngx_pagespeed-release-1.9.32.3-beta \ - -![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/1.png) - -![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/2.png) - -**Step 5 - Build nginx package and Install** - - cd ~/new/nginx_source/nginx-1.8.0/ - dpkg-buildpackage -b - -The dpkg-buildpackage command will build the nginx.deb under ~/new/ngix_source/ Once package building is complete, please look in the directory: - - cd ~/new/ngix_source/ - ls - -![nginx builded with pagespeed](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/3.png) - -And then install nginx. - - dpkg -i nginx_1.8.0-1~trusty_amd64.deb - -![Install nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/4.png) - -#### Testing #### - -Run nginx -V to see the ngx_pagespeed was builted with nginx. - - nginx -V - -![nginx -V](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/5.png) - -### Conclusion ### - -The nginx web server there is a stable and fast open source http server that supports a variety of modules for optimization. One of these modules is the 'PageSpeed module' which is developed by google. Unlike apache, nginx modules are not dynamically loadable, so you have to select the desired modules before you build the nginx package. - --------------------------------------------------------------------------------- - -via: https://www.howtoforge.com/tutorial/how-to-install-nginx-and-google-pagespeed-on-ubuntu-15-04/#step-build-nginx-package-and-install - -作者:Muhammad Arul -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[1]:https://developers.google.com/speed/pagespeed/module/ diff --git a/translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md b/translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md new file mode 100644 index 0000000000..91d16acb00 --- /dev/null +++ b/translated/tech/20150610 How to Install nginx and google pagespeed on Ubuntu 15.04 Vivid Vervet.md @@ -0,0 +1,129 @@ +如何在Ubuntu 15.04(Vivid Vervet)中安装nginx和google pagespeed +================================================================================ +Nginx (engine-x)是一个开源高性能http、反向代理和IMAP/POP3代理服务器。nginx杰出的功能有:稳定、丰富的功能集、简单的配置和低资源消耗。nginx被用于一些高性能网站并在站长之间变得越来越流行。本教程会从源码构建一个带有google paespeed模块用于Ubuntu 15.04中的.deb包。 + + +pagespeed是一个由google开发的web服务器模块来加速网站响应时间、优化html和减少页面加载时间。ngx_pagespeed的功能如下: + +- 图像优化:去除meta数据、动态剪裁、重压缩。 +- CSS与JavaScript 放大、串联、内联、外联。 +- 小资源内联 +- 延迟图像与JavaScript加载 +- HTML重写。 +- 缓存生命期插件 + +更多请见 [https://developers.google.com/speed/pagespeed/module/][1]. + +### 预备要求 ### + +Ubuntu Server 15.04 64位 +root 权限 + +本篇我们将要: + +- 安装必备包 +- 安装带ngx_pagespeed的nginx +- 测试 + +#### 安装必备包 #### + +sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev + +#### 安装带ngx_pagespeed的nginx #### + +**第一步 - 添加nginx仓库** + + vim /etc/apt/sources.list.d/nginx.list + +加入下面的行: + + deb http://nginx.org/packages/ubuntu/ trusty nginx + deb-src http://nginx.org/packages/ubuntu/ trusty nginx + +更新仓库: + + sudo apt-get update + +注意:如果你看到信息:GPG error [...] NO_PUBKEY [...] 等等 + +请添加key: + + sudo sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYNUMBER + sudo apt-get update + +**第二步 - 从仓库下载nginx 1.8** + + sudo su + cd ~ + mkdir -p ~/new/nginx_source/ + cd ~/new/nginx_source/ + apt-get source nginx + apt-get build-dep nginx + +**第三步 - 下载Pagespeed** + + cd ~ + mkdir -p ~/new/ngx_pagespeed/ + cd ~/new/ngx_pagespeed/ + ngx_version=1.9.32.3 + wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${ngx_version}-beta.zip + unzip release-${ngx_version}-beta.zip + + cd ngx_pagespeed-release-1.9.32.3-beta/ + wget https://dl.google.com/dl/page-speed/psol/${ngx_version}.tar.gz + tar -xzf 1.9.32.3.tar.gz + +**第三步 - 配置nginx来编译Pagespeed** + + cd ~/new/nginx_source/nginx-1.8.0/debin/ + vim rules + +在CFLAGS `.configure`下添加模块: + + --add-module=../../ngx_pagespeed/ngx_pagespeed-release-1.9.32.3-beta \ + +![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/1.png) + +![adding pagespeed to nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/2.png) + +**第五步 - 打包nginx包并安装** + + cd ~/new/nginx_source/nginx-1.8.0/ + dpkg-buildpackage -b + +dpkg-buildpackage会编译 ~/new/ngix_source/成nginx.deb。打包完成后,看一下目录: + + cd ~/new/ngix_source/ + ls + +![nginx builded with pagespeed](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/3.png) + +接着安装nginx。 + + dpkg -i nginx_1.8.0-1~trusty_amd64.deb + +![Install nginx](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/4.png) + +#### 测试 #### + +运行nginx -V测试nginx是否已经自带ngx_pagespeed。 + + nginx -V + +![nginx -V](https://www.howtoforge.com/images/nginx_pagespeed_ubuntu_15_04/big/5.png) + +### 总结 ### + +稳定、快速、开源的nginx支持许多不同的优化模块。这其中之一是google开发的‘pagespeed’。不像apache,nginx模块不是动态加载的,因此你必须在编译之前就选择完需要的模块。 + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-install-nginx-and-google-pagespeed-on-ubuntu-15-04/#step-build-nginx-package-and-install + +作者:Muhammad Arul +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://developers.google.com/speed/pagespeed/module/ From e25117711c325dbb281d33b5d9f4366040bfcaea Mon Sep 17 00:00:00 2001 From: Alan You <1058413893@qq.com> Date: Thu, 11 Jun 2015 22:23:44 +0800 Subject: [PATCH 062/153] Create 20150515 How to Install Percona Server on CentOS 7.md translated --- ...w to Install Percona Server on CentOS 7.md | 220 ++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 translated/tech/20150515 How to Install Percona Server on CentOS 7.md diff --git a/translated/tech/20150515 How to Install Percona Server on CentOS 7.md b/translated/tech/20150515 How to Install Percona Server on CentOS 7.md new file mode 100644 index 0000000000..ef283c8b92 --- /dev/null +++ b/translated/tech/20150515 How to Install Percona Server on CentOS 7.md @@ -0,0 +1,220 @@ + +如何在CentOS 7上安装Percona Server + +================================================================================ +在这篇文章中我们将了解关于Percona Server,一个开源简易的MySQL,MariaDB的替代。InnoDB的数据库引擎使得Percona Server非常有吸引力,如果你需要的高性能,高可靠性和高性价比的解决方案,它将是一个很好的选择。 + +在下文中将介绍在CentOS 7上Percona的服务器的安装,以及备份当前数据,配置的步骤和如何恢复备份。 + + +###目录### + + +1.什么是Percona,为什么使用它 +2.备份你的数据库 +3.删除之前的SQL服务器 +4.使用二进制包安装Percona +5.配置Percona +6.保护你的数据 +7.恢复你的备份 + + +### 1.什么是Percona,为什么使用它 ### + + +Percona是一个开源简易的MySQL,MariaDB数据库的替代,它是MYSQL的一个分支,相当多的改进和独特的功能使得它比MYSQL更可靠,性能更强,速度更快,它与MYSQL完全兼容,你甚至可以在Oracle的MYSQL与Percona之间使用复制命令。 + +#### 在Percona中独具特色的功能 #### + + +-分段自适应哈希搜索 +-快速校验算法 +-缓冲池预加载 +-支持FlashCache + +#### MySQL企业版和Percona的特定功能 #### + +-从不同的服务器导入表 +-PAM认证 +-审计日志 +-线程池 + + +现在,你肯定很兴奋地看到这些好的东西整理在一起,我们将告诉你如何安装和做些的Percona Server的基本配置。 + +### 2. 备份你的数据库 ### + + +接下来,在命令行下使用SQL命令创建一个mydatabases.sql文件来重建/恢复salesdb和employeedb数据库,重命名数据库以便反映你的设置,如果没有安装MYSQL跳过此步 + + mysqldump -u root -p --databases employeedb salesdb > mydatabases.sql + +复制当前的配置文件,如果你没有安装MYSQL也可跳过 + + + cp my.cnf my.cnf.bkp + +### 3.删除之前的SQL服务器 ### + + +停止MYSQL/MariaDB如果它们还在运行 + + + systemctl stop mysql.service + +卸载MariaDB和MYSQL + + + yum remove MariaDB-server MariaDB-client MariaDB-shared mysql mysql-server + +移动重命名在/var/lib/mysql当中的MariaDB文件,这比仅仅只是移除更为安全快速,这就像2级即时备份。:) + + + mv /var/lib/mysql /var/lib/mysql_mariadb + +### 4.使用二进制包安装Percona ### + + +你可以在众多Percona安装方法中选择,在CentOS中使用Yum或者RPM包安装通常是更好的主意,所以这些是本文介绍的方式,下载源文件编译后安装在本文中并没有介绍。 + + +从Yum仓库中安装: + + +首先,你需要设置的Percona的Yum库: + + + yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm + +接下来安装Percona: + + + yum install Percona-Server-client-56 Percona-Server-server-56 + +上面的命令安装Percona的服务器和客户端,共享库,可能需要Perl和Perl模块,以及其他依赖的需要。如DBI::MySQL的,如果这些尚未安装, + +使用RPM包安装: + + +我们可以使用wget命令下载所有的rpm包: + + + wget -r -l 1 -nd -A rpm -R "*devel*,*debuginfo*" \ http://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-5.5.42-37.1/binary/redhat/7/x86_64/ + +使用rpm工具,一次性安装所有的rpm包: + + + rpm -ivh Percona-Server-server-55-5.5.42-rel37.1.el7.x86_64.rpm \ Percona-Server-client-55-5.5.42-rel37.1.el7.x86_64.rpm \ Percona-Server-shared-55-5.5.42-rel37.1.el7.x86_64.rpm + +注意在上面命令语句中最后的反斜杠'\',如果您安装单独的软件包,记住要解决依赖关系,在安装客户端之前要先安装共享包,在安装服务器之前请先安装客户端。 + +### 5.配置Percona服务器 ### + + + +#### 恢复之前的配置 #### + + +当我们从MariaDB迁移过来时,你可以将之前的my.cnf的备份文件恢复回来。 + + + cp /etc/my.cnf.bkp /etc/my.cnf + +#### 创建一个新的my.cnf文件 #### + + +如果你需要一个适合你需求的新的配置文件或者你并没有备份配置文件,你可以使用以下方法,通过简单的几步生成新的配置文件。 + +下面是Percona-server软件包自带的my.cnf文件 + + + # Percona Server template configuration + + [mysqld] + # + # Remove leading # and set to the amount of RAM for the most important data + # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. + # innodb_buffer_pool_size = 128M + # + # Remove leading # to turn on a very important data integrity option: logging + # changes to the binary log between backups. + # log_bin + # + # Remove leading # to set options mainly useful for reporting servers. + # The server defaults are faster for transactions and fast SELECTs. + # Adjust sizes as needed, experiment to find the optimal values. + # join_buffer_size = 128M + # sort_buffer_size = 2M + # read_rnd_buffer_size = 2M + datadir=/var/lib/mysql + socket=/var/lib/mysql/mysql.sock + + # Disabling symbolic-links is recommended to prevent assorted security risks + symbolic-links=0 + + [mysqld_safe] + log-error=/var/log/mysqld.log + pid-file=/var/run/mysqld/mysqld.pid + +根据你的需要配置好my.cnf后,就可以启动该服务了: + + + systemctl restart mysql.service + +如果一切顺利的话,它已经准备好执行SQL命令了,你可以用以下命令检查它是否已经正常启动: + + + mysql -u root -p -e 'SHOW VARIABLES LIKE "version_comment"' + +如果你不能够正常启动它,你可以在**/var/log/mysql/mysqld.log**中查找原因,该文件可在my.cnf的[mysql_safe]的log-error中设置。 + + tail /var/log/mysql/mysqld.log + +你也可以在/var/lib/mysql/文件夹下查找格式为[hostname].err的文件,就像下面这个例子样: + + + tail /var/lib/mysql/centos7.err + +如果还是没找出原因,你可以试试strace: + + + yum install strace && systemctl stop mysql.service && strace -f -f mysqld_safe +上面的命令挺长的,输出的结果也相对简单,但绝大多数时候你都能找到无法启动的原因。 + +### 6.保护你的数据 ### + +好了,你的关系数据库管理系统已经准备好接收SQL查询,但是把你宝贵的数据放在没有最起码安全保护的服务器上并不可取,为了更为安全最好使用mysql_secure_instalation,这个工具可以帮助删除未使用的默认功能,还设置root的密码,并限制使用此用户进行访问。 +只需要在shell中执行,并参照屏幕上的说明。 + + mysql_secure_install + +### 7.还原备份 ### + +如果您参照之前的设置,现在你可以恢复数据库,只需再用mysqldump一次。 + + + mysqldump -u root -p < mydatabases.sql +恭喜你,你刚刚已经在你的CentOS上成功安装了Percona,你的服务器已经可以正式投入使用;你可以像使用MYSQL一样使用它,你的服务器与他完全兼容。 + +### 总结 ### + +为了获得更强的性能你需要对配置文件做大量的修改,但这里也有一些简单的选项来提高机器的性能。当使用InnoDB引擎时,将innodb_file_per_table设置为on,它将在一个文件中为每个表创建索引表,这意味着每个表都有它自己的索引文件,它使系统更强大和更容易维修。 + +可以修改innodb_buffer_pool_size选项,InnoDB应该有足够的缓存池来应对你的数据集,大小应该为当前可用内存的70%到80%。 + +过将innodb-flush-method设置为O_DIRECT,关闭写入高速缓存,如果你使用了RAID,这可以提升性能因为在底层已经完成了缓存操作。 + +如果你的数据并不是十分关键并且并不需要对数据库事务正确执行的四个基本要素完全兼容,可以将innodb_flush_log_at_trx_commit设置为2,这也能提升系统的性能。 + + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/percona-server-centos-7/ + +作者:[Carlos Alberto][a] +译者:[FatJoe123](https://github.com/FatJoe123) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/carlosal/ From 2eb16fd656fcc8ece9033fe6b6d5bcfa43a43319 Mon Sep 17 00:00:00 2001 From: Alan You <1058413893@qq.com> Date: Thu, 11 Jun 2015 22:23:53 +0800 Subject: [PATCH 063/153] Delete 20150515 How to Install Percona Server on CentOS 7.md --- ...w to Install Percona Server on CentOS 7.md | 227 ------------------ 1 file changed, 227 deletions(-) delete mode 100644 sources/tech/20150515 How to Install Percona Server on CentOS 7.md diff --git a/sources/tech/20150515 How to Install Percona Server on CentOS 7.md b/sources/tech/20150515 How to Install Percona Server on CentOS 7.md deleted file mode 100644 index 1ac8d71901..0000000000 --- a/sources/tech/20150515 How to Install Percona Server on CentOS 7.md +++ /dev/null @@ -1,227 +0,0 @@ -translating by FatJoe123 -如何在CentOS 7上安装Percona Server -How to Install Percona Server on CentOS 7 -================================================================================ -在这篇文章中我们将了解关于Percona Server,一个开源简易的MySQL,MariaDB的替代。InnoDB的数据库引擎使得Percona Server非常有吸引力,如果你需要的高性能,高可靠性和高性价比的解决方案,它将是一个很好的选择。 -In this article we are going to learn about percona server, an opensource drop-in replacement for MySQL and also for MariaDB. The InnoDB database engine make it very attractive and a good alternative if you need performance, reliability and a cost efficient solution -在接下来的文节中将涵盖在CentOS的7 Percona的服务器的安装,以及备份当前数据,配置的步骤和如何恢复备份。 -In the following sections I am going to cover the installation of the percona server on the CentOS 7, I will also cover the steps needed to make backup of your current data, configuration and how to restore your backup. - -###目录### -### Table of contents ### - -1.什么是Percona,为什么使用它 -2.备份你的数据库 -3.删除之前的SQL服务器 -4.使用二进制包安装Percona -5.配置Percona -6. -7.恢复你的备份 - -1. What is and why use percona -1. Backup your databases -1. Remove previous SQL server -1. Installing Percona binaries -1. Configuring Percona -1. Securing your environment -1. Restore your backup - -### 1.什么是Percona,为什么使用它 -### 1. What is and why use Percona ### - -Percona是一个开源简易的MySQL,MariaDB数据库的替代,它是MYSQL的一个分支,相当多的改进和独特的功能使得它比MYSQL更可靠,性能更强,速度更快,它与MYSQL完全兼容,在Oracle的MYSQL与Percona之间你甚至都可以使用复制命令。 -Percona is an opensource alternative to the MySQL and MariaDB databases, it's a fork of the MySQL with many improvements and unique features that makes it more reliable, powerful and faster than MySQL, and yet is fully compatible with it, you can even use replication between Oracle's MySQL and Percona. -#### 在Percona中独特的功能 #### -#### Features exclusive to Percona #### - --分段自适应哈希搜索 --快速校验算法 --缓冲池预加载 --支持FlashCache -- Partitioned Adaptive Hash Search -- Fast Checksum Algorithm -- Buffer Pool Pre-Load -- Support for FlashCache - -#### MySQL企业版和Percona的特定功能 #### -#### MySQL Enterprise and Percona specific features #### - --从不同的服务器导入表 --PAM认证 --审计日志 --线程池 - -- Import Tables From Different Servers -- PAM authentication -- Audit Log -- Threadpool - -现在,你肯定很兴奋地看到这些好的东西整理在一起,我们将告诉你如何安装和做些的Percona Server的基本配置。 -Now that you are pretty excited to see all these good things together, we are going show you how to install and do basic configuration of Percona Server. - -### 2. 备份你的数据库 ### -### 2. Backup your databases ### - -接下来,在命令行下使用SQL命令创建一个mydatabases.sql文件来重建/恢复salesdb和employeedb数据库,重命名数据库以便反映你的设置,如果没有安装MYSQL跳过此步 -The following, command creates a mydatabases.sql file with the SQL commands to recreate/restore salesdb and employeedb databases, replace the databases names to reflect your setup, skip if this is a brand new setup - - mysqldump -u root -p --databases employeedb salesdb > mydatabases.sql - -复制当前的配置文件,如果你没有安装MYSQL也可跳过 -Copy the current configuration file, you can also skip this in fresh setups - - cp my.cnf my.cnf.bkp - -### 3.删除之前的SQL服务器 ### -### 3. Remove your previous SQL Server ### - -停止MYSQL/MariaDB如果它们还在运行 -Stop the MySQL/MariaDB if it's running. - - systemctl stop mysql.service - -卸载MariaDB和MYSQL -Uninstall MariaDB and MySQL - - yum remove MariaDB-server MariaDB-client MariaDB-shared mysql mysql-server - -移动重命名在/var/lib/mysql当中的MariaDB文件,这比仅仅只是移除更为安全快速,这就像2级即时备份。:) -Move / Rename the MariaDB files in **/var/lib/mysql**, it's a safer and faster than just removing, it's like a 2nd level instant backup. :) - - mv /var/lib/mysql /var/lib/mysql_mariadb - -### 4.使用二进制包安装Percona ### -### 4. Installing Percona binaries ### - -你可以在众多Percona安装方法中选择,在CentOS中使用Yum或者RPM包安装通常是更好的主意,所以这些是本文介绍的方式,下载源文件编译后安装在本文中并没有介绍。 - -You can choose from a number of options on how to install Percona, in a CentOS system it's generally a better idea to use yum or RPM, so these are the way that are covered by this article, compiling and install from sources are not covered by this article. - -从Yum仓库中安装: -Installing from Yum repository: - -首先,你需要用这个设置的Percona的Yum库: -First you need to set the Percona's Yum repository with this: - - yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm - -接下来安装Percona: -And then install Percona with: - - yum install Percona-Server-client-56 Percona-Server-server-56 - -上面的命令安装Percona的服务器和客户端,共享库,可能需要Perl和Perl模块,如DBI::MySQL的,如果尚未安装,以及其他依赖的需要。 -The above command installs Percona server and clients, shared libraries, possibly Perl and perl modules such as DBI::MySQL, if that are not already installed, and also other dependencies as needed. - -Installing from RPM package: - -We can download all rpm packages with the help of wget: - - wget -r -l 1 -nd -A rpm -R "*devel*,*debuginfo*" \ http://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-5.5.42-37.1/binary/redhat/7/x86_64/ - -And with rpm utility, you install all the packages once: - - rpm -ivh Percona-Server-server-55-5.5.42-rel37.1.el7.x86_64.rpm \ Percona-Server-client-55-5.5.42-rel37.1.el7.x86_64.rpm \ Percona-Server-shared-55-5.5.42-rel37.1.el7.x86_64.rpm - -Note the backslash '\' on the end of the sentences on the above commands, if you install individual packages, remember that to met dependencies, the shared package must be installed before client and client before server. - -### 5. Configuring Percona Server ### - -#### Restoring previous configuration #### - -As we are moving from MariaDB, you can just restore the backup of my.cnf file that you made in earlier steps. - - cp /etc/my.cnf.bkp /etc/my.cnf - -#### Creating a new my.cnf #### - -If you need a new configuration file that fit your needs or if you don't have made a copy of my.cnf, you can use this wizard, it will generate for you, through simple steps. - -Here is a sample my.cnf file that comes with Percona-Server package - - # Percona Server template configuration - - [mysqld] - # - # Remove leading # and set to the amount of RAM for the most important data - # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. - # innodb_buffer_pool_size = 128M - # - # Remove leading # to turn on a very important data integrity option: logging - # changes to the binary log between backups. - # log_bin - # - # Remove leading # to set options mainly useful for reporting servers. - # The server defaults are faster for transactions and fast SELECTs. - # Adjust sizes as needed, experiment to find the optimal values. - # join_buffer_size = 128M - # sort_buffer_size = 2M - # read_rnd_buffer_size = 2M - datadir=/var/lib/mysql - socket=/var/lib/mysql/mysql.sock - - # Disabling symbolic-links is recommended to prevent assorted security risks - symbolic-links=0 - - [mysqld_safe] - log-error=/var/log/mysqld.log - pid-file=/var/run/mysqld/mysqld.pid - -After making your my.cnf file fit your needs, it's time to start the service: - - systemctl restart mysql.service - -If everything goes fine, your server is now up and ready to ready to receive SQL commands, you can try the following command to check: - - mysql -u root -p -e 'SHOW VARIABLES LIKE "version_comment"' - -If you can't start the service, you can look for a reason in **/var/log/mysql/mysqld.log** this file is set by the **log-error** option in my.cnf's **[mysqld_safe]** session. - - tail /var/log/mysql/mysqld.log - -You can also take a look in a file inside **/var/lib/mysql/** with name in the form of **[hostname].err** as the following example: - - tail /var/lib/mysql/centos7.err - -If this also fail in show what is wrong, you can also try strace: - - yum install strace && systemctl stop mysql.service && strace -f -f mysqld_safe - -The above command is extremely verbous and it's output is quite low level but can show you the reason you can't start service in most times. - -### 6. Securing your environment ### - -Ok, you now have your RDBMS ready to receive SQL queries, but it's not a good idea to put your precious data on a server without minimum security, it's better to make it safer with mysql_secure_instalation, this utility helps in removing unused default features, also set the root main password and make access restrictions for using this user. -Just invoke it by the shell and follow instructions on the screen. - - mysql_secure_install - -### 7. Restore your backup ### - -If you are coming from a previous setup, now you can restore your databases, just use mysqldump once again. - - mysqldump -u root -p < mydatabases.sql - -Congratulations, you just installed Percona on your CentOS Linux, your server is now fully ready for use; You can now use your service as it was MySQL, and your services are fully compatible with it. - -### Conclusion ### - -There is a lot of things to configure in order to achieve better performance, but here is some straightforward options to improve your setup. When using innodb engine it's also a good idea to set the **innodb_file_per_table** option **on**, it gonna distribute table indexes in a file per table basis, it means that each table have it's own index file, it makes the overall system, more robust and easier to repair. - -Other option to have in mind is the **innodb_buffer_pool_size** option, InnoDB should have large enough to your datasets, and some value **between 70% and 80%** of the total available memory should be reasonable. - -By setting the **innodb-flush-method** to **O_DIRECT** you disable write cache, if you have **RAID**, this should be set to improved performance as this cache is already done in a lower level. - -If your data is not that critical and you don't need fully **ACID** compliant transactions, you can adjust to 2 the option **innodb_flush_log_at_trx_commit**, this will also lead to improved performance. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-how-to/percona-server-centos-7/ - -作者:[Carlos Alberto][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/carlosal/ From d0aff8d13f681c729c683bdd4ab3589efa16f480 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 11 Jun 2015 22:42:51 +0800 Subject: [PATCH 064/153] PUB:20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops @geekpi --- ...a Gorgeous GTK Theme for Linux Desktops.md | 57 +++++++++++++++++++ ...a Gorgeous GTK Theme for Linux Desktops.md | 55 ------------------ 2 files changed, 57 insertions(+), 55 deletions(-) create mode 100644 published/20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops.md delete mode 100644 translated/share/20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops.md diff --git a/published/20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops.md b/published/20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops.md new file mode 100644 index 0000000000..e8fd8c6dbd --- /dev/null +++ b/published/20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops.md @@ -0,0 +1,57 @@ +一款很棒的GTK桌面主题:Arc +================================================================================ +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/06/arc-gtk-theme.jpg) + +距离本站上次推荐的GTK主题已经过了很久了。但是看到上图中的Arc主题后,就值得打破冷场了。我们不能不推荐它! + +### Arc GTK主题 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/06/see-through-theme.png) + +*透明,并不符合每个人的口味* + +Arc是一个扁平化主题并有微妙的配色方案,窗口的选中区域是透明的,如GTK的顶栏和Nautilus的侧边栏。 + +它的效果不像我们之前介绍的主题那样将程序渲染的像那么混乱。有点像 OSX Yosemite,效果用的不多但是很好。 + +与之伴随的图标集(称为Vertex)同样工作的很好。 + +**是的它支持Unity** + +Arc主题支持基于GTK3和GTK2桌面环境,包含Gnome Shell(当然了)和标准的Ubuntu Unity。 + +它可以很好地游刃于轻量级的Budgie和elementary的Pantheon桌面之间,并且与Cinnamon配合也不错。 + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/06/Screen-Shot-2015-06-02-at-18.07.15.png) + +*Arc中的开关、滑块和小挂件* + +它并不容易下载与安装- *understatement klaxon* - 因为它还在密集开发中。 + +安装包需要GTK 3.14及以上,这意味着Ubuntu 14.04 LTS和14.10的用户无法使用了。 + +那些使用Ubuntu 15.04的用户可以使用这个主题。你可以添加ppa或者双击.deb包来安装。 + +如果你喜欢它,你需要卷起你的袖子并查看github上的编译指导。 + +- [Github中Arc安装指导][1] + +更新6/7:现在可以使用软件库来安装它(由 openSUSE 用户 Horst1380 创建,也可用于 Ubuntu 用户),也可以下载预打包的 .deb 文件。 + +- [Horst31890 的 Arc 主题库][2] +- [下载 Arc 主题 .deb][3] + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/06/arc-gtk-theme + +作者:[Joey-Elijah Sneddon][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:https://github.com/horst3180/Arc-theme +[2]:http://software.opensuse.org/download.html?project=home%3AHorst3180&package=arc-theme +[3]:http://download.opensuse.org/repositories/home:/Horst3180/xUbuntu_15.04/all/arc-theme_1433786431.697b2c3_all.deb \ No newline at end of file diff --git a/translated/share/20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops.md b/translated/share/20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops.md deleted file mode 100644 index 14dd88ef70..0000000000 --- a/translated/share/20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops.md +++ /dev/null @@ -1,55 +0,0 @@ -Arc是一个很棒的Linux桌面的GTK主题 -================================================================================ -![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/06/arc-gtk-theme.jpg) - -距离本站上次推荐的GTK主题已经过了很久了。 - -但是看到上面的Arc后,需要纠正这点了。 - -我们不能不提到它。 - -### Arc GTK主题 ### - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/06/see-through-theme.png) - -Transparency. Not to everyones’ taste. -透明并不符合每个人的口味 - -Arc是一个扁平化主题并有微妙的配色并部分选中的窗口透明,就像GTK的顶拦和Nautilus的侧边栏。 - - -它的效果不像我们之前的主题那样将程序渲染的像躲猫猫那样混乱。像OSX Yosemite,效果用的不变多但是很好。 - -随之的图标集(称为Vertex)同样可用。 - -**是的它支持Unity** - -Arc主题支持基于GTK3和GTK2桌面环境,包含Gnome Shell(当然)和标准的Ubuntu Unity。 - -它也可以很好地与轻量级的Budgie和elementary的Pantheon桌面以及也可以工作在Cinnamon上。 - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/06/Screen-Shot-2015-06-02-at-18.07.15.png) - -Arc中的开关、滑块和小挂件。 - -它并不容易下载与安装- *understatement klaxon* - 因为它还在密集开发中。 - - -安装包需要GTK 3.14或者更新,这意味着Ubuntu 14.04 LTS和14.10的用户无法使用了。 - -那些使用Ubuntu 15.04的用户可以使用这个主题。你还不能添加ppa或者双击.deb包。如果你喜欢你看见的你需要卷起你的袖子并查看github上的编译指导。 - -- [Github中Arc安装指导][1] - --------------------------------------------------------------------------------- - -via: http://www.omgubuntu.co.uk/2015/06/arc-gtk-theme - -作者:[Joey-Elijah Sneddon][a] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://plus.google.com/117485690627814051450/?rel=author -[1]:https://github.com/horst3180/Arc-theme From aa6668080ff88d363b633c897a10a7511e417623 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 11 Jun 2015 23:30:14 +0800 Subject: [PATCH 065/153] PUB:20150209 How to access Feedly RSS feed from the command line on Linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @chenzhijun 翻译的不错,有些错别字下回需要注意。另外,注意保持原文的 markdown 段落等格式。 明天下午就可以看到了: https://linux.cn/article-5615-1.html --- ...RSS feed from the command line on Linux.md | 111 ++++++++++++++++ ...RSS feed from the command line on Linux.md | 123 ------------------ 2 files changed, 111 insertions(+), 123 deletions(-) create mode 100644 published/20150209 How to access Feedly RSS feed from the command line on Linux.md delete mode 100644 translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md diff --git a/published/20150209 How to access Feedly RSS feed from the command line on Linux.md b/published/20150209 How to access Feedly RSS feed from the command line on Linux.md new file mode 100644 index 0000000000..6eac136d1a --- /dev/null +++ b/published/20150209 How to access Feedly RSS feed from the command line on Linux.md @@ -0,0 +1,111 @@ +在 Linux 上如何用命令行获取 Freely RSS 源 +================================================================================ + +也许你并不知道 Feedly,它是世界上最流行的在线新闻聚合服务之一;它提供了平滑而一致的新闻阅读体验,你可以使用电脑的浏览器扩展,Android 和 iOS 设备上的移动应用程序等来体验Feedly。Feedly 在2013年Google Reader 停用后,迅速的获得了一大批Google Reader的用户。我就是他们之中的一位。从这以后,Feedly就一直是我的默认RSS(简易信息聚合)阅读器。 + +除了使用我非常喜欢的Feedly浏览器扩展和手机上的Feedly程序,这里还有一种途径来获取Feedly:Linux命令行。没错,你可以用命令行来获取Feedly上的新闻概要。听起来非常傻?但是对于那些在服务器上工作的系统管理员来说,这是非常有用的。 + +点击进入[Feednix][2],这个用c++编写的开源软件是Feedly的非官方命令行客户端。它允许你在一个基于ncurses的终端界面(例如:bash)下浏览Feedly的新闻。默认模式下,Feednix 关联了一个叫做 w3m 的基于控制台的浏览器,允许你在命令行终端的环境下阅读文章。当然你也可以选择使用你喜欢的网页浏览器。 + +在这个教程中,我准备示范一下怎样在命令行下安装和配置Feednix 来获取Feedly。 + +### 在Linux下安装Feednix ### + +你可以通过以下的步骤从源代码中构建Feednix。同时,在其官方的github仓库的Ubuntu-stable(Ubuntu稳定版本)的分支上有最新的Feednix源代码。现在让我们开始吧: + +作为必要组件,你需要安装一组开发包,和w3m浏览器(文字式页面浏览器)。 + +#### 在Debian、Ubuntu 和Linux Mint 操作 #### + + $ sudo apt-get install git automake g++ make libncursesw5-dev libjsoncpp-dev libcurl4-gnutls-dev w3m + $ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git + $ cd Feednix + $ ./autogen.sh + $ ./configure + $ make + $ sudo make install + + +#### 在Fedora 下操作 #### + + $ sudo yum groupinstall "C Development Tools and Libraries" + $ sudo yum install gcc-c++ git automake make ncurses-devel jsoncpp-devel libcurl-devel w3m + $ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git + $ cd Feednix + $ ./autogen.sh + $ ./configure + $ make + $ sudo make install + +#### Arch Linux #### + +在Arch Linux发行版下,你可以非常容易的从 [AUR][3]安装Feednix。 + +### 配置Feednix ### + +在安装完软件后,用下面的命令启动Feednix + + $ feednix + +如果你是第一次运行Feddnix,它会弹出一个网页浏览器窗口,在这个窗口里,你需要登录来创建一个Feedly的账户ID和相应的开发人员密钥。 + +如果你是在无桌面环境下运行Feednix,先在另外一台电脑上打开一个网页,进入到网站:https://feedly.com/v3/auth/dev 。 + +![](https://farm8.staticflickr.com/7427/15825106524_42883b3e32_b.jpg) + +当你登录后,你对应的Feedly账户ID就生成了。 + +![](https://farm9.staticflickr.com/8565/15827565143_eb93db9c81_b.jpg) + +为了得到一个访问密钥,你需要在浏览器上访问发送你的邮箱中的密钥链接。之后就会在浏览器窗口显示你的用户ID,密钥,和密钥的有效期。请注意密钥的长度是非常长的(超过200个字符),所以密钥显示在一个带有垂直滚动条的文本框内,请确保把整个密钥复制下来。 + +![](https://farm9.staticflickr.com/8605/16446685812_9098df494b_b.jpg) + +像下面这样,把你的用户ID和密钥输入到Feddnix的命令行提示下: + + [Enter User ID] >> XXXXXX + [Enter token] >> YYYYY + +成功授权后,你会在屏幕上见到一个初始化为两个窗格的Feednix界面。左边的标题为“Categories”窗格,显示了一个新闻分类栏;右边“Posts”窗格显示了当前类别的新闻文章。 + +![](https://farm8.staticflickr.com/7412/16421639256_deb8e2d276_c.jpg) + +### 用Feednix读文章 ### + +这里我想简要描叙一下怎样通过Feednix来访问Feedly。 + +#### 在Feednix中导航 #### + +像我之前提过的,Feednix窗口包含了两个窗格。想在两个窗口之间进行切换的话,可以使用"TAB"健。想在一个窗格内的列表中上下移动,可以使用"j"和"k"。这些快捷健明显是受到了Vim编辑器的启发。 + +#### 阅读文章 #### + +想阅读一篇特定的文章,可以在当前的文章上使用"o"健。它会调用w3m浏览器,并且在浏览器里面加载文章。当你读完之后,可以使用"q"健来退出浏览器,并返回到Feednix。如果你的电脑环境允许打开网页浏览器,你可以按"0"健来在你默认的网页浏览器里面加载文章,比如使用Firefox。 + +![](https://farm8.staticflickr.com/7406/16445870201_b98e8da6d9_b.jpg) + +#### 订阅新闻源 #### + +你可以在Feednix界面中来为你的Feedly账户增加任何一种RSS新闻源。要这么做,仅仅只需要按下"a"键,它会在屏幕底部显示一个"[ENTER FEED]:"的提示。在输入完RSS新闻源后,继续输入新闻源的名字和及其首选分类。 + +![](https://farm8.staticflickr.com/7324/16421639296_b52ed3c52e_c.jpg) + +#### 总结 #### + +如你所见, Feednix 是一个非常方便易用的命令行RSS阅读器。如果你是重度依赖命令行的用户,同时也是一个Feedly用户的话,Feednix 是肯定值得去尝试的。我和Feednix的开发者Jarkore交流解决了一些问题。我想说,对于[bug的报告][4]和修复他非常的积极。鼓励大家来试用Feednix,并且给他(Jarkore)一些回馈。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/feedly-rss-feed-command-line-linux.html + +作者:[Dan Nanni][a] +译者:[chenzhijun](https://github.com/chenzhijun) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:https://feedly.com/ +[2]:https://github.com/Jarkore/Feednix +[3]:https://aur.archlinux.org/packages/feednix/ +[4]:https://github.com/Jarkore/Feednix/issues diff --git a/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md b/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md deleted file mode 100644 index 4109ceb947..0000000000 --- a/translated/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md +++ /dev/null @@ -1,123 +0,0 @@ -从Linux命令行获取基于RSS协议的Feedly上信息 -================================================================================ - -也许你并不知道,Feedly --世界上最流行的在线新闻聚合服务之一;它提供了无缝地统一的新闻阅读体验,你可以使用电脑的浏览器扩展,Android 和 iOS 设备上的移动应用程序等来体验Feedly。Feedly 在2013年Google Reader 停用后,迅速的获得了一大批Google Reader的用户。我就是他们之中的一位。从这以后,Feedly就一直是我的默认RSS(简易信息聚合)阅读器 -除了我非常喜欢的Feedly浏览器扩展和手机上的Feedly程序,这里还有一种途径来获取Feedly:Linux command-line (Linux命令行) -对的。你可以用命令行来获取Feedly上的新闻概要。 - -听起来非常傻?但是对于那些在服务器上工作的系统管理员来说,这是非常有用的。 -点击进入[Feednix][2]. 这个用c++编写的开源软件是Feedly的非官方命令行客户端。它允许你浏览Feedly的新闻在一个基于字符的终端界面(例如:bash)。默认模式下,Feednix 连接了一个基于控制台的浏览器,这个浏览器的名字叫w3m,允许你在命令行终端的环境下阅读文章。当然你也可以选择使用你喜欢的网页浏览器。在这个教程中,我准备示范以下怎样在命令行下安装和配置Feednix 来获取获取Feedly。 - -### 在Linux下安装Feednix ### - -你可以通过以下的步骤从源代码中安装Feednix。同时,在github的Ubuntu分区里面Ubuntu-stable(Ubuntu稳定版本)的分支上有最新的Feednix源代码。现在让我们开始吧: -作为必要组件,你需要安装一组开发包,和w3m浏览器(文字式页面浏览器)。 - -#### 在Debian,Ubuntu 和Linux Mint 操作 #### - - $ sudo apt-get install git automake g++ make libncursesw5-dev libjsoncpp-dev libcurl4-gnutls-dev w3m - $ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git - $ cd Feednix - $ ./autogen.sh - $ ./configure - $ make - $ sudo make install - - -#### 在Fedora 下操作 #### - - $ sudo yum groupinstall "C Development Tools and Libraries" - $ sudo yum install gcc-c++ git automake make ncurses-devel jsoncpp-devel libcurl-devel w3m - $ git clone -b Ubuntu-stable https://github.com/Jarkore/Feednix.git - $ cd Feednix - $ ./autogen.sh - $ ./configure - $ make - $ sudo make install - -Arch Linux - -在Arch Linux发行版下, 你可以非常容易的安装Feednix 从 [AUR][3]. - - -### 配置Feednix ### - -在安装完软件后,用下面的命令启动Feednix - - $ feednix - -如果你是第一次运行Feddnix,它会弹出一个网页浏览器窗口,在这个窗口里,你需要登陆来创建一个Feedly的账户ID和相应的开发人员密钥。 - -如果你是在无桌面环境下运行Feednix,先在另外一台电脑上打开一个网页,进入到网站:https://feedly.com/v3/auth/dev. - -![](https://farm8.staticflickr.com/7427/15825106524_42883b3e32_b.jpg) - -一旦你登陆,你对应的Feedly账户ID就生成了。 - -![](https://www.flickr.com/photos/xmodulo/15827565143/) - -为了验证密钥,你需要在浏览器上允许验证密钥的链接发送你的邮箱。之后就会在浏览器窗口显示你的用户ID,密钥,和密钥的有效期。 -请注意密钥的长度是非常超过200个字符的。所以密钥显示在一个带有垂直滚动条的文书框内,请确保把整个密钥的长度复制下来。 - -![](https://farm9.staticflickr.com/8605/16446685812_9098df494b_b.jpg) - -向下面这样,把你的用户ID和密钥输入到Feddnix的命令行提示下: - - [Enter User ID] >> XXXXXX - [Enter token] >> YYYYY - -成功授权后,你会在屏幕上见到一个初始化的有两个窗格的Feednix界面 - -左边的标题为“Categories”窗格,显示了一个新闻分类栏;右边“Posts”窗格显示了当前类别的新闻文章 - -![](https://farm8.staticflickr.com/7412/16421639256_deb8e2d276_c.jpg) - - -### 用Feednix读文章 ### - -这里我想简要描叙一下怎样通过Feednix来访问Feedly。 - - -#### Feednix界面 #### - -向我之前提过的,Feednix窗口包含了两个窗格。想在两个窗口之间进行切换的话,可以使用"TAB"健。在一个窗格内,想上下移动选择可以使用"j"和"k"。 -这些快捷健明显是受到了使用Vim编辑器的人启发。 - -#### 阅读文章 #### - -想阅读一些有特色的文章,可以在选定的文章上使用"o"健。它会调用w2m浏览器,并且在浏览器里面加载文章。 -一旦你读完之后,可以使用"q"健来推出当前W2m浏览器,并且返回到Feednix. -如果你的电脑环境允许打开一个网页浏览器,你可以按"0"健来在你默认的网页浏览器里面家在文章,比如使用Firefox. - - -![](https://farm8.staticflickr.com/7406/16445870201_b98e8da6d9_b.jpg) - - -#### 订阅新闻 #### - -你可以通过Feednix来为你的Feedly账户增加任何一种RSS新闻。 -要这么做,仅仅只需要按下"a"键,它会显示一个"[ENTER FEED]:"的提示在屏幕上,然后按下"ENTER" -在选择完RSS新闻后,继续为它编写分组信息和分类。 - -![](https://farm8.staticflickr.com/7324/16421639296_b52ed3c52e_c.jpg) - -#### 总结 #### - - -现在你知道了吧, Feednix 是一个非常友好的并且容易使用的命令行RSS阅读器。如果你是重度依赖命令行的用户或者是一个Feedly用户,Feednix 是肯定值得去尝试的。 -我经常和Feednix的开发者Jarkore交流来解决一些问题。我想说,对于bug的报告和修复他非常的积极。 -鼓励大家来试用Feednix,并且给他(Jarkore)一些回馈。 --------------------------------------------------------------------------------- - -via: http://xmodulo.com/feedly-rss-feed-command-line-linux.html - -作者:[Dan Nanni][a] -译者:[chenzhijun](https://github.com/chenzhijun) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://xmodulo.com/author/nanni -[1]:https://feedly.com/ -[2]:https://github.com/Jarkore/Feednix -[3]:https://aur.archlinux.org/packages/feednix/ From 7f623c6628759dbac4dc7568590306b8bf82d53c Mon Sep 17 00:00:00 2001 From: theo-l Date: Thu, 11 Jun 2015 22:39:24 -0300 Subject: [PATCH 066/153] I translated the documentation of tmux, just take a look --- translated/tech/Tmux_doc_cn.md | 1646 ++++++++++++++++++++++++++++++++ 1 file changed, 1646 insertions(+) create mode 100644 translated/tech/Tmux_doc_cn.md diff --git a/translated/tech/Tmux_doc_cn.md b/translated/tech/Tmux_doc_cn.md new file mode 100644 index 0000000000..5d2ac507c2 --- /dev/null +++ b/translated/tech/Tmux_doc_cn.md @@ -0,0 +1,1646 @@ +- [名称](#名称) +- [用法](#用法) +- [描述](#描述) +- [键绑定](#键绑定) +- [命令](#命令) +- [客户端和会话](#客户端和会话) +- [窗口和面板](#窗口和面板) + - [窗口和面板命令](#窗口和面板命令) +- [键绑定2](#键绑定2) + - [键绑定命令](#键绑定命令) +- [选项](#选项) + - [选项设置](#选项设置) + - [服务器选项](#服务器选项) + - [会话选项](#会话选项) + - [窗口选项](#窗口选项) +- [鼠标支持](#鼠标支持) +- [格式](#格式) +- [名称和标题](#名称和标题) +- [环境](#环境) +- [状态行](#状态行) +- [缓冲区](#缓冲区) +- [杂项](#杂项) +- [TERMINFO EXTENSIONS](#TERMINFO EXTENSIONS) +- [控制模式](#控制模式) +- [文件](#文件) +- [样例](#样例) + + +##名称 +tmux — terminal multiplexer(终端复用器) + +##用法: + + tmux [-2lCuv] [-c shell-command] [-f file] [-L socket-name] [-S socket-path] [command [flags]] + +##描述 + +tmux是一个终端复用器:它可以在单个屏幕中创建、访问以及控制多个终端。 +tmux也可以从窗口中脱离附着并且继续在后台运行,以便在之后再回到会话。 +当开启tmux之后,它会创建带有一个单独窗口的会话并且在屏幕中进行显示。 +在屏幕底部的状态行显示当前会话的信息并且用来进入交互式命令。 +一个会话是一个在tmux管理下的伪终端集合,每个会话具有一个或多个窗口与其链接。 +一个窗口占用了整个屏幕,并且可以被分割成长方形的面板,每个面板分别为一个伪终端。 +多个tmux实例可能连接到同一个会话,并且任何的窗口可能在一个会话中表示。 +当所有的会话被终止之后,tmux就会退出。 + +每个会话都是持久的并且可能在意外失联或故意脱离附着之后生存下来,tmux可以使用下面的命令来恢复原来的会话: + + $ tmux attach + +在tmux中,一个会话由一个客户端在整个屏幕中显示,并且所有的会话都是由一个单独的服务器进行管理的。 +这个服务器以及每个客户端是通过一个在/tmp中的socket进行交流的。 + +*选项描述*: + + '-2' + 强制tmux假设终端支持256颜色。 + + '-C' + 以控制模式开启,使用-CC来让echo失效 + + '-c shell-command' + 使用默认的shell来执行shell命令。 + 如果有必要的话,tmux服务器会开启来检索默认的shell选项。 + 这个选项用来当tmux作为一个登录shell时与sh进行兼容的。 + + '-f file' + 指定一个可选的配置文件,默认情况下,tmux会从/etc/tmux.conf中加载系统配置文件-如果这个文件存在的话。 + 然后会尝试查找用户的配置文件 ~/.tmux.conf。 + 配置文件是一个tmux命令集合,其中的命令在服务器第一次启动时按顺序执行的。 + tmux会在服务器进程启动之后加载一次配置文件。 + "source-file"命令可以用来在稍后加载一个文件。 + tmux在第一次会话创建时会显示配置文件中的命令出现的任何错误,但是会继续处理配置文件的余下部分。 + + '-L socket-name' + tmurx 将服务器*socsket*存储在*TMUX_TMPDIR*目录下,如果这个变量没有设置的话就会使用*TMPDIR*替换, + 或者当两者都不存在时,就会存储在 /tmp 目录下。默认的*socket*的名称为*default*。 + 这个选项允许指定一个不同的socket名称,允许多个独立的tmux服务器运行。 + 与-S不同的是,不需要使用全路经:所有的sockets文件会创建在一个相同的目录下。 + 如果socket被意外地删除了,那么SIGUSR1信号会发送给tmux服务器进程来重新创建socket文件(注意如果当之前描述的任何 + 父目录不存在的话会出错)。 + + '-l' + 当作一个登录shell使用,当前这个标记没有什么效果是当tmux被用来作为登录shell时与其他shell进行兼容的。 + + '-S socket-path' + 为服务器的socket指定一个可选的全路经,当这个选项指定之后,那么默认的目录不会被使用,并且-L选项会被忽略。 + + '-u' + tmux尝试通过第一个LC_ALL,LC_CTYPE和LANG环境变量来猜测终端是否可能支持UTF-8,这可能不会总是正确。 + -u 选项显式地告知tmux UTF-8是支持的。 + 如果服务器通过客户端传递-u或者检测到UTF-8进行启动的,那么utf8和status-utf8选项会分别在全局窗口和会话选项中生效。 + + '-v' + 请求详细登录,这个选项可能由于不断增长的修饰词被多次指定。登录消息会被存储在当前目录下的tmux-clientPID.log + 和tmux-serverPID.log文件中。其中的PID代表服务器或客户端进程ID。 + + 'command [flags]' + 这个用来指定命令集合中的一个来控制tmux,如果没有指定任何命令那么假设一个新建会话命令。 + +##键绑定 + +tmux可以通过一个前缀键与跟随的命令键进行结合的方式从一个附着的客户端进行控制,前缀键默认为'C-b' + +默认的命令键绑定为: + + 结合键 |含义 +-------------------------------------|--------------------- + C-b |给应用发送一个前缀键 C-b + C-o |将当前窗口中的面板向前切换。 + C-z |将tmux客户端挂起 + ! |将当前面板在窗口中突出显示 + " |将当前的面板分割为上下两个面板 + # |列出所有的粘贴缓存 + $ |重命名当前会话 + % |将当前面板分割为左右两个面板 + & |终止当前窗口 + ' |显示一个窗口索引来进行选择 + ( |将当前附着的客户端转换到前一个会话 + ) |将附着的客户端转换到下一个会话 + , |重命名当前窗口 + - |删除最近的复制文本缓存 + . |提示一个索引来移动当前窗口 + 0-9 |选择0-9个窗口 + : |输入tmux命令提示 + ; |移动到前面的活动面板 + = |从一个列表中选择一个缓存来交互式粘贴。 + ? |列出所有的键绑定 + D |选择一个客户端来脱离其附着 + L |将附着的客户端切换到最后一个会话中 + [ |输入赋值模式来复制文本或查看历史 + ] |粘贴最近复制的文本缓存 + c |创建一个新的窗口 + d |脱离当前的客户端 + f |提示在打开的窗口中搜索文本 + i |显示关于当前窗口的一些信息 + l |移动到之前选择的窗口 + n |移动到下一个窗口 + o |移动到当前窗口的下一个面板 + p |移动到之前的窗口 + q |简单地显示面板索引 + r |强制重绘附着的客户端 + s |为当前附着的客户端交互式地选择一个新的会话 + t |显示时间 + w |交互式地选择当前的窗口 + x |终止当前的面板 + z |切换当前面板的放大状态 + { |使用之前的面板来替换当前的面板 + } |使用下一个面板来替换当前的面板 + ~ |显示tmux之前的消息如果存在的话。 + PageUp |进入复制模式并且将页面向上滚动一页。 + Up,Down,Left,Right |转换到当前面板的上, 下,左,右 + M-1到M-5(M=Alt) |将面板按照预设的1-5个布局进行安排:偶数水平,偶数垂直,主水平,主垂直或平铺 + Space |将当前窗口按照下一个预设布局进行安排 + M-n |移动到下一个窗口并且带有一个响铃或者活动标记 + M-o |将当前窗口中的面板从前向后反转 + M-p |移动到前一个窗口并且带有响铃或者活动标记 + C-Up, C-Down C-Left, C-Right |以一个单格的步调调整当前面板的大小 + M-Up, M-Down M-Left, M-Right |以五个单格的步调调整当前面板的大小 + +键绑定可以通过bind-key和unbind-key命令来改变。 + + +##命令 + +这部分包含了tmux支持的命令列表,大部分的命令接收可选的-t参数与一个目标客户端,目标会话,目标窗口或者目标面板。 +它们指定了受命令影响的客户端,会话,窗口或面板 + +目标客户端应该为客户端链接的pty文件的名称,例如对于附着在/dev/ttyp1的客户端可能为 /dev/ttyp1或 +ttyp1。如果没有指定客户端,tmux会尝试当前使用的客户端; +如果失败的话,就会报告一个错误。客户端可以通过list-clients命令列出。 + +目标会话会按照以下顺序进行尝试: + + 1. 一个以$作为前缀的会话ID。 + 2. 一个精确的会话名称(会在list-sessions命令中列出)。 + 3. 会话名称的开始部分,例如“mysess”会匹配一个名为"mysession"的会话。 + 4. 一个与会话名称匹配的fnmatch 模式 + +如果找到了一个单独的会话,就会将其作为目标会话;如果匹配多个会话就会产生错误。 +如果忽略一个会话的话,那么就会使用当前的会话-如果可用的话;如果当前会话不可用,那么最近使用的会话就会被选择。 + +目标窗口通过session:window的格式来指定一个窗口。 会话按照target-session的规则,而窗口会按照以下的顺序来查找: + + 1. 一个下面列表中的特殊标记。 + 2. 一个窗口索引,例如'mysession:1'表示会话'mysession'中的第一个窗口。 + 3. 一个窗口ID,例如@1。 + 4. 一个精确的窗口名称,例如'mysession:mywindow'。 + 5. 一个窗口名称的开始部分,例如'mysession:mywin'。 + 6. 一个于窗口名称相匹配的fnmatch模式。 + 7. 一个空窗口名称制定了下一个未使用的索引如果合适的话(例如new-window或link-window命令), + 否则会话中的当前窗口就被选择。 + +下面的特殊标记可用来指定一个特定的窗口。每个都具有一个可选的单字符格式。 + + 符号 | 别名 | 含义 +--------------|------|--------------- + {start} | ^ | 最小数值的窗口 + {end} | $ | 最大数值的窗口 + {last} | ! | 最后一个窗口 + {next} | + | 按照数字的下一个窗口 + {previous}| - | 按照数字的上一个窗口 + {mouse} | = | 鼠标事件发生的窗口 + +目标面板可以是一个面板ID或者是一个与目标窗口相似的形式,但是带有一个额外可选的跟随面板索引或面板ID的点号“.”。 +如果忽略面板索引的话,那么指定窗口当前的活动面板就会被使用,下面的特殊符号可以作为面板索引使用: + + 符号 |别名 | 含义 +-------------------|------|------------- + {last} | ! | 最后一个面板 + {next} | + | 数字指定的下一个面板 + {previous} | - | 数字指定的前一个面板 + {top} | | 顶端面板 + {bottom} | | 底端面板 + {left} | | 最左端面板 + {right} | | 最右端面板 + {top-left} | | 左顶端面板 + {top-right} | | 右顶端面板 + {bottom-left} | | 左底端面板 + {bottom-right} | | 右底端面板 + {up} | | 活动面板上面的面板 + {down} | | 活动面板下面的面板 + {left} | | 活动面板左边的面板 + {right} | | 活动面板右边的面板 + {mouse} | = | 鼠标事件发生的面板 + +符号'+'和'-'可能跟随一个位移,例如: + + select-window -t:+2 + +会话,窗口和面板都通过一个唯一的ID来进行数字编码; +会话ID带有一个*$*前缀,窗口ID带有一个*@*前缀,面板ID带有一个*%*前缀。 +这些在tmux服务器中的会话,窗口或面板生命周期中都是唯一不变的。 +面板ID通过TMUX_PANE环境变量传递给面板的子进程, +ID可能使用'session_id','window_id'或'pane_id'何display-message,list-sesions,list-windows或list-panes命令的格式进行显示。 + +shell-command 参数是sh命令,这可能是一个传递给shell的参数,例如: + + new-window 'vi /etc/passwd' + +会运行: + /bin/sh -c 'vi /etc/passwd' + +此外,new-window,new-session,split-window, respawn-window以及respawn-pane命令允许 shell-command +作为多参数给定并且可以直接执行(不需要 'sh -C')。 者可以避免shell引用问题,例如: + + $ tmux new-window vi /etc/passwd + +会直接运行vi,而不需要调用shell。 + +命令 [参数] 指向一个tmux命令,命令和参数分别进行传递,例如: + + bind-key F1 set-window-option force-width 81 + +或者,如果使用sh的话: + + $ tmux bind-key F1 set-window-option force-width 81 + +多个命令可以作为命令序列的一部分一起指定,每个命令需要使用空格和分号来分隔; +命令按照从左至右的顺序执行,并且以反斜线结束的行会继续到下一行,除非被另外一个反斜线转义。 +一个字面量分号可以通过一个反斜线进行转义包含进来(例如,当需要制定一个命令行序列给键绑定时) + +tmux命令包含样例: + + refresh-client -t/dev/ttyp2 + rename-session -tfirst newname + set-window-option -t:0 monitor-activity on + new-window ; split-window -d + bind-key R source-file ~/.tmux.conf \; \ + display-message "source-file done" + +或者从sh中: + + $ tmux kill-window -t :1 + $ tmux new-window \; split-window -d + $ tmux new-session -d 'vi /etc/passwd' \; split-window -d \; attach + +##客户端和会话: + +tmux服务器管理客户端,会话,窗口和面板。 +客户端是附着在会话上来与他们交互的,不论他们是通过new-session命令或者之后的attach-session命令创建的会话。 +每个会话具有一个或多个窗口与其链接。 +窗口可以连接到多个会话上,窗口又是有一个或多个面板组成的,每个面板包含了一个伪终端。 +对于创建、链接或其他窗口操作的命令会在 [窗口和面板](#窗口和面板)部分详解。 + +下面的命令可以用来管理客户端和会话: + + attach-session [-dr] [-c working-directory] [-t target-session] + (别名: attach) + +如果在tmux外部来运行,会在当前终端中创建一个新的客户端并且将其附着在一个目标会话上。如果这个命令是在tmux中运行的,就会切换当前的客户端。 +-d 使附着在这个会话上的其他客户端就会脱离, +-r表示这个客户端时只读的(只有键绑定到detach-client或switch-client命令时具有效果)。 +如果没有启动服务器, attach-session 会尝试启动服务器;除非在配置文件中创建了会话否则就会失败。 +对于attach-session命令的目标会话规则稍微有一点调整:如果tmux需要选择最近使用的会话,会偏好选择最近使用的脱离附着的会话。 +-c 设置会话的工作目录(为新窗口所使用)为working-directory + + detach-client [-P] [-a] [-s target-session] [-t target-client] + (别名: detach) + +如果绑定了一个键时会脱离当前客户端,由-t来指定客户端,或者所有附着在由-s指定的会话中的客户端。 +-a选项会终止除-t指定的目标客户端之外的所有客户端。 +-P发送一个SIGHUP信号给当前客户端的父进程,一般是导致其触发退出动作。 + + has-session [-t target-session] + (别名: has) + +如果指定的会话不存在的话,就会报告一个错误并且退出,返回值为1. 如果存在的话,就会退出,返回值为0. + + kill-server + +终止tmux服务器和客户端并且销毁所有的会话。 + + kill-session [-a] [-t target-session] + +销毁指定的会话,关闭连接到会话的任何窗口,并且让所有附着在其上的客户端脱离。 +如果给定了-a选项的话,除了指定的会话之外的会话都被终止。 + + list-clients [-F format] [-t target-session] + (别名: lsc) + +列出附着在服务器上的所有客户端。 对于-F标记,可以参考 [FORMATS](#格式)部分。 +如果给定了目标会话的话,只列出连接到该会话上的客户端。 + + list-commands + (别名: lscm) + +列出所有tmux支持的所有命令语法。 + + list-sessions [-F format] + (别名: ls) + +列出服务器管理的所有会话,对于-F标记,参考 [FORMATS](#格式)部分。 + + lock-client [-t target-client] + (别名: lockc) + +锁定目标客户端, 可以参考 lock-server 命令。 + + lock-session [-t target-session] + (别名: locks) + +锁定附着在目标会话上的所有客户端。 + + new-session [-AdDP] [-c start-directory] [-F format] [-n window-name] [-s session-name] [-t target-session] [-x width] [-y height] [shell-command] + (别名:new) + +使用session-name 来创建一个新的会话。 + +除非给定-d选项,否则新的会话就会附着在当前的终端上。 window-name和shell-comand +是在初始化窗口中执行的窗口和shell命令名称。 +如果使用了-d选项, -x和-y用来指定初始窗口的大小(默认为80x24)。 +如果从终端中运行,任何的termios特殊字符都被保存并且在新会话中的新窗口中使用。 +-A 标记使得新会话与一个附着会话具有相同的行为,如果会话名称已经存在的话;这种情况下,对于attach-session来说-D具有与-d相同的行为。 +如果给定了-t选项,新的会话被分组到目标会话中。 +这就意味着他们共享相同的窗口集合--目标会话中的所有窗口都会连接到新的会话上,并且任何后续的新建窗口或关闭窗口都会被应用在两个会话上。 +当前的窗口和之前的窗口以及任何会话选项保持独立,并且每个会话都会在不影响其他会话的情况下被终止。 +-n或 shell-command只有在使用-t选项时合法。 +-P选项会在新会话创建之后来打印新会话相关信息。默认情况下,会使用'#{session_name}:'格式,但是可以通过-F来指定一个不同的格式。 + + refresh-client [-S] [-t target-client] + (别名:refresh) + +如果绑定了一个键的话会刷新当前客户端,如果使用-t指定了一个客户端的话会刷新单独的客户端。 +-S 只会更新客户端的状态条。 + + rename-session [-t target-session] new-name + (别名:rename) + +重命名会话为一个新名称。 + + show-messages [-IJT] [-t target-client] + (别名:showmsgs) + +显示客户端消息或服务器信息。 +所有显示在状态行的消息都存储在一个客户端独立的消息日志中,具有一个由message-limit选项设置的最大限制。 +-t 显示目标客户端的日志。 +-I,-J 和-T分别显示运行服务器,任务和终端的调试信息。 + + source-file path + (别名:source) + +从路径中来执行命令 + + start-server + (别名:start) + +开启tmux服务器,如果还没有运行,不会创建任何会话。 + + suspend-client [-t target-client] + (别名:suspendc) + +通过发送一个SIGTSTP(tty stop)信号来挂起一个客户端。 + + switch-client [-lnpr] [-c target-client] [-t target-session] [-T key-table] + (别名:switchc) + +将目标客户端所在的当前会话切换到目标会话中, +如果-l, -n或者-p被使用的话,客户端会被分别移动到最后,下一个或上一个会话中。 +-r 转换一个客户端的只读(可以参考attach-session命令) +-T 设置客户端的键表;来自客户端的下一个键会被解释为来自键表。 +这可能会被用在配置多个前缀键时或者绑定命令到一序列键值时使用。 + +例如,让键入'abc'来运行 list-keys命令: + + bind-key -Ttable2 c list-keys + bind-key -Ttable1 b switch-client -Ttable2 + bind-key -Troot a switch-client -Ttable1 + +##窗口和面板 + +一个tmux窗口可能会在处在多个模式中的某一个模式。 +默认的模式时直接访问附着在窗口上的终端。 +另外一个是复制模式,允许一个窗口的一部分或者其历史能够被复制到一个粘贴缓存中,以便稍候插入到另外的窗口中。 +这个模式时使用 copy-mode命令来进入的,默认绑定到'\['上。也会在一个命令产生输出时进入,例如通过键绑定执行的list-keys。 +可用的键依赖于是选择emacs还是vi模式(参考 mode-keys 选项)。 下面的键对于不同的模式具有合适的支持。 + + 函数 |vi模式 |emacs模式 +-------------------------------|-----------|---------------- + Append selection |A | + Back to indentation |^ |M-m + Bottom of history |G |M-< + Clear selection Escape |C-g | + Copy selection Enter |M-w | + Copy to named buffer |" | + Cursor down |j |Down + Cursor left |h |Left + Cursor right |l |Right + Cursor to bottom line |L | + Cursor to middle line |M |M-r + Cursor to top line |H |M-R + Cursor up |k |Up + Delete entire line |d |C-u + Delete/Copy to end of line |D |C-k + End of line |$ |C-e + Go to line |: |g + Half page down |C-d |M-Down + Half page up |C-u |M-Up + Jump again |; |; + Jump again in reverse |, |, + Jump backward |F |F + Jump forward |f |f + Jump to backward |T | + Jump to forward |t | + Next page |C-f |Page down + Next space |W | + Next space, end of word |E | + Next word |w | + Next word end |e |M-f + Other end of selection |o | + Paste buffer |p |C-y + Previous page |C-b |Page up + Previous space |B | + Previous word |b |M-b + Quit mode |q |Escape + Rectangle toggle |v |R + Scroll down |C-Down/C-e |C-Down + Scroll up |C-Up/C-y |C-Up + Search again |n |n + Search again in reverse |N |N + Search backward |? |C-r + Search forward |/ |C-s + Select line |V | + Start of line |0 |C-a + Start selection |Space |C-Space + Top of history |g |M-> + Transpose characters |C-t | + +下一个和上一个单词简默认使用空格和'-','_'以及'@'字符作为单词分隔符,但是可以通过设置会话的word-separators选项进行调整。 +下一个单词会移动到下一个单词的开始位置,下一个单词的末尾会移动到下一个单词的末尾位置, +前一个单词移动到前一个单词的开始位置。 三个下一个和前一个空格键具有相似的作用但是单独使用一个空格作为单词分隔符。 + +跳转命令允许在一个行中快速移动,例如,输入'f'跟随一个'/'会将光标移动到当前行的下一个'/'字符处。 +一个';'之后会移动到字符下一次出现的地方。 + +复制模式中的命令可能由一个可选的重复计数器作为前导,在vi键绑定下,通过数字键来输入前导; +使用emacs时,使用Alt(meta)+数字作为前导实体。例如,为了将光标向前移动10个单词使用'M-1 0 M-f'-对于emacs模式,'10w'-对于vi模式。 + +模式键绑定是通过一个命名表集合定义的:在命令提示的行编辑时使用vi-edit和emacs-edit键, +当从列表中选择时使用vi-choice和emacs-coice键,在复制模式中时使用vi-copy和emacs-copy键。 +这些表可以通过list-keys命令来查看,另外可以通过bind-key和unbund-key命令来修改或移除键。 +如果append-selection,copy-selection或者start-named-buffer给定-x标记,tmux将不会在复制之后退出复制模式。 +copy-pipe复制所选内容并且将其管道到一个命令。 + +例如下面的命令会绑定'C-w'在复制之后不会退出, 'C-q'将所选内容复制到/tmp和粘贴缓冲中。 + + bind-key -temacs-copy C-w copy-selection -x + bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out" + +粘贴缓存键会从栈中顶端的粘贴缓存中粘贴第一行。 +copy-mode命令的简介为: + + copy-mode [-Mu] [-t target-pane] + +进入复制模式。-u选项向上滚动一页。 -M 开始一个鼠标拖拽(只有在绑定鼠标键绑定时有效,参考MOUSE SUPPORT) + +tmux显示的每个窗口可能会被分割为一个或多个面板;每个面板占用一个特定的区域进行显示并且具有一个单独的终端。 +一个窗口可以通过split-window名令分割为多个面板。窗口可以被水平分割(使用-h标记)或者垂直分割。 +面板可以通过resize-pane命令改变大小(默认绑定为'C-up','C-down','C-left','C-right'), +当前的面板可能会通过select-panel命令改变,而rotate-window和swap-panel命令可以在不改变面板位置的情况下切换面板。 +面板被从0开始的数字按顺序计数。 + +有一些默认的预设布局可用,这可以通过select-layout命令来选择或者使用next-layout命令循环选择(默认绑定为'Space'布局); +一旦布局被选定,其中的面板会被移动以及重新改变大小。 + +支持以下的布局: + +even-horizontal: 面板按照偶数地从左到右来分布在窗口中。 +even-vertical: 面板按照偶数地从上到下来分布在窗口中 +main-horizontal: 在窗口的顶端会显示一个大的面板,其余的面板按照从左到右的方式在底部左端的空间分布, +可以使用main-pane-height窗口选项来指定顶部面板的高度。 +main-vertical: 类似于main-horizontal,但是最大的面板会放置在窗口左边而其他的面板按照从上往下的方式在右边进行分布。 +可以参考main-pane-width窗口选项。 +tiled: 面板会尽量将面板在窗口中在行列上以偶数地方式分布。 + +此外,select-layout可以用来应用一个之前使用的布局,list-windows命令会以一个合适的格式显示每个窗口的布局来于select-layout命令结合使用,例如: + + $ tmux list-windows + + 0: ksh [159x48] layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0} + $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0} + +tmux自动地调整当前窗口大小中的布局大小。 注意,一个布局不能应用在多于布局默认定义的面板数量。 + +###窗口和面板命令 +与窗口和面板相关的命令如下: + + break-pane [-dP] [-F format] [-t target-pane] + (别名:breakp) + +将目标面板从其所在的窗口中终止,并将其作为一个新窗口中的唯一的面板。 如果指定-d,新的窗口不会称为当前的窗口。 +-P选项会在新窗口创建之后显示其信息。 默认会使用 +'#{session_name}:#{window_index}'的显示格式,但是可以通过-f来指定一个不同的格式。 + + capture-pane [-aepPq] [-b buffer-name] [-E end-line] [-S start-line] [-t target-pane] + (别名:capturep) +捕获一个面板的内容,如果指定-p,那么输出会到达stdou,否则会到达有-b指定的缓冲区(如果没有指定-b缓冲区的话就会指定一个新的缓冲区)。 +如果指定-a, 会使用备用屏幕,并且历史是不可以访问的。如果没有备用的屏幕,在没有指定-q的情况下会返回一个错误。 +如果指定-e,那么输出会包含文本转义序列和后台属性。 -C 也会转义非打印字符为八进制 \\xxx。 -J +会链接包裹的多行并且保留每行末尾尾随的空格。 -P 只会面板接受到的捕获开头是一个非完整转义序列的任意输出。 +-S 和 -E 指定开始和结束行的行数,0是可视面板的第一行,而负数时历史行。 '-'到 -S是历史的开始,而 +'-'到-E是可视面板的结尾。 默认情况下只会捕获面板的可视内容。 + + choose-client [-F format] [-t target-window] [template] +将一个窗口置于客户端选择模式,允许从一个列表中交互地选择一个客户端。 +在一个客户端被选择之后'%%'会由模板中的客户端pty路径替换,之后的结果会作为一个命令被执行。 +如果模板没有给定,会使用"detach-client -t '%%'"。 +对于-F标记,可以参考[FORMATS](#格式)部分。 这个命令只有在至少一个客户端被附着之后才工作。 + + choose-session [-F format] [-t target-window] [template] +将一个窗口置于会话选择模式中,可以从一个列表中交互式地选择一个会话。 +当一个会话被选择时,'%%'会由模板中的会话名称替换,之后的结果会作为一个命令被执行。 +如果模板没有给定,会使用"switch-client -t '%%'"。 +对于-F标记,可以参考[FORMATS](#格式)部分。这个命令只有在至少有一个客户端附着时工作。 + + choose-tree [-suw] [-b session-template] [-c window-template] [-S format] [-W format] [-t target-window] +将窗口置于一个树选择模式,其中的会话或窗口可能是从一个列表中交互地选择的。 +默认情况下,窗口属于一个会话主要为了显示他们与一个会话的关系。 +注意choose-window和choose-session命令被包裹在choose-tree中。 +如果给定-s会显示会话,如果给定-w会显示窗口。 +默认情形下,树是被折叠起来的,会话必须通过右箭头简将其展开为窗口。 -u选项会将所有的会话展开。 +如果给定-b,会重载默认的会话命令。 注意 '%%'可以被使用而且会被会话名称替换。如果没有指定的话,默认为"switch-client -t +'%%'"。 如果给定-c,会重载默认的窗口命令,与-b类似,'%%'可以被使用而且会被会话名与窗口索引替换。 +当一个窗口从列表中被选择时,会话命令会在窗口命令运行之前运行。 +如果给定-S,会显示指定的格式而不是默认的会话格式。如果给定-W,会显示指定的格式而不是默认的窗口格式。 +对于-s和-w选项的含义可以参考[FORMATS](#格式)部分。 +这个命令只有当至少有一个客户端附着时工作。 + + choose-window [-F format] [-t target-window] [template] +将一个窗口置于一个选择模式,其中的窗口可以从一个列表中交互地选择。 +当选择一个窗口之后,'%%'会被模板中的会话名称和窗括索引替换,之后的结果作为一个命令被执行。 +如果没有给定模板,"select-window -t '%%'"被使用。 +对于-F的含义可以参考[FORMATS](#格式)部分。 这个命令只有在至少一个客户端附着之后才会工作。 + + display-panes [-t target-client] + (别名:displayp) +由一个客户端来显示每个面板的可视化指示器,可以参考 display-panes-time, display-panes-colour和 +display-panes-active-colour会话选项。由于指示器在屏幕上,一个面板可以通过'0-9'键来选择。 + + find-window [-CNT] [-F format] [-t target-window] match-string + (别名:findw) +在窗口名称,标题和可见的内容中搜索fnmatch模式的匹配字符串。标记被用来控制匹配行为: -C只匹配可见窗口内容, +-N只匹配窗口名称,-T匹配窗口标题。 +默认为-CNT。如果只有一个窗口匹配,就会被自动选择,否则就会显示一个选项列表。 +对于-F标记可以参考[FORMATS](#格式)部分。这个命令只有在至少一个客户端被附着时会工作。 + + join-pane [-bdhv] [-l size | -p percentage] [-s src-pane] [-t dst-pane] + (别名:joinp) +与split-window相似,但是取代分割dst-panel并创建一个新面板而代之的是,将其分割并将src-panel移动到空间中。 +这个可以用来逆转break-pane动作。-b选项使得src-pane被联接到dst-pane的左边或上边。 + + kill-pane [-a] [-t target-pane] + (别名:killp) +销毁给定的pane。如果所在窗口中没有剩余的面板,该窗口也会被销毁。 -a选项会销毁除由-t指定面板之外的所有面板。 + + kill-window [-a] [-t target-window] + (别名:killw) +终止当前窗口或目标窗口,将其从所链接的任意会话中移除。 -a选项终止除-t指定窗口之外的所有窗口。 + + last-pane [-de] [-t target-window] + (别名:lastp) +选择最后一个面板,-e 使得输入到面板生效,-d使得输入到面板失效。 + + last-window [-t target-session] + (别名:last) +选择最后一个窗口,如果没有目标窗口指定,选择当前会话中的最后一个窗口。 + + link-window [-dk] [-s src-window] [-t dst-window] + (别名:linkw) +将在src-window的窗口链接到指定的dst-window。如果dst-window被指定但是不存在的话,那么src-window会被链接导那儿。 +如果给定-k并且dst-window存在,那么就会将其终止,否则就会生成一个错误。如果给定-d,新链接的窗口不会被选择。 + + list-panes [-as] [-F format] [-t target] + (别名:lsp) +如果给定-a, 会湖绿target并且会列出服务器上的所有面板。 +如果给定-s,target就是一个会话(或者当前会话)。如果都没有指定,target就是一个窗口(或者当前窗口)。对于-F标记可以参考[FORMATS](#格式)部分。 + + list-windows [-a] [-F format] [-t target-session] + (别名:lsw) +如果给定-a,会列出服务器上的所有窗口。 否则会列出当前会话或target-session中的窗口。对于-F标记可以参考[FORMATS](#格式)部分。 + + move-pane [-bdhv] [-l size | -p percentage] [-s src-pane] [-t dst-pane] + (别名:movep) +与join-pane类似,但是src-pane和dst-pane可以属于相同的窗口。 + + move-window [-rdk] [-s src-window] [-t dst-window] + (别名: movew) +这个于link-window相似,除了src-window中的窗口被移动到dst-window。给定-r会话中的所有窗口都会在遵照base-index选项下按照序列顺序重新编号。 + + new-window [-adkP] [-c start-directory] [-F format] [-n window-name] [-t target-window] [shell-command] + (别名:neww) +创建一个新的窗口,给定-a,新建的窗口会被插入到指定target-window的下一个索引上,必要的话会将窗口向上移,否则target-window就是这个新建的窗口。 + +如果给定-d, 会话不会将新建窗口作为当前窗口。target-window表示将会创建的窗口;如果目标窗口已经存在会显示一个错误,如果使用-k标记就会销毁。 +shell-command是将要执行的命令。如果没有指定shell-command, +default-command选项的值被默认使用。-c选项指定了新窗口创建的工作目录。 +当shell命令完成时,窗口关闭。 参考remain-on-exit选项来改变这个行为。 +对于运行在tmux中的所有程序需要将TERM环境变量设置为"screen"。 +新的窗口会自动将"TERM=screen"加到他们的环境中,但是必须注意不要在shell启动文件中重置这个变量。 +-P 选项在新窗口创建后会打印与之相关的信息。 +默认情况下,使用'#{session_name}:#{window_index}'的格式,但是可以通过使用-F来指定一个不同的格式。 + + next-layout [-t target-window] + (别名:nextl) +将窗口移动到下一个布局模式并且重新安排面板来使之适应。 + + next-window [-a] [-t target-session] + (别名:next) +移动到会话中的下一个窗口,如果-a指定,在移动到下一个窗口时带有警告。 + + pipe-pane [-o] [-t target-pane] [shell-command] + (别名:pipep) +将target-pane中程序的输出通过管道传递给一个shell命令。一个面板可能一次只能管道给一个命令,在shell-command命令执行之前任何存在的管道都会关闭。 +shell-command字符串可能会包含status-left选项所支持的特殊字符序列。 如果没有指定shell-command,那么当前的管道就会被关闭。 +-o选项只有在没有之前的管道存在时打开一个新管道,允许一个管道通过一个单键进行切换,例如: + + bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P' + + + previous-layout [-t target-window] + (别名:prevl ) +移动到会话之前的布局。 + + previous-window [-a] [-t target-session] + (别名:prev) +移动到会话之前的窗口,使用-a选项会带有一个警告。 + + rename-window [-t target-window] new-name + (别名: renamew) +重命名当前窗口或者由-t指定的target-window窗口为new-name + + resize-pane [-DLMRUZ] [-t target-pane] [-x width] [-y height] [adjustment] + (别名:resizep) +重新定义面板的大小,通过-U, -D, -L或-R来调整上下左右,或者通过-x/-y指定绝对值大小。 +调整是通过行或单元格来给定的(默认为1)。 +使用-Z时,活动面板会在放大(占用整个窗口)或未放大(在布局中的正常位置)之间进行切换。 +-M 开始鼠标重定义大小(只有在鼠标键绑定时有效,参考MOUSE SUPPORT部分) + + respawn-pane [-k] [-t target-pane] [shell-command] + (别名:respawnp) +在shell-comman退出之后重新激活面板(可以参考remain-on-exit 窗口选项)。如果没有给定shell-comman, +那么面板创建时所使用的命令会被执行。面板必须是已经激活的状态,如果给定-k,任何存在的命令都会被终止。 + + respawn-window [-k] [-t target-window] [shell-command] + (别名:respawnw) +在shell-command退出之后重新激活窗口(可以参考remain-on-exit窗口选项)。 如果没有指定shell-comman, +那么窗口创建时所使用的命令会被执行。 窗口必须是已经激活的状态,如果指定-k任何存在的命令都会被终止。 + + rotate-window [-DU] [-t target-window] + (别名:rotatew) +轮换窗口中面板的位置,或者通过-U向前或者向后。 + + select-layout [-nop] [-t target-window] [layout-name] + (别名:selectl) +为窗口选择一个特定的布局,如果没有指定布局名称,就会使用最后使用的预设布局并且重新布局。 + + select-pane [-DdegLlRU] [-P style] [-t target-pane] + (别名:selectp) +将target-pane面板作为target-window窗口中的活动面板,或者设置其风格(使用-P)。 +如果使用了-D,-L,-R或者-U的话,就会分别使用target-pane面板的下面,左边,右边或上面的面板。 +-l与使用last-pane命令效果一样。 -e使得输入到面板生效,-d使得输入到面板失效。 + +每个面板具有一个风格:默认使用window-style和window-active-style选项。select-pane -P 为单个面板设置风格。 +例如将第一个面板的北京设置为红色red: + + select-pane -t:.1 -P 'bg=red' + +-g 显示当前面板的样式。 + + select-window [-lnpT] [-t target-window] + (别名:selectw) +选择目标窗口。-l,-n和-p等价于last-window,next-window和previous-window命令。 +如果给定-T,而且选择的窗口已经是当前窗口,那么命令表现为last-windown命令。 + + split-window [-bdhvP] [-c start-directory] [-l size | -p percentage] [-t target-pane] [shell-command] [-F format] + (别名:splitw) +通过分割target-pane窗口来创建一个新面板: -h为水平分割,-v为垂直分割; 默认为垂直分割。 +-l和-p选项指定新面板的行(对于垂直分割)或单元格(水平分割),或者作为百分比。-b选项使得新建面板在target-pane的左边或上边。 +其他的任何选项的含义于new-window命令一样。 + + swap-pane [-dDU] [-s src-pane] [-t dst-pane] + (别名:swapp) +转换两个面板。如果使用-U并且没有通过-s来指定源面板的话,dst-pane会与之前的面板进行转换;-D与下一个面板进行转换。 +-d用来指示tmux不要改变活动面板。 + + swap-window [-d] [-s src-window] [-t dst-window] + (别名:swapw) +这个与link-window类似,除了源面板与目标面板相互转换之外。如果在src-window没有窗口的话会出错。 + + unlink-window [-k] [-t target-window] + (别名:unlinkw) +取消target-window的链接。除非给定-k选项,否则只有当一个窗口链接到多个会话时才会被取消链接-窗口不能链接到空会话; +如果指定-k选项,而且窗口只有与一个会话相关联,那么窗口会被取消该链接并且被销毁。 + +##键绑定2 + + tmux允许一个命令被绑定到大多数键上-无论是否带有前导键。当指定键时,大部分键代表其本身字面量含义(例如'A-Z')。 +Control键可能表示为'C-'或'^'前导,而Alt(meta)表示为'M-'。此外,特殊的键名称也是被接受的:Up,Down, Left, Right, +BSpace, BTab, DC(delete), End, Enter, Escape, F1-F12, Home, IC(insert), NPage/PageDown/PgDn, PPage/PageUp/PgUp, Space和Tab。 +注意为了绑定双引号或单引号键,引号标记是必需的,例如: + + bind-key '"' split-window + bind-key "'" new-window + +###键绑定命令 +与键绑定相关的命令如下: + + bind-key [-cnr] [-t mode-table] [-T key-table] key command [arguments] + (别名:bind) +将键绑定到命令。键被绑定到一个键表中。 +默认情况(没有'-T')时,键被绑定到前导键表中。这个表被用在前导键键入之后再键入的键(例如,'c'默认绑定为前导键表中的新建窗口命令, +所以'C-b c'会创建一个新窗口)。 +根键表被用在不需要前导键的键输入:将'c'在根键表中绑定为新建窗口命令时意味着一个普通的'c'键就会创建一个新窗口。 +'-n' 是 '-T root' 的别名。键同样可以绑定到客制化的键表中,'switch-client -T command' 用来从一个键绑定中切换到相应的键。 +'-r' 标记指定这个键可以重复,参考'repeat-time'选项。 + +如果出现-t选项,那么键会绑定到一个mode-table(模式表): 使用-c来绑定到命令模式,缺省时绑定为普通模式。 +可以参考WINDOWS AND PANES部分,并且 list-keys命令可以查看模式键绑定。 + +为了查看默认的绑定和可用的命令可以参考list-keys 命令: + + list-keys [-t mode-table] [-T key-table] + (别名:lsk) +列出所有的键绑定。 没有指定-T时会打印所有的键表,指定-T时只会打印key-table. +带-t时,在模式表中的键绑定会被列出来; 模式可能为以下之一:vi-edit,emacs-edit,vi-choice,emacs-choice, +vi-copy或emcas-copy。 + + send-keys [-lMR] [-t target-pane] key ... + (别名:send) +发送一个或多个键到一个窗口中,其中的每个参数key是发送的键的名称(例如'C-a'或者'npage'); +如果字符串不能作为键来识别,就会作为一系列字符串发送。 +-l标记让键名查找失效并且发送键的字面量值。所有的参数被按照先后顺序序列地发送。 +-R标记导致终端状态被重置。 +-M 通过一个鼠标时间传递(只有当绑定一个鼠标键绑定时有效,参考MOUSE SUPPORT)。 + + send-prefix [-2] [-t target-pane] +发送前导键-或者发送二级前导键如果与-2一起使用时-到一个窗口就像该键被按下一样。 + + unbind-key [-acn] [-t mode-table] [-T key-table] key + (别名:unbind) +取消命令到键的绑定,-c,-n,-T 和-t与bind-key命令的含义一样。 如果-a存在,所有的键绑定都会被移除。 + +##选项 +tmux的外观和行为可以通过修改各个选项的值来进行改变,具有三种选项:服务器选项,会话选项和窗口选项。 +tmux服务器具有一个全局选项集合--这个选项集合不会应用到任何特定的窗口或会话中。 +这些选项通过'set-option -s'命令进行修改,或者通过'show-options -s' 命令进行显示。 +此外,每个单独的会话可能具有一个会话选项集合,同时具有一个分开全局会话选项集合。 +没有特定选项配置的会话会从全局会话选项中继承其值。会话选项可以通过set-option命令进行设置或重置, +可以通过show-options命令来列出会话选项。可用的服务器和会话选项会在set-option命令下列出。 +类似地,每个窗口都附着了一个窗口选项集合,并且具有一个全局窗口集合来继承所有的重置选项。 +窗口选项使用set-window-option命令来进行修改,并且可以通过show-window-options命令来列出。 +所有的窗口选项使用set-window-option命令归档。 + +tmux也支持以'@'作为前导的用户选项, 用户选项可以具有任何名称,可以被设置为任何字符串,只要具有'@'作为前导,例如: + + $ tmux setw -q @foo "abc123" + $ tmux showw -v @foo + abc123 + +###选项设置 + +设置选项的命令如下: + + set-option [-agoqsuw] [-t target-session | target-window] option value + (别名:set) +通过-w来设置窗口选项(与set-window-option命令等价),-s设置服务器选项,否则设置会话选项。 +如果指定-g,那么全局会话或窗口选项就会被设置。 +-u标记用来重置选项,所以一个会话从全局选项中来继承,不能重置一个全局选项。 +-o标记阻止设置一个已经存在的选项。 +-q标记会取消位置选项发生的错误。 +带有-a时,如果选项期待一个字符串或者一个样式,那么只会被附加在已经设置的值后面,例如: + + set -g status-left "foo" + set -ag status-left "bar" + +会得到'foobar'结果,而: + + set -g status-style "bg=red" + set -ag status-style "fg=blue" + +会得到一个红色背景和蓝色前景的结果。 +没有-a时,这个值会使用默认的背景和一个蓝色前景。 +可用的窗口选项在set-window-option下列出。 +选项的值依赖于选项类型,可以为数字,字符串,或者一个标记(on/off/省略)。 + + + + +###服务器选项 +可选的服务器选项有: + + buffer-limit number +设置缓冲器数量; 新的缓冲器被放置在栈顶端,旧的缓冲器在维护最大长度时有必要时从栈底端移除。 + + default-terminal terminal +为会话中新创键的窗口设置一个默认的终端-默认值为TERM环境变量。为了让tmux正确工作,这个值必须设置为'screen','tmux'或者来自他们的一个派生值。 + + escape-time time +设置一个tmux用来在接受到一个转义字符输入时的等待毫秒数,以此让tmux来判断该字符时函数的一部分还是一个meta键序列的一部分。 +默认为500毫秒。 +设置一个tmux用来在接受到一个转义字符输入时的等待毫秒数,以此让tmux来判断该字符时函数的一部分还是一个meta键序列的一部分。 +默认为500毫秒。 + + exit-unattached [on | off] +如果生效,服务器会在没有任何附着的客户端时退出。 + + + focus-events [on | off] +如果生效,在终端支持的情况下会从终端获取聚焦事件请求,然后通过tmux中运行的应用来传递。 +附着的客户端应该被脱离附着状态然后在选项修改之后重新进行附着。 + + message-limit number +设置每个客户端保存到消息日志中的错误或信息消息的数量,默认为100。 + + set-clipboard [on | off] +尝试使用\e]52;...\007 xterm转义序列来设置终端的剪切版。 +如果在客户终端的terminfo描述中存在一个Ms实体,那么这个选项默认为on. 注意在xterm中需要设置以下资源来让这个特性生效: + + disallowedWindowOps: 20,21,SetXprop + +或者在需要的时候从xterm交互中改变这个属性值。 + + terminal-overrides string +包含了一个个实体列表来重载使用terminfo读取的终端描述信息。 +字符串是一个"逗号"分割的项目列表,每个项目是一个':'分割的字符串来组成终端类型模式以及一个name=value实体集合。 + +例如,为了给所有的终端类型设置terminfo实体'clear'为'\e[H\e[J',以及将'rxvt'终端类型的实体'dch1'的值设置为'\e[P', +那么这个选项会按照以下字符串进行设置: + + "*:clear=\e[H\e[2J,rxvt:dch1=\e[P" + +终端实体值会在解释之前通过strunvis传递,默认的值会强制地更新支持256colors的终端的'colors'实体: + + "*256col*:colors=256,xterm*:XT" + + + +###会话选项 + +可用的会话选项有: + + assume-paste-time milliseconds +如果被键入的键快于用毫秒指定的值,那么这些键会被假设为粘贴而不是键入,而且tmux键绑定不会被执行。默认为一毫秒,0用来让选项失效。 + + base-index index +设置在创建一个新窗口时应该搜索的未使用索引的基索引,默认为0。 + + bell-action [any | none | current] +窗口响铃动作,any表示连接到一个会话的任何窗口中的响铃会导致这个会话中的当前窗口中的一个响铃,none表示所有的响铃被忽略, +current表示除了当前窗口之外的窗口中的响铃将会被忽略。 + + bell-on-alert [on | off] +如果为on,在出现一个警告时,终端会响铃。 + + default-command shell-command +设置新窗口所使用的命令(如果没有指定就是窗口创建时的命令)为shell-command, 可能为任何sh命令。 +默认是一个空字符串,用来指示tmux使用默认shell选项来创建一个登录shell。 + + default-shell path +指定默认的shell, 当default-command为空时,这个会作为新建窗口的登录shell,这个path值必须为完整的路径名。 +在启动之后,tmux会尝试从第一个合适的SHELL环境变量中来设置为默认值,shell由'getpwuid'或者 '/bin/sh'。 +这个选项在将tmux作为一个登录shell使用时应该被配置。 + + destroy-unattached [on | off] +如果生效的话,当会话不再附着在任何客户端时就会被销毁。 + + detach-on-destroy [on | off] +如果为on(默认值), 当附着的会话被销毁时,客户端会脱离附着。 如果off,客户端会被切换为剩余会话中的最近活动的会话。 + + display-panes-active-colour colour +设置为活动面板显示指令的display-panes命令所使用的colour。 + + display-panes-colour colour +设置为不活动面板显示指令的display-panes命令所使用的colour。 + + display-panes-time time +以毫秒为淡灰来设置display-panes命令显示指令出现的时间。 + + display-time time +设置状态行消息和其他屏幕指令显示的时间总和,时间是以毫秒指定的。 + + history-limit lines +设置窗口历史持有的最大行数,这个设置只会应用在新窗口上--退出时窗口历史不会重写大小并且会保留在其创建时段的限制。 + + lock-after-time number +在number秒时间不活动后会锁定会话(与lock-session命令类似),如果lock-server选项被设置的话, +那么整个服务器(所有会话)都会被锁定。默认为不锁定(number为0)。 + + lock-command shell-command +锁定每个客户端时运行的命令,默认为lock -np 命令。 + + lock-server [on | off] +如果选项为on(默认值), 与每个会话单独锁定不同的是,整个服务器会在所有会话被锁定时锁定。 +作为一个会话选项这个没有什么影响,这个必须时一个全局选项。 + + message-command-style style +设置状态行命令样式,样式是一个由逗号分割的字符列表来指定的。 +这些样式可能时'bg=colour'来设置背景颜色,'fg=colour'来设置前景颜色,另外有下面指定的属性列表: + +颜色值可以为这些颜色中的一个:black,red,green, yellow, blue, magenta,cyan,white,aixterm bright +variants(如果支持的话,会有:brightred,breightgreen,等)。 +256-colour集合中从colour0到colour255为默认值,或者一个十六进制的RGB字符串,例如'#ffffff'-会从默认的256-colour集合中选择最匹配的颜色。 +属性既可以为none或者一个逗号分割一个或多个包含(bright(或bold),dim,underscore,blink,reverse, hidden或者italics)的列表来开启属性, +或者带有'no'前缀的属性来关闭属性。 + +样例: + + fg=yellow,bold,underscore,blink + bg=black,fg=default,noreverse + +如果set-option命令具有一个 '-a' 标记的话,新的样式会添加进来,否则已经存在的样式被替换。 + + message-style style +设置状态行消息样式,对于如何指定样式,可以参考message-command-style选项。 + + mouse [on | off] +如果为on,tmux会捕获鼠标并且允许鼠标时间作为键绑定进行结合。 可以参考MOUSE SUPPORT 部分详解。 + + mouse-utf8 [on | off] +如果生效,在UTF-8终端请求鼠标输入作为UTF-8。 + + prefix key +设置接收到的key作为前导键 + + prefix2 key +设置接收到的键作为二级前导键。 + + renumber-windows [on | off] +如果为on, 当一个窗口在会话中关闭时,自动地将其他窗口按照数字顺序重新编序。 +这回参考base-index选项如果设置了这个选项的话。如果为off,不会对窗口进行重新排序。 + + repeat-time time +允许指定的时间内(默认为500毫秒)在不重新输入前导键时输入多个命令。 +一个键是否可以重复可以在使用bind-key命令结合时使用-r选项进行设置。 +对于与resize-pane命令结合的默认键的重复是开启的。 + + set-remain-on-exit [on | off] +为在这个会话中任何第一次创建的窗口设置remain-on-exit窗口选项。 +当这个选项为true时,运行程序所在的窗口在程序退出时不会关闭,而是保持打开但是不活动。 +可以使用respawn-window命令来重新激活这个窗口,或者使用kill-window来销毁窗口。 + +如果tsl和fslterminfo实体存在的话,会尝试用其来设置客户终端的标题。 +如果终端显示为一个xterm的话tmux自动将其设置为\e]2;...\007序列。 +这个选项默认为off。注意elinks只会在设置了STY环境变量时才尝试设置窗口标题。 + + set-titles-string string +如果set-titles为on,那么字符串string就会用来设置窗口标题。 格式被扩展,参考[FORMATS](#格式)部分。 + + status [on | off] +显示或隐藏状态行。 + + status-interval interval +在每个间隔时间段更新状态栏。 默认时没15秒更新。如果为0会让时间间隔重绘状态失效。 + + status-justify [left | centre | right] +设置状态行窗口列表组件的位置:left,center,或者right对齐。 + + status-keys [vi | emacs] +在状态栏使用vi或者emacs-样式的键绑定,例如在命令提示时。默认为emacs, 除非VISUAL +或者EDITOR环境变量被设置并且包含字符串'vi'。 + + status-left string +将字符串(默认为会话名称)显示在状态栏的左边。字符串会通过strftime传递并且格式会被扩展,也可能会包含下面特殊字符序列的任意字符: + + 字符对 | 替换值 +---------------------------|--------------------------------- + #(shell-command) | 命令输出的首行。 + #[attributes] | 颜色或属性改变 + ## | 一个'#'字面量值。 + +'\#(shell-command)'形式执行'shell-command'然后插入其输出的首行。 +注意shell命令只会在由status-interval选项指定的时间间隔内执行一次:如果同时重绘状态的话,会使用之前输出结果。 +shell命令的执行会带有tmux的全局变量集合(参考 ENVIRONMENT部分)。 +对于如何设置名字和标题的细节可以参考NAMES AND TITLES 部分。 对于允许设定的属性可以参考message-command-style选项。 + +样例有: + + #(sysctl vm.loadavg) + #[fg=yellow,bold]#(apm -l)%%#[default] [#S] + +默认字符串中的UTF-8不会被解释,需要使用status-utf8选项来开启UTF-8。 +默认值为'[#s]'。 + + status-left-length length +设置状态栏左边组件的最大长度,默认为10。 + + status-left-style style +设置状态行左边部分的样式,参考message-style-style选项来指定样式。 + + status-position [top | bottom] +设置状态行的位置。 + + status-right string +显示字符串在状态栏的右边,默认为带双引号的当前窗口标题以及日期时间会被显示。 +与status-left类似,字符串也会传递给strftime,字符对会被替换而且UTF-8也依赖于status-utf8选项。 + + status-right-length length +设置状态栏右边组件的最大长度,默认为10。 + + status-right-style style +设置状态行右边部分的样式,参考message-command-style选项设置样式。 + + status-style style +设置状态行样式,参考message-command-style选项设置样式。 + + status-utf8 [on | off] +指示tmux将status-left和status-right中的字符串中的top-bit-set当作UTF-8处理;值得注意的时,这对于宽字符很重要。默认为off。 + + update-environment variables +设置一个包含由空格分开的环境变量列表字符串--这些环境变量会在新会话创建时或一个已存在的会话被附着时复制到会话环境中。 +任何在源环境中不存在的变量会从会话环境中设置为移除(类似于将-r传递给set-environment命令)。 +默认值为"DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"。 + + visual-activity [on | off] +如果为on, 当活动出现在一个由monitor-activity窗口选项生效的窗口中时显示一个状态行。 + + visual-bell [on | off] +如果为on,响铃时会显示一个消息而不是将其传递到终端(会产生一个声音)。可以参考bell-action选项。 + + visual-silence [on | off] +如果monitor-silence生效的话,那么当时间间隔在一个指定窗口中过期时会打印一个消息。 + + word-separators string +设置会话关于单词分隔符字符的概念,主要是为了复制模式中的下一个或前一个单词命令的目的。默认为'-_@'。 + + set-window-option [-agoqu] [-t target-window] option value + (别名:setw) +Set a window option. The -a, -g, -o, -q and -u flags work similarly to the set-option command. + +###窗口选项 +支持的窗口选项有: + + aggressive-resize [on | off] +积极地重新调整所选窗口大小。意味着tmux会重新调整窗口的尺寸为当前窗口的最小会话尺寸,而不是其附着的最小的会话。 +在当前窗口改变为另外一个会话时窗口会重新调整大小;这个选项对于支持SIGWINCH的全屏程序有好处而对于交互式程序如shell不是太好。 + + allow-rename [on | off] +允许程序通过终端转义序列(\033k...\033\\)改变窗口名称。默认为on。 + + alternate-screen [on | off] +这个选项用来配置运行在tmux中的程序是否可以使用终端的被用屏幕特性-允许terminfo的smcup和rmcup能力。 +被用屏幕特性在一个交互式程序开启并且在从退出后恢复之后可以保留窗口的内容, +这样任何程序开始之前的可视输出会在程序退出之后重新出现。默认为on。 + + automatic-rename [on | off] +控制自动化窗口命名。当开启这个设置时,tmux会使用由automatic-rename-format指定的格式来自动地重命名窗口。 +对于由new-window和new-session在创建时,或者之后通过rename-window或者使用终端转义序列指定的窗口名称, 这个标识会自动失效。 + +可以通过以下方式来将其在全局范围内关闭: + + set-window-option -g automatic-rename off + + + automatic-rename-format format + +在automatic-rename选项生效时会使用这个格式, 参考 [FORMATS](#格式) 。 + + c0-change-interval interval + c0-change-trigger trigger +这两个选项配置面板改变时间间隔的一个简单格式。如果tmux在1毫秒内查看到除C0序列之外的触发器(例如回车,换行或删除) +修改屏幕,会立即停止更新面板。否则会在每个时间间隔内重绘整个面板。 +这个可以帮助来阻止快速输出(例如yes)覆盖整个终端。默认为触发器250, 时间间隔100。 +0触发器用来失效速率限制。 + + + + clock-mode-colour colour +设置时钟颜色。 + + clock-mode-style [12 | 24] +设置时钟小时格式 + + force-height height + force-width width +阻止tmux将窗口的大小值超过width或height, 0值会恢复默认无限制设置。 + + main-pane-height height + main-pane-width width +设置main-horizontal 或 main-vertical布局中的主面板的长和宽。 + + +mode-keys [vi | emacs] +在复制或选择模式中使用vi/emacs键绑定。与status-keys选项一样默认为emacs, 除非VISUAL或EDITOR包含了vi。 + +mode-style style +设置窗口模式样式, 参考message-command-style选项指定样式。 + +monitor-activity [on | off] +监视窗口中的活动。具有活动事件的窗口在状态栏上高亮显示。 + +monitor-silence [interval] +在一段时间间隔内对非活动窗口进行监控。时间间隔内沉默的窗口在状态栏高亮。 +0间隔值让其监控失效。 + + +other-pane-height height +设置main-horizontal布局中主面板之外的面板高度。默认为0-没有任何作用。 +如果main-pane-height和other-pane-height选项同时设置,主面板会变得来使得 +其他面板达到指定高度,但是不会反过来作用。 + +other-pane-width width +与other-pane-height类似,只是用来设置 main-vertical布局中的其他面板的宽度。 + +pane-active-border-style style +设置当前活动面板的边框样式。 参考 message-command-style选项来指定样式,属性被忽视。 + +pane-base-index index +与 base-index类似,只是用来设置面板的开始数字。 + +pane-border-style style +设置活动面板周围面板的样式。 参考 message-command-style选项来指定样式,属性被忽视。 + +remain-on-exit [on | off] +带有该标识设置的窗口在其中程序退出时不会被销毁。 +窗口可能使用respawn-window命令重新激活。 + +synchronize-panes [on | off] +将到任意面板的输入复制到相同窗口中的所有其他面板(没有在特殊模式中的面板)。 + +utf8 [on | off] +指示tmux期待在窗口中出现 UTF-8序列。 + +window-active-style style +设置窗口的活动面板的样式。参考 message-command-style选项来指定样式。 + +window-status-activity-style style +设置窗口的状态行样式带有一个活动警告。参考 message-command-style选项来指定样式。 + +window-status-bell-style style +设置窗口的状态行样式带有一个响铃警告。参考 message-command-style选项来指定样式。 + + window-status-current-format string +与 window-status-format类似,只是这个格式在窗口为当前窗口时使用。 + + window-status-current-style style +为当前的活动窗口设置状态行样式。 参考 message-command-style选项来指定样式。 + + window-status-format string +设置状态行列表中显示窗口的格式。 参考 status-left选项关于可用的特殊字符序列信息。默认值为'#I:#W#F'。 + + window-status-last-style style +为最后一个活动窗口设置状态行样式。参考 message-command-style选项来指定样式。 + + window-status-separator string +设置状态行中窗口之间的分隔符,默认为单个空格符。 + + window-status-style style +为单个窗口设置状态行样式。参考 message-command-style选项来指定样式。 + + window-style style +设置默认窗口样式。参考 message-command-style选项来指定样式。 + + xterm-keys [on | off] +设置该选项会使tmux生成xterm-style功能键序列; 这些包含了一个数字来指定修饰符如Shift,Alt或Ctrl。默认为off。 + + wrap-search [on | off] +设置这个选项会使得搜索动作包含面板内容的末尾。 默认为on。 + + show-options [-gqsvw] [-t target-session | target-window] [option] +(别名:show) +使用-w来显示窗口选项(可以指定单个窗口),使用-s显示服务器选项,否则显示target-session的会话选项。 +-g用来显示全局会话或窗口选项。 +-v只显示选项值,不包含名称。 +-q指示重置选项不会返回错误。 + + show-window-options [-gv] [-t target-window] [option] +(别名:showw) +列出窗口选项或者target-window指定的单个窗口选项。 +-g用来显示全局窗口选项。 +-v显示选项值,忽略选项名。 + +##鼠标支持 +如果鼠标选项开启(默认为关闭),tmux允许将鼠标时间作为键来结合。 +每个键的名称是由鼠标事件(例如'MouseUp1')和一个位置后缀('Pane'表示面板内容,'Border'面板边界 +或者'Status'状态行)组成的。可以使用以下的鼠标事件: + + MouseDown1 MouseUp1 MouseDrag1 + MouseDown2 MouseUp2 MouseDrag2 + MouseDown3 MouseUp3 MouseDrag3 + WheelUp WheelDown + +每个都需要带有一个位置后缀,例如'MouseDown1Status' + +特殊标记'{mouse}'或'='可能在命令中作为target-window或target-pane与鼠标键绑定进行结合。 +会在鼠标事件发生的位置解析为窗口或面板(例如,对于一个'MouseUp1Status'绑定在在状态行上的窗口, +或者对于'WheelDownPane'绑定面板上的鼠标滚动)。 + +'send-key -M'标记可以用来将一个鼠标时间转发到一个面板上。 + +默认的键绑定允许鼠标用来选择和改变面板大小,复制文本或者使用状态行来改变窗口。 +这些动作在开启鼠标选项时发生作用。 + + +##格式 + +有些命令接受由-F标记附带的格式参数。这个参数是一个控制命令输出格式的字符串。 +可替换的变量被包含在'#{'和'}'之间,例如'#{session_name}'。 +可用的变量在下表中列出,或者tmux选项的名称可以一个选项的值。 +有些变量具有一个简短的别名,例如'#s', 而'##'会使用一个单独的'#'来替换。 + + +条件可以通过'?'作为前缀,逗号作为分隔符来使用,如果指定的变量存在并且不是0,那么第一个选项被选择,否则选择第二个选项。 +例如'#{?session_attached,attached,not attached}'条件,当会话是附着的就会包含'attached'否则就会包含'not attached'。 +而对于'#{?automatic-rename, yes, no}'如果开启了automatic-rename的话会包含'yes'否则包含'no'。 +可以通过一个前缀'=',一个数字和一个冒号来作为字符串的长度限制,所以'#{=10:pane_title}'最多包含pane标题的前10个字符。 + +在合适的地方有以下的变量是可用的: + + 变量名 | 别名 | 替换值 + -----------------------|--------------|----------------------------------- + alternate_on | | If pane is in alternate screen + alternate_saved_x | | Saved cursor X in alternate screen + alternate_saved_y | | Saved cursor Y in alternate screen + buffer_sample | | Sample of start of buffer + buffer_size | | Size of the specified buffer in bytes + client_activity | | Integer time client last had activity + client_activity_string | | String time client last had activity + client_created | | Integer time client created + client_created_string | | String time client created + client_height | | Height of client + client_last_session | | Name of the client's last session + client_prefix | | 1 if prefix key has been pressed + client_readonly | | 1 if client is readonly + client_session | | Name of the client's session + client_termname | | Terminal name of client + client_tty | | Pseudo terminal of client + client_utf8 | | 1 if client supports utf8 + client_width | | Width of client + cursor_flag | | Pane cursor flag + cursor_x | | Cursor X position in pane + cursor_y | | Cursor Y position in pane + history_bytes | | Number of bytes in window history + history_limit | | Maximum window history lines + history_size | | Size of history in bytes + host | #H | Hostname of local host + host_short | #h | Hostname of local host (no domain name) + insert_flag | | Pane insert flag + keypad_cursor_flag | | Pane keypad cursor flag + keypad_flag | | Pane keypad flag + line | | Line number in the list + mouse_any_flag | | Pane mouse any flag + mouse_button_flag | | Pane mouse button flag + mouse_standard_flag | | Pane mouse standard flag + mouse_utf8_flag | | Pane mouse UTF-8 flag + pane_active | | 1 if active pane + pane_bottom | | Bottom of pane + pane_current_command | | Current command if available + pane_dead | | 1 if pane is dead + pane_dead_status | | Exit status of process in dead pane + pane_height | | Height of pane + pane_id | #D | Unique pane ID + pane_in_mode | | If pane is in a mode + pane_input_off | | If input to pane is disabled + pane_index | #P | Index of pane + pane_left | | Left of pane + pane_pid | | PID of first process in pane + pane_right | | Right of pane + pane_start_command | | Command pane started with + pane_synchronized | | If pane is synchronized + pane_tabs | | Pane tab positions + pane_title | #T | Title of pane + pane_top | | Top of pane + pane_tty | | Pseudo terminal of pane + pane_width | | Width of pane + saved_cursor_x | | Saved cursor X in pane + saved_cursor_y | | Saved cursor Y in pane + scroll_region_lower | | Bottom of scroll region in pane + scroll_region_upper | | Top of scroll region in pane + session_attached | | Number of clients session is attached to + session_activity | | Integer time of session last activity + session_activity_string| | String time of session last activity + session_created | | Integer time session created + session_created_string | | String time session created + session_group | | Number of session group + session_grouped | | 1 if session in a group + session_height | | Height of session + session_id | | Unique session ID + session_many_attached | | 1 if multiple clients attached + session_name | #S | Name of session + session_width | | Width of session + session_windows | | Number of windows in session + window_active | | 1 if window active + window_activity_flag | | 1 if window has activity alert + window_bell_flag | | 1 if window has bell + window_find_matches | | Matched data from the find-window + window_flags | #F | Window flags + window_height | | Height of window + window_id | | Unique window ID + window_index | #I | Index of window + window_last_flag | | 1 if window is the last used + window_layout | | Window layout description + window_name | #W | Name of window + window_panes | | Number of panes in window + window_silence_flag | | 1 if window has silence alert + window_width | | Width of window + window_zoomed_flag | | 1 if window is zoomed + wrap_flag | | Pane wrap flag + + +##名称和标题 + +tmux区分名称和标题,窗口和会话具有名称用来作为目标标识,并且在状态行和不同的列表中显示: +名称是tmux对于一个窗口或会话的标识符。 +只有pane面板有标题,面板的标题是由在其中运行的程序设置的并且不能由tmux改变。 +与X窗口管理器中的xterm窗口标题的设置所使用的机制相同。 +窗口本身没有标题----一个窗口的标题就是其活动面板的标题。 +tmux本身会设置客户端所在终端的标题,参考set-title选项。 + +A session's name is set with the new-session and rename-session commands. A window's name is set with one of: +一个会话的名称通过new-session和rename-session命令来设置的,一个窗口的名称可以通过以下方式设置: + + 1. 一个命令的参数(如new-window和new-session的-n参数) + 2. 一个转义序列: $ printf '\033kWINDOW_NAME\033\\' + +自动重命名会将名称设置为窗口活动面板中的活动程序,参考automatic-rename选项。 + +当一个面板第一次创建时,其标题为主机名hostname。一个面板的标题可以通过OSC标题设置序列进行设置,例如: + $ printf '\033]2;My Title\033\\' + +##环境 + +当tmux服务器启动时,tmux会将环境复制到全局环境中,此外每个会话具有一个会话环境。 +当一个窗口被创建时,会将会话环境和全局环境合并。 +如果一个变量存在两个环境中,会使用会话环境中的变量。结果就是初始环境传递给新进程。 + +当一个新会话创建或者一个就会话重新附着时,update-environment会话选项可以用来从一个客户端来更新会话环境。 +tmux也会使用一些内部信息来初始化TMUX变量以便允许命令在内部执行,TERM变量会设置为正确的终端'screen'。 + +修改和查看环境的命令有: + + set-environment [-gru] [-t target-session] name [value] + (别名:setenv) +设置或重置一个环境变量,如果使用-g,会在全局变量中进行改变;否则只会改变target-session的会话环境。 +-u标记用来重置一个变量。 -r用来指示在开起一个新进程时从环境中移除该变量。 + + show-environment [-g] [-t target-session] [variable] + (别名:showenv) +显示目标会话target-session或者全局环境(使用-g时)变量。 +如果忽略变量,会显示所有的变量。从环境中移除的变量会用'-'作为前导。 + +##状态行 +tmux包含了一个可选的状态行会显示在每个终端的底端行。 +默认状态行时有效的(可以通过status会话选项失效)并且被包含的,从左到右分别有: +包含在方括号中的当前会话名称;窗口列表;双引号包含的活动面板;以及时间和日期。 + +状态行由三部分组成: +可配置的左边和右边部分(可以包含shell命令输出的动态的内容,例如时间和日期, +参考status-left,status-left-length,status-right,status-right-length选项), 以及中间的窗口列表。 +默认窗口列表显示当前会话中按照数字升序排列窗口的索引,名称和标记(如果存在的话)。 +可以通过window-status-format和window-status-current-format选项客制化。 + +附加在窗口名称后面的标记可以是以下符号之一: + + 符号 | 含义 +---------|----------- + * | 表示当前窗口 + - | 最有一个选择的窗口。 + # | 窗口被监控并且活动会被检测。 + ! | 会在窗口中出现一个响铃。 + ~ | 窗口会在monitor-silence时间间隔中保持沉默。 + Z | 窗口的活动面板被放大了。 + +符号#与monitor-activity窗口选项相关。窗口名称会在有警告(响铃,活动或沉默)出现的时候以反转的颜色打印 + +状态行的颜色和属性是可以配置的,整个状态行使用status-style会话选项,单个的窗口使用window=status-style窗口选项配置。 + +状态行会自动地刷新如果当其在时间间隔内被改变的话,时间间隔可以通过status-interval会话选项控制。 + +与状态行相关的命令有: + + command-prompt [-I inputs] [-p prompts] [-t target-client] [template] +在客户端打开一个命令提示,可以在tmux内用用来执行交互式命令。 + +如果指定了template的话,其会被作为命令使用。 +-I是每个提示初始化文本列表-由逗号分割的。 +-p 提示是一个按照顺序显示的逗号分割的提示列表;否则只显示一个单独的构造于template(如果提供了的话)提示,否则使用':'。 +inputs和prompts都可能包含由status-left选项支持的特殊字符序列。 +在命令被执行之前,第一个出现的字符串'%%'和出现的所有'%1'都会被第一个提示的响应替换, +第二个'%%'和所有的'%2'会被第二个提示的响应替换,以此类推, 直到第九个提示可以被替换。 + + confirm-before [-p prompt] [-t target-client] command + (别名:confirm) +在执行命令之前进行确认,如果指定-p, 提示为prompt参数的显示,否则提示会从command来构造。 +可能会包含由status-left选项支持的特殊字符序列。 +这个命令只会在tmux中工作。 + + display-message [-p] [-c target-client] [-t target-pane] [message] + (别名:display) +显示一个消息, 如果没有给定-p, +那么输出会被打印到标准输出中,否则会显示在target-client的状态行上。 +消息的格式在[FORMTS](#格式)部分描述。 +如果给第-t就会从target-pane中获取信息,否则就会从附着在target-client的会话中的活动窗口中获取。 + +##缓冲区 +tmux维护了一个命名的粘贴缓冲区集合,每个可能显式地或自动地命名。 +显式地命名的缓冲区是在通过set-buffer或load-buffer命令创建时命名的, +或者是通过set-buffer -n 来重命名一个自动命名的缓冲区。 +自动命名的缓冲区的名称会类似于'buffer0001','buffer0002'等。 +当达到buffer-limit选项的限制时,最旧的自动命名的缓冲区被删除。 +显示命名的缓冲区不会收到buffer-limit的限制,可以通过delete-buffer命令删除。 + +缓冲区可以使用copy-mode或set-buffer以及load-buffer命令来添加,并且通过paste-buffer命令来将其粘贴到一个窗口。 +如果一个缓冲区命令没有指定缓冲区时,就会假设使用最近添加的自动命名的缓冲区。 + +每个窗口也会维护一个可配值的历史缓冲区,默认会保留到2000行;这个可以通过history-limit选项修改(参考set-option命令)。 + +缓冲区命令有: + choose-buffer [-F format] [-t target-window] [template] +将窗口置于缓冲区选择模式,一个缓冲区可以从一个列表中交互地选择。 +在选择一个缓冲区之后,'%%'会被template中的缓冲区名称替换,之后的结果会作为一个命令被执行。 +如果没有给定template,会使用"paste-buffer -b '%%'"来替换。 对于-F标记参考[FORMATS](#格式)部分。 +这个命令只有在至少有一个客户端附着时工作。 + + clear-history [-t target-pane] + (别名:clearhist) +对指定的pane删除并释放history。 + + delete-buffer [-b buffer-name] + (别名:deleteb) +删除名为buffer-name的缓冲区,在没有指定buffer-name时删除最佳男自动命名添加的缓冲区。 + + list-buffers [-F format] + (别名:lsb) +列出全局缓冲区,对于-F可以参考[FORMATS](#格式)部分。 + + load-buffer [-b buffer-name] path + (别名:loadb) +从path中加载指定粘贴缓冲区的内容。 + + paste-buffer [-dpr] [-b buffer-name] [-s separator] [-t target-pane] + (别名:pasteb) +将一个粘贴缓冲却中的内容插入到一个指定的pane中。如果没有指定target-pane,会被粘贴到当前的一个。 +-d 同时也会删除粘贴缓冲区。当输出时,任何粘贴缓冲区中的换行符会使用一个分隔符替换(默认为回车符)。 +-s 指定客制化分隔符。 +-r 标记意味着不做换行符的替换。 +-p 当应用程序请求大括号粘贴模式的话,粘贴的大括号控制代码会被插入到缓冲区中。 + + save-buffer [-a] [-b buffer-name] path + (别名:saveb) +将指定的粘贴缓冲区中的内容保存到一个路径path. -a选项用来指示附加模式而不是直接重写文件。 + + set-buffer [-a] [-b buffer-name] [-n new-buffer-name] data + (别名:setb) +将指定缓冲区的内容设置为data. +使用-a选项来将data附加到缓冲区而不是直接重写缓冲区。-n用来重命名缓冲区到一个new-buffer-name。 + + show-buffer [-b buffer-name] + (别名:showb) +显示指定缓冲区的内容。 + +##杂项 +其他杂项命令有: + clock-mode [-t target-pane] +显示一个大的时钟。 + + if-shell [-bF] [-t target-pane] shell-command command [command] + (别名:if) +如果shell-command返回成功的话执行第一个命令,否则执行第二个命令。 +在执行之前,shell-command会使用[FORMATS](#格式)部分指定的规则进行扩展,包括相关的target-pane。-b指示shell-command在后台运行。 +如果给定-F,shell-command不会被执行而是认为时成功的(如果既不是空的也不是0的话-在格式扩展之后)。 + + lock-server + (别名:lock) +通过运行lock-command选项指定的命令来分别锁定每个客户端。 + + run-shell [-b] [-t target-pane] shell-command + (别名:run) +在不创建一个窗口的前提下在后台中运行一个shell-command。 +执行之前,shell-command使用[FORMATS](#格式)部分指定的规则进行扩展。 +-b指示在后台运行。 +在完成之后,任何到标准输出的输出会在copy模式中显示(在由-t指定的pane或当前pane-如果缺省的话)。 +如果命令没有成功返回,退出状态也会被显示。 + + wait-for [-L | -S | -U] channel + (别名:wait) +当不带选项使用时,在使用相同的channel的wait-for -S唤醒之前阻止客户端退出。 +-L会锁定channel,任何尝试锁定相同channel的客户端会一直等待直到使用wait-for -U 解锁。 这个命令只有在tmux外部工作。 + +##TERMINFO EXTENSIONS + +tmux可以理解terminfo的一些扩展: +Cs, Cr +设置光标颜色,第一个使用一个单个字符串参数来设置颜色;第二个没有参数来恢复默认的光标颜色。 +如果设置的话一系列这样的值会被用来在tmux中改变光标颜色: + + $ printf '\033]12;red\033\\' + +Ss, Se +设置或重置光标样式。 如果设置以下的序列可能会用来将光标变为一个下划线: + + $ printf '\033[4 q' + +如果没有设置Se,Ss和参数0会被用来重新设置光标样式。 + +Ms +这个序列可以被tmux用来存储当前缓冲区到主机终端剪贴板中。可以参考set-clipboad选项和xterm的man页面。 + +##控制模式 + +tmux提供了一个成为control(控制)模式的文本界面。这使得应用程序可以通过一个简单的文本协议与tmux进行交流。 +在控制模式中,一个客户端发送tmux命令或以新行结束的命令序列到标准输入中。 +每个命令将会在标准输出中产生一个输出块。 +一个输出块包含了一个%begin行与跟随的输出(可能为空)。 +输出块会以一个%end或%error作为结尾。 +%begin和匹配的%end/%error具有两个参数:一个整数时间和命令编号,例如: + + %begin 1363006971 2 + 0: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active) + %end 1363006971 2 + +在控制模式中,tmux输出通知,一个通知不会出现在输出块中。 + +下面是通知的定义: + + %exit [reason] + +当tmux客户端没有附着在任何会话中或者出现错误时,tmux客户端会立即退出。如果存在的话,reason描述了客户端退出的原因。 + + %layout-change window-id window-layout + +一个带有window-id的窗口布局被改变,新的布局为window-layout。 + + %output pane-id value + +一个窗口面板产生的输出。 值会转义非打印字符而且饭斜线作为八进制\xxx。 + + %session-changed session-id name +客户端现在被附着在ID为session-id的会话上,并且使用name命名。 + + %session-renamed name +当前会话被重命名为name。 + + %sessions-changed + +一个会话被创建或销毁。 + + %unlinked-window-add window-id + +ID为window-id的窗口被创建,但是没有连接到当前会话。 + + %window-add window-id +ID为window-id的窗口被连接到当前会话。 + + %window-close window-id +ID为window-id的窗口被关闭。 + + %window-renamed window-id name +ID为window-id的窗口重命名为name。 + +##文件 +o + ~/.tmux.conf : 默认的tmux配置文件。 + /etc/tmux.conf : 系统范围的配置文件。 + +##样例 + +创建一个运行vi的新的tmux会话: + + $ tmux new-session vi + +大部分命令具有一个简短形式,也成为别名。例如new-session的别名为new: + $ tmux new vi + +可选地,一个命令最短的不混淆的简短格式是被接受的,如果有多个选项,会被列出: + + $ tmux n + ambiguous command: n, could be: new-session, new-window, next-window + +在一个活动会话中,一个新的窗口可以通过键入'C-b c'来创建(ctrl 跟随b 然后跟随c键)。 + +窗口可以使用'C-b 0-9'来在窗口0-9中导航,也可以通过'C-b n'选择下一个窗口,'C-b p'选择上一个窗口。 + +一个会话可以通过使用'C-b d'来脱离附着,也可以通过以下命令来重新附着: + $ tmux attach-session + +键入'C-b ?' 列出当前窗口中的当前键绑定; 使用上下箭头可以导航列表,'q'从其中退出。 + +当tmux启动时运行的命令可能放置在 ~/.tmux.conf配置文件中,常见样例包括: + +改变默认的前导键: + + set-option -g prefix C-a + unbind-key C-b + bind-key C-a send-prefix + +关闭状态行或者改变其颜色: + + set-option -g status off + set-option -g status-style bg=blue + +设置其他选项,例如默认命令或者在30分钟不活动之后锁定: + + set-option -g default-command "exec /bin/ksh" + set-option -g lock-after-time 1800 + +创建新的键绑定: + + bind-key b set-option status + bind-key / command-prompt "split-window 'exec man %%'" + bind-key S command-prompt "new-window -n %1 'ssh %1'" + +参考: pty(4) + +作者: Nicholas Marriott + +译者: Liang Guisheng From 3855fdb020c44b6bd8d075c8cc55d76de00fc922 Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Fri, 12 Jun 2015 11:25:22 +0800 Subject: [PATCH 067/153] Translating by ZTinoZ --- ... 20 Useful Terminal Emulators for Linux.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index 4ff7820781..1b239a3904 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -14,7 +14,7 @@ Terminator是一款先进且强大的终端仿真器,它支持多终端窗口 #### Terminator的特性 #### -- 自定义外形和色彩设计,根据你的需要设置尺寸。 +- 自定义外形和配色方案,根据你的需要设置尺寸。 - 使用插件来获取更多功能。 - 快捷键可以加快普通操作。 - 可以把终端窗口分裂成几个虚拟终端并把它们重新设置成你需要的尺寸。 @@ -34,7 +34,7 @@ Tilda是一款漂亮的基于GTK+的下拉式终端,敲击一个键你就可 - 高度定制的选项界面设置。 - 你可以给Tilda设置透明度。 -- 优秀的嵌入式色彩设计。 +- 优秀的嵌入式配色方案。 ![Tilda Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Tilda-Emulator.jpeg) @@ -75,9 +75,9 @@ Yakuake Terminal ### 5. ROXTerm ### -ROXterm又是一款轻量级终端仿真器,旨在提供与GNOME终端相似的特性。它原本创造出来是为了通过不使用Gnome库从而拥有更少的占用空间和更快的启动速度并使用独立的小程序来建立配置界面(GUI), 但是随着时间的流逝,它的角色就转变为给那些老牌用户带来更高一层的特性。 +ROXterm又是一款轻量级终端仿真器,旨在提供与GNOME终端相似的特性。它原本创造出来是为了通过不使用Gnome库从而拥有更少的占用空间和更快的启动速度并使用独立的小程序来建立配置界面(GUI), 但是随着时间的流逝,它的角色就转变为给那些高级用户带来更高一层的特性。 -然而,它比GNOME终端更加具有可制定性并且对于那些经常使用终端的老牌用户更令人期望。它能和GNOME桌面环境完美结合并在终端中提供像拖拽项目那样的特性。 +然而,它比GNOME终端更加具有可制定性并且对于那些经常使用终端的高级用户更令人期望。它能和GNOME桌面环境完美结合并在终端中提供像拖拽项目那样的特性。 ![Roxterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Roxterm-Terminal.jpeg) @@ -97,7 +97,7 @@ Eterm Terminal ### 7. Rxvt ### -代表着扩展虚拟终端的Rxvt是一款彩色终端仿真器,为那些不需要一些特性例如Tektronix 4014仿真和toolkit-style可配置性的老牌用户而生的xterm的替代品。 +代表着扩展虚拟终端的Rxvt是一款彩色终端仿真器,为那些不需要一些特性例如Tektronix 4014仿真和toolkit-style可配置性的高级用户而生的xterm的替代品。 ![Rxvt Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Rxvt-Terminal.jpeg) @@ -107,7 +107,7 @@ Rxvt Terminal ### 8. Wterm ### -Wterm is a another light weight color terminal emulator based on rxvt project. It includes features such as background images, transparency, reverse transparency and an considerable set or runtime options are accessible resulting in a very high customizable terminal emulator. +Wterm是另一款以rxvt项目为基础的轻量级彩色终端仿真器。它所包含的特性包括设置背景图片、透明度、反向透明度和大量的设置或运行环境选项让它成为一款可高度自定义的终端仿真器。 ![wterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/wterm-Terminal-.jpeg) @@ -117,14 +117,14 @@ wterm Terminal ### 9. LXTerminal ### -LXTerminal is a default VTE-based terminal emulator for LXDE (Lightweight X Desktop Environment) without any unnecessary dependency. The terminal has got some nice features such as. +LXTerminal是一款基于VTE的终端仿真器,默认运行于没有任何多余依赖的LXDE(轻量级X桌面环境)下。这款终端有很多很棒的特性。 -LXTerminal Features +#### LXTerminal的特性 #### -- Multiple tabs support -- Supports common commands like cp, cd, dir, mkdir, mvdir. -- Feature to hide the menu bar for saving space -- Change the color scheme. +- 多标签支持 +- 支持普通命令如cp, cd, dir, mkdir, mvdir +- 隐藏菜单栏以保证足够界面空间 +- 更改配色方案 ![lxterminal Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/lxterminal-Terminal.jpeg) @@ -136,13 +136,13 @@ lxterminal Terminal Konsole是另一款强大的基于KDE的免费终端仿真器,最初由Lars Doelle创造。 -Konsole的特性 +#### Konsole的特性 #### - 多标签式终端 - 半透明背景 - 支持拆分视图模式 - 目录和SSH书签化 -- 可定制的颜色设计 +- 可定制的配色方案 - 可定制的按键绑定 - 终端中的活动通知警告 - 增量搜索 From d28df772bfc9222f544c16a9a80ceb0e8bcf8f01 Mon Sep 17 00:00:00 2001 From: DeadFire Date: Fri, 12 Jun 2015 14:28:36 +0800 Subject: [PATCH 068/153] =?UTF-8?q?20150612-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...w We Designed for Performance and Scale.md | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md diff --git a/sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md b/sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md new file mode 100644 index 0000000000..559d28996c --- /dev/null +++ b/sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md @@ -0,0 +1,174 @@ +Inside NGINX: How We Designed for Performance & Scale +================================================================================ +NGINX leads the pack in web performance, and it’s all due to the way the software is designed. Whereas many web servers and application servers use a simple threaded or process-based architecture, NGINX stands out with a sophisticated event-driven architecture that enables it to scale to hundreds of thousands of concurrent connections on modern hardware. + +The [Inside NGINX][1] infographic drills down from the high-level process architecture to illustrate how NGINX handles multiple connections within a single process. This blog explains how it all works in further detail. + +### Setting the Scene – the NGINX Process Model ### + +![Master Process](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.36.30-PM.png) + +To better understand this design, you need to understand how NGINX runs. NGINX has a master process (which performs the privileged operations such as reading configuration and binding to ports) and a number of worker and helper processes. + + # service nginx restart + * Restarting nginx + # ps -ef --forest | grep nginx + root 32475 1 0 13:36 ? 00:00:00 nginx: master process /usr/sbin/nginx \ + -c /etc/nginx/nginx.conf + nginx 32476 32475 0 13:36 ? 00:00:00 \_ nginx: worker process + nginx 32477 32475 0 13:36 ? 00:00:00 \_ nginx: worker process + nginx 32479 32475 0 13:36 ? 00:00:00 \_ nginx: worker process + nginx 32480 32475 0 13:36 ? 00:00:00 \_ nginx: worker process + nginx 32481 32475 0 13:36 ? 00:00:00 \_ nginx: cache manager process + nginx 32482 32475 0 13:36 ? 00:00:00 \_ nginx: cache loader process + +On this 4-core server, the NGINX master process creates 4 worker processes and a couple of cache helper processes which manage the on-disk content cache. + +### Why Is Architecture Important? ### + +The fundamental basis of any Unix application is the thread or process. (From the Linux OS perspective, threads and processes are mostly identical; the major difference is the degree to which they share memory.) A thread or process is a self-contained set of instructions that the operating system can schedule to run on a CPU core. Most complex applications run multiple threads or processes in parallel for two reasons: + +- They can use more compute cores at the same time. +- Threads and processes make it very easy to do operations in parallel (for example, to handle multiple connections at the same time). + +Processes and threads consume resources. They each use memory and other OS resources, and they need to be swapped on and off the cores (an operation called a context switch). Most modern servers can handle hundreds of small, active threads or processes simultaneously, but performance degrades seriously once memory is exhausted or when high I/O load causes a large volume of context switches. + +The common way to design network applications is to assign a thread or process to each connection. This architecture is simple and easy to implement, but it does not scale when the application needs to handle thousands of simultaneous connections. + +### How Does NGINX Work? ### + +NGINX uses a predictable process model that is tuned to the available hardware resources: + +- The master process performs the privileged operations such as reading configuration and binding to ports, and then creates a small number of child processes (the next three types). +- The cache loader process runs at startup to load the disk-based cache into memory, and then exits. It is scheduled conservatively, so its resource demands are low. +- The cache manager process runs periodically and prunes entries from the disk caches to keep them within the configured sizes. +- The worker processes do all of the work! They handle network connections, read and write content to disk, and communicate with upstream servers. + +The NGINX configuration recommended in most cases – running one worker process per CPU core – makes the most efficient use of hardware resources. You configure it by including the [worker_processes auto][2] directive in the configuration: + + worker_processes auto; + +When an NGINX server is active, only the worker processes are busy. Each worker process handles multiple connections in a non-blocking fashion, reducing the number of context switches. + +Each worker process is single-threaded and runs independently, grabbing new connections and processing them. The processes can communicate using shared memory for shared cache data, session persistence data, and other shared resources. + +### Inside the NGINX Worker Process ### + +![](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.39.48-PM.png) + +Each NGINX worker process is initialized with the NGINX configuration and is provided with a set of listen sockets by the master process. + +The NGINX worker processes begin by waiting for events on the listen sockets ([accept_mutex][3] and [kernel socket sharding][4]). Events are initiated by new incoming connections. These connections are assigned to a state machine – the HTTP state machine is the most commonly used, but NGINX also implements state machines for stream (raw TCP) traffic and for a number of mail protocols (SMTP, IMAP, and POP3). + +![Internet Requests](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.40.32-PM.png) + +The state machine is essentially the set of instructions that tell NGINX how to process a request. Most web servers that perform the same functions as NGINX use a similar state machine – the difference lies in the implementation. + +### Scheduling the State Machine ### + +Think of the state machine like the rules for chess. Each HTTP transaction is a chess game. On one side of the chessboard is the web server – a grandmaster who can make decisions very quickly. On the other side is the remote client – the web browser that is accessing the site or application over a relatively slow network. + +However, the rules of the game can be very complicated. For example, the web server might need to communicate with other parties (proxying to an upstream application) or talk to an authentication server. Third-party modules in the web server can even extend the rules of the game. + +#### A Blocking State Machine #### + +Recall our description of a process or thread as a self-contained set of instructions that the operating system can schedule to run on a CPU core. Most web servers and web applications use a process-per-connection or thread-per-connection model to play the chess game. Each process or thread contains the instructions to play one game through to the end. During the time the process is run by the server, it spends most of its time ‘blocked’ – waiting for the client to complete its next move. + +![Blocking I/O](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.40.52-PM.png) + +1. The web server process listens for new connections (new games initiated by clients) on the listen sockets. +1. When it gets a new game, it plays that game, blocking after each move to wait for the client’s response. +1. Once the game completes, the web server process might wait to see if the client wants to start a new game (this corresponds to a keepalive connection). If the connection is closed (the client goes away or a timeout occurs), the web server process returns to listening for new games. + +The important point to remember is that every active HTTP connection (every chess game) requires a dedicated process or thread (a grandmaster). This architecture is simple and easy to extend with third-party modules (‘new rules’). However, there’s a huge imbalance: the rather lightweight HTTP connection, represented by a file descriptor and a small amount of memory, maps to a separate thread or process, a very heavyweight operating system object. It’s a programming convenience, but it’s massively wasteful. + +#### NGINX is a True Grandmaster #### + +Perhaps you’ve heard of [simultaneous exhibition][5] games, where one chess grandmaster plays dozens of opponents at the same time? + +![Kiril Georgiev](http://cdn.nginx.com/wp-content/uploads/2015/06/Kiril-Georgiev.gif) + +[Kiril Georgiev played 360 people simultaneously in Sofia, Bulgaria][6]. His final score was 284 wins, 70 draws and 6 losses. + +That’s how an NGINX worker process plays “chess.” Each worker (remember – there’s usually one worker for each CPU core) is a grandmaster that can play hundreds (in fact, hundreds of thousands) of games simultaneously. + +![Event-driven Architecture](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.41.13-PM.png) + +1. The worker waits for events on the listen and connection sockets. +1. Events occur on the sockets and the worker handles them: + + - An event on the listen socket means that a client has started a new chess game. The worker creates a new connection socket. + - An event on a connection socket means that the client has made a new move. The worker responds promptly. + +A worker never blocks on network traffic, waiting for its “opponent” (the client) to respond. When it has made its move, the worker immediately proceeds to other games where moves are waiting to be processed, or welcomes new players in the door. + +### Why Is This Faster than a Blocking, Multi-Process Architecture? ### + +NGINX scales very well to support hundreds of thousands of connections per worker process. Each new connection creates another file descriptor and consumes a small amount of additional memory in the worker process. There is very little additional overhead per connection. NGINX processes can remain pinned to CPUs. Context switches are relatively infrequent and occur when there is no work to be done. + +In the blocking, connection-per-process approach, each connection requires a large amount of additional resources and overhead, and context switches (swapping from one process to another) are very frequent. + +For a more detailed explanation, check out this [article][7] about NGINX architecture, by Andrew Alexeev, VP of Corporate Development and Co-Founder at NGINX, Inc. + +With appropriate [system tuning][8], NGINX can scale to handle hundreds of thousands of concurrent HTTP connections per worker process, and can absorb traffic spikes (an influx of new games) without missing a beat. + +### Updating Configuration and Upgrading NGINX ### + +NGINX’s process architecture, with a small number of worker processes, makes for very efficient updating of the configuration and even the NGINX binary itself. + +![Updating Configuration](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.41.33-PM.png) + +Updating NGINX configuration is a very simple, lightweight, and reliable operation. It typically just means running the `nginx –s reload` command, which checks the configuration on disk and sends the master process a SIGHUP signal. + +When the master process receives a SIGHUP, it does two things: + +- Reloads the configuration and forks a new set of worker processes. These new worker processes immediately begin accepting connections and processing traffic (using the new configuration settings). +- Signals the old worker processes to gracefully exit. The worker processes stop accepting new connections. As soon as each current HTTP request completes, the worker process cleanly shuts down the connection (that is, there are no lingering keepalives). Once all connections are closed, the worker processes exit. + +This reload process can cause a small spike in CPU and memory usage, but it’s generally imperceptible compared to the resource load from active connections. You can reload the configuration multiple times per second (and many NGINX users do exactly that). Very rarely, issues arise when there are many generations of NGINX worker processes waiting for connections to close, but even those are quickly resolved. + +NGINX’s binary upgrade process achieves the holy grail of high-availability – you can upgrade the software on the fly, without any dropped connections, downtime, or interruption in service. + +![New Binary](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.41.51-PM.png) + +The binary upgrade process is similar in approach to the graceful reload of configuration. A new NGINX master process runs in parallel with the original master process, and they share the listening sockets. Both processes are active, and their respective worker processes handle traffic. You can then signal the old master and its workers to gracefully exit. + +The entire process is described in more detail in [Controlling NGINX][9]. + +### Conclusion ### + +The [Inside NGINX infographic][10] provides a high-level overview of how NGINX functions, but behind this simple explanation is over ten years of innovation and optimization that enable NGINX to deliver the best possible performance on a wide range of hardware while maintaining the security and reliability that modern web applications require. + +If you’d like to read more about the optimizations in NGINX, check out these great resources: + +- [Installing and Tuning NGINX for Performance][11] (webinar; [slides][12] at Speaker Deck) +- [Tuning NGINX for Performance][13] +- [The Architecture of Open Source Applications – NGINX][14] +- [Socket Sharding in NGINX Release 1.9.1][15] (using the SO_REUSEPORT socket option) + +-------------------------------------------------------------------------------- + +via: http://nginx.com/blog/inside-nginx-how-we-designed-for-performance-scale/ + +作者:[Owen Garrett][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://nginx.com/author/owen/ +[1]:http://nginx.com/resources/library/infographic-inside-nginx/ +[2]:http://nginx.org/en/docs/ngx_core_module.html#worker_processes +[3]:http://nginx.org/en/docs/ngx_core_module.html#accept_mutex +[4]:http://nginx.com/blog/socket-sharding-nginx-release-1-9-1/ +[5]:http://en.wikipedia.org/wiki/Simultaneous_exhibition +[6]:http://gambit.blogs.nytimes.com/2009/03/03/in-chess-records-were-made-to-be-broken/ +[7]:http://www.aosabook.org/en/nginx.html +[8]:http://nginx.com/blog/tuning-nginx/ +[9]:http://nginx.org/en/docs/control.html +[10]:http://nginx.com/resources/library/infographic-inside-nginx/ +[11]:http://nginx.com/resources/webinars/installing-tuning-nginx/ +[12]:https://speakerdeck.com/nginx/nginx-installation-and-tuning +[13]:http://nginx.com/blog/tuning-nginx/ +[14]:http://www.aosabook.org/en/nginx.html +[15]:http://nginx.com/blog/socket-sharding-nginx-release-1-9-1/ \ No newline at end of file From 1ca6167f0f43b7469c2c72ee7802ae9e2ff9092b Mon Sep 17 00:00:00 2001 From: DeadFire Date: Fri, 12 Jun 2015 14:55:11 +0800 Subject: [PATCH 069/153] =?UTF-8?q?20150612-2=20=E9=80=89=E9=A2=98=20RHCSA?= =?UTF-8?q?=20Series=2014?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Up LDAP-based Authentication in RHEL 7.md | 275 ++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 sources/tech/RHCSA Series/RHCSA Series--Part 14--Setting Up LDAP-based Authentication in RHEL 7.md diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 14--Setting Up LDAP-based Authentication in RHEL 7.md b/sources/tech/RHCSA Series/RHCSA Series--Part 14--Setting Up LDAP-based Authentication in RHEL 7.md new file mode 100644 index 0000000000..36bf319b19 --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 14--Setting Up LDAP-based Authentication in RHEL 7.md @@ -0,0 +1,275 @@ +RHCSA Series: Setting Up LDAP-based Authentication in RHEL 7 – Part 14 +================================================================================ +We will begin this article by outlining some LDAP basics (what it is, where it is used and why) and show how to set up a LDAP server and configure a client to authenticate against it using Red Hat Enterprise Linux 7 systems. + +![Setup LDAP Server and Client Authentication](http://www.tecmint.com/wp-content/uploads/2015/06/setup-ldap-server-and-configure-client-authentication.png) + +RHCSA Series: Setup LDAP Server and Client Authentication – Part 14 + +As we will see, there are several other possible application scenarios, but in this guide we will focus entirely on LDAP-based authentication. In addition, please keep in mind that due to the vastness of the subject, we will only cover its basics here, but you can refer to the documentation outlined in the summary for more in-depth details. + +For the same reason, you will note that I have decided to leave out several references to man pages of LDAP tools for the sake of brevity, but the corresponding explanations are at a fingertip’s distance (man ldapadd, for example). + +That said, let’s get started. + +**Our Testing Environment** + +Our test environment consists of two RHEL 7 boxes: + + Server: 192.168.0.18. FQDN: rhel7.mydomain.com + Client: 192.168.0.20. FQDN: ldapclient.mydomain.com + +If you want, you can use the machine installed in [Part 12: Automate RHEL 7 installations][1] using Kickstart as client. + +#### What is LDAP? #### + +LDAP stands for Lightweight Directory Access Protocol and consists in a set of protocols that allows a client to access, over a network, centrally stored information (such as a directory of login shells, absolute paths to home directories, and other typical system user information, for example) that should be accessible from different places or available to a large number of end users (another example would be a directory of home addresses and phone numbers of all employees in a company). + +Keeping such (and more) information centrally means it can be more easily maintained and accessed by everyone who has been granted permissions to use it. + +The following diagram offers a simplified diagram of LDAP, and is described below in greater detail: + +![LDAP Diagram](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Diagram.png) + +LDAP Diagram + +Explanation of above diagram in detail. + +- An entry in a LDAP directory represents a single unit or information and is uniquely identified by what is called a Distinguished Name. +- An attribute is a piece of information associated with an entry (for example, addresses, available contact phone numbers, and email addresses). +- Each attribute is assigned one or more values consisting in a space-separated list. A value that is unique per entry is called a Relative Distinguished Name. + +That being said, let’s proceed with the server and client installations. + +### Installing and Configuring a LDAP Server and Client ### + +In RHEL 7, LDAP is implemented by OpenLDAP. To install the server and client, use the following commands, respectively: + + # yum update && yum install openldap openldap-clients openldap-servers + # yum update && yum install openldap openldap-clients nss-pam-ldapd + +Once the installation is complete, there are some things we look at. The following steps should be performed on the server alone, unless explicitly noted: + +**1. Make sure SELinux does not get in the way by enabling the following booleans persistently, both on the server and the client:** + + # setsebool -P allow_ypbind=0 authlogin_nsswitch_use_ldap=0 + +Where allow_ypbind is required for LDAP-based authentication, and authlogin_nsswitch_use_ldap may be needed by some applications. + +**2. Enable and start the service:** + + # systemctl enable slapd.service + # systemctl start slapd.service + +Keep in mind that you can also disable, restart, or stop the service with [systemctl][2] as well: + + # systemctl disable slapd.service + # systemctl restart slapd.service + # systemctl stop slapd.service + +**3. Since the slapd service runs as the ldap user (which you can verify with ps -e -o pid,uname,comm | grep slapd), such user should own the /var/lib/ldap directory in order for the server to be able to modify entries created by administrative tools that can only be run as root (more on this in a minute).** + +Before changing the ownership of this directory recursively, copy the sample database configuration file for slapd into it: + + # cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG + # chown -R ldap:ldap /var/lib/ldap + +**4. Set up an OpenLDAP administrative user and assign a password:** + + # slappasswd + +as shown in the next image: + +![Set LDAP Admin Password](http://www.tecmint.com/wp-content/uploads/2015/06/Set-LDAP-Admin-Password.png) + +Set LDAP Admin Password + +and create an LDIF file (ldaprootpasswd.ldif) with the following contents: + + dn: olcDatabase={0}config,cn=config + changetype: modify + add: olcRootPW + olcRootPW: {SSHA}PASSWORD + +where: + +- PASSWORD is the hashed string obtained earlier. +- cn=config indicates global config options. +- olcDatabase indicates a specific database instance name and can be typically found inside /etc/openldap/slapd.d/cn=config. + +Referring to the theoretical background provided earlier, the `ldaprootpasswd.ldif` file will add an entry to the LDAP directory. In that entry, each line represents an attribute: value pair (where dn, changetype, add, and olcRootPW are the attributes and the strings to the right of each colon are their corresponding values). + +You may want to keep this in mind as we proceed further, and please note that we are using the same Common Names `(cn=)` throughout the rest of this article, where each step depends on the previous one. + +**5. Now, add the corresponding LDAP entry by specifying the URI referring to the ldap server, where only the protocol/host/port fields are allowed.** + + # ldapadd -H ldapi:/// -f ldaprootpasswd.ldif + +The output should be similar to: + +![LDAP Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Configuration.png) + +LDAP Configuration + +and import some basic LDAP definitions from the `/etc/openldap/schema` directory: + + # for def in cosine.ldif nis.ldif inetorgperson.ldif; do ldapadd -H ldapi:/// -f /etc/openldap/schema/$def; done + +![LDAP Definitions](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Definitions.png) + +LDAP Definitions + +**6. Have LDAP use your domain in its database.** + +Create another LDIF file, which we will call `ldapdomain.ldif`, with the following contents, replacing your domain (in the Domain Component dc=) and password as appropriate: + + dn: olcDatabase={1}monitor,cn=config + changetype: modify + replace: olcAccess + olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" + read by dn.base="cn=Manager,dc=mydomain,dc=com" read by * none + + dn: olcDatabase={2}hdb,cn=config + changetype: modify + replace: olcSuffix + olcSuffix: dc=mydomain,dc=com + + dn: olcDatabase={2}hdb,cn=config + changetype: modify + replace: olcRootDN + olcRootDN: cn=Manager,dc=mydomain,dc=com + + dn: olcDatabase={2}hdb,cn=config + changetype: modify + add: olcRootPW + olcRootPW: {SSHA}PASSWORD + + dn: olcDatabase={2}hdb,cn=config + changetype: modify + add: olcAccess + olcAccess: {0}to attrs=userPassword,shadowLastChange by + dn="cn=Manager,dc=mydomain,dc=com" write by anonymous auth by self write by * none + olcAccess: {1}to dn.base="" by * read + olcAccess: {2}to * by dn="cn=Manager,dc=mydomain,dc=com" write by * read + +Then load it as follows: + + # ldapmodify -H ldapi:/// -f ldapdomain.ldif + +![LDAP Domain Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Domain-Configuration.png) + +LDAP Domain Configuration + +**7. Now it’s time to add some entries to our LDAP directory. Attributes and values are separated by a colon `(:)` in the following file, which we’ll name `baseldapdomain.ldif`:** + + dn: dc=mydomain,dc=com + objectClass: top + objectClass: dcObject + objectclass: organization + o: mydomain com + dc: mydomain + + dn: cn=Manager,dc=mydomain,dc=com + objectClass: organizationalRole + cn: Manager + description: Directory Manager + + dn: ou=People,dc=mydomain,dc=com + objectClass: organizationalUnit + ou: People + + dn: ou=Group,dc=mydomain,dc=com + objectClass: organizationalUnit + ou: Group + +Add the entries to the LDAP directory: + + # ldapadd -x -D cn=Manager,dc=mydomain,dc=com -W -f baseldapdomain.ldif + +![Add LDAP Domain Attributes and Values](http://www.tecmint.com/wp-content/uploads/2015/06/Add-LDAP-Domain-Configuration.png) + +Add LDAP Domain Attributes and Values + +**8. Create a LDAP user called ldapuser (adduser ldapuser), then create the definitions for a LDAP group in `ldapgroup.ldif`.** + + # adduser ldapuser + # vi ldapgroup.ldif + +Add following content. + + dn: cn=Manager,ou=Group,dc=mydomain,dc=com + objectClass: top + objectClass: posixGroup + gidNumber: 1004 + +where gidNumber is the GID in /etc/group for ldapuser) and load it: + + # ldapadd -x -W -D "cn=Manager,dc=mydomain,dc=com" -f ldapgroup.ldif + +**9. Add a LDIF file with the definitions for user ldapuser (`ldapuser.ldif`):** + + dn: uid=ldapuser,ou=People,dc=mydomain,dc=com + objectClass: top + objectClass: account + objectClass: posixAccount + objectClass: shadowAccount + cn: ldapuser + uid: ldapuser + uidNumber: 1004 + gidNumber: 1004 + homeDirectory: /home/ldapuser + userPassword: {SSHA}fiN0YqzbDuDI0Fpqq9UudWmjZQY28S3M + loginShell: /bin/bash + gecos: ldapuser + shadowLastChange: 0 + shadowMax: 0 + shadowWarning: 0 + +and load it: + + # ldapadd -x -D cn=Manager,dc=mydomain,dc=com -W -f ldapuser.ldif + +![LDAP User Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-User-Configuration.png) + +LDAP User Configuration + +Likewise, you can delete the user entry you just created: + + # ldapdelete -x -W -D cn=Manager,dc=mydomain,dc=com "uid=ldapuser,ou=People,dc=mydomain,dc=com" + +**10. Allow communication through the firewall:** + + # firewall-cmd --add-service=ldap + +**11. Last, but not least, enable the client to authenticate using LDAP.** + +To help us in this final step, we will use the authconfig utility (an interface for configuring system authentication resources). + +Using the following command, the home directory for the requested user is created if it doesn’t exist after the authentication against the LDAP server succeeds: + + # authconfig --enableldap --enableldapauth --ldapserver=rhel7.mydomain.com --ldapbasedn="dc=mydomain,dc=com" --enablemkhomedir --update + +![LDAP Client Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Client-Configuration.png) + +LDAP Client Configuration + +### Summary ### + +In this article we have explained how to set up basic authentication against a LDAP server. To further configure the setup described in the present guide, please refer to [Chapter 13 – LDAP Configuration][3] in the RHEL 7 System administrator’s guide, paying special attention to the security settings using TLS. + +Feel free to leave any questions you may have using the comment form below. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/setup-ldap-server-and-configure-client-authentication/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/automatic-rhel-installations-using-kickstart/ +[2]:http://www.tecmint.com/manage-services-using-systemd-and-systemctl-in-linux/ +[3]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Directory_Servers.html \ No newline at end of file From ee107f6081605dce3fc6a61a7c7e33c3fe0d448c Mon Sep 17 00:00:00 2001 From: DeadFire Date: Fri, 12 Jun 2015 15:36:37 +0800 Subject: [PATCH 070/153] =?UTF-8?q?20150612-3=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...che Containers with Docker on Fedora 22.md | 282 ++++++++++++++++++ ...gure Swarm Native Clustering for Docker.md | 95 ++++++ ...Color ANSI Logos of Linux Distributions.md | 183 ++++++++++++ 3 files changed, 560 insertions(+) create mode 100644 sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md create mode 100644 sources/tech/20150612 How to Configure Swarm Native Clustering for Docker.md create mode 100644 sources/tech/20150612 Linux_Logo--A Command Line Tool to Print Color ANSI Logos of Linux Distributions.md diff --git a/sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md b/sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md new file mode 100644 index 0000000000..493e474c7e --- /dev/null +++ b/sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md @@ -0,0 +1,282 @@ +How to Configure Apache Containers with Docker on Fedora 22 +================================================================================ +In this article we are going to learn about Docker, how to use it to deploy Apache httpd and how can you share it on Docker Hub. First we are going to learn how to pull and use images hosted on Docker Hub, and then install Apache on an image of Fedora 22 interactively, after that we are going to learn how to use a Dockerfile to make an image in a faster and more elegant way, finally we are going to publish the image we've created in Docker Hub, so anyone will be able download and use it later. + +### Installing Docker and saying hello world ### + +**Requirements** + +You will need atleast these things to run Docker: + +- You need a 64bit Kernel version 3.10 or higher +- Iptables 1.4 - This will be used by Docker to make the network wizardry, such as Network Address Translation. +- Git 1.7 - Docker uses Git to make it transactions to repositories, like Docker Hub +- ps - This utility is present in most environments and is provided in the procps package. +- root - despite normal users can run docker client by TCP and other means, we will assume that you are root, for sake of simplicity + +#### Install docker using dnf #### + +The following commands will install Docker + + dnf update && dnf install docker + +**Note**: You can still use Yum in Fedora 22, but it's deprecated in favor of DNF and is not present in a clean install. + +#### Check your install #### + +The first command we are going to use is docker info, this give you many information: + + docker info + +Also try **docker version**: + + docker version + +#### Starting Docker as daemon #### + +You should start a docker instance that will take care of our requests. + + docker -d + +Now set docker to start with the system, so you don't need to run the previous command every time you reboot. + + chkconfig docker on + +Let's say hello world with Busybox: + + docker run -t busybox /bin/echo "hello world" + +In this command, we tell Docker to execute /bin/echo "hello world" in an instance/container of the Busybox image, which is a minimal POSIX environment based in a single binary and links to it. + +If Docker can't find a local image of Busybox on your system, it will pull the image automatically from Docker Hub, as you can see in the following screenshot: + +![Hello world with Busybox](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-hello-world-busybox-complete.png) + +Hello world with Busybox + +Try the same command again, this time as Docker already have the Busybox image locally, all you will see is the output of echo: + + docker run -t busybox /bin/echo "hello world" + +Try also the following to enter in the container environment: + + docker run -it busybox /bin/sh + +To leave and stop the container use the **exit** command + +### Dockerizing Apache interactively ### + +Pull/Download the Fedora image: + + docker pull fedora:22 + +Run a container dettached from the console: + + docker run -d -t fedora:22 /bin/bash + +List running containers and identify by name as follows + + docker ps + +![listing with docker ps and attaching with docker attach](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-ps-with-docker-attach-highlight.png) + +listing with docker ps and attaching with docker attach + +The name angry_nobel was given to our instance, so let's attach: + + docker attach angry_nobel + +Note: Every time you run a container a new name will be given, if you need a constant name for you container you should use the -name parameter to docker run command. + +#### Installing Apache #### + +The following command will update DNF database, download install Apache (httpd package) and clean DNF cache to make the image small + + dnf -y update && dnf -y install httpd && dnf -y clean all + +Configuring Apache + +The only thing we are going to change httpd.conf is the ServerName, this makes Apache stops to complain. + + sed -i.orig 's/#ServerName/ServerName/' /etc/httpd/conf/httpd.conf + +**Set the environment** + +To make Apache run in standalone mode, you must provide some information in the form of enviroenment variables, and also you will need the directories set in these variables, so we are going to make this with a small shell script that will also start Apache + + vi /etc/httpd/run_apache_foreground + +---------- + + #!/bin/bash + + #set variables + APACHE_LOG_DI=R"/var/log/httpd" + APACHE_LOCK_DIR="/var/lock/httpd" + APACHE_RUN_USER="apache" + APACHE_RUN_GROUP="apache" + APACHE_PID_FILE="/var/run/httpd/httpd.pid" + APACHE_RUN_DIR="/var/run/httpd" + + #create directories if necessary + if ! [ -d /var/run/httpd ]; then mkdir /var/run/httpd;fi + if ! [ -d /var/log/httpd ]; then mkdir /var/log/httpd;fi + if ! [ -d /var/lock/httpd ]; then mkdir /var/lock/httpd;fi + + #run Apache + httpd -D FOREGROUND + +**Alternatively**, you can past and run this snippet on the container shell: + + dnf -y install git && git clone https://github.com/gaiada/run-apache-foreground.git && cd run-apach* && ./install && dnf erase git + +The inline script above will, install Git, clone [this repository][1], put the script in place and ask you if you want uninstall Git. + +**Saving your container state** + +Your container is now ready to run Apache, now it is time to save the current state of this container in an image to be able use whenever you need. + +To leave the container environment, you must press **Ctrl+p** followed by **Ctrl+q**, if you just call exit in the shell, you will also stop the container and lost what you have done so far. + +Once you are back to the Docker host, use **docker commit** followed by the container and the repository name/tag you desire: + + docker commit angry_nobel gaiada/apache + +Now that you saved the container status into a image, you can use **docker stop** on the running container: + + docker stop angry_nobel + +**Run and test your image** + +Finally, run a container from your new image and redirect connections on port 80 to it with: + + docker run -p 80:80 -d -t gaiada/apache /etc/httpd/run_apache_foreground + + + +At this point, you are already running Apache in your container, open your browser to access the service in [http://localhost][2] and you will see the Apache default page as follows + +![Apache default page running from Docker container](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-apache-running.png) + +Apache default page running from Docker container + +### Dockerizing Apache with a Dockerfile ### + +Now we are going to create a new Apache image, this time the steps will be written in a Dockerfile, that will be processed to form the image. + +First, create a directory on which we will put the Dockerfile and enter this directory: + + mkdir apachedf; cd apachedf + +And then create a file named Dockerfile with the following content: + + FROM fedora:22 + + MAINTAINER Carlos Alberto + LABEL version="0.1" + + RUN dnf -y update && dnf -y install httpd && dnf -y clean all + + RUN [ -d /var/log/httpd ] || mkdir /var/log/httpd + RUN [ -d /var/run/httpd ] || mkdir /var/run/httpd + RUN [ -d /var/lock/httpd ] || mkdir /var/lock/httpd + + RUN sed -i.orig 's/#ServerName/ServerName/' /etc/httpd/conf/httpd.conf + + ENV APACHE_RUN_USER apache + ENV APACHE_RUN_GROUP apache + ENV APACHE_LOG_DIR /var/log/httpd + ENV APACHE_LOCK_DIR /var/lock/httpd + ENV APACHE_RUN_DIR /var/run/httpd + ENV APACHE_PID_FILE /var/run/httpd/httpd.pid + + EXPOSE 80 + + CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"] + + + +Let's see what is on this Dockerfile: + +**FROM** - This tells docker that we are going to use Fedora 22 as base image + +**MANTAINER** and **LABEL** - these commands are informative and have no direct influence on the image + +**RUN** - Automate the steps we've done interactively, install Apache, create directories and edit httpd.conf + +**ENV** - Set the environment variables, now we don't need the run_apache_foreground script anymore. + +**EXPOSE** - Expose the port 80 to the world + +**CMD** - Set the default command to httpd, so we don't need to do this every time we start a new container + +**Build the image** + +Now we are going to build the image and put the TAG gaiada/apachedf on it: + + docker build -t gaiada/apachedf:0.1 . + +![docker build complete](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-build-complete.png) + +docker build complete + +Use **docker images** list the local images and see if your new image is there: + + docker images + +And then run you new image: + + docker run -t -p 80:80 gaiada/apachedf + +That is it for the Dockerfile, using this feature make things much easier, faster and reproducible. + +### Publishing your images ### + +Until now, you just pulled images from Docker Hub, but you can also push you image and pull them later as needed. In fact other can also download your image and use it in their systems without the need of change anything and now we are going to learn how to make our image available for others worldwide. + +**Creating account** + +For you to be able to push your image on Docker Hub, you need to create an account. Access [https://hub.docker.com/account/signup/][3] and fill the following form: + +![Docker Hub signup page](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-hub-signup.png) + +Docker Hub signup page + +**Login** + +Enter the following command and proceed with the login name, password and email you provided in your account creation + + docker login + +After you do the first login, your account information will be recorded in **~/.dockercfg** + +**Pushing** + +Push the page to the server with the **docker push [registry/]your_login/repository_name[:tag]** + + docker push docker.io/gaiada/apachedf + +You might see something like this on your console: + +![Docker push Apache image complete](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-pushing-apachedf-complete.png) + +Docker push Apache image complete + +### Conclusion ### + +Now that you know how to Dockerize Apache, try to include some modules, Perl, PHP, proxy, HTTPS, or whatever you need. I hope you guys liked it, and push your own images on Docker Hub. + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/configure-apache-containers-docker-fedora-22/ + +作者:[Carlos Alberto][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/carlosal/ +[1]:https://github.com/gaiada/run-apache-foreground +[2]:http://localhost/ +[3]:https://hub.docker.com/account/signup/ \ No newline at end of file diff --git a/sources/tech/20150612 How to Configure Swarm Native Clustering for Docker.md b/sources/tech/20150612 How to Configure Swarm Native Clustering for Docker.md new file mode 100644 index 0000000000..d07cd26428 --- /dev/null +++ b/sources/tech/20150612 How to Configure Swarm Native Clustering for Docker.md @@ -0,0 +1,95 @@ +How to Configure Swarm Native Clustering for Docker +================================================================================ +Hi everyone, today we'll learn about Swarm and how we can create native clusters using Docker with Swarm. [Docker Swarm][1] is a native clustering program for Docker which turns a pool of Docker hosts into a single virtual host. Swarm serves the standard Docker API, so any tool which can communicate with a Docker daemon can use Swarm to transparently scale to multiple hosts. Swarm follows the "batteries included but removable" principle as other Docker Projects. It ships with a simple scheduling backend out of the box, and as initial development settles, an API will develop to enable pluggable backends. The goal is to provide a smooth out-of-box experience for simple use cases, and allow swapping in more powerful backends, like Mesos, for large scale production deployments. Swarm is extremely easy to setup and get started. + +So, here are some features of Swarm 0.2 out of the box. + +1. Swarm 0.2.0 is about 85% compatible with the Docker Engine. +2. It supports Resource Management. +3. It has Advanced Scheduling feature with constraints and affinities. +4. It supports multiple Discovery Backends (hubs, consul, etcd, zookeeper) +5. It uses TLS encryption method for security and authentication. + +So, here are some very simple and easy steps on how we can use Swarm. + +### 1. Pre-requisites to run Swarm ### + +We must install Docker 1.4.0 or later on all nodes. While each node's IP need not be public, the Swarm manager must be able to access each node across the network. + +Note: Swarm is currently in beta, so things are likely to change. We don't recommend you use it in production yet. + +### 2. Creating Swarm Cluster ### + +Now, we'll create swarm cluster by running the below command. Each node will run a swarm node agent. The agent registers the referenced Docker daemon, monitors it, and updates the discovery backend with the node's status. The below command returns a token which is a unique cluster id, it will be used when starting the Swarm Agent on nodes. + + # docker run swarm create + +![Creating Swarm Cluster](http://blog.linoxide.com/wp-content/uploads/2015/05/creating-swarm-cluster.png) + +### 3. Starting the Docker Daemon in each nodes ### + +We'll need to login into each node that we'll use to create clusters and start the Docker Daemon into it using flag -H . It ensures that the docker remote API on the node is available over TCP for the Swarm Manager. To do start the docker daemon, we'll need to run the following command inside the nodes. + + # docker -H tcp://0.0.0.0:2375 -d + +![Starting Docker Daemon](http://blog.linoxide.com/wp-content/uploads/2015/05/starting-docker-daemon.png) + +### 4. Adding the Nodes ### + +After enabling Docker Daemon, we'll need to add the Swarm Nodes to the discovery service. We must ensure that node's IP must be accessible from the Swarm Manager. To do so, we'll need to run the following command. + + # docker run -d swarm join --addr=:2375 token:// + +![Adding Nodes to Cluster](http://blog.linoxide.com/wp-content/uploads/2015/05/adding-nodes-to-cluster.png) + +**Note**: Here, we'll need to replace and with the IP address of the Node and the cluster ID we got from step 2. + +### 5. Starting the Swarm Manager ### + +Now, as we have got the nodes connected to the cluster. Now, we'll start the swarm manager, we'll need to run the following command in the node. + + # docker run -d -p :2375 swarm manage token:// + +![Starting Swarm Manager](http://blog.linoxide.com/wp-content/uploads/2015/05/starting-swarm-manager.png) + +### 6. Checking the Configuration ### + +Once the manager is running, we can check the configuration by running the following command. + + # docker -H tcp:// info + +![Accessing Swarm Clusters](http://blog.linoxide.com/wp-content/uploads/2015/05/accessing-swarm-cluster.png) + +**Note**: We'll need to replace with the ip address and port of the host running the swarm manager. + +### 7. Using the docker CLI to access nodes ### + +After everything is done perfectly as explained above, this part is the most important part of the Docker Swarm. We can use Docker CLI to access the nodes and run containers on them. + + # docker -H tcp:// info + # docker -H tcp:// run ... + +### 8. Listing nodes in the cluster ### + +We can get a list of all of the running nodes using the swarm list command. + + # docker run --rm swarm list token:// + +![Listing Swarm Nodes](http://blog.linoxide.com/wp-content/uploads/2015/05/listing-swarm-nodes.png) + +### Conclusion ### + +Swarm is really an awesome feature of docker that can be used for creating and managing clusters. It is pretty easy to setup and use. It is more beautiful when we use constraints and affinities on top of it. Advanced Scheduling is an awesome feature of it which applies filters to exclude nodes with ports, labels, health and it uses strategies to pick the best node. So, if you have any questions, comments, feedback please do write on the comment box below and let us know what stuffs needs to be added or improved. Thank You! Enjoy :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/configure-swarm-clustering-docker/ + +作者:[Arun Pyasi][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://docs.docker.com/swarm/ \ No newline at end of file diff --git a/sources/tech/20150612 Linux_Logo--A Command Line Tool to Print Color ANSI Logos of Linux Distributions.md b/sources/tech/20150612 Linux_Logo--A Command Line Tool to Print Color ANSI Logos of Linux Distributions.md new file mode 100644 index 0000000000..6cdc510092 --- /dev/null +++ b/sources/tech/20150612 Linux_Logo--A Command Line Tool to Print Color ANSI Logos of Linux Distributions.md @@ -0,0 +1,183 @@ +Linux_Logo – A Command Line Tool to Print Color ANSI Logos of Linux Distributions +================================================================================ +linuxlogo or linux_logo is a Linux command line utility that generates a color ANSI picture of Distribution logo with a few system information. + +![Linux_Logo - Prints Color ANSI Logs of Linux Distro](http://www.tecmint.com/wp-content/uploads/2015/06/Linux_Logo.png) + +Linux_Logo – Prints Color ANSI Logs of Linux Distro + +This utility obtains System Information from /proc Filesystem. linuxlogo is capable of showing color ANSI image of various logos other than the host distribution logo. + +The System information associated with logo includes – Linux Kernel Version, Time when Kernel was last Compiled, Number/core of processor, Speed, Manufacturer and processor Generation. It also show information about total physical RAM. + +It is worth mentioning here that screenfetch is another tool of similar kind, which shows distribution logo and a more detailed and formatted system inform http://www.tecmint.com/screenfetch-system-information-generator-for-linux/ation. We have already covered screenfetch long ago, which you may refer at: + +- [ScreenFetch – Generates Linux System Information][15] + +linux_logo and Screenfetch should not be compared to each other. While the output of screenfetch is more formatted and detailed, where linux_logo produce maximum number of color ANSI diagram, and option to format the output. + +linux_logo is written primarily in C programming Language, which displays linux logo in an X Window System and hence User Interface X11 aka X Window System should be installed. The software is released under GNU General Public License Version 2.0. + +For the purpose of this article, we’re using following testing environment to test the linux_logo utility. + + Operating System : Debian Jessie + Processor : i3 / x86_64 + +### Installing Linux Logo Utility in Linux ### + +**1. The linuxlogo package (stable version 5.11) is available to install from default package repository under all Linux distributions using apt, yum or dnf package manager as shown below.** + + # apt-get install linux_logo [On APT based Systems] + # yum install linux_logo [On Yum based Systems] + # dnf install linux_logo [On DNF based Systems] + OR + # dnf install linux_logo.x86_64 [For 64-bit architecture] + +**2. Once linuxlogo package has been installed, you can run the command `linuxlogo` to get the default logo for the distribution you are using..** + + # linux_logo + OR + # linuxlogo + +![Get Default OS Logo](http://www.tecmint.com/wp-content/uploads/2015/06/Get-Default-OS-Logo.png) + +Get Default OS Logo + +**3. Use the option `[-a]`, not to print any fancy color. Useful if viewing linux_logo over black and white terminal.** + + # linux_logo -a + +![Black and White Linux Logo](http://www.tecmint.com/wp-content/uploads/2015/06/Black-and-White-Linux-Logo.png) + +Black and White Linux Logo + +**4. Use option `[-l]` to print LOGO only and exclude all other System Information.** + +# linux_logo -l + +![Print Distribution Logo](http://www.tecmint.com/wp-content/uploads/2015/06/Print-Distribution-Logo.png) + +Print Distribution Logo + +**5. The `[-u]` switch will display system uptime.** + + # linux_logo -u + +![Print System Uptime](http://www.tecmint.com/wp-content/uploads/2015/06/Print-System-Uptime.png) + +Print System Uptime + +**6. If you are interested in Load Average, use option `[-y]`. You may use more than one option at a time.** + + # linux_logo -y + +![Print System Load Average](http://www.tecmint.com/wp-content/uploads/2015/06/Print-System-Load-Average.png) + +Print System Load Average + +For more options and help on them, you may like to run. + + # linux_logo -h + +![Linuxlogo Options and Help](http://www.tecmint.com/wp-content/uploads/2015/06/linuxlogo-options.png) + +Linuxlogo Options and Help + +**7. There are a lots of built-in Logos for various Linux distributions. You may see all those logos using option `-L list` switch.** + + # linux_logo -L list + +![List of Linux Logos](http://www.tecmint.com/wp-content/uploads/2015/06/List-of-Linux-Logos.png) + +List of Linux Logos + +Now you want to print any of the logo from the list, you may use `-L NUM` or `-L NAME` to display selected logo. + +- -L NUM – will print logo with number NUM (deprecated). +- -L NAME – will print the logo with name NAME. + +For example, to display AIX Logo, you may use command as: + + # linux_logo -L 1 + OR + # linux_logo -L aix + +![Print AIX Logo](http://www.tecmint.com/wp-content/uploads/2015/06/Print-AIX-Logo.png) + +Print AIX Logo + +**Notice**: The `-L 1` in the command where 1 is the number at which AIX logo appears in the list, where `-L aix` is the name at which AIX logo appears in the list. + +Similarly, you may print any logo using these options, few examples to see.. + + # linux_logo -L 27 + # linux_logo -L 21 + +![Various Linux Logos](http://www.tecmint.com/wp-content/uploads/2015/06/Various-Linux-Logos.png) + +Various Linux Logos + +This way, you can use any of the logos just by using the number or name, that is against it. + +### Some Useful Tricks of Linux_logo ### + +**8. You may like to print your Linux distribution logo at login. To print default logo at login you may add the below line at the end of `~/.bashrc` file.** + + if [ -f /usr/bin/linux_logo ]; then linux_logo; fi + +**Notice**: If there isn’t any` ~/.bashrc` file, you may need to create one under user home directory. + +**9. After adding above line, just logout and re-login again to see the default logo of your Linux distribution.** + +![Print Logo on User Login](http://www.tecmint.com/wp-content/uploads/2015/06/Print-Logo-on-Login.png) + +Print Logo on User Login + +Also note, that you may print any logo, after login, simply by adding the below line. + + if [ -f /usr/bin/linux_logo ]; then linux_logo -L num; fi + +**Important**: Don’t forget to replace num with the number that is against the logo, you want to use. + +**10. You can also print your own logo by simply specifying the location of the logo as shown below.** + + # linux_logo -D /path/to/ASCII/logo + +**11. Print logo on Network Login.** + + # /usr/local/bin/linux_logo > /etc/issue.net + +You may like to use ASCII logo if there is no support for color filled ANSI Logo as: + + # /usr/local/bin/linux_logo -a > /etc/issue.net + +**12. Create a Penguin port – A set of port to answer connection. To create Penguin port Add the below line to file /etc/services file.** + + penguin 4444/tcp penguin + +Here ‘4444‘ is the port number which is currently free and not used by any resource. You may use a different port. + +Also add the below line to file /etc/inetd.conf file. + + penguin stream tcp nowait root /usr/local/bin/linux_logo + +Restart the service inetd as: + + # killall -HUP inetd + +Moreover linux_logo can be used in bootup script to fool the attacker as well as you can play a prank with your friend. This is a nice tool and I might use it in some of my scripts to get output as per distribution basis. + +Try it once and you won’t regret. Let us know what you think of this utility and how it can be useful for you. Keep Connected! Keep Commenting. Like and share us and help us get spread. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux_logo-tool-to-print-color-ansi-logos-of-linux/ + +作者:[Avishek Kumar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/screenfetch-system-information-generator-for-linux/ \ No newline at end of file From 6cc8ebfcfd4b55f1522095583d260fae8d32d56b Mon Sep 17 00:00:00 2001 From: NearTan Date: Fri, 12 Jun 2015 18:38:21 +0800 Subject: [PATCH 071/153] translated --- ...Command Line Using 'Speedtest-CLI' Tool.md | 134 ------------ ...Command Line Using 'Speedtest-CLI' Tool.md | 196 ++++++++++++++++++ 2 files changed, 196 insertions(+), 134 deletions(-) delete mode 100644 sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md create mode 100644 translated/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md diff --git a/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md b/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md deleted file mode 100644 index 601a89151d..0000000000 --- a/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md +++ /dev/null @@ -1,134 +0,0 @@ -translating by NearTan - -How to Test Your Internet Speed Bidirectionally from Command Line Using ‘Speedtest-CLI’ Tool -================================================================================ -We always need to check the speed of the Internet connection at home and office. What we do for this? Go to websites like Speedtest.net and begin test. It loads JavaScript in the web browser and then select best server based upon ping and output the result. It also uses a Flash player to produce graphical results. - -What about headless server, where isn’t any web based browser and the main point is, most of the servers are headless. The another bottleneck of such web browser based speed testing is that, you can’t schedule the speed testing at regular interval. Here comes an application “Speedtest-cli” that removes such bottlenecks and let you test the speed of Internet connection from command line. - -#### What is Speedtest-cli #### - -The application is basically a script developed in Python programming Language. It measures Internet Bandwidth speed bidirectionally. It used speedtest.net infrastructure to measure the speed. Speedtest-cli is able to list server based upon physical distance, test against specific server, and gives you URL to share the result of your internet speed test. - -To install latest speedtest-cli tool in Linux systems, you must have Python 2.4-3.4 or higher version installed on the system. - -### Install speedtest-cli in Linux ### - -There are two ways to install speedtest-cli tool. The first method involves the use of `python-pip` package while the second method is to download the Python script, make it executable and run, here I will cover both ways…. - -#### Install speedtest-cli Using pythin-pip #### - -First you need to install `python-pip` package, then afterwards you can install the speedtest-cli tool using pip command as shown below. - - $ sudo apt-get install python-pip - $ sudo pip install speedtest-cli - -To upgrade speedtest-cli, at later stage, use. - - $ sudo pip install speedtest-cli --upgrade - -#### Install speedtest-cli Using Python Script #### - -First download the python script from github using wget command, unpack the downloaded file (master.zip) and extract it.. - - $ wget https://github.com/sivel/speedtest-cli/archive/master.zip - $ unzip master.zip - -After extracting the file, go to the extracted directory `speedtest-cli-master` and make the script file executable. - - $ cd speedtest-cli-master/ - $ chmod 755 speedtest_cli.py - -Next, move the executable to `/usr/bin` folder, so that you don’t need to type the full path everytime. - - $ sudo mv speedtest_cli.py /usr/bin/ - -### Testing Internet Connection Speed with speedtest-cli ### - -**1. To test Download and Upload speed of your internet connection, run the `speedtest-cli` command without any argument as shown below.** - - $ speedtest_cli.py - -![Test Download Upload Speed in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Download-Upload-Speed-in-Linux1.png) -Test Download Upload Speed in Linux - -**2. To check the speed result in bytes in place of bits.** - - $ speedtest_cli.py --bytes - -![Test Internet Speed in Bytes](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Speed-in-Bytes.png) -Test Internet Speed in Bytes - -**3. Share your bandwidth speed with your friends or family. You are provided with a link that can be used to download an image.** - -![Share Internet Speed Results](http://www.tecmint.com/wp-content/uploads/2015/03/Share-Internet-Speed-Results.png) -Share Internet Speed Results - -The following picture is a sample speed test result generated using above command. - -![Speed Test Results](http://www.tecmint.com/wp-content/uploads/2015/03/Speed-Test-Results.png) -Speed Test Results - -**4. Don’t need any additional information other than Ping, Download and upload?** - - $ speedtest_cli.py --simple - -![Test Ping Download Upload Speed](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Ping-Download-Upload-Speed1.png) -Test Ping Download Upload Speed - -**5. List the `speedtest.net` server based upon physical distance. The distance in km is mentioned.** - - $ speedtest_cli.py --list - -![Check Speedtest.net Servers](http://www.tecmint.com/wp-content/uploads/2015/03/Check-Speedtest-Servers.png) -Check Speedtest.net Servers - -**6. The last stage generated a huge list of servers sorted on the basis of distance. How to get desired output? Say I only want to see the speedtest.net server located in Mumbai (India).** - - $ speedtest_cli.py --list | grep -i Mumbai - -![Check Nearest Server](http://www.tecmint.com/wp-content/uploads/2015/03/Check-Nearest-Server.png) -Check Nearest Server - -**7. Test connection speed against a specific server. Use Server Id generated in example 5 and example 6 in above.** - - $ speedtest_cli.py --server [server ID] - $ speedtest_cli.py --server [5060] ## Here server ID 5060 is used in the example. - -![Test Connection Against Server](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Connection-Against-Server.png) -Test Connection Against Server - -**8. To check the version number and help of `speedtest-cli` tool.** - - $ speedtest_cli.py --version - -![Check SpeedCli Version](http://www.tecmint.com/wp-content/uploads/2015/03/Check-SpeedCLi-Version.png) -Check SpeedCli Version - - $ speedtest_cli.py --help - -![SpeedCli Help](http://www.tecmint.com/wp-content/uploads/2015/03/SpeedCli-Help.png) -SpeedCli Help - -**Note:** Latency reported by tool is not its goal and one should not rely on it. The relative latency values output is responsible for server selected to be tested against. CPU and Memory capacity will influence the result to certain extent. - -### Conclusion ### - -The tool is must for system administrators and developers. A simple script which runs without any issue. I must say that the application is wonderful, lightweight and do what it promises. I disliked Speedtest.net for the reason it was using flash, but speedtest-cli gave me a reason to love them. - -speedtest_cli is a third party application and should not be used to automatically record the bandwidth speed. Speedtest.net is used by millions of users and it is a good idea to [Set Your Own Speedtest Mini Server][1]. - -That’s all for now, till then stay tuned and connected to Tecmint. Don’t forget to give your valuable feedback in the comments below. Like and share us and help us get spread. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/check-internet-speed-from-command-line-in-linux/ - -作者:[Avishek Kumar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/speedtest-mini-server-to-test-bandwidth-speed/ diff --git a/translated/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md b/translated/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md new file mode 100644 index 0000000000..9b4c2ae075 --- /dev/null +++ b/translated/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md @@ -0,0 +1,196 @@ + + +用命令行工具Speedtest-CLI来测试你的上下行网速 +================================================================================ + +我们经常需要到检查家里与办公室之间的网络是否连通,那么我们要怎么做呢?打开网站Speedtest.net然后开始测试。网站是通过加载浏览器中的JavaScript脚本然后选择最佳的服务器测速然后用Flash产生图形化的结果。 + + +那么远程服务器呢?要知道大多数远程服务器是没有浏览器可以打开web页面的。用浏览器打开网页测速的瓶颈就在此,你不能按计划的对服务器进行定期的常规测试。这时需要到一个名为Speedtest-cli的软件来打破这个瓶颈,它能让你通过命令行来测试互联网连接的速度。 + + +#### Speedtest-cli是什么 #### + + +此程序是基于Python开发的脚本程序,利用了speedtest.net的服务来测量出上下行的宽带。Speedtest-cli能根据机房离测速服务器的物理距离来列出测速服务器,或者针对某一服务器进行测速,同时还能为你生成一个URL以便你分享你的测速结果。 + + +要在Linux上安装最新版本的speedtest-cli,你必须安装2.4-3.4或者更高版本的Python。 + + +### 在Linux上安装speedtest-cli ### + + +有两种方法可以安装speedtest-cli。第一种方法需要用到`python-pip`包管理器,第二种方法需要安装Python脚本,生成安装文件然后运行,这里我们分别介绍两种方法: + + +#### 使用pythin-pip安装speedtest-cli#### + + +首先你需要安装`python-pip`包管理器,之后你就可以用pip命令来安装speedtest-cli + + $ sudo apt-get install python-pip + $ sudo pip install speedtest-cli + + +如果要吧speedtest-cli升级至最新版本,你需要输入以下命令 + + $ sudo pip install speedtest-cli --upgrade + + +#### 通过Pyhton脚本来安装speedtest-cli #### + + +首先要用wget命令从github上下来Python脚本,然后解压提取下载的文件(master.zip) + + $ wget https://github.com/sivel/speedtest-cli/archive/master.zip + $ unzip master.zip + + +提取出文件后,进入提取出的目录`speedtest-cli-master`然后使脚本可以执行。 + + $ cd speedtest-cli-master/ + $ chmod 755 speedtest_cli.py + + +下一步,把可执行的脚本移动到`/usr/bin`文件夹,这样你就不用每次都输入完整的脚本路径了。 + + $ sudo mv speedtest_cli.py /usr/bin/ + + +### 用speedtest-cli测试互联网连通速度### + + +**1. 要测试你的下载与上传速度,只需要运行`speedtest-cli`命令,不需要带参数。** + + $ speedtest_cli.py + +
+![Test Download Upload Speed in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Download-Upload-Speed-in-Linux1.png) + +在Linux下测试上传下载速度 +
+ + +**2. 测试上传下载bytes的速度** + + $ speedtest_cli.py --bytes + +
+![Test Internet Speed in Bytes](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Speed-in-Bytes.png) + +测试bytes的速度 +
+ + +**3. 工具提供一个链接来下载由你的宽带测试结果生成的图片,你可以分享给你的家人朋友。** + +
+![Share Internet Speed Results](http://www.tecmint.com/wp-content/uploads/2015/03/Share-Internet-Speed-Results.png) + +分享测速结果 +
+ + +下面的图片就是你通过以上的命令行测速而生成的图片 + +
+![Speed Test Results](http://www.tecmint.com/wp-content/uploads/2015/03/Speed-Test-Results.png) + +测速结果 +
+ +**4.如果你仅仅需要Ping,上传,下载的结果,就运行以下命令:** + + $ speedtest_cli.py --simple + +
+![Test Ping Download Upload Speed](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Ping-Download-Upload-Speed1.png) + +测试Ping,上传,下载的速度 +
+ + + + + +**5. 列出`speedtest.net`所有的服务器距离你的物理距离,单位是千米(km)** + + + $ speedtest_cli.py --list + +
+![Check Speedtest.net Servers](http://www.tecmint.com/wp-content/uploads/2015/03/Check-Speedtest-Servers.png) + +列出Speedtest.net的服务器 +
+ + +**6. 当获得一个非常长的服务器列表之后,怎么列出我想要的某个服务器?如果我要在speedtest.net服务器列表中找出位于Mumbai(印度)的服务器呢?** + + $ speedtest_cli.py --list | grep -i Mumbai + +
+![Check Nearest Server](http://www.tecmint.com/wp-content/uploads/2015/03/Check-Nearest-Server.png) + +列出最近的服务器 +
+ + +**7. 对指定的服务器进行测速。我们使用上面例子5和例子6中获取的服务器ID:** + + $ speedtest_cli.py --server [server ID] + $ speedtest_cli.py --server [5060] ## Here server ID 5060 is used in the example. + $ speedtest_cli.py --server [5060] ## 这里使用服务器ID为5060作为例子 + +
+![Test Connection Against Server](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Connection-Against-Server.png) + +对指定的服务器进行测速 +
+ + +**8. 输出`speedtest-cli`的版本信息和帮助文档** + + $ speedtest_cli.py --version + +
+![Check SpeedCli Version](http://www.tecmint.com/wp-content/uploads/2015/03/Check-SpeedCLi-Version.png) + +输出版本号 +
+ + $ speedtest_cli.py --help +
+![SpeedCli Help](http://www.tecmint.com/wp-content/uploads/2015/03/SpeedCli-Help.png) + +输出帮助文档 +
+ + +**提醒:**报告中的延迟并不是确切的结果,不应该过于依赖它;这个数值可以当作相对延迟,这对你选择某一测试服务器来说是可靠的。同时,CPU和内存的容量会影响结果的准确度。 + + +### 结论 ### + + +系统管理员和开发者应该必备这个简单的脚本工具,这个工具轻量级,功能齐全,真是太赞了。我不喜欢Speedtest.net的原因是它使用来flash,相反speedtest-cli刚好戳中了我的痛点。 + + +speedtest_cli是一个第三方工具,也不能自动地记录下宽带速度。Speedtest.net拥有上百万的用户,你可以自己[配制一个小型的测速服务器][1]。 + + +上面就是所有内容,更多内容敬请关注Tecmint。如果你有任何反馈记得在文章下方评论,如果你喜欢别忘了给我们点歌赞,分享我们的文章。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/check-internet-speed-from-command-line-in-linux/ + +作者:[Avishek Kumar][a] +译者:[NearTan](https://github.com/NearTan) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/speedtest-mini-server-to-test-bandwidth-speed/ From 14396245902d47487a9a9cc1ae020237156a32b7 Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 13 Jun 2015 08:56:28 +0800 Subject: [PATCH 072/153] PUB:20150520 How to Use tmpfs on RHEL or CentOS 7.0 @geekpi --- ... How to Use tmpfs on RHEL or CentOS 7.0.md | 64 +++++++++++++++++++ ... How to Use tmpfs on RHEL or CentOS 7.0.md | 64 ------------------- 2 files changed, 64 insertions(+), 64 deletions(-) create mode 100644 published/20150520 How to Use tmpfs on RHEL or CentOS 7.0.md delete mode 100644 translated/tech/20150520 How to Use tmpfs on RHEL or CentOS 7.0.md diff --git a/published/20150520 How to Use tmpfs on RHEL or CentOS 7.0.md b/published/20150520 How to Use tmpfs on RHEL or CentOS 7.0.md new file mode 100644 index 0000000000..8d376b8b72 --- /dev/null +++ b/published/20150520 How to Use tmpfs on RHEL or CentOS 7.0.md @@ -0,0 +1,64 @@ +如何在RHEL/CentOS 7.0中使用tmpfs +================================================================================ +今天我们来谈谈 Centos 7 中的一个文件系统tmpfs,这是一个将所有文件和文件夹写到虚拟内存中而不是实际写到磁盘中的虚拟文件系统。这意味中tmpfs中所有的内容都是临时的,在tmpfs卸载、系统重启或者电源切断后内容都将会丢失。技术的角度上来说,tmpfs将所有的内容放在内核内部缓存中并且会调整大小来容纳文件,并可从交换空间中交换出不需要的页。 + +CentOS默认使用tmpfs做的几种用途可用df -h命令的输出来看: + + # df –h + +![df](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs1.jpg) + +- /dev - 含有针对所有设备的设备文件的目录 +- /dev/shm - 包含共享内存分配 +- /run - 用于系统日志 +- /sys/fs/cgroup - 用于cgrpups, 一个针对特定进程限制、管制和审计资源利用的内核特性 + +显然,它也可以用作/tmp目录, 你可以用下面的两种方法来做到: + +### 使用systemctl来在/tmp中启用tmpfs ### + +你可以使用systemctl命令在tmp目录启用tmpfs, 首先用下面的命令来检查这个特性是否可用: + + # systemctl is-enabled tmp.mount + +这会显示当先的状态,(如果未启用,)你可以使用下面的命令来启用它: + + # systemctl enable tmp.mount + +![systemctl](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs3.jpg) + +这会让系统控制/tmp目录并在该目录下挂载一个tmpfs文件系统。 + +### 手动挂载/tmp文件系统 ### + +你可以在/etc/fstab中添加下面这行,来手工在/tmp下挂载 tmpfs。 + + tmpfs /tmp tmpfs size=512m 0 0 + +接着运行这条命令 + + # mount –a + +![df](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs2.jpg) + +这应该就会在df -h中显示tmpfs了,同样也会在你下次重启时自动挂载。 + +### 立即创建tmpfs ### + +如果由于一些原因,你需要在一个文件夹下立即创建tmpfs,你可以使用下面的命令: + + # mount -t tmpfs -o size=1G tmpfs /mnt/mytmpfs + +当然你可以在size选项中指定你希望的大小和希望的挂载点,只要记住是有效的目录就行了。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/file-system/use-tmpfs-rhel-centos-7-0/ + +作者:[Adrian Dinu][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/adriand/ diff --git a/translated/tech/20150520 How to Use tmpfs on RHEL or CentOS 7.0.md b/translated/tech/20150520 How to Use tmpfs on RHEL or CentOS 7.0.md deleted file mode 100644 index 7f3e37b3fe..0000000000 --- a/translated/tech/20150520 How to Use tmpfs on RHEL or CentOS 7.0.md +++ /dev/null @@ -1,64 +0,0 @@ -如何在RHEL/CentOS 7.0中使用tmpfs -================================================================================ - 7中的tmpfs,这是一个将所有文件和文件夹写到虚拟内存中而不是实际写到磁盘中的虚拟文件系统。这意味中tmpfs中所有的内容都是临时的,在取消挂载、系统重启或者电源切断后内容都将会丢失。技术的角度上来说,tmpfs将搜有的内容放在内核内部缓存中并且会增大或者缩小来容纳文件并可从交换空间中交换处不需要的页。 - -CentOS默认使用tmpfs做的事可用df -h命令的输出来看: - - # df –h - -![df](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs1.jpg) - -/dev - 含有针对所有设备的设备文件的目录 -/dev/shm – 包含共享内存分配 -/run - 用于系统日志 -/sys/fs/cgroup - 用于cgrpups, 一个针对特定进程限制、管制和审计资源利用的内核特性 - -/tmp目录, 你可以用下面的两种方法来做到: - -### 使用systemctl来在/tmp中启用tmpfs ### - -你可以使用systemctl命令在tmp目录启用tmpfs, 首先用下面的命令来检查这个特性是否可用: - - # systemctl is-enabled tmp.mount - -这会显示当先的状态,你可以使用下面的命令来启用它: - - # systemctl enable tmp.mount - -![systemctl](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs3.jpg) - -这会控制/tmp目录并挂载tmpfs。 - -### 手动挂载/tmp/文件系统 ### - -你可以在/etc/fstab中添加下面这行在/tmp挂载tmpfs。 - - tmpfs /tmp tmpfs size=512m 0 0 - -接着运行这条命令 - - # mount –a - -![df](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs2.jpg) - -这应该就会在df -h中显示tmpfs了,同样也会在你下次重启是会自动挂载。 - -### 立即创建tmpfs ### - -如果由于一些原因,你写昂立即创建tmpfs,你可以使用下面的命令: - - # mount -t tmpfs -o size=1G tmpfs /mnt/mytmpfs - -当然你可以在size选项中指定你希望的大小和希望的挂载点,只要记住是有效的目录就行了。 - --------------------------------------------------------------------------------- - -via: http://linoxide.com/file-system/use-tmpfs-rhel-centos-7-0/ - -作者:[Adrian Dinu][a] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/adriand/ From 0d3a67a4e52ae4ab9ae0e8e588b98da3e08171b7 Mon Sep 17 00:00:00 2001 From: KayGuoWhu Date: Sat, 13 Jun 2015 13:26:38 +0800 Subject: [PATCH 073/153] translated --- ...0150610 How to secure your Linux server.md | 234 ----------------- ...0150610 How to secure your Linux server.md | 236 ++++++++++++++++++ 2 files changed, 236 insertions(+), 234 deletions(-) delete mode 100644 sources/tech/20150610 How to secure your Linux server.md create mode 100644 translated/tech/20150610 How to secure your Linux server.md diff --git a/sources/tech/20150610 How to secure your Linux server.md b/sources/tech/20150610 How to secure your Linux server.md deleted file mode 100644 index 51246cbfcb..0000000000 --- a/sources/tech/20150610 How to secure your Linux server.md +++ /dev/null @@ -1,234 +0,0 @@ -[translating by KayGuoWhu] -How to secure your Linux server -================================================================================ -> A server is made up of so many different components that makes it hard to offer one solution for everyone's needs. This articles tries to cover some useful tips and tricks to help you keep your server and users protected. - -No doubt improving server security is one of the most important things system administrators should always look for. This of course has been a topic of many different articles, blogs and forum threads. - -A server is made up of so many different components that makes it hard to offer one solution for everyone’s needs. This articles tries to cover some useful tips and tricks to help you keep your server and users protected. - -There are a few things that every system administrator should know and there is no way to talk about security without mentioning: - -- Keep your system **up to date** -- Change passwords frequently – use numeric, alphabetical and non-alphabetical symbols -- Give users the **minimum** permissions they need to do their job. -- Install only packages that you really need - -Here comes the more interesting part: - -### Change default SSH port ### - -The first thing that I would like to change when setting up a new server is the default SSH port. This simple change can save your server from thousands of brute force attempts. - -To change the default SSH port, open your sshd_config: - - sudo vim /etc/ssh/sshd_config - -Find the following line: - - #Port 22 - -The “#” symbol means that this line is a comment. Remove the # symbol then change the port to a number of your choice. The port number should not be larger than 65535. Make sure not to use any port already used by your system or other services. You can see a list of commonly used ports in [Wikipedia][1]. For the purpose of this article I will use: - - Port 16543 - -Now save the file and close it for a moment. - -Next important step is to: - -### Use SSH Keys ### - -It is extremely important to use SSH keys when accessing the server over SSH. This adds additional protection and ensure that only people who have the key can access the server. - -To generate SSH key on your local computer run: - - ssh-keygen -t rsa - -You will receive an output asking you to setup the file name where the key should be written as well as setup a password: - - Generating public/private rsa key pair. - Enter file in which to save the key (/root/.ssh/id_rsa): my_key - Enter passphrase (empty for no passphrase): - Enter same passphrase again: - Your identification has been saved in my_key. - Your public key has been saved in my_key.pub. - The key fingerprint is: - SHA256:MqD/pzzTRsCjZb6mpfjyrr5v1pJLBcgprR5tjNoI20A - -When compete, you will have two files: - -my_key - -my_key.pub - -Now copy the my_key.pub to ~/.ssh/authorized_keys - - cp my_key.pub ~/.ssh/authorized_keys - -Now upload your key on the server by using: - - scp -P16543 authorized_keys user@yourserver-ip:/home/user/.ssh/ - -Now you can access the server from the same local machine without having to enter any password. - -### Disable password authentication for SSH ### - -Now that we have SSH keys, it is safe to disable the password authentication for SSH. Open again the sshd_config file and set the following changes: - - ChallengeResponseAuthentication no - PasswordAuthentication no - UsePAM no - -### Disable Root login ### - -The next important step is to disable direct access with root user. Instead you should use sudo or su to perform administrative jobs. To do this you will need to add a new user that has root privileges. To do this you will need to edit the sudoers file located in: - - /etc/sudoers/ - -You may edit that file with command such as **visudo**. I would recommend you using this command as it will check the file for any syntax errors prior closing the file. This is useful if you have wrongly edited the file. - -Now to give root privileges to a user. For the purpose of this tutorial I will use user **sysadmin**. Make sure you are using an existing user on your system when you edit your own file. Now find the following line: - - root ALL=(ALL) ALL - -Copy that line and paste it below. In the new line change “root” with “sysadmin”. You should now have these two lines: - - root ALL=(ALL) ALL - sysadmin ALL=(ALL) ALL - -I would like to explain what each of the options in the above line represents: - - (1) root (2)ALL=(3)(ALL) (4)ALL - -(1) User - -(2) Terminal from which user can use sudo - -(3) Which users User may act as - -(4) Which commands he may use - - -You can use this settings to give access to users to some of the system tools. - -At this point it is safe to save your file. - -To disable direct root access over SSH open again the **sshd_config** file and find the following line: - - #PermitRootLogin yes - -and change it to: - - PermitRootLogin no - -Now save the file and restart the sshd daemon so the changes can take effect. Simply run the following command: - - sudo /etc/init.d/sshd restart - -### Setup firewall ### - -A firewall can help you block incoming and outgoing ports as well as block brute force login attempts. I like using SCF (Config Server Firewall) as it a powerful solution that uses iptables, it’s easy to manage and has a web interface for people who don’t like typing too many commands. - -To install CSF access your server and navigate to: - - cd /usr/local/src/ - -Then execute the following commands as root: - - wget https://download.configserver.com/csf.tgz - tar -xzf csf.tgz - csf - sh install.sh - -You will need to wait for the installer to finish its job. We will edit CSF configuration by editing: - - /etc/csf/csf.conf - -By default CSF will be started in testing mode. You will need to set it to product by changing the “TESTING” value to 0 - - TESTING = "0" - -Next thing you can edit are the allowed ports on your server. For that purpose find the following section of the csf.conf file and modify the ports per your needs: - - # Allow incoming TCP ports - TCP_IN = "20,21,25,53,80,110,143,443,465,587,993,995,16543" - # Allow outgoing TCP ports - TCP_OUT = "20,21,22,25,53,80,110,113,443,587,993,995,16543" - # Allow incoming UDP ports - UDP_IN = "20,21,53" - # Allow outgoing UDP ports - # To allow outgoing traceroute add 33434:33523 to this list - UDP_OUT = "20,21,53,113,123" - -Setup these per your requirements. I would recommend you using only the ports you need and avoiding allowing huge ranges of ports. Additionally you can avoid using the unsecured services unsecured ports. For example instead of allowing the default SMTP port 25 you can only allow ports 465 and 587 for outgoing emails. - -**IMPORTANT**: Do not forget to allow your customized SSH port. - -It is important to allow your IP address so it will never get blocked. Such IP addresses can be defined in: - - /etc/csf/csf.ignore - -The blocked IP address will appear in: - - /etc/csf/csf.deny - -When you have finished making changes – restart csf with: - - sudo /etc/init.d/csf restart - -Just to show you how useful CSF is I will show you part of csf.deny on one of my servers: - - 211.216.48.205 # lfd: (sshd) Failed SSH login from 211.216.48.205 (KR/Korea, Republic of/-): 5 in the last 3600 secs - Fri Mar 6 00:30:35 2015 - 103.41.124.53 # lfd: (sshd) Failed SSH login from 103.41.124.53 (HK/Hong Kong/-): 5 in the last 3600 secs - Fri Mar 6 01:06:46 2015 - 103.41.124.42 # lfd: (sshd) Failed SSH login from 103.41.124.42 (HK/Hong Kong/-): 5 in the last 3600 secs - Fri Mar 6 01:59:04 2015 - 103.41.124.26 # lfd: (sshd) Failed SSH login from 103.41.124.26 (HK/Hong Kong/-): 5 in the last 3600 secs - Fri Mar 6 02:48:26 2015 - 109.169.74.58 # lfd: (sshd) Failed SSH login from 109.169.74.58 (GB/United Kingdom/mail2.algeos.com): 5 in the last 3600 secs - Fri Mar 6 03:49:03 2015 - -The IP addresses that performed the brute force login attempt got blocked and they will not bother me again. - -#### Lock accounts #### - -In case an account is not going to be used for a long period of time you can lock it in order to prevent access to it. You can do this with: - - passwd -l accountName - -Account can still be used by the root user. - -### Know your services ### - -The whole idea of a server is to provide access to different services. Limit those to only the ones you need and disable the unused ones. This will not only free some resources, but will make your server a little bit more secured. For example if you are running a headless server you will definitely not need X display or a desktop environment. If there are no Windows network shares, you can safely disable Samba. - -You can use the commands below to see which services are started upon system boot: - - chkconfig --list | grep "3:on" - -If your system runs with **systemd**: - - systemctl list-unit-files --type=service | grep enabled - -To disable a service you can use commands such as: - - chkconfig service off - systemctl disable service - -In the above example change “service” with the name of the actual service you wish to stop. Here is an example: - - chkconfig httpd off - systemctl disable httpd - -### Conclusion ### - -This article was meant to cover some of the general security steps you can take to start securing your server. You can always take additional actions to increase the server protection. Remember that it is your responsibility to keep your server secured and make the wise decision while doing it. Unfortunately there is no easy way to do this and the “perfect” setup requires lots of time and tests until you achieve the desired result. - --------------------------------------------------------------------------------- - -via: http://www.linuxveda.com/2015/06/03/secure-linux-server/ - -作者:[Marin Todorow][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.linuxveda.com/author/marin_todorov/ -[1]:http://en.wikipedia.org/wiki/Port_%28computer_networking%29#Common_port_numbers \ No newline at end of file diff --git a/translated/tech/20150610 How to secure your Linux server.md b/translated/tech/20150610 How to secure your Linux server.md new file mode 100644 index 0000000000..ef34eea398 --- /dev/null +++ b/translated/tech/20150610 How to secure your Linux server.md @@ -0,0 +1,236 @@ +Linux服务器安全攻略 +================================================================================ +> 一台服务器由大量功能各异的部件组成,这一点使得很难根据每个人的需求去提供定制的解决方案。这篇文章尽可能涵盖一些有所裨益的小技巧来帮助管理员保证服务器和用户安全。 + +毋庸置疑,对于系统管理员,提高服务器的安全性是最重要的事情之一。因此,也就有了许多针对这个话题而生的文章、博客和论坛帖子。 + +一台服务器由大量功能各异的部件组成,这一点使得很难根据每个人的需求去提供定制的解决方案。这篇文章尽可能涵盖一些有所裨益的小技巧来帮助管理员保证服务器和用户安全。 + +有一些常识是每个系统管理员都应该烂熟于心的,所以下面的几点在后文将不会提及: + +- 务必保证系统是**最新的** +- 经常更换密码 - 使用数字、阿拉伯字母和非阿拉伯字母的符号组合 +- 给予用户**最小**的权限,满足他们日常使用所需即可 +- 只安装那些真正需要的软件包 + +下面是一些更有意思的内容: + +### 更改SSH默认端口 ### + +在搭建好一台全新的服务器后要做的第一件事情就是更改SSH的默认端口。这个小小单的改动能够使你的服务器避免受到成千上万的暴力攻击(译者注:不更改默认端口相当于黑客们知道你家的门牌号,这样他们只需要一把一把的试钥匙就可能打开你家的锁)。 + +要更改默认的SSH端口,先打开sshd_config文件: + + sudo vim /etc/ssh/sshd_config + +找到下面这行: + + #Port 22 + +“#”号表示这行是注释。首先删除#号,然后把端口号改成目的端口。端口号不能超过65535,确保要指定的端口号没有被系统或其它服务占用。建议在[维基百科]上查看常用端口号列表。在本文中,使用这个端口号: + + Port 16543 + +然后保存并关闭文件,等待更改生效。 + +接下来的一步是: + +### 使用SSH密钥 ###、 + +在通过SSH访问服务器时,使用SSH密钥进行认证是尤其重要的。这样做为服务器增加了额外的保护,确保只有那些拥有密钥的人才能访问服务器。 + +在本地机器上运行下面命令以生成SSH密钥: + + ssh-keygen -t rsa + +你会看到下面的输出,询问要将密钥写到哪一个文件,并且设置一个密码: + + Generating public/private rsa key pair. + Enter file in which to save the key (/root/.ssh/id_rsa): my_key + Enter passphrase (empty for no passphrase): + Enter same passphrase again: + Your identification has been saved in my_key. + Your public key has been saved in my_key.pub. + The key fingerprint is: + SHA256:MqD/pzzTRsCjZb6mpfjyrr5v1pJLBcgprR5tjNoI20A + +完成之后,就得到两个文件: + +my_key + +my_key.pub + +接下来把my_key.pub拷贝到~/.ssh/authorized_key中 + + cp my_key.pub ~/.ssh/authorized_keys + +然后使用下面命令将密钥上传到服务器: + + scp -P16543 authorized_keys user@yourserver-ip:/home/user/.ssh/ + +至此,你就可以从这台本地机器上无密码地访问服务器了。 + +### 关闭SSH的密码认证 ### + +既然已经有了SSH密钥,那么关闭SSH的密码认证就很安全了。再次打开并编辑sshd_config,按如下设置: + + ChallengeResponseAuthentication no + PasswordAuthentication no + UsePAM no + +### 关闭Root登录 ### + +下面关键的一步是关闭root用户的直接访问,而使用sudo或su来执行管理员任务。首先需要添加一个有root权限的新用户,所以编辑这个路径下的sudoers文件: + + /etc/sudoers/ + +可以使用如**visudo**这样的命令编辑文件,推荐使用这个命令,因为它会在关闭文件之前检查任何可能出现的语法错误。当你在编辑文件时出错了,这就很有用了。 + +接下来赋予某个用户root权限。在本文中,使用用户**sysadmin**。确保在编辑后这个文件时使用的用户是系统已有的用户。找到下面这行: + + root ALL=(ALL) ALL + +拷贝这行,然后粘贴在下一行,然后把root更改为“sysadmin”,如下所示: + + root ALL=(ALL) ALL + sysadmin ALL=(ALL) ALL + +现在解释一下这行的每一个选项的含义: + + (1) root (2)ALL=(3)(ALL) (4)ALL + +(1) 指定用户 + +(2) 指定用户使用sudo的终端 + +(3) 指定用户可以担任的用户角色 + +(4) 这个用户可以使用的命令 + +使用这个配置可以给用户访问一些系统工具的权限。 + +这时,可以放心保存文件了。 + +为了关闭通过SSH直接访问root,需要再次打开**sshd_config**,找到下面这行: + + #PermitRootLogin yes + +更改为: + + PermitRootLogin no + +然后保存文件,重启sshd守护进程使改动生效。执行下面命令即可: + + sudo /etc/init.d/sshd restart + +### 设置防火墙 ### + +防火墙有助于过滤出入端口和阻止使用暴力法的登录尝试。我倾向于使用SCF(Config Server Firewall)这个强力防火墙。它使用了iptables,易于管理,而且对于不擅于输入命令的用户提供了web界面。 + +要安装CSF,先登录到服务器,切换到这个目录下: + + cd /usr/local/src/ + +然后以root权限执行下面命令: + + wget https://download.configserver.com/csf.tgz + tar -xzf csf.tgz + csf + sh install.sh + +只需等待安装程序完成,然后编辑CSF的配置文件: + + /etc/csf/csf.conf + +默认情况下CSF是以测试模式运行。通过将“TESTING”的值设置成0,切换到product模式。 + + TESTING = "0" + +下面要设置的就是服务器上允许通过的端口。在csf.conf中定位到下面的部分,根据需要修改端口: + + # Allow incoming TCP ports + TCP_IN = "20,21,25,53,80,110,143,443,465,587,993,995,16543" + # Allow outgoing TCP ports + TCP_OUT = "20,21,22,25,53,80,110,113,443,587,993,995,16543" + # Allow incoming UDP ports + UDP_IN = "20,21,53" + # Allow outgoing UDP ports + # To allow outgoing traceroute add 33434:33523 to this list + UDP_OUT = "20,21,53,113,123" + +请根据需要逐一设置,推荐只使用那些需要的端口,避免设置对端口进行大范围设置。此外,也要避免使用不安全服务的不安全端口。比如只允许端口465和587来发送电子邮件,取代默认的SMTP端口25. + +**重要**:千万不要忘记允许自定义SHH端口。 + +允许防火墙通过你的IP地址使其不被屏蔽,这一点很重要。IP地址定义在下面的文件中: + + /etc/csf/csf.ignore + +被屏蔽的IP地址会出现在这个文件中: + + /etc/csf/csf.deny + +一旦完成更改,使用这个命令重启csf: + + sudo /etc/init.d/csf restart + +下面是在某台服务器上的csf.deny文件的部分内容,来说明CSF是很有用的: + + 211.216.48.205 # lfd: (sshd) Failed SSH login from 211.216.48.205 (KR/Korea, Republic of/-): 5 in the last 3600 secs - Fri Mar 6 00:30:35 2015 + 103.41.124.53 # lfd: (sshd) Failed SSH login from 103.41.124.53 (HK/Hong Kong/-): 5 in the last 3600 secs - Fri Mar 6 01:06:46 2015 + 103.41.124.42 # lfd: (sshd) Failed SSH login from 103.41.124.42 (HK/Hong Kong/-): 5 in the last 3600 secs - Fri Mar 6 01:59:04 2015 + 103.41.124.26 # lfd: (sshd) Failed SSH login from 103.41.124.26 (HK/Hong Kong/-): 5 in the last 3600 secs - Fri Mar 6 02:48:26 2015 + 109.169.74.58 # lfd: (sshd) Failed SSH login from 109.169.74.58 (GB/United Kingdom/mail2.algeos.com): 5 in the last 3600 secs - Fri Mar 6 03:49:03 2015 + +可以看到,尝试通过暴力法登录的IP地址都被屏蔽了,真是眼不见心不烦啊! + +#### 锁住账户 #### + +如果某个账户在很长一段时间内都不会被使用了,那么可以将其锁住以防止其它人访问。使用如下命令: + + passwd -l accountName + +当然,这个账户依然可以被root用户使用。 + +### 了解服务器上的服务 ### + +服务器的本质是为各种服务提供访问功能。使服务器只运行所需的服务,关闭没有使用的服务。这样做不仅会释放一些系统资源,而且也会使服务器变得更加安全。比如,如果只是运行一个简单的服务器,显然不需要X显示或者桌面环境。如果不需要Windows网络共享功能,则可以放心关闭Samba。 + +使用下面的命令能查看伴随系统启动而启动的服务: + + chkconfig --list | grep "3:on" + +如果系统运行了**systemd**,执行这条命令: + + systemctl list-unit-files --type=service | grep enabled + +然后使用下面的命令关闭服务: + + chkconfig service off + systemctl disable service + +在上面的例子中,把“service”替换成真正想要停止的服务名称。实例如下: + + chkconfig httpd off + systemctl disable httpd + +### 小结 ### + +这篇文章的目的是涵盖一些通用的安全步骤以便帮助你保护服务器。你可以采取额外的方式去增强对服务器的保护。请记住保证服务器安全是你的责任,在维护服务器安全时尽量做出明智的选择,尽管并没有什么容易的方式去完成这件事情,而建立“完善的”安全需要花费大量的时间和测试直到达到想要的结果。 + +-------------------------------------------------------------------------------- + +via: http://www.linuxveda.com/2015/06/03/secure-linux-server/ + +作者:[Marin Todorow][a] +译者:[KayGuoWhu](https://github.com/KayGuoWhu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxveda.com/author/marin_todorov/ +[1]:http://en.wikipedia.org/wiki/Port_%28computer_networking%29#Common_port_numbers + + + + From 24068760b9a53ebeed8d27007a690b3abe71e962 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 13 Jun 2015 14:20:30 +0800 Subject: [PATCH 074/153] translating --- ... watch--Repeat Linux or Unix Commands Regular Intervals.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md b/sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md index 65d844a296..9da85b9fb8 100644 --- a/sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md +++ b/sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md @@ -1,3 +1,5 @@ +translating---geekpi + watch - Repeat Linux / Unix Commands Regular Intervals ================================================================================ A server administrator needs to maintain the system and keep it updated and safe. A number of intrusion attempts may happen every day. There are some other activities that maintain their log. These logs are updated regularly. In order to check these updates, the commands are executed repeatedly. For example, for simply reading a file, commands like head, tail, cat etc are used. These commands need to be executed repeatedly. The watch command can be used to repeat a command at regular intervals. @@ -130,4 +132,4 @@ via: http://linoxide.com/linux-command/linux-watch-command/ 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]:http://linoxide.com/author/arunrz/ \ No newline at end of file +[a]:http://linoxide.com/author/arunrz/ From ced362889f0353fdf5b551770f1354aa03e1a1fc Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 13 Jun 2015 15:08:41 +0800 Subject: [PATCH 075/153] translated --- ...inux or Unix Commands Regular Intervals.md | 135 ------------------ ...inux or Unix Commands Regular Intervals.md | 133 +++++++++++++++++ 2 files changed, 133 insertions(+), 135 deletions(-) delete mode 100644 sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md create mode 100644 translated/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md diff --git a/sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md b/sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md deleted file mode 100644 index 9da85b9fb8..0000000000 --- a/sources/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md +++ /dev/null @@ -1,135 +0,0 @@ -translating---geekpi - -watch - Repeat Linux / Unix Commands Regular Intervals -================================================================================ -A server administrator needs to maintain the system and keep it updated and safe. A number of intrusion attempts may happen every day. There are some other activities that maintain their log. These logs are updated regularly. In order to check these updates, the commands are executed repeatedly. For example, for simply reading a file, commands like head, tail, cat etc are used. These commands need to be executed repeatedly. The watch command can be used to repeat a command at regular intervals. - -### Watch Command ### - -Watch is a simple command, with a few options. The basic syntax of watch command is: - - watch [-dhvt] [-n ] [--differences[=cumulative]] [--help] [--interval=] [--no-title] [--version] - -Watch command runs the command specified to it after every 2 seconds by default. This time is counted between the completion of command and beginning of next execution. As a simple example, watch command can be used to watch the log updates, The updates are appended at the end of the file, so tail command can be used with watch to see the updates to the file. This command continues to run until you hit CTRL + C to return to the prompt. - -### Examples ### - -> Keep an eye on errors/notices/warning being generated at run time every couple of seconds. - - watch tail /var/log/messages - -![tail messages](http://blog.linoxide.com/wp-content/uploads/2015/06/1.png) - -> Keep an eye on disk usage after specified time interval. - - watch df -h - -![df -h](http://blog.linoxide.com/wp-content/uploads/2015/06/2.png) - -> It is very important for administrators to keep an eye on high I/O wait causing disk operations especially the Mysql transactions. - - watch mysqladmin processlist - -![processlist](http://blog.linoxide.com/wp-content/uploads/2015/06/3.png) - -> Keep an eye on server load and uptime at runtime. - - watch uptime - -![uptime](http://blog.linoxide.com/wp-content/uploads/2015/06/10.png) - -> Keep an eye on queue size for Exim at the time a cron is run to send notices to subscribers. - - watch exim -bpc - -![exim -bpc](http://blog.linoxide.com/wp-content/uploads/2015/06/9.png) - -### 1) Iteration delay ### - - watch [-n ] - -The default interval between the commands can be changed with -n switch. The following command will run the tail command after 5 seconds: - - watch -n 5 date - -![date 5 seconds](http://blog.linoxide.com/wp-content/uploads/2015/06/4b.png) - -### 2) Successive output comparison ### - -If you use -d option with watch command, it will highlight the differences between the first command output to every next command output cumulatively. - - watch [-d or --differences[=cumulative]] - -#### Example1 #### - -Let’s see the successive time outputs extracted using following watch command and observe how the difference is highlighted. - - watch -n 15 -d date - -First time date is capture when command is executed, the next iteration will be repeated after 15 seconds. - -![Difference A](http://blog.linoxide.com/wp-content/uploads/2015/06/6.png) - -Upon the execution of next iteration, it can be seen that all output is exactly same except the seconds have increased from 14 to 29 which is highlighted. - -![Difference A](http://blog.linoxide.com/wp-content/uploads/2015/06/6b.png) - -#### Example 2 #### - -Let’s experience in difference between two successive outputs of “uptime” command repeated by watch. - - watch -n 20 -d uptime - -![uptime](http://blog.linoxide.com/wp-content/uploads/2015/06/10.png) - -Now the difference between the time is highlighted as well as the three load snapshots as well. - -![10b](http://blog.linoxide.com/wp-content/uploads/2015/06/10b.png) - -### 3) Output without title ### - -If you don’t want to display extra details about the iteration delay and actual command run by watch then –t switch can be used. - - watch [-t or --no-title] - -Let’s see the output of following command as an example. - - watch -t date - -![watch without title](http://blog.linoxide.com/wp-content/uploads/2015/06/7t.png) - -### Watch help ### - -Brief details of the watch command can be found by typing the following command in SSH. - - watch -h [or --help] - -![watch help](http://blog.linoxide.com/wp-content/uploads/2015/06/8h.png) - -### Watch version ### - -Run the following command in SSH terminal to check the version of watch. - - watch -v [--version] - -![version](http://blog.linoxide.com/wp-content/uploads/2015/06/11.png) - -**BUGS** - -Unfortunately, upon terminal resize, the screen will not be correctly repainted until the next scheduled update. All --differences highlight-ing is lost on that update as well. - -### Summary ### - -Watch is a very powerful utility for system administrators because it can be used to monitor, logs, operations, performance and throughput of the system at run time. One can easily format and delay the output of watch utility. Any Linux command / utility or script and be supplied to watch for desired and continuous output. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-command/linux-watch-command/ - -作者:[Aun Raza][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/arunrz/ diff --git a/translated/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md b/translated/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md new file mode 100644 index 0000000000..f5e395c278 --- /dev/null +++ b/translated/tech/20150610 watch--Repeat Linux or Unix Commands Regular Intervals.md @@ -0,0 +1,133 @@ +watch - 定期重复Linux / Unix命令 +================================================================================ +服务器管理员需要维护系统并保持更新和安全。每天需要尝试大量的指令。一些其他的活动存储在日志中。这些日志定期地更新。为了检车这些更新,需要重复地执行命令。比如,为了读取一个文件需要使用head、tail、cat等命令。这些命令需要重读地执行。watch命令可以用于定期地执行一个命令。 + +### Watch 命令 ### + +watch是一个简单的命令,只有几个选项。watch命令的基本语法是: + + watch [-dhvt] [-n ] [--differences[=cumulative]] [--help] [--interval=] [--no-title] [--version] + +watch命令默认每隔2秒执行后面的命令。这个时间根据的是命令执行结束到上次执行的间隔来算的。比如,watch命令可以用于监测日志更新,更新时在文件的后面追加新行,因此tail命令可以用来检测文件的更新。这个命令会持续地运行直到你按下 CTRL + C回到提示符。 + +### 例子 ### + +> 每两秒监测 errors/notices/warning 生成的情况。 + + watch tail /var/log/messages + +![tail messages](http://blog.linoxide.com/wp-content/uploads/2015/06/1.png) + +> 用指定的时间监测磁盘的使用率。 + + watch df -h + +![df -h](http://blog.linoxide.com/wp-content/uploads/2015/06/2.png) + +> 对磁盘管理员而言关注高I/O等待导致的磁盘操作尤其是mysql事务是很重要的。 + + watch mysqladmin processlist + +![processlist](http://blog.linoxide.com/wp-content/uploads/2015/06/3.png) + +> 监测服务器负载和运行时间。 + + watch uptime + +![uptime](http://blog.linoxide.com/wp-content/uploads/2015/06/10.png) + +> 检测exim排队给用户发送通知队列的大小。 + + watch exim -bpc + +![exim -bpc](http://blog.linoxide.com/wp-content/uploads/2015/06/9.png) + +### 1) 掩饰循环 ### + + watch [-n ] + +命令默认运行的间隔用-n改变,下面的命令会在5秒后运行后面的命令: + + watch -n 5 date + +![date 5 seconds](http://blog.linoxide.com/wp-content/uploads/2015/06/4b.png) + +### 2) 连续输出比较### + +如果你使用-d选项,它会累次地高亮第一次和下一次命令之间输出的差别。 + + watch [-d or --differences[=cumulative]] + +#### 例子 1 #### + +用下面的命令连续地输出时间病观察高亮出来的不同部分。 + + watch -n 15 -d date + +第一次执行date的输出会被捕捉,15后会会重复运行命令。 + +![Difference A](http://blog.linoxide.com/wp-content/uploads/2015/06/6.png) + +在下一次执行时,可以看到输出除了被高亮的秒数从14到29之外其他的都一样。 + +![Difference A](http://blog.linoxide.com/wp-content/uploads/2015/06/6b.png) + +#### 例子 2 #### + +让我们来体验一下两个连续的“uptime”命令输出的不同。 + + watch -n 20 -d uptime + +![uptime](http://blog.linoxide.com/wp-content/uploads/2015/06/10.png) + +现在列出了时间和3个负载快照之间的不同。 + +![10b](http://blog.linoxide.com/wp-content/uploads/2015/06/10b.png) + +### 3) 不带标题输出 ### + +如果你不希望显示更多关于延迟和实际命令的信息可以使用-t选项。 + + watch [-t or --no-title] + +让我们看下下面例子命令的输出: + + watch -t date + +![watch without title](http://blog.linoxide.com/wp-content/uploads/2015/06/7t.png) + +### Watch 帮助 ### + +可以在ssh中输入下面的命令来得到watch的简要帮助。 + + watch -h [or --help] + +![watch help](http://blog.linoxide.com/wp-content/uploads/2015/06/8h.png) + +### Watch 版本 ### + +在ssh终端中运行下面的命令来检查watch的版本。 + + watch -v [--version] + +![version](http://blog.linoxide.com/wp-content/uploads/2015/06/11.png) + +**问题** + +不幸的是,在终端大小调整时,屏幕不能在下次运行前重画。所有用--difference高亮的内容也会在更新时丢失。 + +### 总结 ### + +watch对系统管理员而言是一个非常强大的工具因为它可以用于监控、日志、运维、性能和系统运行时的吞吐量。人们可以非常简单地格式化和推延watch的输出。任何Linux命令/程序或脚本可以按照所需监测和连续输出。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-command/linux-watch-command/ + +作者:[Aun Raza][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunrz/ From dc5ff01228270adb77451b652b8fe78ce9d44794 Mon Sep 17 00:00:00 2001 From: strugglingyouth <630441839@qq.occom> Date: Sat, 13 Jun 2015 02:18:02 -0700 Subject: [PATCH 076/153] translation by strugglingyouth --- ...to Clear RAM Memory Cache Buffer and Swap Space on Linux.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md b/sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md index e668e5d9ec..9a001f45b4 100644 --- a/sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md +++ b/sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md @@ -1,3 +1,4 @@ +translation by strugglingyouth How to Clear RAM Memory Cache, Buffer and Swap Space on Linux ================================================================================ Like any other operating system, GNU/Linux has implemented a memory management efficiently and even more than that. But if any process is eating away your memory and you want to clear it, Linux provides a way to flush or clear ram cache. @@ -96,4 +97,4 @@ via: http://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linu [a]:http://www.tecmint.com/author/avishek/ [1]:http://www.tecmint.com/echo-command-in-linux/ -[2]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/ \ No newline at end of file +[2]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/ From ad897f5375c5192774e142efb27232515dda32f1 Mon Sep 17 00:00:00 2001 From: wi-cuckoo Date: Sat, 13 Jun 2015 18:14:37 +0800 Subject: [PATCH 077/153] translated wi-cuckoo --- .../20150527 3 Open Source Python Shells.md | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/sources/share/20150527 3 Open Source Python Shells.md b/sources/share/20150527 3 Open Source Python Shells.md index 65102bd1bc..24b81d697a 100644 --- a/sources/share/20150527 3 Open Source Python Shells.md +++ b/sources/share/20150527 3 Open Source Python Shells.md @@ -1,37 +1,36 @@ -translating wi-cuckoo -3 Open Source Python Shells -================================================================================ -Python is a high-level, general-purpose, structured, powerful, open source programming language that is used for a wide variety of programming tasks. It features a fully dynamic type system and automatic memory management, similar to that of Scheme, Ruby, Perl, and Tcl, avoiding many of the complexities and overheads of compiled languages. The language was created by Guido van Rossum in 1991, and continues to grow in popularity. +3个开源的Python Shell +========================================================================= +Python是一个高级,通用,结构化且强大的开源编程语言,用于广泛的编程工作。它拥有一个完全的动态类型系统和自动内存管理,与Scheme,Ruby,Perl和Tcl的十分相似,避免编译型语言的许多复杂地方和难以理解。Python于1991年由Guido van Rossum创造,然后逐渐成长,流行。 -Python is a very useful and popular computer language. One of the benefits of using an interpreted language such as Python is exploratory programming with its interactive shell. You can try out code without having to write a script. But there are limitations with the Python shell. Fortunately, there are some excellent alternative Python shells that extend on the basic shell. They each offer an excellent interactive Python experience. +Python是一个非常实用,而且流行的计算机编程语言。使用一个如Python这样的解释型语言的好处之一就是,可以借助其交互的shell考察式地编程。你可以试用代码,而不必写一个脚本。但是Python shell也有一些局限性。基本来说,有许多很nice的Python shell可选择,都是在基础shell上扩展的。他们每一个都提供了一个极好的交互性的Python 体验。 ----------- +-------------- ### bpython ### ![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-bpython.png) -bpython is a fancy interface to the Python interpreter for Linux, BSD, OS X and Windows. +对于Linux,BSD,OS X和Windows来说,bpython是Python解释器一个受欢迎的接口。 -The idea is to provide the user with all the features in-line, much like modern IDEs, but in a simple, lightweight package that can be run in a terminal window. +想法是提供给用户所有的内置功能,很像现在的IDEs(集成开发环境),但是是在一个简单,轻量级的包里,可以在终端窗口里面运行。 -bpython doesn't seek to create anything new or groundbreaking. Instead, it brings together a few neat ideas and focuses on practicality and usefulness. +bpython并不追求创造任何新的或者开创性的东西。相反,她聚集了一些简洁的理念,关注于实用性和操作性。 -Features include: +功能包括: + +- 内置的语法高亮 - 使用Pygments排版你敲出的代码,并合理地上色 +- 根据你的行为,显示自动补全的建议。 +- 为任何Python函数列出期望的参数 - 力求显示一列参数,为你调用的任何函数 +- “Rewind”功能,弹出内存里的最后一行代码并重新评定 +- 发送你已经解除占用的代码到粘贴缓存 +- 保存你已经输入到一个文件里的代码 +- 自动缩进 +- 支持Python 3 -- In-line syntax highlighting - uses Pygments for lexing the code as you type, and colours appropriately -- Readline-like autocomplete with suggestions displayed as you type -- Expected parameter list for any Python function - seeks to display a list of parameters for any function you call -- "Rewind" function to pop the last line of code from memory and re-evaluate -- Send the code you've entered off to a pastebin -- Save the code you've entered to a file -- Auto-indentation -- Python 3 support - -- Website: [www.bpython-interpreter.org][1] -- Developer: Bob Farrell and contributors -- License: MIT License -- Version Number: 0.14.1 +- 网址: [www.bpython-interpreter.org][1] +- 开发者: Bob Farrell and contributors +- 证书: MIT License +- 版本号: 0.14.1 ---------- @@ -39,22 +38,22 @@ Features include: ![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-ipython.png) -IPython is an enhanced interactive Python shell. It provides a rich toolkit to help you make the most out of using Python interactively. +IPython是Python shell的一个交互加强版。她提供了一个丰富的工具集合,帮助你交互式地充分利用Python。 -IPython can be used as a replacement for the standard Python shell, or it can be used as a complete working environment for scientific computing (like Matlab or Mathematica) when paired with the standard Python scientific and numerical tools. It supports dynamic object introspections, numbered input/output prompts, a macro system, session logging, session restoring, complete system shell access, verbose and colored traceback reports, auto-parentheses, auto-quoting, and is embeddable in other Python programs. +IPython可以用来取代标准的Python shell,或者当与标准Python 科学和数值处理工具配合,用做一个科学计算(如Matlab或者Mathematical)的完整工作环境。她支持动态对象内省,有限的输入/输出提示,一个宏观系统,会话登录,会话恢复,完整的系统接入,详尽且彩色的追踪报告,自动圆括号,自动应用和可嵌入其他Python程序。 -Features include: +功能包括: -- Powerful interactive shells (terminal and Qt-based) -- A browser-based notebook with support for code, rich text, mathematical expressions, inline plots and other rich media -- Support for interactive data visualization and use of GUI toolkits -- Flexible, embeddable interpreters to load into your own projects -- Easy to use, high performance tools for parallel computing +- 强大的交互Shell(终端或者基于Qt) +- 一个基于浏览器的记事本,支持代码,多样文本,数学表达式,内置飞行图表和其他丰富媒介。 +- 支持交互式的数据虚拟化和GUI工具箱使用 +- 灵活,嵌入式的解释器可以加载进你自己的项目里 +- 易于使用,高效的并行运算工具 -- Website: [ipython.org][2] -- Developer: The IPython Development Team -- License: BSD -- Version Number: 3.1 +- 网址: [ipython.org][2] +- 开发者: The IPython Development Team +- 证书: BSD +- 版本号: 3.1 ---------- @@ -62,35 +61,34 @@ Features include: ![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-DreamPie.png) -DreamPie is a Python shell which is designed to be reliable and fun. +DreamPie是一个为可靠性和兴趣设计的Python shell。 -DreamPie can use just about any Python interpreter (Jython, IronPython, PyPy). +DreamPie可以用于任何Python解释器(Jython,IronPython,PyPy)。 -Features include: +功能包括: -- New concept for an interactive shell: the window is divided into the history box, which lets you view previous commands and their output, and the code box, where you write your code. This allows you to edit any amount of code, just like in your favorite editor, and execute it when it's ready. You can also copy code from anywhere, edit it and run it instantly -- The Copy code only command will copy the code you want to keep, so you can save it in a file. The code is already formatted nicely with a four-space indentation -- Automatic completion of attributes and file names -- Automatically displays function arguments and documentation -- Keeps your recent results in the result history, for later use -- Can automatically fold long outputs, so you can concentrate on what's important -- Save the history of the session as an HTML file, for future reference. You can then load the history file into DreamPie, and quickly redo previous commands -- Automatically adds parentheses and optionally quotes when you press space after functions and methods. For example, type execfile fn and get execfile("fn") -- Supports interactive plotting with matplotlib -- Xupport for Python 2.5, Python 2.6, Python 3.1, Jython 2.5, IronPython 2.6, and PyPy -- Extremely fast and responsive. +- 一个交互shell的新概念:窗口被分成历史区域和代码区域,历史区域可以让你看到之前的命令及其输出,代码区域是里敲代码的地方。这样,你可以编辑任意数量的代码,就好像在你最喜欢的编辑器里一样,并且适当时候可以执行它。你也可以从其他地方复制你想保存的代码,所以你可以把它存入一个文件。代码可以很好地格式化为四级缩进。 +- 自动补全属性和文件名字 +- 自动显示函数参数和文档 +- 在结果历史中保存你最近的结果,备以后用 +- 可以自动展开很长的输出,所以你可以专注于重要的地方 +- 保存会话的历史记录为一个HTML文件,备以后查询。你可以加载历史文件到DreamPie里,并且快速回退到之前的命令。 +- 自动添加圆括号与可选的引用,当你在函数与方法后按下空格键。例如,键入execfile fn并且获得execfile("fn") +- 支持交互的matplotlib绘图 +- 支持Python 2.5,Python 2.6,Python 3.1,Jython 2.5,IronPython 2.6和PyPy +- 难以置信的快速反应 -- Website: [www.dreampie.org][3] -- Developer: Noam Yorav-Raphael -- License: GNU GPL v3 -- Version Number: 1.2.1 +- 网址: [www.dreampie.org][3] +- 开发者: Noam Yorav-Raphael +- 证书: GNU GPL v3 +- 版本号: 1.2.1 -------------------------------------------------------------------------------- via: http://www.linuxlinks.com/article/20150523032756576/PythonShells.html 作者:Frazer Kline -译者:[译者ID](https://github.com/译者ID) +译者:[wi-cuckoo](https://github.com/wi-cuckoo) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -98,3 +96,5 @@ via: http://www.linuxlinks.com/article/20150523032756576/PythonShells.html [1]:http://www.bpython-interpreter.org/ [2]:http://ipython.org/ [3]:http://www.dreampie.org/ + +-------------------------------------------------------------------------------- From c99c9ef0620d7960f5bc3a735e1878ac5f68448b Mon Sep 17 00:00:00 2001 From: wi-cuckoo Date: Sat, 13 Jun 2015 18:15:40 +0800 Subject: [PATCH 078/153] translated wi-cuckoo --- .../share/20150527 3 Open Source Python Shells.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/share/20150527 3 Open Source Python Shells.md (100%) diff --git a/sources/share/20150527 3 Open Source Python Shells.md b/translated/share/20150527 3 Open Source Python Shells.md similarity index 100% rename from sources/share/20150527 3 Open Source Python Shells.md rename to translated/share/20150527 3 Open Source Python Shells.md From 7ef21cc716db43ea6c20e683ef7407f1148c136f Mon Sep 17 00:00:00 2001 From: wi-cuckoo Date: Sat, 13 Jun 2015 20:39:59 +0800 Subject: [PATCH 079/153] translating wi-cuckoo --- ... to Configure Apache Containers with Docker on Fedora 22.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md b/sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md index 493e474c7e..66bd27fbc5 100644 --- a/sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md +++ b/sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md @@ -1,3 +1,4 @@ +translating wi-cuckoo How to Configure Apache Containers with Docker on Fedora 22 ================================================================================ In this article we are going to learn about Docker, how to use it to deploy Apache httpd and how can you share it on Docker Hub. First we are going to learn how to pull and use images hosted on Docker Hub, and then install Apache on an image of Fedora 22 interactively, after that we are going to learn how to use a Dockerfile to make an image in a faster and more elegant way, finally we are going to publish the image we've created in Docker Hub, so anyone will be able download and use it later. @@ -279,4 +280,4 @@ via: http://linoxide.com/linux-how-to/configure-apache-containers-docker-fedora- [a]:http://linoxide.com/author/carlosal/ [1]:https://github.com/gaiada/run-apache-foreground [2]:http://localhost/ -[3]:https://hub.docker.com/account/signup/ \ No newline at end of file +[3]:https://hub.docker.com/account/signup/ From 8209aff788f050ba3405e39cc9385e0ae3be91d5 Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 13 Jun 2015 23:37:05 +0800 Subject: [PATCH 080/153] PUB:20150504 How to Install and Configure 'PowerDNS' (with MariaDB) and 'PowerAdmin' in RHEL or CentOS 7 @GOLinux --- ...B) and 'PowerAdmin' in RHEL or CentOS 7.md | 210 ++++++++++-------- 1 file changed, 122 insertions(+), 88 deletions(-) rename {translated/tech => published}/20150504 How to Install and Configure 'PowerDNS' (with MariaDB) and 'PowerAdmin' in RHEL or CentOS 7.md (68%) diff --git a/translated/tech/20150504 How to Install and Configure 'PowerDNS' (with MariaDB) and 'PowerAdmin' in RHEL or CentOS 7.md b/published/20150504 How to Install and Configure 'PowerDNS' (with MariaDB) and 'PowerAdmin' in RHEL or CentOS 7.md similarity index 68% rename from translated/tech/20150504 How to Install and Configure 'PowerDNS' (with MariaDB) and 'PowerAdmin' in RHEL or CentOS 7.md rename to published/20150504 How to Install and Configure 'PowerDNS' (with MariaDB) and 'PowerAdmin' in RHEL or CentOS 7.md index 0f7bc3d62f..4c3c824682 100644 --- a/translated/tech/20150504 How to Install and Configure 'PowerDNS' (with MariaDB) and 'PowerAdmin' in RHEL or CentOS 7.md +++ b/published/20150504 How to Install and Configure 'PowerDNS' (with MariaDB) and 'PowerAdmin' in RHEL or CentOS 7.md @@ -1,44 +1,48 @@ -RHEL/CentOS 7中安装并配置‘PowerDNS’(与MariaDB搭配)和‘PowerAdmin’ +RHEL/CentOS 7中安装并配置 PowerDNS 和 PowerAdmin ================================================================================ -PowerDNS是一个运行在许多Linux/Unix衍生版上的DNS服务器,它可以使用不同的后端进行配置,包括BIND类型的区域文件、相关的数据库,或者负载均衡/失效转移算法。它也可以被配置成一台DNS递归器,作为服务器上的一个独立进程运行。 +PowerDNS是一个运行在许多Linux/Unix衍生版上的DNS服务器,它可以使用不同的后端进行配置,包括BIND类型的区域文件、关系型数据库,或者负载均衡/失效转移算法。它也可以被配置成一台DNS递归器,作为服务器上的一个独立进程运行。 PowerDNS授权服务器的最新版本是3.4.4,但是当前EPEL仓库中可以获得的版本是3.4.3。我推荐安装EPEL仓库中提供的那一个,因为该版本已经在CentOS和Fedora中测试过。那样,你也可以在今后很容易地更新PowerDNS。 -本文倾向于向你演示如何安装并配置以MariaDB作为后端的PowerDNS和 +本文用于向你演示如何安装并配置以MariaDB作为后端的PowerDNS,以及它的界面友好的 Web 管理工具 PowerAdmin。 + 出于本文的写作目的,我将使用以下服务器: 主机名: centos7.localhost IP地址: 192.168.0.102 -### 步骤 1: 安装带有MariaDB后端的PowerDNS ### +### 第一部分: 安装带有MariaDB后端的PowerDNS ### -#### 1. 首先,你需要为你的系统启用EPEL仓库,只需使用: #### +1、 首先,你需要为你的系统启用EPEL仓库,只需使用: # yum install epel-release.noarch ![Enable Epel Repository](http://www.tecmint.com/wp-content/uploads/2015/04/Enable-Epel-Repository.png) -启用Epel仓库 -#### 2. 下一步是安装MariaDB服务器。运行以下命令即可达成: #### +*启用Epel仓库* + +2、 下一步是安装MariaDB服务器。运行以下命令即可达成: # yum -y install mariadb-server mariadb ![Install MariaDB Server](http://www.tecmint.com/wp-content/uploads/2015/04/Install-MariaDB-Server.png) -安装MariaDB服务器 -#### 3. 接下来,我们将配置并启用MySQL,并设置开机启动: #### +*安装MariaDB服务器* + +3、 接下来,我们将配置并启用MariaDB,并设置开机启动: # systemctl enable mariadb.service # systemctl start mariadb.service ![Enable Start MariaDB System Boot](http://www.tecmint.com/wp-content/uploads/2015/04/Enable-Start-MariaDB-System-Boot.png) -启用MariaDB开机启动 -#### 4. 由于MySQL服务正在运行,我们将为MariaDB设置密码进行安全加固,运行以下命令: #### +*启用MariaDB开机启动* + +4、 现在MariaDB服务运行起来了,我们将为MariaDB设置密码进行安全加固,运行以下命令: # mysql_secure_installation -#### 按照指示做 #### +**按照指示做** /bin/mysql_secure_installation: line 379: find_mysql_client: command not found @@ -102,33 +106,36 @@ PowerDNS授权服务器的最新版本是3.4.4,但是当前EPEL仓库中可以 Thanks for using MariaDB! -#### 5. MariaDB配置成功后,我们可以继续去安装PowerDNS。运行以下命令即可轻易完成: #### +5、 MariaDB配置成功后,我们可以继续去安装PowerDNS。运行以下命令即可轻易完成: # yum -y install pdns pdns-backend-mysql ![Install PowerDNS with MariaDB Backend](http://www.tecmint.com/wp-content/uploads/2015/04/Install-PowerDNS-with-MariaDB-Backend.png) -安装带有MariaDB后端的PowerDNS -#### 6. PowerDNS的配置文件位于`/etc/pdns/pdns`,在编辑之前,我们将为PowerDNS服务配置一个MySQL数据库。首先,我们将连接到MySQL服务器并创建一个名为powerdns的数据库: #### +*安装带有MariaDB后端的PowerDNS* + +6、 PowerDNS的配置文件位于`/etc/pdns/pdns`,在编辑之前,我们将为PowerDNS服务配置一个MariaDB数据库。首先,我们将连接到MariaDB服务器并创建一个名为powerdns的数据库: # mysql -u root -p MariaDB [(none)]> CREATE DATABASE powerdns; ![Create PowerDNS Database](http://www.tecmint.com/wp-content/uploads/2015/04/Create-PowerDNS-Database.png) -创建PowerDNS数据库 -#### 7. 接下来,我们将创建一个名为powerdns的数据库用户: #### +*创建PowerDNS数据库* + +7、 接下来,我们将创建一个名为powerdns的数据库用户: MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'localhost' IDENTIFIED BY ‘tecmint123’; MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'centos7.localdomain' IDENTIFIED BY 'tecmint123'; MariaDB [(none)]> FLUSH PRIVILEGES; ![Create PowerDNS User](http://www.tecmint.com/wp-content/uploads/2015/04/Create-PowerDNS-User.png) -创建PowerDNS用户 + +*创建PowerDNS用户* **注意**: 请将“tecmint123”替换为你想要设置的实际密码。 -#### 8. 我们继续创建PowerDNS要使用的数据库表。像堆积木一样执行以下这些: #### +8、 我们继续创建PowerDNS要使用的数据库表。像堆积木一样执行以下这些: MariaDB [(none)]> USE powerdns; MariaDB [(none)]> CREATE TABLE domains ( @@ -143,7 +150,8 @@ PowerDNS授权服务器的最新版本是3.4.4,但是当前EPEL仓库中可以 ); ![Create Table Domains for PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Table-Domains-for-PowerDNS.png) -创建用于PowerDNS的表域 + +*创建用于PowerDNS的表domains* MariaDB [(none)]> CREATE UNIQUE INDEX name_index ON domains(name); MariaDB [(none)]> CREATE TABLE records ( @@ -158,15 +166,17 @@ PowerDNS授权服务器的最新版本是3.4.4,但是当前EPEL仓库中可以 primary key(id) ); -![Create Index Domains for PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Index-Domains-for-PowerDNS.png) -创建用于PowerDNS的索引域 +![Create Table Records for PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Index-Domains-for-PowerDNS.png) + +*创建用于PowerDNS的表 records* MariaDB [(none)]> CREATE INDEX rec_name_index ON records(name); MariaDB [(none)]> CREATE INDEX nametype_index ON records(name,type); MariaDB [(none)]> CREATE INDEX domain_id ON records(domain_id); -![Create Index Records](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Records.png) -创建索引记录 +![Create Index of Table](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Records.png) + +*创建表索引* MariaDB [(none)]> CREATE TABLE supermasters ( ip VARCHAR(25) NOT NULL, @@ -175,13 +185,14 @@ PowerDNS授权服务器的最新版本是3.4.4,但是当前EPEL仓库中可以 ); ![Create Table Supermaster](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Table-Supermaster.png) -创建表的超主 -你现在可以输入以下命令退出MySQL控制台: +*创建表supermasters* + +你现在可以输入以下命令退出MariaDB控制台: MariaDB [(none)]> quit; -#### 9. 最后,我们可以继续以MySQL作为后台的方式配置PowerDNS。请打开PowerDNS的配置文件: #### +9、 最后,我们可以继续配置PowerDNS了,以MariaDB作为后台。请打开PowerDNS的配置文件: # vim /etc/pdns/pdns.conf @@ -203,35 +214,39 @@ PowerDNS授权服务器的最新版本是3.4.4,但是当前EPEL仓库中可以 修改“user-pass”为你先前设置的实际密码,配置如下: ![Configure PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-PowerDNS.png) -配置PowerDNS + +*配置PowerDNS* 保存修改并退出。 -#### 10. 现在,我们将启动并添加PowerDNS到系统开机启动列表: #### +10、 现在,我们将启动并添加PowerDNS到系统开机启动列表: # systemctl enable pdns.service # systemctl start pdns.service ![Enable and Start PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Enable-and-Start-PowerDNS.png) -启用并启动PowerDNS + +*启用并启动PowerDNS* 到这一步,你的PowerDNS服务器已经起来并运行了。要获取更多关于PowerDNS的信息,你可以参考手册[http://downloads.powerdns.com/documentation/html/index.html][1] -### 步骤 2: 安装PowerAdmin来管理PowerDNS ### +### 第二部分: 安装PowerAdmin来管理PowerDNS ### -#### 11. 现在,我们将安装PowerAdmin——一个友好的网页接口PowerDNS服务器管理器。由于它是用PHP写的,我们将需要安装PHP和一台网络服务器(Apache): #### +11、 现在,我们将安装PowerAdmin——一个界面友好的PowerDNS服务器的 Web 管理器。由于它是用PHP写的,我们将需要安装PHP和一台网络服务器(Apache): # yum install httpd php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mhash gettext ![Install Apache PHP](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Apache-PHP.jpeg) -安装Apache PHP + +*安装Apache 和 PHP* PowerAdmin也需要两个PEAR包: # yum -y install php-pear-DB php-pear-MDB2-Driver-mysql ![Install Pear](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Pear.jpeg) -安装Pear + +*安装Pear* 你也可以参考一下文章了解CentOS 7中安装LAMP堆栈的完整指南: @@ -243,58 +258,66 @@ PowerAdmin也需要两个PEAR包: # systemctl start httpd.service ![Enable Start Apache System Boot](http://www.tecmint.com/wp-content/uploads/2015/04/Enable-Start-Apache-System-Boot.png) -启用Apache开机启动 -#### 12. 由于已经满足PowerAdmin的所有系统要求,我们可以继续下载软件包。因为Apache默认的网页目录位于/var/www/html/,我们将下载软件包到这里。 #### +*启用Apache开机启动* + +12、 由于已经满足PowerAdmin的所有系统要求,我们可以继续下载软件包。因为Apache默认的网页目录位于/var/www/html/,我们将下载软件包到这里。 # cd /var/www/html/ # wget http://downloads.sourceforge.net/project/poweradmin/poweradmin-2.1.7.tgz # tar xfv poweradmin-2.1.7.tgz ![Download PowerAdmin](http://www.tecmint.com/wp-content/uploads/2015/04/Download-PowerAdmin.jpeg) -下载PowerAdmin -#### 13. 现在,我们可以启动PowerAdmin的网页安装器了,只需打开: #### +*下载PowerAdmin* + +13、 现在,我们可以启动PowerAdmin的网页安装器了,只需打开: http://192.168.0.102/poweradmin-2.1.7/install/ 这会进入安装过程的第一步: ![Select Installation Language](http://www.tecmint.com/wp-content/uploads/2015/04/Select-Installation-Language.png) -选择安装语言 + +*选择安装语言* 上面的页面会要求你为PowerAdmin选择语言,请选择你想要使用的那一个,然后点击“进入步骤 2”按钮。 -#### 14. 安装器需要PowerDNS数据库: #### +14、 安装器需要PowerDNS数据库: ![PowerDNS Database](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Database.png) -PowerDNS数据库 -#### 15. 因为我们已经创建了一个,所以我们可以继续进入下一步。你会被要求提供先前配置的数据库详情,你也需要为Poweradmin设置管理员密码: #### +*PowerDNS数据库* + +15、 因为我们已经创建了一个数据库,所以我们可以继续进入下一步。你会被要求提供先前配置的数据库详情,你也需要为Poweradmin设置管理员密码: ![Enter PowerDNS Database Settings](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS.png) -输入PowerDNS数据库配置 -#### 16. 输入这些信息后,进入步骤 4。你将创建为Poweradmin创建一个受限用户。这里你需要输入的字段是: #### +*输入PowerDNS数据库配置* -- 用户名 - PowerAdmin用户名。 -- 密码 – 上述用户的密码。 -- 注册人 - 当创建SOA记录而你没有制定注册人时,该值会被使用。 -- 辅助域名服务器 – 该值在创建新的DNS区域时会被用于作为主域名服务器。 +16、 输入这些信息后,进入步骤 4。你将创建为Poweradmin创建一个受限用户。这里你需要输入的字段是: + +- 用户名(Username) - PowerAdmin用户名。 +- 密码(Password) – 上述用户的密码。 +- 主机管理员(Hostmaster) - 当创建SOA记录而你没有指定主机管理员时,该值会被用作默认值。 +- 主域名服务器 - 该值在创建新的DNS区域时会被用于作为主域名服务器。 +- 辅域名服务器 – 该值在创建新的DNS区域时会被用于作为辅域名服务器。 ![PowerDNS Configuration Settings](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Configuration-Settings.png) -PowerDNS配置设置 -#### 17. 在下一步中,Poweradmin会要求你在数据库表中创建新的受限数据库用户,它会提供你需要在MySQL控制台输入的代码: #### +*PowerDNS配置设置* + +17、 在下一步中,Poweradmin会要求你在数据库表中创建一个新的受限数据库用户,它会提供你需要在MariaDB控制台输入的代码: ![Create New Database User](http://www.tecmint.com/wp-content/uploads/2015/04/Create-New-Database-User.png) -创建新的数据库用户 -#### 18. 现在打开终端并运行: #### +*创建新的数据库用户* + +18、 现在打开终端并运行: # mysql -u root -p -提供你的密码并执行由Poweradmin提供的代码: +提供你的密码并执行由PowerAdmin提供的代码: MariaDB [(none)]> GRANT SELECT, INSERT, UPDATE, DELETE ON powerdns.* @@ -302,27 +325,30 @@ PowerDNS配置设置 IDENTIFIED BY '123qweasd'; ![Grant Mysql Permissions to User](http://www.tecmint.com/wp-content/uploads/2015/04/Grant-Mysql-Permissions-to-User.png) -为用户授予Mysql权限 -#### 19. 现在,回到浏览器中并继续下一步。安装器将尝试创建配置文件到/var/www/html/poweradmin-2.1.7/inc。 #### +*为用户授予Mysql权限* + +19、 现在,回到浏览器中并继续下一步。安装器将尝试创建配置文件到/var/www/html/poweradmin-2.1.7/inc。 文件名是config.inc.php。为防止该脚本没有写权限,你可以手动复制这些内容到上述文件中: ![Configuration Settings of PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Configuration.png) -配置PowerDNS设置 -#### 20. 现在,进入最后页面,该页面会告知你安装已经完成以及如何访问安装好的Poweradmin: #### +*配置PowerDNS设置* + +20、 现在,进入最后页面,该页面会告知你安装已经完成以及如何访问安装好的PowerAdmin: ![PowerDNS Installation Completed](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Installation-Completed.png) -PowerDNS安装完成 -你可以通过运行以下命令来启用其他动态DNS提供商的URL: +*PowerDNS安装完成* + +你可以通过运行以下命令来启用用于其他动态DNS提供商的URL: # cp install/htaccess.dist .htaccess 出于该目的,你将需要在Apache的配置中启用mod_rewrite。 -#### 21. 现在,需要移除从Poweradmin的根目录中移除“install”文件夹,这一点很重要。使用以下命令: #### +21、 现在,需要移除从PowerAdmin的根目录中移除“install”文件夹,这一点很重要。使用以下命令: # rm -fr /var/www/html/poweradmin/install/ @@ -331,78 +357,86 @@ PowerDNS安装完成 http://192.168.0.102/poweradmin-2.1.7/ ![PowerDNS Login](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Login.png) -PowerDNS登录 -在登录后,你应该会看到Poweradmin的主页: +*PowerDNS登录* + +在登录后,你应该会看到PowerAdmin的主页: ![PowerDNS Dashboard](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Dashboard.png) -PowerDNS仪表盘 + +*PowerDNS仪表盘* 到这里,安装已经完成了,你也可以开始管理你的DNS区域了。 -### 步骤 3: PowerDNS中添加、编辑和删除DNS区域 ### +### 第三部分: PowerDNS中添加、编辑和删除DNS区域 ### -#### 22. 要添加新的主区域,只需点击“添加主区域”: #### +22、 要添加新的主区域,只需点击“添加主区域”: ![Add Master Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Add-Master-Zone.png) -添加主区域 + +*添加主区域* 在下一页中,你需要填写一些东西: -- 域 – 你要添加区域的域。 -- 所有者 – 设置DNS区域的所有者。 -- 模板 – DNS模板 – 留空。 -- DNSSEC – Donany名称系统安全扩展(可选——检查你是否需要)。 +- 域(Domain) – 你要添加区域的域。 +- 所有者(Owner) – 设置DNS区域的所有者。 +- 模板(Template)– DNS模板 – 留空。 +- DNSSEC – 域名系统安全扩展(可选——看看你是否需要)。 点击“添加区域”按钮来添加DNS区域。 ![Master DNS Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Master-DNS-Zone.png) -主DNS区域 -现在,你可以点击“首页”链接回到Poweradmin的首页。要查看所有现存的DNS区域,只需转到“列出区域”: +*主DNS区域* + +现在,你可以点击“首页”链接回到PowerAdmin的首页。要查看所有现存的DNS区域,只需转到“列出区域(List Zones)”: ![Check List of Zones](http://www.tecmint.com/wp-content/uploads/2015/04/Check-List-Zones.png) -检查区域列表 + +*查看区域列表* 你现在应该看到一个可用DNS区域列表: ![Check List of DNS Zones](http://www.tecmint.com/wp-content/uploads/2015/04/DNS-Zones.png) -检查DNS区域列表 -#### 23. 要编辑现存DNS区域或者添加新的记录,点击编辑图标: #### +*检查DNS区域列表* + +23、 要编辑现存DNS区域或者添加新的记录,点击编辑图标: ![Edit DNS Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Edit-DNS-Zone.png) -编辑DNS区域 + +*编辑DNS区域* 在接下来的页面,你会看到你选择的DNS区域的条目: ![Domain DNS Zone Entries](http://www.tecmint.com/wp-content/uploads/2015/04/Domain-DNS.png) -主DNS区域条目 -#### 24. 在此处添加新的DNS区域,你需要设置以下信息: #### +*域名的DNS区域条目* -- 名称 – 条目名称。只需添加域/子域的第一部分,Poweradmin会添加剩下的。 -- 类型 – 选择记录类型。 -- 优先级 – 记录优先级。 +24、 在此处添加新的DNS条目,你需要设置以下信息: + +- 名称(Name) – 条目名称。只需添加域/子域的第一部分,PowerAdmin会添加剩下的。 +- 类型(Type) – 选择记录类型。 +- 优先级(Priority) – 记录优先级。 - TTL – 存活时间,以秒计算。 出于本文目的,我将为子域new.example.com添加一个A记录用于解析IP地址192.168.0.102,设置存活时间为14400秒: ![Add New DNS Record](http://www.tecmint.com/wp-content/uploads/2015/04/Add-New-DNS-Record.png) -添加新DNS记录 + +*添加新DNS记录* 最后,点击“添加记录”按钮。 -#### 25. 如果你想要删除DNS区域,你可以回到“列出区域”页面,然后点击你想要删除的DNS区域旁边“垃圾桶”图标: #### +25、 如果你想要删除DNS区域,你可以回到“列出区域”页面,然后点击你想要删除的DNS区域旁边“垃圾桶”图标: ![Delete DNS Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Delete-DNS-Zone.png) -删除DNS区域 + +*删除DNS区域* Poweradmin将问你是否确定想要删除DNS区域。只需点击“是”来完成删除。 -如要获取更多关于怎样创建、编辑和删除区域的说明,你可以参与Poweradmin的文档: - -[https://github.com/poweradmin/poweradmin/wiki/Documentation][3] +如要获取更多关于怎样创建、编辑和删除区域的说明,你可以参与Poweradmin的文档:[https://github.com/poweradmin/poweradmin/wiki/Documentation][3] 我希望你已经发现本文很有趣,也很有用。一如既往,如果你有问题或要发表评论,请别犹豫,在下面评论区提交你的评论吧。 @@ -412,7 +446,7 @@ via: http://www.tecmint.com/install-powerdns-poweradmin-mariadb-in-centos-rhel/ 作者:[Marin Todorov][a] 译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 From 6189e0a0ac55f11c4455a3716bb3648b8789f960 Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 13 Jun 2015 23:41:59 +0800 Subject: [PATCH 081/153] PUB:20150518 Linux FAQs with Answers--How to fix 'Encountered a section with no Package--header' error on Raspbian @ictlyh --- ... section with no Package--header' error on Raspbian.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename {translated/tech => published}/20150518 Linux FAQs with Answers--How to fix 'Encountered a section with no Package--header' error on Raspbian.md (68%) diff --git a/translated/tech/20150518 Linux FAQs with Answers--How to fix 'Encountered a section with no Package--header' error on Raspbian.md b/published/20150518 Linux FAQs with Answers--How to fix 'Encountered a section with no Package--header' error on Raspbian.md similarity index 68% rename from translated/tech/20150518 Linux FAQs with Answers--How to fix 'Encountered a section with no Package--header' error on Raspbian.md rename to published/20150518 Linux FAQs with Answers--How to fix 'Encountered a section with no Package--header' error on Raspbian.md index 54e0f393d1..1d51e06b18 100644 --- a/translated/tech/20150518 Linux FAQs with Answers--How to fix 'Encountered a section with no Package--header' error on Raspbian.md +++ b/published/20150518 Linux FAQs with Answers--How to fix 'Encountered a section with no Package--header' error on Raspbian.md @@ -1,6 +1,6 @@ -Linux 有问必答--如何修复 Raspbian 上的 “Encountered a section with no Package: header” 错误 +Linux 有问必答:如何修复 Rasbian 上的 “Encountered a section with no Package: header” 错误 ================================================================================ -> **问题**: 我在 Raspberry Pi 上安装新版的 Rasbian。但当我使用 sudo apt-get update 命令更新 APT 软件包索引的时候,它抛出下面的错误: +> **问题**: 我在树莓派上安装新版的 Rasbian。但当我使用 sudo apt-get update 命令更新 APT 软件包索引的时候,它抛出下面的错误: E: Encountered a section with no Package: header E: Problem with MergeList /var/lib/dpkg/status @@ -10,7 +10,7 @@ Linux 有问必答--如何修复 Raspbian 上的 “Encountered a section with n ![](https://farm8.staticflickr.com/7704/17445484636_05ba81722f_c.jpg) -错误说 "Problem with MergeList /var/lib/dpkg/status" 表示由于某些原因状态文件损坏了,因此无法解释。这个状态文件包括了已经安装的 deb 软件包的信息,因此需要小心备份。 +这个错误说 "Problem with MergeList /var/lib/dpkg/status" 表示由于某些原因状态文件损坏了,因此无法解析。这个状态文件包括了已经安装的 deb 软件包的信息,因此需要小心备份。 在这种情况下,由于这是新安装的 Raspbian,你可以安全地删除状态文件,然后用下面的命令重新生成。 @@ -24,7 +24,7 @@ via: http://ask.xmodulo.com/encountered-section-with-no-package-header-error.htm 作者:[Dan Nanni][a] 译者:[ictlyh](https://github.com/ictlyh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From 14d06fe7588205c57faefe2dc48658d74c2aea1c Mon Sep 17 00:00:00 2001 From: strugglingyouth <630441839@qq.occom> Date: Sat, 13 Jun 2015 08:42:10 -0700 Subject: [PATCH 082/153] translated --- ...ry Cache Buffer and Swap Space on Linux.md | 100 ------------------ ...ry_Cache_Buffer_and_Swap_Space_on_Linux.md | 88 +++++++++++++++ 2 files changed, 88 insertions(+), 100 deletions(-) delete mode 100644 sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md create mode 100644 translated/tech/20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md diff --git a/sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md b/sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md deleted file mode 100644 index 9a001f45b4..0000000000 --- a/sources/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md +++ /dev/null @@ -1,100 +0,0 @@ -translation by strugglingyouth -How to Clear RAM Memory Cache, Buffer and Swap Space on Linux -================================================================================ -Like any other operating system, GNU/Linux has implemented a memory management efficiently and even more than that. But if any process is eating away your memory and you want to clear it, Linux provides a way to flush or clear ram cache. - -![Clear RAM Cache and Swap in Linux](http://www.tecmint.com/wp-content/uploads/2015/05/Clear-RAM-Cache-in-Linux.jpg) - -### How to Clear Cache in Linux? ### - -Every Linux System has three options to clear cache without interrupting any processes or services. - -1. Clear PageCache only. - - # sync; echo 1 > /proc/sys/vm/drop_caches - -2. Clear dentries and inodes. - - # sync; echo 2 > /proc/sys/vm/drop_caches - -3. Clear PageCache, dentries and inodes. - - # sync; echo 3 > /proc/sys/vm/drop_caches - -Explanation of above command. - -sync will flush the file system buffer. Command Separated by `“;”` run sequentially. The shell wait for each command to terminate before executing the next command in the sequence. As mentioned in kernel documentation, writing to drop_cache will clean cache without killing any application/service, [command echo][1] is doing the job of writing to file. - -If you have to clear the disk cache, the first command is safest in enterprise and production as `“...echo 1 > ….”` will clear the PageCache only. It is not recommended to use third option above `“...echo 3 >”` in production until you know what you are doing, as it will clear PageCache, dentries and inodes. - -**Is it a good idea to free Buffer and Cache in Linux that might be used by Linux Kernel?** - -When you are applying various settings and want to check, if it is actually implemented specially on I/O-extensive benchmark, then you may need to clear buffer cache. You can drop cache as explained above without rebooting the System i.e., no downtime required. - -Linux is designed in such a way that it looks into disk cache before looking onto the disk. If it finds the resource in the cache, then the request doesn’t reach the disk. If we clean the cache, the disk cache will be less useful as the OS will look for the resource on the disk. - -Moreover it will also slow the system for a few seconds while the cache is cleaned and every resource required by OS is loaded again in the disk-cache. - -Now we will be creating a shell script to auto clear RAM cache daily at 2PM via a cron scheduler task. Create a shell script clearcache.sh and add the following lines. - - #!/bin/bash - # Note, we are using "echo 3", but it is not recommended in production instead use "echo 1" - echo "echo 3 > /proc/sys/vm/drop_caches" - -Set execute permission on the clearcache.sh file. - - # chmod 755 clearcache.sh - -Now you may call the script whenever you required to clear ram cache. - -Now set a cron to clear RAM cache everyday at 2PM. Open crontab for editing. - - # crontab -e - -Append the below line, save and exit to run it at 2PM daily. - - 0 3 * * * /path/to/clearcache.sh - -For more details on how to cron a job you may like to check our article on [11 Cron Scheduling Jobs][2]. - -**Is it good idea to auto clear RAM cache on production server?** - -No! it is not. Think of a situation when you have scheduled the script to clear ram cache everyday at 2PM. Everyday at 2PM the script is executed and it flushes your RAM cache. One day for whatsoever reason, may be more than expected users are online on your website and seeking resource from your server. - -At the same time scheduled script run and clears everything in cache. Now all the user are fetching data from disk. It will result in server crash and corrupt the database. So clear ram-cache only when required,and known your foot steps, else you are a Cargo Cult System Administrator. - -#### How to Clear Swap Space in Linux? #### - -If you want to clear Swap space, you may like to run the below command. - - # swapoff -a && swapon -a - -Also you may add above command to a cron script above, after understanding all the associated risk. - -Now we will be combining both above commands into one single command to make a proper script to clear RAM Cache and Swap Space. - - # echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared' - - OR - - su -c 'echo 3 >/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared' - -After testing both above command, we will run command “free -h” before and after running the script and will check cache. - -![Clear RAM Cache and Swap Space](http://www.tecmint.com/wp-content/uploads/2015/05/Clear-RAM-Cache.gif) - -That’s all for now, if you liked the article, don’t forget to provide us with your valuable feedback in the comments to let us know, what you think is it a good idea to clear ram cache and buffer in production and Enterprise? - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/ - -作者:[Avishek Kumar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/echo-command-in-linux/ -[2]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/ diff --git a/translated/tech/20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md b/translated/tech/20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md new file mode 100644 index 0000000000..932bc11cd2 --- /dev/null +++ b/translated/tech/20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md @@ -0,0 +1,88 @@ +像任何其他的操作系统一样,GNU / Linux已经有效地实施了内存管理甚至更多。但是,如果有任何进程正在蚕食你的内存,你要清除它, +Linux提供了一个方法来刷新或清除RAM缓存。 + +在Linux中如何清除缓存? + +每一个Linux系统有三个选项来清除缓存而不中断任何进程或服务。 + +1,仅清除缓存页 +

+sync; echo 1 > /proc/sys/vm/drop_caches
+
+2,清除目录项和inodes +

+sync; echo 2 > /proc/sys/vm/drop_caches
+
+3,清除,缓存页,目录项和inodes +

+sync; echo 3 > /proc/sys/vm/drop_caches
+
+上述命令的说明: + +sync将刷新文件系统缓存,命令通过“;”分隔,顺序执行,shell等待终止在序列中的每一个命令执行之前。正如内核文档中提到的,写到drop_cache将清空缓存而不杀死任何应用程序/服务,echo命令做写入文件的工作。 + +如果你必须清除磁盘高速缓存,第一个命令是最安全在企业和生产环境中,“...echo 1> ...”只会清除页缓存。 +不建议使用上面第三个选项在生产环境中“...echo 3 >” ,除非你明确自己在做什么,因为它会清除缓存页,目录项和inodes。 + +在Linux上释放Buffer和Cache要用到内核是否是个好主意? + +当你请求许多设定想要检查时,如果它实际上是专门实施对I/O 广泛的基准测试,那么你可能需要清除缓存。你可以如上所示删除缓存,无需重新启动系统即无需停机。 + +Linux被设计成它在寻找磁盘之前到磁盘缓存寻找的方式。如果它发现该资源在缓存中,则该请求不到达磁盘。如果我们清理缓存,磁盘缓存将没有用处,系统会到磁盘上寻找资源。 + +此外,当清除缓存后它也将减慢系统运行速度,系统会重新加载每一个被请求的资源再次到磁盘缓存中。 + +现在,我们将通过一个cron任务调度器创建一个shell脚本在每天下午2点自动清除RAM缓存。 +创建一个shell脚本clearcache.sh并在其中添加以下行: +

+#!/bin/bash
+# Note, we are using "echo 3", but it is not recommended in production instead use "echo 1"
+echo "echo 3 > /proc/sys/vm/drop_caches"
+
+给clearcache.sh文件设置执行权限 +

+# chmod 755 clearcache.sh
+
+现在,当你需要清除RAM缓存时只需要调用脚本。 + +现在设置一个定时任务来清除RAM缓存每天在下午2点,打开crontab进行编辑。 +

+# crontab -e
+
+添加以下行,保存并退出。 +

+0 3 * * * /path/to/clearcache.sh
+
+有关如何创建一个定时任务,更多细节你可以查看我们的文章11 Cron Scheduling Jobs。 + +在生产环境的服务器上自动清除RAM是否是一个好主意? + +不!它不是。想想一个情况,当你已经预定脚本来清除RAM缓存每天在下午2点。每天下午2点该脚本会执行并刷新你的RAM缓存。在一天中的任何时候,您网站用户的在线量可能会超过预期的,并从你的服务器请求资源。同时调度器运行着脚本,并在高速缓存中清除一切。当所有的用户都从磁盘读取数据时,这将导致服务器崩溃并损坏数据库。 +因此,清除缓存仅在必要时并且在你的预料之中,否则你就是个Cargo Cult System Administrator。 + +如何清除Linux的交换空间? + +如果你想清除掉的空间,你可以运行下面的命令: +

+# swapoff -a && swapon -a
+
+此外,了解有关风险后,您可能会将上面的命令添加到cron中。 + +现在,我们将上面两种命令结合成一个命令写出正确的脚本来同时清除RAM缓存和交换空间。 +

+# echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'
+
+或 +

+su -c 'echo 3 >/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'
+
+在测试上面的命令之前,我们先运行“free -m” 然后执行脚本检查缓存。 + +Clear RAM Cache and Swap Space + +就是现在,如果你喜欢这篇文章,不要忘记向我们提供您宝贵的意见, +让我们知道,您认为在企业和生产环境中清除RAM缓存和缓冲区是否是一个好主意? + +via:http://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/ + +  \ No newline at end of file From 2969fa15e5575eccd4365b536378a7e596e78d0c Mon Sep 17 00:00:00 2001 From: wxy Date: Sun, 14 Jun 2015 00:46:45 +0800 Subject: [PATCH 083/153] PUB:20150528 Things To Do After Installing Fedora 22 @GOLinux --- ...Things To Do After Installing Fedora 22.md | 237 ++++++++++++++++++ ...Things To Do After Installing Fedora 22.md | 113 --------- 2 files changed, 237 insertions(+), 113 deletions(-) create mode 100644 published/20150528 Things To Do After Installing Fedora 22.md delete mode 100644 translated/tech/20150528 Things To Do After Installing Fedora 22.md diff --git a/published/20150528 Things To Do After Installing Fedora 22.md b/published/20150528 Things To Do After Installing Fedora 22.md new file mode 100644 index 0000000000..1a4ff0ff8a --- /dev/null +++ b/published/20150528 Things To Do After Installing Fedora 22.md @@ -0,0 +1,237 @@ +安装 Fedora 22 后要做的事情 +================================================================================ + +Red Hat操作系统的社区开发版的最新成员Fedora 22,已经于2015年5月26日发布了。对这个经典的Fedora发行版的发布充斥着各种猜测和预期,而最终Fedora 22推出了许多重大变化。 + +就初始化进程而言,Systemd还是个新生儿,但它已经准备好替换古老的sysvinit这个一直是Linux生态系统一部分的模块。另外一个用户会碰到的重大改变存在于基本仓库的python版本中,这里提供了两种不同口味的python版本,2.x和3.x分支,各个都有其不同的偏好和优点。所以,那些偏好2.x口味的用户可能想要安装他们喜爱的python版本。自从Fedora 18开始 dandified YUM安装器(即 DNF)就准备替换过时陈旧的YUM安装器了,Fedora最后决定,现在就用DNF来替换YUM。 + +### 1) 配置RPMFusion仓库 ### + +正如我已经提到过的,Fedora的意识形态很是严谨,它不会自带任何非自由组件。官方仓库不会提供一些包含有非自由组件的基本软件,比如像多媒体编码。因此,安装一些第三方仓库很有必要,这些仓库会为我们提供一些基本的软件。幸运的是,RPMFusion仓库前来拯救我们了。 + + $ sudo dnf install --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-22.noarch.rpm + +### 2) 安装VLC媒体播放器 ### + +Fedora 22默认自带了媒体播放器,即 gnome视频播放器(以前叫做totem)。如果你觉得还好,那么我们可以跳过这一步继续往前走。但是,如果你像我一样,偏好使用最广泛的VLC,那么就去从RPMFusion仓库安装吧。安装方法如下: + + sudo dnf install vlc -y + +### 3) 安装多媒体编码 ### + +刚刚我们说过,一些多媒体编码和插件不会随Fedora一起发送。现在,有谁想仅仅是因为专有编码而错过他们最爱的节目和电影?试试这个吧: + + $ sudo dnf install gstreamer-plugins-bad gstreamer-plugins-bad-free-extras gstreamer-plugins-ugly gstreamer-ffmpeg gstreamer1-libav gstreamer1-plugins-bad-free-extras gstreamer1-plugins-bad-freeworld gstreamer-plugins-base-tools gstreamer1-plugins-good-extras gstreamer1-plugins-ugly gstreamer1-plugins-bad-free gstreamer1-plugins-good gstreamer1-plugins-base gstreamer1 + +### 4) 更新系统 ### + +Fedora是一个前锐的发行版,因此它会不断发布更新用以修复系统中出现的错误和漏洞。因而,保持系统更新到最新,是个不错的做法。 + + $ sudo dnf update -y + +### 5) 卸载你不需要的软件 ### + +Fedora预装了一些大多数用户都有用的软件包,但是对于更高级的用户,你可能知道到你并不需要它。要移除你不需要的包相当容易,只需使用以下命令——我选择卸载rhythmbox,因为我知道我不会用到它: + + $ sudo dnf remove rhythmbox + +### 6) 安装Adobe Flash ### + +我们都希望Adobe Flash不要再存在了,因为它并不被认为是最安全的,或者存在资源问题,但是暂时先让它待着吧。Fedora 22安装Adobe Flash的唯一途径是从Adobe安装官方RPM,就像下面这样。 + +你可以从[这里][1]下载RPM。下载完后,你可以直接右击并像下面这样打开: + +![Install Adobe Flash](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-9.50.42-PM.png) + +右击并选择“用软件安装打开” + +然后,只需在弹出窗口中点击安装: + +![Install Adobe](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-9.51.07-PM.png) + +*点击“安装”来完成安装Adobe定制RPM的过程* + +该过程完成后,“安装”按钮会变成“移除”,而此时安装也完成了。如果在此过程中你的浏览器开着,会提示你先把它关掉或在安装完成后重启以使修改生效。 + +### 7) 用Gnome Boxes加速虚拟机 ### + +你刚刚安装了Fedora,你也很是喜欢,但是出于某些私人原因,你也许仍然需要Windows,或者你只是想玩玩另外一个Linux发行版。不管哪种情况,你都可以使用Gnome Boxes来简单地创建一个虚拟机或使用一个live发行版,Fedora 22提供了该软件。遵循以下步骤,使用你所选的ISO来开始吧!谁知道呢,也许你可以检验一下某个[Fedora Spin][2]。 + +首先,打开Gnome Boxes,然后在顶部左边选择“新建”: + +![Add a new virtual machine (box)](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-10.24.46-PM.png) + +点击“新建”来开始添加一个新虚拟机的进程吧。 + +接下来,点击打开文件并选择一个ISO: + +![Choose ISO](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-10.28.44-PM.png) + +*在点击了“选择文件或ISO”后,选择你的ISO。这里,我已经安装了一个Debian ISO。* + +最后,自定义VM设置或使用默认配置,然后点击“创建”。VM默认会启动,可用的VM会在Gnome Boxes以小缩略图的方式显示。 + +![Create VM](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-10.31.11-PM.png) + +*自定义你自己的设置,或者也可以保持默认。完成后,点击“创建”,VM就一切就绪了。* + +### 8) 添加社交媒体和其它在线帐号 ### + +Gnome自带有不错的内建功能用于容纳帐号相关的东西,像Facebook,Google以及其它在线帐号。你可以通过Gnome设置应用访问在线帐号设置,可以在桌面上右键点击或在应用程序中找到该应用。然后,只需点击在线帐号,并添加你所选择的帐号。如果你要添加一个帐号,比如像Google,你可以用它来作为默认帐号,用来完成诸如发送邮件、日历提醒、相片和文档交互,以及诸如此类的更多事情。 + +### 9) 安装KDE或另一个桌面环境 ### + +我们中的某些人不喜欢Gnome,那也没问题。在终端中运行以下命令来安装KDE所需的一切来替换它。这些指令也可以用以安装xfce、lxde或其它桌面环境。 + + $ sudo dnf install @kde-desktop + +安装完成后,登出。当你点击你的用户名时,注意那个表示设置的小齿轮。点击它,然后选择“Plasma”。当你再次登录时,一个全新的KDE桌面就会欢迎你。 + +![Plasma on Fedora 22](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-11.32.27-PM.png) + +*刚刚安装到Fedora 22上的Plasma环境* + +####在 Fedora 22中安装 Cinnamon桌面:#### + +打开SSH终端,输入或粘帖如下命令并回车: + + sudo dnf install @cinnamon-desktop + +####在 Fedora 22中安装 MATE桌面:#### + +打开SSH终端,输入或粘帖如下命令并回车: + + sudo dnf install @mate-desktop + +####在 Fedora 22中安装 XFCE桌面:#### + +打开SSH终端,输入或粘帖如下命令并回车: + + sudo dnf install @xfce-desktop + +####在 Fedora 22中安装 LXDE桌面:#### + +打开SSH终端,输入或粘帖如下命令并回车: + + sudo dnf install @lxde-desktop + +### 10) 定制桌面并优化设置 ### + +默认的 Gnome 带有一张黑色背景和一个新的锁屏,幸运的是,很容易通过下面的方式来改变: + +![change desktop](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-28-at-7.17.29-AM-1024x767.png) + +*右键点击桌面,然后点修改背景* + +![Desktop or lock screen](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-28-at-7.17.52-AM-1024x769.png) + +*你会看到这个窗口,这里你选择新的桌面背景或锁屏图片* + +进一步,如果你点击“设置”,你会看到一个菜单展示你所以可以修改的设置。举个例子,在笔记本电脑上,你可以修改电源设置来控制合上笔记本电脑时的动作。 + + +### 11) 安装 Fedy 4.0### + +Fedy 可以帮助用户和系统管理员来监控系统的运作,并让他们可以控制系统如其所预期的工作。这里有一行脚本可以安装最新版本的 Fedy。打开终端,输入或粘帖如下行并按下回车。 + + su -c "curl https://satya164.github.io/fedy/fedy-installer -o fedy-installer && chmod +x fedy-installer && ./fedy-installer" + +### 12) 安装 Java### + +使用如下命令可以很容易的安装 Java。 + + sudo dnf install java -y + +它会根据你的系统架构自动安装32位或64位的 Java 发行版。 + +### 13) 在 Fedora 22 上安装浏览器 ### + +Fedora 22的默认浏览器是 Firefox,不过其它的浏览器也各有优缺点。最终用户选择浏览器会有种种原因。这里我们提供一些在 Fedora 22上安装其它浏览器的方法。 + +#### 安装 Google Chrome#### + +使用你惯用的编辑器,在 yum 库目录中打开或创建 google-chrome.repo 文件。 + + sudo gedit /etc/yum.repos.d/google-chrome.repo + +加入以下内容并保存。 + + [google-chrome] + name=google-chrome + baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch + enabled=1 + gpgcheck=1 + gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub + +现在 yum 就配置好可以找到稳定版本的 Chrome 了,使用如下命令安装它。 + + sudo dnf install google-chrome-stable + +#### 安装 Tor 浏览器 #### + +在 Fedora 22 中安装 Tor 有一点棘手,在 /etc/yum.repos.d 目录中打开或创建 torproject.repo 文件。 + + sudo gedit /etc/yum.repos.d/torproject.repo + +插入以下内容。 + + [tor] + name=Tor repo + enabled=1 + baseurl=https://deb.torproject.org/torproject.org/rpm/fc/22/$basearch/ + gpgcheck=1 + gpgkey=https://deb.torproject.org/torproject.org/rpm/RPM-GPG-KEY-torproject.org.asc + + [tor-source] + name=Tor source repo + enabled=1 + autorefresh=0 + baseurl=https://deb.torproject.org/torproject.org/rpm/fc/22/SRPMS + gpgcheck=1 + gpgkey=https://deb.torproject.org/torproject.org/rpm/RPM-GPG-KEY-torproject.org.asc + +也许会问到 GPG 键的指纹,它应该如下。 + + 3B9E EEB9 7B1E 827B CF0A 0D96 8AF5 653C 5AC0 01F1 + +不幸的是,在 EPEL 和 Fedora 仓库中有一个相同名字的软件包,你需要明确排除这个来避免安装/删除/修改它。所以,在/etc/yum.repos.d/epel.repo 中加入 `Exclude=tor` 一行。 + +最后,使用如下命令来安装 Tor。 + + sudo dnf install tor + +安装完成,启动服务。 + + sudo service tor start + +#### 安装 Vivaldi#### + +根据你的系统架构下载32位或64位的 Vivaldi 浏览器。 + + sudo wget https://vivaldi.com/download/Vivaldi_TP3.1.0.162.9-1.i386.rpm + sudo wget https://vivaldi.com/download/Vivaldi_TP3.1.0.162.9-1.x86_64.rpm + +使用下列命令安装下载的 RPM。 + + sudo rpm -ivh Vivaldi_TP3.1.0.162.9-1.i386.rpm + sudo rpm -ivh Vivaldi_TP3.1.0.162.9-1.x86_64.rpm + + +### 尾声 ### + +就是这样了,一切就绪。使用新系统吧,试试新东西。如果你找不到与你喜好的东西,linux赋予你自由修改它的权利。Fedora自带有最新的Gnome Shell作为其桌面环境,如果你觉得太臃肿而不喜欢,那么试试KDE或一些轻量级的DE,像Cinnamon、xfce之类。愿你的Fedora之旅十分开心并且没有困扰!! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/things-do-after-installing-fedora-22/ + +作者:[Jonathan DeMasi][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/jonathande/ +[1]:https://get.adobe.com/flashplayer/ +[2]:http://spins.fedoraproject.org/ +[3]:https://www.google.com/intl/en/chrome/browser/desktop/index.html diff --git a/translated/tech/20150528 Things To Do After Installing Fedora 22.md b/translated/tech/20150528 Things To Do After Installing Fedora 22.md deleted file mode 100644 index 172c7612ae..0000000000 --- a/translated/tech/20150528 Things To Do After Installing Fedora 22.md +++ /dev/null @@ -1,113 +0,0 @@ -安装Fedora 22后要做的事 -================================================================================ -Fedora 22,Red Hat操作系统的社区开发版的最新成员,已经于2015年5月26日发布了。这个令人神圣的Fedora发行版充斥着各种炒作和预期,Fedora 22推出了大量的重大变化。 - -就初始化进程而言,Systemd还是个新生儿,但它已经准备好替换脆弱的sysvinit这个一直是Linux生态系统一部分的模块。另外一个用户会碰到的重大改变存在于基本仓库的python版本中,这里提供了两种不同口味的python版本2.x和3.x分线,各个都有其不同的癖好和优点。所以,那些偏好2.x口味的用户可能想要安装他们喜爱的python版本。自从Fedora 18开始被打扮得更加时髦的Yum安装器也被设置来替换过时陈旧的YUM安装器后。Fedora也已最后决定,现在是时候用DNF来替换YUM了。 -### 1) 安装VLC媒体播放器 ### - -Fedora 22默认自带了媒体播放器viz gnome视频播放器(前身是totem)。如果你对此不感冒,那么我们可以跳过这一步继续往前走。但是,如果你像我一样,偏好使用最广泛的VLC,那么就去从RPMFusion仓库安装吧。安装方法如下: - - sudo dnf install vlc -y - -### 2) 配置RPMFusion仓库 ### - -正如我已经提到过的,Fedora的意识形态很是严谨,它不会自带任何非自由组件。官方仓库不会提供一些包含有非自由组件的基本软件,比如像多媒体编码。因此,安装一些第三方仓库很有必要,这些仓库会为我们提供一些基本的软件。幸运的是,RPMFusion仓库前来拯救我们了。 - - $ sudo dnf install --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-22.noarch.rpm - -### 3) 安装多媒体编码 ### - -刚刚我们说过,一些多媒体编码和插件不会随Fedora一起发送。现在,有谁想仅仅是因为专有编码而错过他们最爱的节目和电影?试试这个吧: - - $ sudo dnf install gstreamer-plugins-bad gstreamer-plugins-bad-free-extras gstreamer-plugins-ugly gstreamer-ffmpeg gstreamer1-libav gstreamer1-plugins-bad-free-extras gstreamer1-plugins-bad-freeworld gstreamer-plugins-base-tools gstreamer1-plugins-good-extras gstreamer1-plugins-ugly gstreamer1-plugins-bad-free gstreamer1-plugins-good gstreamer1-plugins-base gstreamer1 - -### 4) 更新系统 ### - -Fedora是一个尖端的发行版,因此它会持续发布更新用以修复系统中出现的错误和漏洞。因而,保持系统更新到最新,是个不错的做法。 - - $ sudo dnf update -y - -### 5) 卸载你不需要的软件 ### - -Fedora预装了一些大多数用户可以利用的包,但是对于更高级的用户,你可能意识到你并不需要它。要移除你不需要的包相当容易,只需使用以下命令——我选择卸载rhythmbox,因为我知道我不会用到它: - - $ sudo dnf remove rhythmbox - -### 6) 安装Adobe Flash ### - -我们都希望Adobe Flash不要再存在了,因为它并不被认为是最安全的,或者资源利用最好的,但是暂时先让它待着吧。Fedora 22安装Adobe Flash的唯一途径是从Adobe安装官方RPM,就像下面这样。 - -你可以从[这里][1]下载RPM。下载完后,你可以直接右击并像下面这样打开: - -![Install Adobe Flash](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-9.50.42-PM.png) - -右击并选择“用软件安装打开” - -然后,只需在弹出窗口中点击安装: - -![Install Adobe](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-9.51.07-PM.png) - -点击“安装”来完成从Adobe安装自定义RPM的过程 - -该过程完成后,“安装”按钮会变成“移除”,而此时安装也完成了。如果在此过程中你的浏览器开着,会提示你先把它关掉或在安装完成后重启以使修改生效。 - -### 7) 用Gnome Boxes加速虚拟机 ### - -你刚刚安装了Fedora,你也很是喜欢,但是出于某些私人原因,你也许仍然需要Windows,或者你只是想玩玩另外一个Linux发行版。不管哪种情况,你都可以使用Gnome Boxes来简单地创建一个虚拟机或使用一个live发行版,Fedora 22提供了该软件。遵循以下步骤,使用你所选的ISO来开始吧!谁知道呢,也许你可以检验一下某个[Fedora Spin][2]。 - -首先,打开Gnome Boxes,然后在顶部左边选择“新建”: - -![Add a new virtual machine (box)](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-10.24.46-PM.png) - -点击“新建”来开始添加一个新虚拟机的进程吧。 - -接下来,点击打开文件并选择一个ISO: - -![Choose ISO](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-10.28.44-PM.png) - -在选择选择了选择文件或ISO后,选择你的ISO。这里,我已经安装了一个Debian ISO。 - -最后,自定义VM设置或使用默认,然后点击“创建”。VM会以默认方式启动,可用的VM会在Gnome Boxes以小缩略图的方式显示。 - -![Create VM](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-10.31.11-PM.png) - -自定义设置为你所选择的,或者也可以保持默认。完成后,点击“创建”,VM就一切就绪了。 - -### 8) 安装Google Chrome ### - -Firefox被包含在Fedora 22中,但是就跟大多数软件一样,每个人都有他们自己的选择。如果你所喜爱的浏览器恰好是Google Chrome,你可以使用和上面安装Adobe Flash Player类似的指令。然而,很明显,你得使用来自Google的任何你所下载的版本的RPM。最新的版本通常可以在[这里][3]找到。 - -### 9) 添加社交媒体和其它在线帐号 ### - -Gnome自带有不错的内建功能用于容纳帐号相关的东西,像Facebook,Google以及其它在线帐号。你可以通过主Gnome设置应用访问在线帐号设置。然后,只需点击在线帐号,并添加你所选择的帐号。如果你要添加一个帐号,比如像Google,你可以用它来作为默认帐号,用来完成诸如发送邮件、日历提醒、相片和文档交互,以及诸如此类的更多事情。 - -### 10) 安装KDE或另一个桌面环境 ### - -我们中的某些人不喜欢Gnome,那也没问题。在终端中运行以下命令来安装KDE所需的一切来替换它。这些指令也可以用以安装xfce、lxde或其它桌面环境。 - - $ sudo dnf install @kde-desktop - -安装完成后,登出。当你点击你的用户名时,注意那个表示设置的小齿轮。点击它,然后选择“Plasma”。当你再次登录时,一个全新的KDE桌面就会欢迎你。 - -![Plasma on Fedora 22](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-11.32.27-PM.png) - -刚刚安装到Fedora 22上的Plasma环境 - -### 尾声 ### - -就是这样了,一切就绪。使用新系统吧,试试新东西。如果你找不到与你喜好相关的东西,linux赋予你自由修改它的权利。Fedora自带有最新的Gnome Shell作为其桌面环境,如果你觉得太臃肿而不喜欢,那么试试KDE或一些轻量级的DE,像Cinnamon、xfce之类。愿你的Fedora之旅十分开心并且没有困扰。!! - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-how-to/things-do-after-installing-fedora-22/ - -作者:[Jonathan DeMasi][a] -译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/jonathande/ -[1]:https://get.adobe.com/flashplayer/ -[2]:http://spins.fedoraproject.org/ -[3]:https://www.google.com/intl/en/chrome/browser/desktop/index.html From e48fb59106cb00f1efcdfe1f5c381bb92f7c4056 Mon Sep 17 00:00:00 2001 From: strugglingyouth <630441839@qq.occom> Date: Sat, 13 Jun 2015 18:16:20 -0700 Subject: [PATCH 084/153] translated --- ...ry_Cache_Buffer_and_Swap_Space_on_Linux.md | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/translated/tech/20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md b/translated/tech/20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md index 932bc11cd2..bfe689602d 100644 --- a/translated/tech/20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md +++ b/translated/tech/20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md @@ -6,17 +6,11 @@ Linux提供了一个方法来刷新或清除RAM缓存。 每一个Linux系统有三个选项来清除缓存而不中断任何进程或服务。 1,仅清除缓存页 -

 sync; echo 1 > /proc/sys/vm/drop_caches
-
2,清除目录项和inodes -

 sync; echo 2 > /proc/sys/vm/drop_caches
-
3,清除,缓存页,目录项和inodes -

 sync; echo 3 > /proc/sys/vm/drop_caches
-
上述命令的说明: sync将刷新文件系统缓存,命令通过“;”分隔,顺序执行,shell等待终止在序列中的每一个命令执行之前。正如内核文档中提到的,写到drop_cache将清空缓存而不杀死任何应用程序/服务,echo命令做写入文件的工作。 @@ -34,25 +28,17 @@ Linux被设计成它在寻找磁盘之前到磁盘缓存寻找的方式。如果 现在,我们将通过一个cron任务调度器创建一个shell脚本在每天下午2点自动清除RAM缓存。 创建一个shell脚本clearcache.sh并在其中添加以下行: -

 #!/bin/bash
 # Note, we are using "echo 3", but it is not recommended in production instead use "echo 1"
 echo "echo 3 > /proc/sys/vm/drop_caches"
-
给clearcache.sh文件设置执行权限 -

 # chmod 755 clearcache.sh
-
现在,当你需要清除RAM缓存时只需要调用脚本。 现在设置一个定时任务来清除RAM缓存每天在下午2点,打开crontab进行编辑。 -

 # crontab -e
-
添加以下行,保存并退出。 -

 0 3 * * * /path/to/clearcache.sh
-
有关如何创建一个定时任务,更多细节你可以查看我们的文章11 Cron Scheduling Jobs。 在生产环境的服务器上自动清除RAM是否是一个好主意? @@ -63,19 +49,13 @@ echo "echo 3 > /proc/sys/vm/drop_caches" 如何清除Linux的交换空间? 如果你想清除掉的空间,你可以运行下面的命令: -

 # swapoff -a && swapon -a
-
此外,了解有关风险后,您可能会将上面的命令添加到cron中。 现在,我们将上面两种命令结合成一个命令写出正确的脚本来同时清除RAM缓存和交换空间。 -

 # echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'
-
或 -

 su -c 'echo 3 >/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'
-
在测试上面的命令之前,我们先运行“free -m” 然后执行脚本检查缓存。 Clear RAM Cache and Swap Space @@ -85,4 +65,4 @@ su -c 'echo 3 >/proc/sys/vm/drop_caches' && swapoff -a && swa via:http://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/ -  \ No newline at end of file +  From e49a63beb7aed13726aa8f46951cf67668845c86 Mon Sep 17 00:00:00 2001 From: strugglingyouth <630441839@qq.occom> Date: Sat, 13 Jun 2015 19:35:13 -0700 Subject: [PATCH 085/153] translated --- ...y Cache Buffer and Swap Space on Linux.md} | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) rename translated/tech/{20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md => 20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md} (72%) diff --git a/translated/tech/20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md b/translated/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md similarity index 72% rename from translated/tech/20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md rename to translated/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md index bfe689602d..3c272cd4de 100644 --- a/translated/tech/20150610_How_to_Clear_RAM_Memory_Cache_Buffer_and_Swap_Space_on_Linux.md +++ b/translated/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md @@ -1,21 +1,32 @@ -像任何其他的操作系统一样,GNU / Linux已经有效地实施了内存管理甚至更多。但是,如果有任何进程正在蚕食你的内存,你要清除它, + + #在Linux上如何清除RAM内存高速缓存,缓存和交换空间# + +像任何其他的操作系统一样,GNU / Linux已经有效地实施了内存管理甚至更多。但是,如果有任何进程正在蚕食你的内存,你要清除它, Linux提供了一个方法来刷新或清除RAM缓存。 +linux + 在Linux中如何清除缓存? 每一个Linux系统有三个选项来清除缓存而不中断任何进程或服务。 1,仅清除缓存页 +

 sync; echo 1 > /proc/sys/vm/drop_caches
+
2,清除目录项和inodes +

 sync; echo 2 > /proc/sys/vm/drop_caches
+
3,清除,缓存页,目录项和inodes +

 sync; echo 3 > /proc/sys/vm/drop_caches
+
上述命令的说明: sync将刷新文件系统缓存,命令通过“;”分隔,顺序执行,shell等待终止在序列中的每一个命令执行之前。正如内核文档中提到的,写到drop_cache将清空缓存而不杀死任何应用程序/服务,echo命令做写入文件的工作。 -如果你必须清除磁盘高速缓存,第一个命令是最安全在企业和生产环境中,“...echo 1> ...”只会清除页缓存。 +如果你必须清除磁盘高速缓存,第一个命令在企业和生产环境中是最安全,“...echo 1> ...”只会清除页缓存。 不建议使用上面第三个选项在生产环境中“...echo 3 >” ,除非你明确自己在做什么,因为它会清除缓存页,目录项和inodes。 在Linux上释放Buffer和Cache要用到内核是否是个好主意? @@ -28,17 +39,25 @@ Linux被设计成它在寻找磁盘之前到磁盘缓存寻找的方式。如果 现在,我们将通过一个cron任务调度器创建一个shell脚本在每天下午2点自动清除RAM缓存。 创建一个shell脚本clearcache.sh并在其中添加以下行: +

 #!/bin/bash
 # Note, we are using "echo 3", but it is not recommended in production instead use "echo 1"
 echo "echo 3 > /proc/sys/vm/drop_caches"
+
给clearcache.sh文件设置执行权限 +

 # chmod 755 clearcache.sh
+
现在,当你需要清除RAM缓存时只需要调用脚本。 现在设置一个定时任务来清除RAM缓存每天在下午2点,打开crontab进行编辑。 +

 # crontab -e
+
添加以下行,保存并退出。 +

 0 3 * * * /path/to/clearcache.sh
+
有关如何创建一个定时任务,更多细节你可以查看我们的文章11 Cron Scheduling Jobs。 在生产环境的服务器上自动清除RAM是否是一个好主意? @@ -49,20 +68,27 @@ echo "echo 3 > /proc/sys/vm/drop_caches" 如何清除Linux的交换空间? 如果你想清除掉的空间,你可以运行下面的命令: +

 # swapoff -a && swapon -a
+
此外,了解有关风险后,您可能会将上面的命令添加到cron中。 现在,我们将上面两种命令结合成一个命令写出正确的脚本来同时清除RAM缓存和交换空间。 +

 # echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'
+
或 +

 su -c 'echo 3 >/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'
+
在测试上面的命令之前,我们先运行“free -m” 然后执行脚本检查缓存。 -Clear RAM Cache and Swap Space + +![](https://camo.githubusercontent.com/659439c8dbef449fa82ba64ff5a02dc0e9324017/687474703a2f2f7777772e7465636d696e742e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031352f30352f436c6561722d52414d2d43616368652e676966) 就是现在,如果你喜欢这篇文章,不要忘记向我们提供您宝贵的意见, 让我们知道,您认为在企业和生产环境中清除RAM缓存和缓冲区是否是一个好主意? -via:http://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/ -  + +  \ No newline at end of file From dca8c5f495bfe6d316d615eeda987219dd626164 Mon Sep 17 00:00:00 2001 From: wwy-hust Date: Sun, 14 Jun 2015 16:03:30 +0800 Subject: [PATCH 086/153] finish translation --- ...Experience on Linux 'iptables' Firewall.md | 212 ------------------ ...Experience on Linux 'iptables' Firewall.md | 205 +++++++++++++++++ 2 files changed, 205 insertions(+), 212 deletions(-) delete mode 100644 sources/tech/20150610 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md create mode 100644 translated/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md diff --git a/sources/tech/20150610 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md b/sources/tech/20150610 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md deleted file mode 100644 index 455b994975..0000000000 --- a/sources/tech/20150610 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md +++ /dev/null @@ -1,212 +0,0 @@ -Nishita Agarwal Shares Her Interview Experience on Linux ‘iptables’ Firewall -================================================================================ -Nishita Agarwal, a frequent Tecmint Visitor shared her experience (Question and Answer) with us regarding the job interview she had just given in a privately owned hosting company in Pune, India. She was asked a lot of questions on a variety of topics however she is an expert in iptables and she wanted to share those questions and their answer (she gave) related to iptables to others who may be going to give interview in near future. - -![Linux Firewall Iptables Interview Questions](http://www.tecmint.com/wp-content/uploads/2015/05/Linux-iptables-Interview-Questions.jpg) - -All the questions and their Answer are rewritten based upon the memory of Nishita Agarwal. - -> “Hello Friends! My name is **Nishita Agarwal**. I have Pursued Bachelor Degree in Technology. My area of Specialization is UNIX and Variants of UNIX (BSD, Linux) fascinates me since the time I heard it. I have 1+ years of experience in storage. I was looking for a job change which ended with a hosting company in Pune, India.” - -Here is the collection of what I was asked during the Interview. I’ve documented only those questions and their answer that were related to iptables based upon my memory. Hope this will help you in cracking your Interview. - -**1. Have you heard of iptables and firewall in Linux? Any idea of what they are and for what it is used?** - -> **Answer** : I’ve been using iptables for quite long time and I am aware of both iptables and firewall. Iptables is an application program mostly written in C Programming Language and is released under GNU General Public License. Written for System administration point of view, the latest stable release if iptables 1.4.21.iptables may be considered as firewall for UNIX like operating system which can be called as iptables/netfilter, more accurately. The Administrator interact with iptables via console/GUI front end tools to add and define firewall rules into predefined tables. Netfilter is a module built inside of kernel that do the job of filtering. -> -> Firewalld is the latest implementation of filtering rules in RHEL/CentOS 7 (may be implemented in other distributions which I may not be aware of). It has replaced iptables interface and connects to netfilter. - -**2. Have you used some kind of GUI based front end tool for iptables or the Linux Command Line?** - -> **Answer** : Though I have used both the GUI based front end tools for iptables like Shorewall in conjugation of [Webmin][1] in GUI and Direct access to iptables via console.And I must admit that direct access to iptables via Linux console gives a user immense power in the form of higher degree of flexibility and better understanding of what is going on in the background, if not anything other. GUI is for novice administrator while console is for experienced. - -**3. What are the basic differences between between iptables and firewalld?** - -> **Answer** : iptables and firewalld serves the same purpose (Packet Filtering) but with different approach. iptables flush the entire rules set each time a change is made unlike firewalld. Typically the location of iptables configuration lies at ‘/etc/sysconfig/iptables‘ whereas firewalld configuration lies at ‘/etc/firewalld/‘, which is a set of XML files.Configuring a XML based firewalld is easier as compared to configuration of iptables, however same task can be achieved using both the packet filtering application ie., iptables and firewalld. Firewalld runs iptables under its hood along with it’s own command line interface and configuration file that is XML based and said above. - -**4. Would you replace iptables with firewalld on all your servers, if given a chance?** - -> **Answer** : I am familiar with iptables and it’s working and if there is nothing that requires dynamic aspect of firewalld, there seems no reason to migrate all my configuration from iptables to firewalld.In most of the cases, so far I have never seen iptables creating an issue. Also the general rule of Information technology says “why fix if it is not broken”. However this is my personal thought and I would never mind implementing firewalld if the Organization is going to replace iptables with firewalld. - -**5. You seems confident with iptables and the plus point is even we are using iptables on our server.** - -What are the tables used in iptables? Give a brief description of the tables used in iptables and the chains they support. - -> **Answer** : Thanks for the recognition. Moving to question part, There are four tables used in iptables, namely they are: -> -> - Nat Table -> - Mangle Table -> - Filter Table -> - Raw Table -> -> Nat Table : Nat table is primarily used for Network Address Translation. Masqueraded packets get their IP address altered as per the rules in the table. Packets in the stream traverse Nat Table only once. ie., If a packet from a jet of Packets is masqueraded they rest of the packages in the stream will not traverse through this table again. It is recommended not to filter in this table. Chains Supported by NAT Table are PREROUTING Chain, POSTROUTING Chain and OUTPUT Chain. -> -> Mangle Table : As the name suggests, this table serves for mangling the packets. It is used for Special package alteration. It can be used to alter the content of different packets and their headers. Mangle table can’t be used for Masquerading. Supported chains are PREROUTING Chain, OUTPUT Chain, Forward Chain, INPUT Chain, POSTROUTING Chain. -> -> Filter Table : Filter Table is the default table used in iptables. It is used for filtering Packets. If no rules are defined, Filter Table is taken as default table and filtering is done on the basis of this table. Supported Chains are INPUT Chain, OUTPUT Chain, FORWARD Chain. -> -> Raw Table : Raw table comes into action when we want to configure packages that were exempted earlier. It supports PREROUTING Chain and OUTPUT Chain. - -**6. What are the target values (that can be specified in target) in iptables and what they do, be brief!** - -> **Answer** : Following are the target values that we can specify in target in iptables: -> -> - ACCEPT : Accept Packets -> - QUEUE : Paas Package to user space (place where application and drivers reside) -> - DROP : Drop Packets -> - RETURN : Return Control to calling chain and stop executing next set of rules for the current Packets in the chain. - - -**7. Lets move to the technical aspects of iptables, by technical I means practical.** - -How will you Check iptables rpm that is required to install iptables in CentOS?. - -> **Answer** : iptables rpm are included in standard CentOS installation and we do not need to install it separately. We can check the rpm as: -> -> # rpm -qa iptables -> -> iptables-1.4.21-13.el7.x86_64 -> -> If you need to install it, you may do yum to get it. -> -> # yum install iptables-services - -**8. How to Check and ensure if iptables service is running?** - -> **Answer** : To check the status of iptables, you may run the following command on the terminal. -> -> # service status iptables [On CentOS 6/5] -> # systemctl status iptables [On CentOS 7] -> -> If it is not running, the below command may be executed. -> -> ---------------- On CentOS 6/5 ---------------- -> # chkconfig --level 35 iptables on -> # service iptables start -> -> ---------------- On CentOS 7 ---------------- -> # systemctl enable iptables -> # systemctl start iptables -> -> We may also check if the iptables module is loaded or not, as: -> -> # lsmod | grep ip_tables - -**9. How will you review the current Rules defined in iptables?** - -> **Answer** : The current rules in iptables can be review as simple as: -> -> # iptables -L -> -> Sample Output -> -> Chain INPUT (policy ACCEPT) -> target prot opt source destination -> ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED -> ACCEPT icmp -- anywhere anywhere -> ACCEPT all -- anywhere anywhere -> ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh -> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited -> -> Chain FORWARD (policy ACCEPT) -> target prot opt source destination -> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited -> -> Chain OUTPUT (policy ACCEPT) -> target prot opt source destination - -**10. How will you flush all iptables rules or a particular chain?** - -> **Answer** : To flush a particular iptables chain, you may use following commands. -> -> -> # iptables --flush OUTPUT -> -> To Flush all the iptables rules. -> -> # iptables --flush - -**11. Add a rule in iptables to accept packets from a trusted IP Address (say 192.168.0.7)** - -> **Answer** : The above scenario can be achieved simply by running the below command. -> -> # iptables -A INPUT -s 192.168.0.7 -j ACCEPT -> -> We may include standard slash or subnet mask in the source as: -> -> # iptables -A INPUT -s 192.168.0.7/24 -j ACCEPT -> # iptables -A INPUT -s 192.168.0.7/255.255.255.0 -j ACCEPT - -**12. How to add rules to ACCEPT, REJECT, DENY and DROP ssh service in iptables.** - -> **Answer** : Hoping ssh is running on port 22, which is also the default port for ssh, we can add rule to iptables as: -> -> To ACCEPT tcp packets for ssh service (port 22). -> -> # iptables -A INPUT -s -p tcp --dport 22 -j ACCEPT -> -> To REJECT tcp packets for ssh service (port 22). -> -> # iptables -A INPUT -s -p tcp --dport 22 -j REJECT -> -> To DENY tcp packets for ssh service (port 22). -> -> -> # iptables -A INPUT -s -p tcp --dport 22 -j DENY -> -> To DROP tcp packets for ssh service (port 22). -> -> -> # iptables -A INPUT -s -p tcp --dport 22 -j DROP - -**13. Let me give you a scenario. Say there is a machine the local ip address of which is 192.168.0.6. You need to block connections on port 21, 22, 23, and 80 to your machine. What will you do?** - -> **Answer** : Well all I need to use is the ‘multiport‘ option with iptables followed by port numbers to be blocked and the above scenario can be achieved in a single go as. -> -> # iptables -A INPUT -s 192.168.0.6 -p tcp -m multiport --dport 21,22,23,80 -j DROP -> -> The written rules can be checked using the below command. -> -> # iptables -L -> -> Chain INPUT (policy ACCEPT) -> target prot opt source destination -> ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED -> ACCEPT icmp -- anywhere anywhere -> ACCEPT all -- anywhere anywhere -> ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh -> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited -> DROP tcp -- 192.168.0.6 anywhere multiport dports ssh,telnet,http,webcache -> -> Chain FORWARD (policy ACCEPT) -> target prot opt source destination -> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited -> -> Chain OUTPUT (policy ACCEPT) -> target prot opt source destination - -**Interviewer** : That’s all I wanted to ask. You are a valuable employee we won’t like to miss. I will recommend your name to the HR. If you have any question you may ask me. - -As a candidate I don’t wanted to kill the conversation hence keep asking about the projects I would be handling if selected and what are the other openings in the company. Not to mention HR round was not difficult to crack and I got the opportunity. - -Also I would like to thank Avishek and Ravi (whom I am a friend since long) for taking the time to document my interview. - -Friends! If you had given any such interview and you would like to share your interview experience to millions of Tecmint readers around the globe? then send your questions and answers to admin@tecmint.com or you may submit your interview experience using following form. - -- [Share Your Interview Experience][2] - -Thank you! Keep Connected. Also let me know if I could have answered a question more correctly than what I did. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/linux-firewall-iptables-interview-questions-and-answers/ - -作者:[Avishek Kumar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/install-webmin-web-based-system-administration-tool-for-rhel-centos-fedora/ -[2]:https://docs.google.com/a/tecmint.com/forms/d/1jfu1Kg8_qToqvyi6pOT1HQb0dAFvRE-Yc_aOkj0RoSg/viewform \ No newline at end of file diff --git a/translated/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md b/translated/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md new file mode 100644 index 0000000000..270f823b59 --- /dev/null +++ b/translated/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md @@ -0,0 +1,205 @@ +Nishita Agarwal分享它关于Linux防火墙'iptables'的面试经验 +================================================================================ +Nishita Agarwal是Tecmint的用户,她将分享关于她刚刚经历的一家公司(私人公司Pune,印度)的面试经验。在面试中她被问及许多不同的问题,但她是iptables方面的专家,因此她想分享这些关于iptables的问题和相应的答案给那些以后可能会进行相关面试的人。 + +![Linux防火墙Iptables面试问题](http://www.tecmint.com/wp-content/uploads/2015/05/Linux-iptables-Interview-Questions.jpg) + +所有的问题和相应的答案都基于Nishita Agarwal的记忆并经过了重写。 + +> “嗨,朋友!我叫**Nishita Agarwal**。我已经取得了理学学士学位,我的专业集中在UNIX和它的变种(BSD,Linux)。它们一直深深的吸引着我。我在存储方面有1年多的经验。我正在寻求职业上的变化,并将供职于印度的Pune公司。” + +下面是我在面试中被问到的问题的集合。我已经把我记忆中有关iptables的问题和它们的答案记录了下来。希望这会对您未来的面试有所帮助。 + +### 1. 你听说过Linux下面的iptables和Firewalld么?知不知道它们是什么,是用来干什么的? ### + +> **答案** : iptables和Firewalld我都知道,并且我已经使用iptables好一段时间了。iptables主要由C语言写成,并且以GNU GPL许可证发布。它是从系统管理员的角度写的,最新的稳定版是iptables 1.4.21。iptables通常被认为是类UNIX系统中的防火墙,更准确的说,可以称为iptables/netfilter。管理员通过终端/GUI工具与iptables打交道,来添加和定义防火墙规则到预定义的表中。Netfilter是内核中的一个模块,它执行过滤的任务。 +> +> Firewalld是RHEL/CentOS 7(也许还有其他发行版,但我不太清楚)中最新的过滤规则的实现。它已经取代了iptables接口,并与netfilter相连接。 + +### 2. 你用过一些iptables的GUI或命令行工具么? ### + +> **答案** : 虽然我既用过GUI工具,比如与[Webmin][1]结合的Shorewall;以及直接通过终端访问iptables。但我必须承认通过Linux终端直接访问iptables能给予用户更高级的灵活性、以及对其背后工作更好的理解的能力。GUI适合初级管理员而终端适合有经验的管理员。 + +### 3. 那么iptables和firewalld的基本区别是什么呢? ### + +> **答案** : iptables和firewalld都有着同样的目的(包过滤),但它们使用不同的方式。iptables与firewalld不同,在每次发生更改时都刷新整个规则集。通常iptables配置文件位于‘/etc/sysconfig/iptables‘,而firewalld的配置文件位于‘/etc/firewalld/‘。firewalld的配置文件是一组XML文件。以XML为基础进行配置的firewalld比iptables的配置更加容易,但是两者都可以完成同样的任务。例如,firewalld可以在自己的命令行界面以及基于XML的配置文件下使用iptables。 + +### 4. 如果有机会的话,你会在你所有的服务器上用firewalld替换iptables么? ### + +> **答案** : 我对iptables很熟悉,它也工作的很好。如果没有任何需求需要firewalld的动态特性,那么没有理由把所有的配置都从iptables移动到firewalld。通常情况下,目前为止,我还没有看到iptables造成什么麻烦。IT技术的通用准则也说道“为什么要修一件没有坏的东西呢?”。上面是我自己的想法,但如果组织愿意用firewalld替换iptables的话,我不介意。 + +### 5. 你看上去对iptables很有信心,巧的是,我们的服务器也在使用iptables。 ### + +iptables使用的表有哪些?请简要的描述iptables使用的表以及它们所支持的链。 + +> **答案** : 谢谢您的赞赏。至于您问的问题,iptables使用的表有四个,它们是: +> +> Nat 表 +> Mangle 表 +> Filter 表 +> Raw 表 +> +> Nat表 : Nat表主要用于网络地址转换。根据表中的每一条规则修改网络包的IP地址。流中的包仅遍历一遍Nat表。例如,如果一个通过某个接口的包被修饰(修改了IP地址),该流中其余的包将不再遍历这个表。通常不建议在这个表中进行过滤,由NAT表支持的链称为PREROUTING Chain,POSTROUTING Chain和OUTPUT Chain。 +> +> Mangle表 : 正如它的名字一样,这个表用于校正网络包。它用来对特殊的包进行修改。它能够修改不同包的头部和内容。Mangle表不能用于地址伪装。支持的链包括PREROUTING Chain,OUTPUT Chain,Forward Chain,InputChain和POSTROUTING Chain。 +> +> Filter表 : Filter表是iptables中使用的默认表,它用来过滤网络包。如果没有定义任何规则,Filter表则被当作默认的表,并且基于它来过滤。支持的链有INPUT Chain,OUTPUT Chain,FORWARD Chain。 +> +> Raw表 : Raw表在我们想要配置之前被豁免的包时被使用。它支持PREROUTING Chain 和OUTPUT Chain。 + +### 6. 简要谈谈什么是iptables中的目标值(能被指定为目标),他们有什么用 ### + +> **答案** : 下面是在iptables中可以指定为目标的值: +> +> ACCEPT : 接受包 +> QUEUE : 将包传递到用户空间 (应用程序和驱动所在的地方) +> DROP : 丢弃包 +> RETURN : 将控制权交回调用的链并且为当前链中的包停止执行下一调规则 + +### 7. 让我们来谈谈iptables技术方面的东西,我的意思是说实际使用方面 ### + +你怎么检测在CentOS中安装iptables时需要的iptables的rpm? + +> **答案** : iptables已经被默认安装在CentOS中,我们不需要单独安装它。但可以这样检测rpm: +> +> # rpm -qa iptables +> +> iptables-1.4.21-13.el7.x86_64 +> +> 如果您需要安装它,您可以用yum来安装。 +> +> # yum install iptables-services + +### 8. 怎样检测并且确保iptables服务正在运行? ### + +> **答案** : 您可以在终端中运行下面的命令来检测iptables的状态。 +> +> # service status iptables [On CentOS 6/5] +> # systemctl status iptables [On CentOS 7] +> +> 如果iptables没有在运行,可以使用下面的语句 +> +> ---------------- 在CentOS 6/5下 ---------------- +> # chkconfig --level 35 iptables on +> # service iptables start +> +> ---------------- 在CentOS 7下 ---------------- +> # systemctl enable iptables +> # systemctl start iptables +> +> 我们还可以检测iptables的模块是否被加载: +> +> # lsmod | grep ip_tables + +### 9. 你怎么检查iptables中当前定义的规则呢? ### + +> **答案** : 当前的规则可以简单的用下面的命令查看: +> +> # iptables -L +> +> 示例输出 +> +> Chain INPUT (policy ACCEPT) +> target prot opt source destination +> ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED +> ACCEPT icmp -- anywhere anywhere +> ACCEPT all -- anywhere anywhere +> ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> +> Chain FORWARD (policy ACCEPT) +> target prot opt source destination +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> +> Chain OUTPUT (policy ACCEPT) +> target prot opt source destination + +### 10. 你怎样刷新所有的iptables规则或者特定的链呢? ### + +> **答案** : 您可以使用下面的命令来刷新一个特定的链。 +> +> # iptables --flush OUTPUT +> +> 要刷新所有的规则,可以用: +> +> # iptables --flush + +### 11. 请在iptables中添加一条规则,接受所有从一个信任的IP地址(例如,192.168.0.7)过来的包。 ### + +> **答案** : 上面的场景可以通过运行下面的命令来完成。 +> +> # iptables -A INPUT -s 192.168.0.7 -j ACCEPT +> +> 我们还可以在源IP中使用标准的斜线和子网掩码: +> +> # iptables -A INPUT -s 192.168.0.7/24 -j ACCEPT +> # iptables -A INPUT -s 192.168.0.7/255.255.255.0 -j ACCEPT + +### 12. 怎样在iptables中添加规则以ACCEPT,REJECT,DENY和DROP ssh的服务? ### + +> **答案** : 但愿ssh运行在22端口,那也是ssh的默认端口,我们可以在iptables中添加规则来ACCEPT ssh的tcp包(在22号端口上)。 +> +> # iptables -A INPUT -s -p tcp - -dport -j ACCEPT +> +> REJECT ssh服务(22号端口)的tcp包。 +> +> # iptables -A INPUT -s -p tcp - -dport -j REJECT +> +> DENY ssh服务(22号端口)的tcp包。 +> +> +> # iptables -A INPUT -s -p tcp - -dport -j DENY +> +> DROP ssh服务(22号端口)的tcp包。 +> +> +> # iptables -A INPUT -s -p tcp - -dport -j DROP + +### 13. 让我给你另一个场景,假如有一台电脑的本地IP地址是192.168.0.6。你需要封锁在21、22、23和80号端口上的连接,你会怎么做? ### + +> **答案** : 这时,我所需要的就是在iptables中使用‘multiport‘选项,并将要封锁的端口号跟在它后面。上面的场景可以用下面的一条语句搞定: +> +> # iptables -A INPUT -s 192.168.0.6 -p tcp -m multiport --dport 22,23,80,8080 -j DROP +> +> 可以用下面的语句查看写入的规则。 +> +> # iptables -L +> +> Chain INPUT (policy ACCEPT) +> target prot opt source destination +> ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED +> ACCEPT icmp -- anywhere anywhere +> ACCEPT all -- anywhere anywhere +> ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> DROP tcp -- 192.168.0.6 anywhere multiport dports ssh,telnet,http,webcache +> +> Chain FORWARD (policy ACCEPT) +> target prot opt source destination +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> +> Chain OUTPUT (policy ACCEPT) +> target prot opt source destination + +**面试官** : 好了,我问的就是这些。你是一个很有价值的雇员,我们不会错过你的。我将会向HR推荐你的名字。如果你有什么问题,请问我。 + +作为一个候选人我不愿不断的问将来要做的项目的事以及公司里其他的事,这样会打断愉快的对话。更不用说HR轮会不会比较难,总之,我获得了机会。 + +同时我要感谢Avishek和Ravi(我的朋友)花时间帮我整理我的面试。 + +朋友!如果您有过类似的面试,并且愿意与数百万Tecmint读者一起分享您的面试经历,请将您的问题和答案发送到admin@tecmint.com。 + +谢谢!保持联系。如果我能更好的回答我上面的问题的话,请记得告诉我。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-firewall-iptables-interview-questions-and-answers/ + +作者:[Avishek Kumar][a] +译者:[wwy-hust](https://github.com/wwy-hust) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/install-webmin-web-based-system-administration-tool-for-rhel-centos-fedora/ From 15819076b20966bf4d27f7e839224da398fefb96 Mon Sep 17 00:00:00 2001 From: wwy-hust Date: Sun, 14 Jun 2015 16:06:30 +0800 Subject: [PATCH 087/153] fix some errors --- ...r Interview Experience on Linux 'iptables' Firewall.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/translated/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md b/translated/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md index 270f823b59..1d476d0f18 100644 --- a/translated/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md +++ b/translated/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md @@ -139,21 +139,21 @@ iptables使用的表有哪些?请简要的描述iptables使用的表以及它 > **答案** : 但愿ssh运行在22端口,那也是ssh的默认端口,我们可以在iptables中添加规则来ACCEPT ssh的tcp包(在22号端口上)。 > -> # iptables -A INPUT -s -p tcp - -dport -j ACCEPT +> # iptables -A INPUT -s -p tcp --dport 22 -j ACCEPT > > REJECT ssh服务(22号端口)的tcp包。 > -> # iptables -A INPUT -s -p tcp - -dport -j REJECT +> # iptables -A INPUT -s -p tcp --dport 22 -j REJECT > > DENY ssh服务(22号端口)的tcp包。 > > -> # iptables -A INPUT -s -p tcp - -dport -j DENY +> # iptables -A INPUT -s -p tcp --dport 22 -j DENY > > DROP ssh服务(22号端口)的tcp包。 > > -> # iptables -A INPUT -s -p tcp - -dport -j DROP +> # iptables -A INPUT -s -p tcp --dport 22 -j DROP ### 13. 让我给你另一个场景,假如有一台电脑的本地IP地址是192.168.0.6。你需要封锁在21、22、23和80号端口上的连接,你会怎么做? ### From 2e97021d8247f0ae832caac9e14cb6cfb2d17708 Mon Sep 17 00:00:00 2001 From: wxy Date: Sun, 14 Jun 2015 21:23:25 +0800 Subject: [PATCH 088/153] PUB:20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool @NearTan --- ...Command Line Using 'Speedtest-CLI' Tool.md | 85 ++++--------------- 1 file changed, 16 insertions(+), 69 deletions(-) rename {translated/tech => published}/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md (85%) diff --git a/translated/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md b/published/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md similarity index 85% rename from translated/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md rename to published/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md index 9b4c2ae075..462c647ac8 100644 --- a/translated/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md +++ b/published/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md @@ -1,186 +1,133 @@ - - 用命令行工具Speedtest-CLI来测试你的上下行网速 ================================================================================ 我们经常需要到检查家里与办公室之间的网络是否连通,那么我们要怎么做呢?打开网站Speedtest.net然后开始测试。网站是通过加载浏览器中的JavaScript脚本然后选择最佳的服务器测速然后用Flash产生图形化的结果。 - 那么远程服务器呢?要知道大多数远程服务器是没有浏览器可以打开web页面的。用浏览器打开网页测速的瓶颈就在此,你不能按计划的对服务器进行定期的常规测试。这时需要到一个名为Speedtest-cli的软件来打破这个瓶颈,它能让你通过命令行来测试互联网连接的速度。 - #### Speedtest-cli是什么 #### - 此程序是基于Python开发的脚本程序,利用了speedtest.net的服务来测量出上下行的宽带。Speedtest-cli能根据机房离测速服务器的物理距离来列出测速服务器,或者针对某一服务器进行测速,同时还能为你生成一个URL以便你分享你的测速结果。 - 要在Linux上安装最新版本的speedtest-cli,你必须安装2.4-3.4或者更高版本的Python。 - ### 在Linux上安装speedtest-cli ### - 有两种方法可以安装speedtest-cli。第一种方法需要用到`python-pip`包管理器,第二种方法需要安装Python脚本,生成安装文件然后运行,这里我们分别介绍两种方法: - #### 使用pythin-pip安装speedtest-cli#### - 首先你需要安装`python-pip`包管理器,之后你就可以用pip命令来安装speedtest-cli $ sudo apt-get install python-pip $ sudo pip install speedtest-cli - -如果要吧speedtest-cli升级至最新版本,你需要输入以下命令 +如果要把speedtest-cli升级至最新版本,你需要输入以下命令 $ sudo pip install speedtest-cli --upgrade - #### 通过Pyhton脚本来安装speedtest-cli #### - 首先要用wget命令从github上下来Python脚本,然后解压提取下载的文件(master.zip) $ wget https://github.com/sivel/speedtest-cli/archive/master.zip $ unzip master.zip - 提取出文件后,进入提取出的目录`speedtest-cli-master`然后使脚本可以执行。 $ cd speedtest-cli-master/ $ chmod 755 speedtest_cli.py - 下一步,把可执行的脚本移动到`/usr/bin`文件夹,这样你就不用每次都输入完整的脚本路径了。 $ sudo mv speedtest_cli.py /usr/bin/ - ### 用speedtest-cli测试互联网连通速度### - **1. 要测试你的下载与上传速度,只需要运行`speedtest-cli`命令,不需要带参数。** $ speedtest_cli.py -
![Test Download Upload Speed in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Download-Upload-Speed-in-Linux1.png) -在Linux下测试上传下载速度 -
+*在Linux下测试上传下载速度* - -**2. 测试上传下载bytes的速度** +**2. 测试上传下载的速度(以字节计算)** $ speedtest_cli.py --bytes -
![Test Internet Speed in Bytes](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Speed-in-Bytes.png) -测试bytes的速度 -
- +*测试bytes的速度* **3. 工具提供一个链接来下载由你的宽带测试结果生成的图片,你可以分享给你的家人朋友。** -
![Share Internet Speed Results](http://www.tecmint.com/wp-content/uploads/2015/03/Share-Internet-Speed-Results.png) -分享测速结果 -
- +*分享测速结果* 下面的图片就是你通过以上的命令行测速而生成的图片 -
![Speed Test Results](http://www.tecmint.com/wp-content/uploads/2015/03/Speed-Test-Results.png) -测速结果 -
+*测速结果* **4.如果你仅仅需要Ping,上传,下载的结果,就运行以下命令:** $ speedtest_cli.py --simple -
![Test Ping Download Upload Speed](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Ping-Download-Upload-Speed1.png) -测试Ping,上传,下载的速度 -
- - - - +*测试Ping,上传,下载的速度* **5. 列出`speedtest.net`所有的服务器距离你的物理距离,单位是千米(km)** - $ speedtest_cli.py --list -
![Check Speedtest.net Servers](http://www.tecmint.com/wp-content/uploads/2015/03/Check-Speedtest-Servers.png) -列出Speedtest.net的服务器 -
- +*列出Speedtest.net的服务器* **6. 当获得一个非常长的服务器列表之后,怎么列出我想要的某个服务器?如果我要在speedtest.net服务器列表中找出位于Mumbai(印度)的服务器呢?** $ speedtest_cli.py --list | grep -i Mumbai -
![Check Nearest Server](http://www.tecmint.com/wp-content/uploads/2015/03/Check-Nearest-Server.png) -列出最近的服务器 -
- +*列出最近的服务器* **7. 对指定的服务器进行测速。我们使用上面例子5和例子6中获取的服务器ID:** $ speedtest_cli.py --server [server ID] - $ speedtest_cli.py --server [5060] ## Here server ID 5060 is used in the example. $ speedtest_cli.py --server [5060] ## 这里使用服务器ID为5060作为例子 -
![Test Connection Against Server](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Connection-Against-Server.png) -对指定的服务器进行测速 -
- +*对指定的服务器进行测速* **8. 输出`speedtest-cli`的版本信息和帮助文档** $ speedtest_cli.py --version -
![Check SpeedCli Version](http://www.tecmint.com/wp-content/uploads/2015/03/Check-SpeedCLi-Version.png) -输出版本号 -
+*输出版本号* $ speedtest_cli.py --help -
+ ![SpeedCli Help](http://www.tecmint.com/wp-content/uploads/2015/03/SpeedCli-Help.png) -输出帮助文档 -
- +*输出帮助文档* **提醒:**报告中的延迟并不是确切的结果,不应该过于依赖它;这个数值可以当作相对延迟,这对你选择某一测试服务器来说是可靠的。同时,CPU和内存的容量会影响结果的准确度。 - ### 结论 ### - -系统管理员和开发者应该必备这个简单的脚本工具,这个工具轻量级,功能齐全,真是太赞了。我不喜欢Speedtest.net的原因是它使用来flash,相反speedtest-cli刚好戳中了我的痛点。 - +系统管理员和开发者应该必备这个简单的脚本工具,这个轻量级的工具功能齐全,真是太赞了。我不喜欢Speedtest.net的原因是它使用来flash,相反speedtest-cli刚好戳中了我的痛点。 speedtest_cli是一个第三方工具,也不能自动地记录下宽带速度。Speedtest.net拥有上百万的用户,你可以自己[配制一个小型的测速服务器][1]。 - -上面就是所有内容,更多内容敬请关注Tecmint。如果你有任何反馈记得在文章下方评论,如果你喜欢别忘了给我们点歌赞,分享我们的文章。 +上面就是所有内容,更多内容敬请关注我们。如果你有任何反馈记得在文章下方评论,如果你喜欢别忘了给我们点个赞,分享我们的文章。 -------------------------------------------------------------------------------- @@ -188,7 +135,7 @@ via: http://www.tecmint.com/check-internet-speed-from-command-line-in-linux/ 作者:[Avishek Kumar][a] 译者:[NearTan](https://github.com/NearTan) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 From eb8f276ab1960e2edc873010cf5a8c9f75ec3dc8 Mon Sep 17 00:00:00 2001 From: wxy Date: Sun, 14 Jun 2015 22:37:08 +0800 Subject: [PATCH 089/153] PUB:20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux @strugglingyouth --- ...ry Cache Buffer and Swap Space on Linux.md | 106 ++++++++++++++++++ ...ry Cache Buffer and Swap Space on Linux.md | 94 ---------------- 2 files changed, 106 insertions(+), 94 deletions(-) create mode 100644 published/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md delete mode 100644 translated/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md diff --git a/published/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md b/published/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md new file mode 100644 index 0000000000..2007daec95 --- /dev/null +++ b/published/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md @@ -0,0 +1,106 @@ +在Linux上如何清除内存的 Cache、Buffer 和交换空间 +============================================ + +像任何其他的操作系统一样,GNU/Linux 已经实现的内存管理不仅有效,而且更好。但是,如果有任何进程正在蚕食你的内存,而你想要清除它的话,Linux 提供了一个刷新或清除RAM缓存方法。 + +![Clear RAM Cache and Swap in Linux](http://www.tecmint.com/wp-content/uploads/2015/05/Clear-RAM-Cache-in-Linux.jpg) + +### 如何在 Linux 中清除缓存(Cache)?### + +每个 Linux 系统有三种选项来清除缓存而不需要中断任何进程或服务。 + +(LCTT 译注:Cache,译作“缓存”,指 CPU 和内存之间高速缓存。Buffer,译作“缓冲区”,指在写入磁盘前的存储再内存中的内容。在本文中,Buffer 和 Cache 有时候会通指。) + +1. 仅清除页面缓存(PageCache) + + # sync; echo 1 > /proc/sys/vm/drop_caches + +2. 清除目录项和inode + + # sync; echo 2 > /proc/sys/vm/drop_caches + +3. 清除页面缓存,目录项和inode + + # sync; echo 3 > /proc/sys/vm/drop_caches + + +上述命令的说明: + +sync 将刷新文件系统缓冲区(buffer),命令通过“;”分隔,顺序执行,shell在执行序列中的下一个命令之前会等待命令的终止。正如内核文档中提到的,写入到drop_cache将清空缓存而不会杀死任何应用程序/服务,[echo命令][1]做写入文件的工作。 + +如果你必须清除磁盘高速缓存,第一个命令在企业和生产环境中是最安全,`"...echo 1> ..."`只会清除页面缓存。 +在生产环境中不建议使用上面的第三个选项`"...echo 3 > ..."` ,除非你明确自己在做什么,因为它会清除缓存页,目录项和inodes。 + +**在Linux上释放也许被内核所使用的缓冲区(Buffer)和缓存(Cache)是否是个好主意?** + +当你设置许多设定想要检查效果时,如果它实际上是专门针对 I/O 范围的基准测试,那么你可能需要清除缓冲区和缓存。你可以如上所示删除缓存,无需重新启动系统(即无需停机)。 + +Linux被设计成它在寻找磁盘之前到磁盘缓存寻找的方式。如果它发现该资源在缓存中,则该请求不会发送到磁盘。如果我们清理缓存,磁盘缓存就起不到作用了,系统会到磁盘上寻找资源。 + +此外,当清除缓存后它也将减慢系统运行速度,系统会将每一个被请求的资源再次加载到磁盘缓存中。 + + +现在,我们将创建一个 shell 脚本,通过一个 cron 调度任务在每天下午2点自动清除RAM缓存。如下创建一个 shell 脚本 clearcache.sh 并在其中添加以下行: + + #!/bin/bash + # 注意,我们这里使用了 "echo 3",但是不推荐使用在产品环境中,应该使用 "echo 1" + echo "echo 3 > /proc/sys/vm/drop_caches" + +给clearcache.sh文件设置执行权限 + + # chmod 755 clearcache.sh + +现在,当你需要清除内存缓存时只需要调用脚本。 + +现在设置一个每天下午2点的定时任务来清除RAM缓存,打开crontab进行编辑。 + + # crontab -e + +添加以下行,保存并退出。 + + 0 3 * * * /path/to/clearcache.sh + +有关如何创建一个定时任务,更多细节你可以查看我们的文章 [11 个定时调度任务的例子][2]。 + +**在生产环境的服务器上自动清除RAM是否是一个好主意?** + +不!它不是。想想一个情况,当你已经预定脚本在每天下午2点来清除内存缓存。那么其时该脚本会执行并刷新你的内存缓存。在某一天由于某些原因,可能您的网站的在线用户会超过预期地从你的服务器请求资源。 + + +而在这时,按计划调度的脚本运行了,并清除了缓存中的一切。当所有的用户都从磁盘读取数据时,这将导致服务器崩溃并损坏数据库。因此,清除缓存仅在必要时并且在你的预料之中,否则你就是个呆瓜系统管理员。 + +###如何清除Linux的交换空间?### + +如果你想清除掉的空间,你可以运行下面的命令: + + # swapoff -a && swapon -a + +此外,了解有关风险后,您可以将上面的命令添加到cron中。 + +现在,我们将上面两种命令结合成一个命令,写成正确的脚本来同时清除RAM缓存和交换空间。 + + # echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared' + +或 + + su -c 'echo 3 > /proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared' + +在测试上面的命令之前,我们在执行脚本前后运行“free -m” 来检查缓存。 + +![Clear RAM Cache and Swap Space](http://www.tecmint.com/wp-content/uploads/2015/05/Clear-RAM-Cache.gif) + +就是这样,如果你喜欢这篇文章,不要忘记向我们提供您宝贵的意见,让我们知道,您认为在企业和生产环境中清除内存缓存和缓冲区是否是一个好主意? + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/ + +作者:[Avishek Kumar][a] +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:https://linux.cn/article-3592-1.html +[2]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/ \ No newline at end of file diff --git a/translated/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md b/translated/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md deleted file mode 100644 index 3c272cd4de..0000000000 --- a/translated/tech/20150610 How to Clear RAM Memory Cache Buffer and Swap Space on Linux.md +++ /dev/null @@ -1,94 +0,0 @@ - - #在Linux上如何清除RAM内存高速缓存,缓存和交换空间# - -像任何其他的操作系统一样,GNU / Linux已经有效地实施了内存管理甚至更多。但是,如果有任何进程正在蚕食你的内存,你要清除它, -Linux提供了一个方法来刷新或清除RAM缓存。 - -linux - -在Linux中如何清除缓存? - -每一个Linux系统有三个选项来清除缓存而不中断任何进程或服务。 - -1,仅清除缓存页 -

-sync; echo 1 > /proc/sys/vm/drop_caches
-
-2,清除目录项和inodes -

-sync; echo 2 > /proc/sys/vm/drop_caches
-
-3,清除,缓存页,目录项和inodes -

-sync; echo 3 > /proc/sys/vm/drop_caches
-
-上述命令的说明: - -sync将刷新文件系统缓存,命令通过“;”分隔,顺序执行,shell等待终止在序列中的每一个命令执行之前。正如内核文档中提到的,写到drop_cache将清空缓存而不杀死任何应用程序/服务,echo命令做写入文件的工作。 - -如果你必须清除磁盘高速缓存,第一个命令在企业和生产环境中是最安全,“...echo 1> ...”只会清除页缓存。 -不建议使用上面第三个选项在生产环境中“...echo 3 >” ,除非你明确自己在做什么,因为它会清除缓存页,目录项和inodes。 - -在Linux上释放Buffer和Cache要用到内核是否是个好主意? - -当你请求许多设定想要检查时,如果它实际上是专门实施对I/O 广泛的基准测试,那么你可能需要清除缓存。你可以如上所示删除缓存,无需重新启动系统即无需停机。 - -Linux被设计成它在寻找磁盘之前到磁盘缓存寻找的方式。如果它发现该资源在缓存中,则该请求不到达磁盘。如果我们清理缓存,磁盘缓存将没有用处,系统会到磁盘上寻找资源。 - -此外,当清除缓存后它也将减慢系统运行速度,系统会重新加载每一个被请求的资源再次到磁盘缓存中。 - -现在,我们将通过一个cron任务调度器创建一个shell脚本在每天下午2点自动清除RAM缓存。 -创建一个shell脚本clearcache.sh并在其中添加以下行: -

-#!/bin/bash
-# Note, we are using "echo 3", but it is not recommended in production instead use "echo 1"
-echo "echo 3 > /proc/sys/vm/drop_caches"
-
-给clearcache.sh文件设置执行权限 -

-# chmod 755 clearcache.sh
-
-现在,当你需要清除RAM缓存时只需要调用脚本。 - -现在设置一个定时任务来清除RAM缓存每天在下午2点,打开crontab进行编辑。 -

-# crontab -e
-
-添加以下行,保存并退出。 -

-0 3 * * * /path/to/clearcache.sh
-
-有关如何创建一个定时任务,更多细节你可以查看我们的文章11 Cron Scheduling Jobs。 - -在生产环境的服务器上自动清除RAM是否是一个好主意? - -不!它不是。想想一个情况,当你已经预定脚本来清除RAM缓存每天在下午2点。每天下午2点该脚本会执行并刷新你的RAM缓存。在一天中的任何时候,您网站用户的在线量可能会超过预期的,并从你的服务器请求资源。同时调度器运行着脚本,并在高速缓存中清除一切。当所有的用户都从磁盘读取数据时,这将导致服务器崩溃并损坏数据库。 -因此,清除缓存仅在必要时并且在你的预料之中,否则你就是个Cargo Cult System Administrator。 - -如何清除Linux的交换空间? - -如果你想清除掉的空间,你可以运行下面的命令: -

-# swapoff -a && swapon -a
-
-此外,了解有关风险后,您可能会将上面的命令添加到cron中。 - -现在,我们将上面两种命令结合成一个命令写出正确的脚本来同时清除RAM缓存和交换空间。 -

-# echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'
-
-或 -

-su -c 'echo 3 >/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'
-
-在测试上面的命令之前,我们先运行“free -m” 然后执行脚本检查缓存。 - - -![](https://camo.githubusercontent.com/659439c8dbef449fa82ba64ff5a02dc0e9324017/687474703a2f2f7777772e7465636d696e742e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031352f30352f436c6561722d52414d2d43616368652e676966) - -就是现在,如果你喜欢这篇文章,不要忘记向我们提供您宝贵的意见, -让我们知道,您认为在企业和生产环境中清除RAM缓存和缓冲区是否是一个好主意? - - - -  \ No newline at end of file From 55e4b621c8b0bfbdc271efff112a85fd42fcb9b2 Mon Sep 17 00:00:00 2001 From: joeren Date: Mon, 15 Jun 2015 07:58:10 +0800 Subject: [PATCH 090/153] Update 20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md --- ...e incremental backup of LUKS-encrypted disk or partition.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md b/sources/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md index 64e872c4b7..ee43b08c2a 100644 --- a/sources/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md +++ b/sources/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md @@ -1,3 +1,4 @@ +Translating by GOLinux! How to make remote incremental backup of LUKS-encrypted disk/partition ================================================================================ Some of us have our hard drives at home or on a [VPS][1] encrypted by [Linux Unified Key Setup (LUKS)][2] for security reasons, and these drives can quickly grow to tens or hundreds of GBs in size. So while we enjoy the security of our LUKS device, we may start to think about a possible remote backup solution. For secure off-site backup, we will need something that operates at the block level of the encrypted LUKS device, and not at the un-encrypted file system level. So in the end we find ourselves in a situation where we will need to transfer the entire LUKS device (let's say 200GB for example) each time we want to make a backup. Clearly not feasible. How can we deal with this problem? @@ -77,4 +78,4 @@ via: http://xmodulo.com/remote-incremental-backup-luks-encrypted-disk-partition. [2]:http://xmodulo.com/how-to-create-encrypted-disk-partition-on-linux.html [3]:http://bdsync.rolf-fokkens.nl/ [4]:http://xmodulo.com/recommend/linuxbook -[5]:http://xmodulo.com/how-to-enable-ssh-login-without.html \ No newline at end of file +[5]:http://xmodulo.com/how-to-enable-ssh-login-without.html From 21fb1a56adef26f222fe808288afba02f0b8e378 Mon Sep 17 00:00:00 2001 From: GOLinux Date: Mon, 15 Jun 2015 08:51:19 +0800 Subject: [PATCH 091/153] [Translated]20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md --- ...kup of LUKS-encrypted disk or partition.md | 81 ------------------- ...kup of LUKS-encrypted disk or partition.md | 80 ++++++++++++++++++ 2 files changed, 80 insertions(+), 81 deletions(-) delete mode 100644 sources/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md create mode 100644 translated/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md diff --git a/sources/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md b/sources/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md deleted file mode 100644 index ee43b08c2a..0000000000 --- a/sources/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md +++ /dev/null @@ -1,81 +0,0 @@ -Translating by GOLinux! -How to make remote incremental backup of LUKS-encrypted disk/partition -================================================================================ -Some of us have our hard drives at home or on a [VPS][1] encrypted by [Linux Unified Key Setup (LUKS)][2] for security reasons, and these drives can quickly grow to tens or hundreds of GBs in size. So while we enjoy the security of our LUKS device, we may start to think about a possible remote backup solution. For secure off-site backup, we will need something that operates at the block level of the encrypted LUKS device, and not at the un-encrypted file system level. So in the end we find ourselves in a situation where we will need to transfer the entire LUKS device (let's say 200GB for example) each time we want to make a backup. Clearly not feasible. How can we deal with this problem? - -### A Solution: Bdsync ### - -This is when a brilliant open-source tool called [Bdsync][3] (thanks to Rolf Fokkens) comes to our rescue. As the name implies, Bdsync can synchronize "block devices" over network. For fast synchronization, Bdsync generates and compares MD5 checksums of blocks in the local/remote block devices, and sync only the differences. What rsync can do at the file system level, Bdsync can do it at the block device level. Naturally, it works with encrypted LUKS devices as well. Pretty neat! - -Using Bdsync, the first-time backup will copy the entire LUKS block device to a remote host, so it will take a lot of time to finish. However, after that initial backup, if we make some new files on the LUKS device, the second backup will be finished quickly because we will need to copy only that blocks which have been changed. Classic incremental backup at play! - -### Install Bdsync on Linux ### - -Bdsync is not included in the standard repositories of [Linux][4] distributions. Thus you need to build it from the source. Use the following distro-specific instructions to install Bdsync and its man page on your system. - -#### Debian, Ubuntu or Linux Mint #### - - $ sudo apt-get install git gcc libssl-dev - $ git clone https://github.com/TargetHolding/bdsync.git - $ cd bdsync - $ make - $ sudo cp bdsync /usr/local/sbin - $ sudo mkdir -p /usr/local/man/man1 - $ sudo sh -c 'gzip -c bdsync.1 > /usr/local/man/man1/bdsync.1.gz' - -#### Fedora or CentOS/RHEL #### - - $ sudo yum install git gcc openssl-devel - $ git clone https://github.com/TargetHolding/bdsync.git - $ cd bdsync - $ make - $ sudo cp bdsync /usr/local/sbin - $ sudo mkdir -p /usr/local/man/man1 - $ sudo sh -c 'gzip -c bdsync.1 > /usr/local/man/man1/bdsync.1.gz' - -### Perform Off-site Incremental Backup of LUKS-Encrypted Device ### - -I assume that you have already provisioned a LUKS-encrypted block device as a backup source (e.g., /dev/LOCDEV). I also assume that you have a remote host where the source device will be backed up (e.g., as /dev/REMDEV). - -You need to access the root account on both systems, and set up [password-less SSH access][5] from the local host to a remote host. Finally, you need to install Bdsync on both hosts. - -To initiate a remote backup process on the local host, we execute the following command as the root: - - # bdsync "ssh root@remote_host bdsync --server" /dev/LOCDEV /dev/REMDEV | gzip > /some_local_path/DEV.bdsync.gz - -Some explanations are needed here. Bdsync client will open an SSH connection to the remote host as the root, and execute Bdsync client with --server option. As clarified, /dev/LOCDEV is our source LUKS block device on the local host, and /dev/REMDEV is the target block device on the remote host. They could be /dev/sda (for an entire disk) or /dev/sda2 (for a single partition). The output of the local Bdsync client is then piped to gzip, which creates DEV.bdsync.gz (so-called binary patch file) in the local host. - -The first time you run the above command, it will take very long time, depending on your Internet/LAN speed and the size of /dev/LOCDEV. Remember that you must have two block devices (/dev/LOCDEV and /dev/REMDEV) with the same size. - -The next step is to copy the generated patch file from the local host to the remote host. Using scp is one possibility: - - # scp /some_local_path/DEV.bdsync.gz root@remote_host:/remote_path - -The final step is to execute the following command on the remote host, which will apply the patch file to /dev/REMDEV: - - # gzip -d < /remote_path/DEV.bdsync.gz | bdsync --patch=/dev/DSTDEV - -I recommend doing some tests with small partitions (without any important data) before deploying Bdsync with real data. After you fully understand how the entire setup works, you can start backing up real data. - -### Conclusion ### - -In conclusion, we showed how to use Bdsync to perform incremental backups for LUKS devices. Like rsync, only a fraction of data, not the entire LUKS device, is needed to be pushed to an off-site backup site at each backup, which saves bandwidth and backup time. Rest assured that all the data transfer is secured by SSH or SCP, on top of the fact that the device itself is encrypted by LUKS. It is also possible to improve this setup by using a dedicated user (instead of the root) who can run bdsync. We can also use bdsync for ANY block device, such as LVM volumes or RAID disks, and can easily set up Bdsync to back up local disks on to USB drives as well. As you can see, its possibility is limitless! - -Feel free to share your thought. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/remote-incremental-backup-luks-encrypted-disk-partition.html - -作者:[Iulian Murgulet][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://xmodulo.com/author/iulian -[1]:http://xmodulo.com/go/digitalocean -[2]:http://xmodulo.com/how-to-create-encrypted-disk-partition-on-linux.html -[3]:http://bdsync.rolf-fokkens.nl/ -[4]:http://xmodulo.com/recommend/linuxbook -[5]:http://xmodulo.com/how-to-enable-ssh-login-without.html diff --git a/translated/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md b/translated/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md new file mode 100644 index 0000000000..645ade2261 --- /dev/null +++ b/translated/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md @@ -0,0 +1,80 @@ +为LUKS——加密的磁盘/分区做增量备份 +================================================================================ +我们中有些人出于安全原因,在家里或者[VPS][1]上通过[Linux统一密钥配置(LUKS)][2]为硬盘驱动器加密,而这些驱动器的容量很快会增长到数十或数百GB。因此,虽然我们享受着LUKS设备带来的安全感,但是我们也该开始考虑一个可能的远程备份方案了。对于安全的非现场备份,我们将需要在LUKS加密的设备上以块级别操作的东西。因此,最后我们发现这么个状况,我们每次都需要传输想要做备份的LUKS设备(比如说200GB)。很明显,这是不可行的。我们该怎么来处理这个问题呢? + +### 一个解决方案: Bdsync ### + +这时,一个卓越的开源工具来拯救我们了,它叫[Bdsync][3](多亏了Rolf Fokkens)。顾名思义,Bdsync可以通过网络同步“块设备”。对于快速同步,Bdsync会生成并对比本地/远程块设备的块MD5校验和,只同步差异部分。rsync在文件系统级别可以做的,Bdsync可以在块设备级别完成。很自然,对于LUKS加密的设备它也能工作得很好。相当地灵巧! + +使用Bdsync,首次备份将拷贝整个LUKS块设备到远程主机,因而会花费大量时间来完成。然而,在初始备份后,如果我们在LUKS设备新建一些文件,再次备份就会很快完成,因为我们只需拷贝修改过的块。经典的增量备份在起作用了! + +### 安装Bdsync到Linux ### + +Bdsync并不包含在[Linux][4]发行版的标准仓库中,因而你需要从源代码来构建它。使用以下针对特定版本的指令来安装Bdsync及其手册页到你的系统中。 + +#### Debian,Ubuntu或Linux Mint #### + + $ sudo apt-get install git gcc libssl-dev + $ git clone https://github.com/TargetHolding/bdsync.git + $ cd bdsync + $ make + $ sudo cp bdsync /usr/local/sbin + $ sudo mkdir -p /usr/local/man/man1 + $ sudo sh -c 'gzip -c bdsync.1 > /usr/local/man/man1/bdsync.1.gz' + +#### Fedora或CentOS/RHEL #### + + $ sudo yum install git gcc openssl-devel + $ git clone https://github.com/TargetHolding/bdsync.git + $ cd bdsync + $ make + $ sudo cp bdsync /usr/local/sbin + $ sudo mkdir -p /usr/local/man/man1 + $ sudo sh -c 'gzip -c bdsync.1 > /usr/local/man/man1/bdsync.1.gz' + +### 对LUKS加密的设备实施非现场增量备份 ### + +我假定你已经准备好了一个LUKS加密的块设备作为备份源(如,/dev/LOCDEV)。同时,我假定你也有一台远程主机,用以作为源设备的备份点(如,/dev/REMDEV)。 + +你需要在两台系统上具有root帐号访问权限,并且设置从本地访问远程的[无密码SSH访问][5]。最后,你需要安装Bdsync到两台主机上。 + +要在本地主机上初始化一个远程备份进程,我们需要以root执行以下命令: + + # bdsync "ssh root@remote_host bdsync --server" /dev/LOCDEV /dev/REMDEV | gzip > /some_local_path/DEV.bdsync.gz + +这里需要进行一些说明。Bdsync客户端将以root打开一个到远程主机的SSH连接,并执行带有--server选项的Bdsync客户端。明确说明一下,/dev/LOCDEV是我们的本地主机上的源LUKS块设备,而/dev/REMDEV是远程主机上的目标块设备。它们可以是/dev/sda(作为整个磁盘),或者/dev/sda2(作为单个分区)。本地Bdsync客户端的输出结果随后被管道输送到gzip,用来在本地主机中创建DEV.bdsync.gz(所谓的二进制补丁文件)。 + +你第一次运行上面的命令的时候,它会花费很长一段时间,这取决于你的互联网/局域网速度,以及/dev/LOCDEV的大小。记住,你必须有两个大小相同的块设备(/dev/LOCDEV和/dev/REMDEV)。 + +下一步是要将补丁文件从本地主机拷贝到远程主机。一种可能是使用scp: + + # scp /some_local_path/DEV.bdsync.gz root@remote_host:/remote_path + +最后一步,是要在远程主机上执行以下命令,它们会将补丁文件应用到/dev/REMDEV: + + # gzip -d < /remote_path/DEV.bdsync.gz | bdsync --patch=/dev/DSTDEV + +我推荐在使用真实数据部署Bdsync前,使用一些(没有任何重要数据)小分区来做这些测试。在你完全弄懂整个设置是如何工作之后,你可以开始备份真实数据。 + +### 尾声 ### + +小结之,我们演示了如何使用Bdsync来为LUKS设备实施增量备份。和rsync一样,每次备份只有一小部分数据,而不是整个LUKS设备,需要被推送到非现场备份点,这样会节省带宽和备份时间。剩下来,需要保证所有数据传输通过SSH或SCP加固安全,事实上设备自身是由LUKS加密的。也可以通过使用可以运行bdsync的专用用户(而非root)来改善该配置。我们也可以将bdsync用于任何块设备,如LVM卷或RAID磁盘,也可以很轻易地设置Bdsync备份本地磁盘到USB驱动器上。如你所见,它有着无限可能性! + +随时分享你的想法。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/remote-incremental-backup-luks-encrypted-disk-partition.html + +作者:[Iulian Murgulet][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/iulian +[1]:http://xmodulo.com/go/digitalocean +[2]:http://xmodulo.com/how-to-create-encrypted-disk-partition-on-linux.html +[3]:http://bdsync.rolf-fokkens.nl/ +[4]:http://xmodulo.com/recommend/linuxbook +[5]:http://xmodulo.com/how-to-enable-ssh-login-without.html From ebc81d816b71c6daeb5920d0c59008d667d98360 Mon Sep 17 00:00:00 2001 From: wi-cuckoo Date: Mon, 15 Jun 2015 10:52:46 +0800 Subject: [PATCH 092/153] translated wi-cuckoo --- ...che Containers with Docker on Fedora 22.md | 283 ------------------ ...che Containers with Docker on Fedora 22.md | 279 +++++++++++++++++ 2 files changed, 279 insertions(+), 283 deletions(-) delete mode 100644 sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md create mode 100644 translated/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md diff --git a/sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md b/sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md deleted file mode 100644 index 66bd27fbc5..0000000000 --- a/sources/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md +++ /dev/null @@ -1,283 +0,0 @@ -translating wi-cuckoo -How to Configure Apache Containers with Docker on Fedora 22 -================================================================================ -In this article we are going to learn about Docker, how to use it to deploy Apache httpd and how can you share it on Docker Hub. First we are going to learn how to pull and use images hosted on Docker Hub, and then install Apache on an image of Fedora 22 interactively, after that we are going to learn how to use a Dockerfile to make an image in a faster and more elegant way, finally we are going to publish the image we've created in Docker Hub, so anyone will be able download and use it later. - -### Installing Docker and saying hello world ### - -**Requirements** - -You will need atleast these things to run Docker: - -- You need a 64bit Kernel version 3.10 or higher -- Iptables 1.4 - This will be used by Docker to make the network wizardry, such as Network Address Translation. -- Git 1.7 - Docker uses Git to make it transactions to repositories, like Docker Hub -- ps - This utility is present in most environments and is provided in the procps package. -- root - despite normal users can run docker client by TCP and other means, we will assume that you are root, for sake of simplicity - -#### Install docker using dnf #### - -The following commands will install Docker - - dnf update && dnf install docker - -**Note**: You can still use Yum in Fedora 22, but it's deprecated in favor of DNF and is not present in a clean install. - -#### Check your install #### - -The first command we are going to use is docker info, this give you many information: - - docker info - -Also try **docker version**: - - docker version - -#### Starting Docker as daemon #### - -You should start a docker instance that will take care of our requests. - - docker -d - -Now set docker to start with the system, so you don't need to run the previous command every time you reboot. - - chkconfig docker on - -Let's say hello world with Busybox: - - docker run -t busybox /bin/echo "hello world" - -In this command, we tell Docker to execute /bin/echo "hello world" in an instance/container of the Busybox image, which is a minimal POSIX environment based in a single binary and links to it. - -If Docker can't find a local image of Busybox on your system, it will pull the image automatically from Docker Hub, as you can see in the following screenshot: - -![Hello world with Busybox](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-hello-world-busybox-complete.png) - -Hello world with Busybox - -Try the same command again, this time as Docker already have the Busybox image locally, all you will see is the output of echo: - - docker run -t busybox /bin/echo "hello world" - -Try also the following to enter in the container environment: - - docker run -it busybox /bin/sh - -To leave and stop the container use the **exit** command - -### Dockerizing Apache interactively ### - -Pull/Download the Fedora image: - - docker pull fedora:22 - -Run a container dettached from the console: - - docker run -d -t fedora:22 /bin/bash - -List running containers and identify by name as follows - - docker ps - -![listing with docker ps and attaching with docker attach](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-ps-with-docker-attach-highlight.png) - -listing with docker ps and attaching with docker attach - -The name angry_nobel was given to our instance, so let's attach: - - docker attach angry_nobel - -Note: Every time you run a container a new name will be given, if you need a constant name for you container you should use the -name parameter to docker run command. - -#### Installing Apache #### - -The following command will update DNF database, download install Apache (httpd package) and clean DNF cache to make the image small - - dnf -y update && dnf -y install httpd && dnf -y clean all - -Configuring Apache - -The only thing we are going to change httpd.conf is the ServerName, this makes Apache stops to complain. - - sed -i.orig 's/#ServerName/ServerName/' /etc/httpd/conf/httpd.conf - -**Set the environment** - -To make Apache run in standalone mode, you must provide some information in the form of enviroenment variables, and also you will need the directories set in these variables, so we are going to make this with a small shell script that will also start Apache - - vi /etc/httpd/run_apache_foreground - ----------- - - #!/bin/bash - - #set variables - APACHE_LOG_DI=R"/var/log/httpd" - APACHE_LOCK_DIR="/var/lock/httpd" - APACHE_RUN_USER="apache" - APACHE_RUN_GROUP="apache" - APACHE_PID_FILE="/var/run/httpd/httpd.pid" - APACHE_RUN_DIR="/var/run/httpd" - - #create directories if necessary - if ! [ -d /var/run/httpd ]; then mkdir /var/run/httpd;fi - if ! [ -d /var/log/httpd ]; then mkdir /var/log/httpd;fi - if ! [ -d /var/lock/httpd ]; then mkdir /var/lock/httpd;fi - - #run Apache - httpd -D FOREGROUND - -**Alternatively**, you can past and run this snippet on the container shell: - - dnf -y install git && git clone https://github.com/gaiada/run-apache-foreground.git && cd run-apach* && ./install && dnf erase git - -The inline script above will, install Git, clone [this repository][1], put the script in place and ask you if you want uninstall Git. - -**Saving your container state** - -Your container is now ready to run Apache, now it is time to save the current state of this container in an image to be able use whenever you need. - -To leave the container environment, you must press **Ctrl+p** followed by **Ctrl+q**, if you just call exit in the shell, you will also stop the container and lost what you have done so far. - -Once you are back to the Docker host, use **docker commit** followed by the container and the repository name/tag you desire: - - docker commit angry_nobel gaiada/apache - -Now that you saved the container status into a image, you can use **docker stop** on the running container: - - docker stop angry_nobel - -**Run and test your image** - -Finally, run a container from your new image and redirect connections on port 80 to it with: - - docker run -p 80:80 -d -t gaiada/apache /etc/httpd/run_apache_foreground - - - -At this point, you are already running Apache in your container, open your browser to access the service in [http://localhost][2] and you will see the Apache default page as follows - -![Apache default page running from Docker container](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-apache-running.png) - -Apache default page running from Docker container - -### Dockerizing Apache with a Dockerfile ### - -Now we are going to create a new Apache image, this time the steps will be written in a Dockerfile, that will be processed to form the image. - -First, create a directory on which we will put the Dockerfile and enter this directory: - - mkdir apachedf; cd apachedf - -And then create a file named Dockerfile with the following content: - - FROM fedora:22 - - MAINTAINER Carlos Alberto - LABEL version="0.1" - - RUN dnf -y update && dnf -y install httpd && dnf -y clean all - - RUN [ -d /var/log/httpd ] || mkdir /var/log/httpd - RUN [ -d /var/run/httpd ] || mkdir /var/run/httpd - RUN [ -d /var/lock/httpd ] || mkdir /var/lock/httpd - - RUN sed -i.orig 's/#ServerName/ServerName/' /etc/httpd/conf/httpd.conf - - ENV APACHE_RUN_USER apache - ENV APACHE_RUN_GROUP apache - ENV APACHE_LOG_DIR /var/log/httpd - ENV APACHE_LOCK_DIR /var/lock/httpd - ENV APACHE_RUN_DIR /var/run/httpd - ENV APACHE_PID_FILE /var/run/httpd/httpd.pid - - EXPOSE 80 - - CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"] - - - -Let's see what is on this Dockerfile: - -**FROM** - This tells docker that we are going to use Fedora 22 as base image - -**MANTAINER** and **LABEL** - these commands are informative and have no direct influence on the image - -**RUN** - Automate the steps we've done interactively, install Apache, create directories and edit httpd.conf - -**ENV** - Set the environment variables, now we don't need the run_apache_foreground script anymore. - -**EXPOSE** - Expose the port 80 to the world - -**CMD** - Set the default command to httpd, so we don't need to do this every time we start a new container - -**Build the image** - -Now we are going to build the image and put the TAG gaiada/apachedf on it: - - docker build -t gaiada/apachedf:0.1 . - -![docker build complete](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-build-complete.png) - -docker build complete - -Use **docker images** list the local images and see if your new image is there: - - docker images - -And then run you new image: - - docker run -t -p 80:80 gaiada/apachedf - -That is it for the Dockerfile, using this feature make things much easier, faster and reproducible. - -### Publishing your images ### - -Until now, you just pulled images from Docker Hub, but you can also push you image and pull them later as needed. In fact other can also download your image and use it in their systems without the need of change anything and now we are going to learn how to make our image available for others worldwide. - -**Creating account** - -For you to be able to push your image on Docker Hub, you need to create an account. Access [https://hub.docker.com/account/signup/][3] and fill the following form: - -![Docker Hub signup page](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-hub-signup.png) - -Docker Hub signup page - -**Login** - -Enter the following command and proceed with the login name, password and email you provided in your account creation - - docker login - -After you do the first login, your account information will be recorded in **~/.dockercfg** - -**Pushing** - -Push the page to the server with the **docker push [registry/]your_login/repository_name[:tag]** - - docker push docker.io/gaiada/apachedf - -You might see something like this on your console: - -![Docker push Apache image complete](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-pushing-apachedf-complete.png) - -Docker push Apache image complete - -### Conclusion ### - -Now that you know how to Dockerize Apache, try to include some modules, Perl, PHP, proxy, HTTPS, or whatever you need. I hope you guys liked it, and push your own images on Docker Hub. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-how-to/configure-apache-containers-docker-fedora-22/ - -作者:[Carlos Alberto][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/carlosal/ -[1]:https://github.com/gaiada/run-apache-foreground -[2]:http://localhost/ -[3]:https://hub.docker.com/account/signup/ diff --git a/translated/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md b/translated/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md new file mode 100644 index 0000000000..9665855542 --- /dev/null +++ b/translated/tech/20150612 How to Configure Apache Containers with Docker on Fedora 22.md @@ -0,0 +1,279 @@ +如何在Fedora 22上面配置Apache的Docker容器 +============================================================================= +在这篇文章中,我们将会学习关于Docker的一些知识,如何使用Docker部署Apache httpd服务,并且共享到Docker Hub上面去。首先,我们学习怎样拉取和使用Docker Hub里面的镜像,然后交互式地安装Apache到一个Fedora 22的镜像里去,之后我们将会学习如何用一个Dockerfile文件来制作一个镜像,以一种更快,更优雅的方式。最后,我们会在Docker Hub上公开我们创建地镜像,这样以后任何人都可以下载并使用它。 + +### 安装Docker,运行hello world ### + +**要求** + +运行Docker,里至少需要满足这些: + +- 你需要一个64位的内核,版本3.10或者更高 +- Iptables 1.4 - Docker会用来做网络配置,如网络地址转换(NAT) +- Git 1.7 - Docker会使用Git来与仓库交流,如Docker Hub +- ps - 在大多数环境中这个工具都存在,在procps包里有提供 +- root - 防止一般用户可以通过TCP或者其他方式运行Docker,为了简化,我们会假定你就是root + +### 使用dnf安装docker ### + +以下的命令会安装Docker + + dnf update && dnf install docker + +**注意**:在Fedora 22里,你仍然可以使用Yum命令,但是被DNF取代了,而且在纯净安装时不可用了。 + +### 检查安装 ### + +我们将要使用的第一个命令是docker info,这会输出很多信息给你: + + docker info + +也可以试着用**docker version**: + + docker version + +### 启动Dcoker为守护进程 ### + +你应该启动一个docker实例,然后她会处理我们的请求。 + + docker -d + +让我们用Busybox来打印hello world: + + dockr run -t busybox /bin/echo "hello world" + +这个命令里,我们告诉Docker执行 /bin/echo "hello world",在Busybox镜像的一个实例/容器里。Busybox是一个小型的POSIX环境,将许多小工具都结合到了一个单独的可执行程序里。 + +如果Docker不能在你的系统里找到本地的Busybox镜像,她就会自动从Docker Hub里拉取镜像,正如你可以看下如下的快照: + +![Hello world with Busybox](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-hello-world-busybox-complete.png) + +Hello world with Busybox + +再次尝试相同的命令,这次由于Docker已经有了本地的Busybox镜像,所有你将会看到的就是echo的输出: + + docker run -t busybox /bin/echo "hello world" + +也可以尝试以下的命令进入到容器环境里去: + + docker run -it busybox /bin/sh + +使用**exit**命令可以离开容器并停止它 + +### 交互式地Docker化Apache ### + +拉取/下载 Fedora 镜像: + + docker pull fedora:22 + +起一个容器在后台运行: + + docker run -d -t fedora:22 /bin/bash + +列出正在运行地容器,并用名字标识,如下 + + docker ps + +![listing with docker ps and attaching with docker attach](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-ps-with-docker-attach-highlight.png) + +使用docker ps列出,并使用docker attach进入一个容器里 + +angry_noble是docker分配给我们容器的名字,所以我们来附上去: + + docker attach angry_noble + +注意:每次你起一个容器,就会被给与一个新的名字,如果你的容器需要一个固定的名字,你应该在 docker run 命令里使用 -name 参数。 + +### 安装Apache ### + +下面的命令会更新DNF的数据库,下载安装Apache(httpd包)并清理dnf缓存使镜像尽量小 + + dnf -y update && dnf -y install httpd && dnf -y clean all + +配置Apache + +我们需要修改httpd.conf的唯一地方就是ServerName,这会使Apache停止抱怨 + + sed -i.orig 's/#ServerName/ServerName/' /etc/httpd/conf/httpd.conf + +**设定环境** + +为了使Apache运行为单机模式,你必须以环境变量的格式提供一些信息,并且你也需要在这些变量里的目录设定,所以我们将会用一个小的shell脚本干这个工作,当然也会启动Apache + + vi /etc/httpd/run_apache_foreground + +---------- + + #!/bin/bash + + #set variables + APACHE_LOG_DI=R"/var/log/httpd" + APACHE_LOCK_DIR="/var/lock/httpd" + APACHE_RUN_USER="apache" + APACHE_RUN_GROUP="apache" + APACHE_PID_FILE="/var/run/httpd/httpd.pid" + APACHE_RUN_DIR="/var/run/httpd" + + #create directories if necessary + if ! [ -d /var/run/httpd ]; then mkdir /var/run/httpd;fi + if ! [ -d /var/log/httpd ]; then mkdir /var/log/httpd;fi + if ! [ -d /var/lock/httpd ]; then mkdir /var/lock/httpd;fi + + #run Apache + httpd -D FOREGROUND + +**另外地**,你可以粘贴这个片段代码到容器shell里并运行: + + dnf -y install git && git clone https://github.com/gaiada/run-apache-foreground.git && cd run-apach* && ./install && dnf erase git + +上面的内嵌脚本会安装Git,克隆[这个仓库][1],到文件里去运行脚本,并询问你是否卸载Git。 + +**保存你的容器状态** + +你的容器现在可以运行Apache,是时候保存容器当前的状态为一个镜像,以备你需要的时候使用。 + +为了离开容器环境,你必须顺序按下 **Ctrl+q** 和 **Ctrl+p**,如果你仅仅在shell执行exit,你同时也会停止容器,失去目前为止你做过的所有工作。 + +回到Docker主机,使用 **docker commit** 加容器和你期望的仓库名字/标签: + + docker commit angry_noble gaiada/apache + +现在,你保存了容器的状态到一个镜像里,可以使用 **docker stop** 停止容器了: + + docker stop angry_noble + +**运行并测试你的镜像** + +最后,从你的新镜像起一个容器,并且重定向80端口到容器: + + docker run -p 80:80 -d -t gaiada/apache /etc/httpd/run_apache_foreground + + + +到目前,你正在你的容器里运行Apache,打开你的浏览器访问该服务,在[http://localhost][2],你将会看到如下Apache默认的页面 + +![Apache default page running from Docker container](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-apache-running.png) + +在容器里运行的Apache默认页面 + +### 使用Dockerfile Docker化Apache ### + +现在,我们将要去创建一个新的Apache镜像,这次所有步骤会写在一个Dockerfile文件里,文件将会被用于生成该镜像。 + +首先,新建一个目录,在里面放Dockerfile文件,并进入该目录: + + mkdir apachedf; cd apachedf + +然后创建一个名为Dockerfile的文件,添加以下内容: + + FROM fedora:22 + + MAINTAINER Carlos Alberto + LABEL version="0.1" + + RUN dnf -y update && dnf -y install httpd && dnf -y clean all + + RUN [ -d /var/log/httpd ] || mkdir /var/log/httpd + RUN [ -d /var/run/httpd ] || mkdir /var/run/httpd + RUN [ -d /var/lock/httpd ] || mkdir /var/lock/httpd + + RUN sed -i.orig 's/#ServerName/ServerName/' /etc/httpd/conf/httpd.conf + + ENV APACHE_RUN_USER apache + ENV APACHE_RUN_GROUP apache + ENV APACHE_LOG_DIR /var/log/httpd + ENV APACHE_LOCK_DIR /var/lock/httpd + ENV APACHE_RUN_DIR /var/run/httpd + ENV APACHE_PID_FILE /var/run/httpd/httpd.pid + + EXPOSE 80 + + CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"] + + + +我们一起来看看Dockerfile里面有什么: + +**FROM** - 这告诉docker,我们将要使用Fedora 22作为基础镜像 + +**MAINTAINER** 和 **LABLE** - 这些命令对镜像没有直接作用,属于标记信息 + +**RUN** - 自动完成我们之前交互式做的工作,安装Apache,新建目录并编辑httpd.conf + +**ENV** - 设置环境变量,现在我们再不需要run_apache_foreground脚本 + +**EXPOSE** - 暴露80端口给外网 + +**CMD** - 设置默认的命令启动httpd服务,这样我们就不需要每次起一个新的容器都重复这个工作 + +**建立该镜像** + +现在,我们将要建立这个镜像,并为其添加tag gaiada/apachedf + + docker build -t gaiada/apachedf:0.1 . + +![docker build complete](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-build-complete.png) + +docker完成创建 + +使用 **docker images** 列出本地镜像,查看是否存在你新建的镜像: + + docker images + +然后运行新的镜像: + + docker run -t -p 80:80 gaiada/apachedf + +这就是Dockerfile的工作,使用这项功能会使得事情更加容易,快速并且可重复生成。 + +### 公开你的镜像 ### + +直到现在,你仅仅是从Docker Hub拉取了镜像,但是你也可以推送你的镜像,以后需要也可以再次拉取他们。实际上,其他人也可以下载你的镜像,在他们的系统中使用它而不需要改变任何东西。现在我们将要学习如何使我们的镜像对世界上的其他人可用。 + +**创建帐号** + +为了能够在Docker Hub上推送你的镜像,你需要创建一个帐号。访问 [https://hub.docker.com/account/signup/][3],填写下面的表格: + +![Docker Hub signup page](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-hub-signup.png) + +Docker Hub 注册页面 + +**登录** + +输入下面的命令,接着输入你注册时提供的用户名,密码和邮箱 + + docker login + +第一次登录过后,你的帐号信息会被记录在 **~/.dockercfg** + +**推送** + +推送镜像,使用 **docker push [registry/]your_login/repository_name[:tag]** + + docker push docker.io/gaiada/apachedf + +你可能会看见像这样的输出,在你的控制台上: + +![Docker push Apache image complete](http://blog.linoxide.com/wp-content/uploads/2015/06/docker-pushing-apachedf-complete.png) + +Docker推送Apache镜像完成 + +### 结论 ### + +现在,你知道如何Docker化Apache,试一试包含其他一些组块,Perl,PHP,proxy,HTTPS,或者任何你需要的东西。我希望你们这些家伙喜欢她,并推送你们自己的镜像到Docker Hub。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/configure-apache-containers-docker-fedora-22/ + +作者:[Carlos Alberto][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/carlosal/ +[1]:https://github.com/gaiada/run-apache-foreground +[2]:http://localhost/ +[3]:https://hub.docker.com/account/signup/ + From effbcc0ecb43fdb6913ee24406c45ba67d70bbec Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Mon, 15 Jun 2015 15:08:49 +0800 Subject: [PATCH 093/153] Translating by ZTinoZ --- .../20150526 20 Useful Terminal Emulators for Linux.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index 1b239a3904..82a8ff5aff 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -157,7 +157,7 @@ Konsole Terminal ### 11. TermKit ### -TermKit is a elegant terminal that aims to construct aspects of the GUI with the command line based application using WebKit rendering engine mostly used in web browsers like Google Chrome and Chromium. TermKit is originally designed for Mac and Windows, but due to TermKit fork by Floby which you can now able to install it under Linux based distributions and experience the power of TermKit. +TermKit是一款漂亮简洁的终端,其目标是用在Google Chrome和Chromium中广泛被使用的WebKit渲染引擎在基于应用程序的命令行中构建出GUI视图。TermKit起初是为Mac和Windows设计的,但是由于TermKit被Floby给fork并做了修改,现在你可以将它安装在Linux发行版上并感受TermKit带来的魅力。 ![TermKit Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/TermKit-Terminal.jpeg) @@ -167,7 +167,7 @@ TermKit Terminal ### 12. st ### -st is a simple terminal implementation for X Window. +st是一款简单的X Window终端实现接口。 ![st terminal](http://www.tecmint.com/wp-content/uploads/2014/01/st-terminal.png) @@ -177,9 +177,9 @@ st terminal ### 13. Gnome-Terminal ### -GNOME terminal is a built-in terminal emulator for GNOME desktop environment developed by Havoc Pennington and others. It allow users to run commands using a real Linux shell while remaining on the on the GNOME environment. GNOME Terminal emulates the xterm terminal emulator and brings a few similar features. +GNOME终端是一款在GNOME桌面环境下的嵌入式终端仿真器,由Havoc Pennington和其他一些人共同开发。它允许用户在GNOME环境下的同时使用一个真实的Linux shell来运行命令。GNOME终端是模拟的xterm终端仿真器并带来了一些相似的特性。 -The Gnome terminal supports multiple profiles, where users can able to create multiple profiles for his/her account and can customize configuration options such as fonts, colors, background image, behavior, etc. per account and define a name to each profile. It also supports mouse events, url detection, multiple tabs, etc. +Gnome终端支持多用户,用户可以为他们的账户创建多个用户,每个用户能自定义配置选项,如字体、颜色、背景图片、行为习惯等等并能分别给它们取名。它也支持鼠标事件、url探测、多标签等。 ![Gnome Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Gnome-terminal.jpg) From 1d88963ae6aba8d9d9b9c10d55dfd39f16701870 Mon Sep 17 00:00:00 2001 From: KS Date: Mon, 15 Jun 2015 15:09:58 +0800 Subject: [PATCH 094/153] Update 20150612 Inside NGINX--How We Designed for Performance and Scale.md --- ... Inside NGINX--How We Designed for Performance and Scale.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md b/sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md index 559d28996c..970144275f 100644 --- a/sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md +++ b/sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md @@ -1,3 +1,4 @@ +wyangsun 申领 Inside NGINX: How We Designed for Performance & Scale ================================================================================ NGINX leads the pack in web performance, and it’s all due to the way the software is designed. Whereas many web servers and application servers use a simple threaded or process-based architecture, NGINX stands out with a sophisticated event-driven architecture that enables it to scale to hundreds of thousands of concurrent connections on modern hardware. @@ -171,4 +172,4 @@ via: http://nginx.com/blog/inside-nginx-how-we-designed-for-performance-scale/ [12]:https://speakerdeck.com/nginx/nginx-installation-and-tuning [13]:http://nginx.com/blog/tuning-nginx/ [14]:http://www.aosabook.org/en/nginx.html -[15]:http://nginx.com/blog/socket-sharding-nginx-release-1-9-1/ \ No newline at end of file +[15]:http://nginx.com/blog/socket-sharding-nginx-release-1-9-1/ From 957ca2f001291eade1765802bccdfa664a17f05d Mon Sep 17 00:00:00 2001 From: DeadFire Date: Mon, 15 Jun 2015 15:43:44 +0800 Subject: [PATCH 095/153] =?UTF-8?q?20150615-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...P at 20--From pet project to powerhouse.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/talk/20150615 PHP at 20--From pet project to powerhouse.md diff --git a/sources/talk/20150615 PHP at 20--From pet project to powerhouse.md b/sources/talk/20150615 PHP at 20--From pet project to powerhouse.md new file mode 100644 index 0000000000..610913c846 --- /dev/null +++ b/sources/talk/20150615 PHP at 20--From pet project to powerhouse.md @@ -0,0 +1,82 @@ +PHP at 20: From pet project to powerhouse +================================================================================ +![](http://images.techhive.com/images/article/2015/06/13049862325_8c97a11878_z-100590275-primary.idge.jpg) + +Credit: [Steve Jurvetson via Flickr][1] + +> The one-time ‘silly little project’ has transformed into a Web powerhouse, thanks to flexibility, pragmatism, and a vibrant community of Web devs + +When Rasmus Lerdorf released “[a set of small tight CGI binaries written in C][2],” he had no idea how much his creation would impact Web development. Delivering the opening keynote at this year’s SunshinePHP conference in Miami, Lerdorf quipped, “In 1995, I thought I had unleashed a C API upon the Web. Obviously, that’s not what happened, or we’d all be C programmers.” + +In fact, when Lerdorf released version 1.0 of Personal Home Page Tools -- as PHP was then known -- the Web was very young. HTML 2.0 would not be published until November of that year, and HTTP/1.0 not until May the following year. NCSA HTTPd was the most widely deployed Web server, and Netscape Navigator was the most popular Web browser, with Internet Explorer 1.0 to arrive in August. In other words, PHP’s beginnings coincided with the eve of the browser wars. + +Those early days speak volumes about PHP’s impact on Web development. Back then, our options were limited when it came to server-side processing for Web apps. PHP stepped in to fill our need for a tool that would enable us to do dynamic things on the Web. That practical flexibility captured our imaginations, and PHP has since grown up with the Web. Now powering [more than 80 percent of the Web][3], PHP has matured into a scripting language that is especially suited to solve the Web problem. Its unique pedigree tells a story of pragmatism over theory and problem solving over purity. + +### The Web glue we got hooked on ### + +PHP didn’t start out as a language, and this is clear from its design -- or lack thereof, as detractors point out. It began as an API to help Web developers access lower-level C libraries. The first version was a small CGI binary that provided form-processing functionality with access to request parameters and the mSQL database. And its facility with a Web app’s database would prove key in sparking our interest in PHP and PHP’s subsequent ascendancy. + +By version 2 -- aka PHP/FI -- database support had expanded to include PostgreSQL, MySQL, Oracle, Sybase, and more. It supported these databases by wrapping their C libraries, making them a part of the PHP binary. PHP/FI could also wrap the GD library to create and manipulate GIF images. It could be run as an Apache module or compiled with FastCGI support, and it introduced the PHP script language with support for variables, arrays, language constructs, and functions. For many of us working on the Web at that time, PHP was the kind of glue we'd been looking for. + +As PHP folded in more and more programming language features, morphing into version 3 and onward, it never lost this gluelike aspect. Through repositories like PECL (PHP Extension Community Library), PHP could tie together libraries and expose their functionality to the PHP layer. This capacity to bring together components became a significant facet of the beauty of PHP, though it was not limited to its source code. + +### The Web as a community of coders ### + +PHP’s lasting impact on Web development isn’t limited to what can be done with the language itself. How PHP work is done and who participates -- these too are important parts of PHP’s legacy. + +As early as 1997, PHP user groups began forming. One of the earliest was the Midwest PHP User’s Group (later known as Chicago PHP), which held its [first meeting in February 1997][4]. This was the beginning of what would become a vibrant, energetic community of developers assembled over an affinity for a little tool that helped them solve problems on the Web. The ubiquity of PHP made it a natural choice for Web development. It became especially popular in the shared hosting world, and its low barrier to entry was attractive to many early Web developers. + +With a growing community came an assortment of tools and resources for PHP developers. The year 2000 -- a watershed moment for PHP -- witnessed the first PHP Developers’ Meeting, a gathering of the core developers of the programming language, who met in Tel Aviv to discuss the forthcoming 4.0 release. PHP Extension and Application Repository (PEAR) also launched in 2000 to provide high-quality userland code packages following standards and best practices. The first PHP conference, PHP Kongress, was held in Germany soon after. [PHPDeveloper.org][5] came online, and to this day, it is the most authoritative news source in the PHP community. + +This communal momentum proved vital to PHP’s growth in subsequent years, and as the Web development industry erupted, so did PHP. PHP began powering more and larger websites. More user groups formed around the world. Mailing lists; online forums; IRC; conferences; trade journals such as php[architect], the German PHP Magazin, and International PHP Magazine -- the vibrancy of the PHP community had a significant impact on the way Web work would be done: collectively and openly, with an emphasis on code sharing. + +Then, 10 years ago, shortly after the release of PHP 5, an interesting thing happened in Web development that created a general shift in how the PHP community built libraries and applications: Ruby on Rails was released. + +### The rise of frameworks ### + +The Ruby on Rails framework for the Ruby programming language created an increased focus and attention on the MVC (model-view-controller) architectural pattern. The Mojavi PHP framework a few years prior had used this pattern, but the hype around Ruby on Rails is what firmly cemented MVC in the PHP frameworks that followed. Frameworks exploded in the PHP community, and frameworks have changed the way developers build PHP applications. + +Many important projects and developments have arisen, thanks to the proliferation of frameworks in the PHP community. The PHP [Framework Interoperability Group][6] formed in 2009 to aid in establishing coding standards, naming conventions, and best practices among frameworks. Codifying these standards and practices helped provide more interoperable software for developers using member projects’ code. This interoperability meant that each framework could be split into components and stand-alone libraries could be used together with monolithic frameworks. With interoperability came another important milestone: The Composer project was born in 2011. + +Inspired by Node.js’s NPM and Ruby’s Bundler, Composer has ushered in a new era of PHP application development, creating a PHP renaissance of sorts. It has encouraged interoperability between packages, standard naming conventions, adoption of coding standards, and increased test coverage. It is an essential tool in any modern PHP application. + +### The need for speed and innovation ### + +Today, the PHP community has a thriving ecosystem of applications and libraries. Some of the most widely installed PHP applications include WordPress, Drupal, Joomla, and MediaWiki. These applications power the Web presence of businesses of all sizes, from small mom-and-pop shops to sites like whitehouse.gov and Wikipedia. Six of the Alexa top 10 sites use PHP to serve billions of pages a day. As a result, PHP applications have been optimized for speed -- and much innovation has gone into PHP core to improve performance. + +In 2010, Facebook unveiled its HipHop for PHP source-to-source compiler, which translates PHP code into C++ code and compiles it into a single executable binary application. Facebook’s size and growth necessitated the move away from standard interpreted PHP code to a faster, optimized executable. However, Facebook wanted to continue using PHP for its ease of use and rapid development cycles. HipHop for PHP evolved into HHVM, a JIT (just-in-time) compilation-based execution engine for PHP, which included a new language based on PHP: [Hack][7]. + +Facebook’s innovations, as well as other VM projects, created competition at the engine level, leading to discussions about the future of the Zend Engine that still powers PHP’s core, as well as the question of a language specification. In 2014, a language specification project was created “to provide a complete and concise definition of the syntax and semantics of the PHP language,” making it possible for compiler projects to create interoperable PHP implementations. + +The next major version of PHP became a topic of intense debate, and a project known as phpng (next generation) was offered as an option to clean up, refactor, optimize, and improve the PHP code base, which also showed substantial improvements to the performance of real-world applications. After deciding to name the next major version “PHP 7,” due to a previous, unreleased PHP 6.0 version, the phpng branch was merged in, and plans were made to proceed with PHP 7, working in many of the language features offered by Hack, such as scalar and return type hinting. + +With the [first PHP 7 alpha release due out today][8] and benchmarks showing [performance as good as or better than that of HHVM][9] in many cases, PHP is keeping up with the pace of modern Web development needs. Likewise, the PHP-FIG continues to innovate and push frameworks and libraries to collaborate and cooperate -- most recently with the adoption of [PSR-7][10], which will change the way PHP projects handle HTTP. User groups, conferences, publications, and initiatives like [PHPMentoring.org][11] continue to advocate best practices, coding standards, and testing to the PHP developer community. + +PHP has seen the Web mature through various stages, and PHP has matured. Once a simple API wrapper around lower-level C libraries, PHP has become a full-fledged programming language in its own right. Its developer community is vibrant and helpful, priding themselves in pragmatism and welcoming newcomers. PHP has stood the test of time for 20 years, and current activity in the language and community is ensuring it will be a relevant and useful language for years to come. + +During his SunshinePHP keynote, Rasmus Lerdorf reflected, “Did I think I’d be here 20 years later talking about this silly little project I did? No, I didn’t.” + +Here’s to Lerdorf and the rest of the PHP community for transforming this “silly little project” into a lasting, powerful component of the Web today. + +-------------------------------------------------------------------------------- + +via: http://www.infoworld.com/article/2933858/php/php-at-20-from-pet-project-to-powerhouse.html + +作者:[Ben Ramsey][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.infoworld.com/author/Ben-Ramsey/ +[1]:https://www.flickr.com/photos/jurvetson/13049862325 +[2]:https://groups.google.com/d/msg/comp.infosystems.www.authoring.cgi/PyJ25gZ6z7A/M9FkTUVDfcwJ +[3]:http://w3techs.com/technologies/overview/programming_language/all +[4]:http://web.archive.org/web/20061215165756/http://chiphpug.php.net/mpug.htm +[5]:http://www.phpdeveloper.org/ +[6]:http://www.php-fig.org/ +[7]:http://www.infoworld.com/article/2610885/facebook-q-a--hack-brings-static-typing-to-php-world.html +[8]:https://wiki.php.net/todo/php70#timetable +[9]:http://talks.php.net/velocity15 +[10]:http://www.php-fig.org/psr/psr-7/ +[11]:http://phpmentoring.org/ \ No newline at end of file From 3d4e771f318899f20325eb7c7bb9e5ce6417534d Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 15 Jun 2015 15:45:13 +0800 Subject: [PATCH 096/153] PUB:20150518 Linux FAQs with Answers--How to view threads of a process on Linux @GOLinux --- ...-How to view threads of a process on Linux.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename {translated/tech => published}/20150518 Linux FAQs with Answers--How to view threads of a process on Linux.md (72%) diff --git a/translated/tech/20150518 Linux FAQs with Answers--How to view threads of a process on Linux.md b/published/20150518 Linux FAQs with Answers--How to view threads of a process on Linux.md similarity index 72% rename from translated/tech/20150518 Linux FAQs with Answers--How to view threads of a process on Linux.md rename to published/20150518 Linux FAQs with Answers--How to view threads of a process on Linux.md index a91a2b3ed3..0011c66b1e 100644 --- a/translated/tech/20150518 Linux FAQs with Answers--How to view threads of a process on Linux.md +++ b/published/20150518 Linux FAQs with Answers--How to view threads of a process on Linux.md @@ -1,16 +1,16 @@ -Linux有问必答——Linux上如何查看某个进程的线程 +Linux有问必答:Linux上如何查看某个进程的线程 ================================================================================ -> **问题**: 我的程序创建并在它里头执行了多个线程,我怎样才能在该程序创建线程后监控其中单个线程?我想要看到带有它们名称的单个线程详细情况(如,CPU/内存使用率)。 +> **问题**: 我的程序在其内部创建并执行了多个线程,我怎样才能在该程序创建线程后监控其中单个线程?我想要看到带有它们名称的单个线程详细情况(如,CPU/内存使用率)。 -线程是现代操作系统上进行并行执行的一个流行的编程方面的抽象概念。当一个程序内有多个线程被叉分出用以执行多个流时,这些线程就会在它们之间共享特定的资源(如,内存地址空间、打开的文件),以使叉分开销最小化,并避免大量花销IPC(进程间通信)频道。这些功能让线程在并发执行时成为一个高效的机制。 +线程是现代操作系统上进行并行执行的一个流行的编程方面的抽象概念。当一个程序内有多个线程被叉分出用以执行多个流时,这些线程就会在它们之间共享特定的资源(如,内存地址空间、打开的文件),以使叉分开销最小化,并避免大量高成本的IPC(进程间通信)通道。这些功能让线程在并发执行时成为一个高效的机制。 -在Linux中,程序中创建的线程(也称为轻量级进程,LWP)会具有和程序的PID相同的“线程组ID”。然后,各个线程会获得其自身的线程ID(TID)。对于Linux内核调度器而言,线程不过是恰好共享特定资源的标准的进程。经典的命令行工具,如ps或top,都可以用来显示线程级别的信息,默认情况下它们会显示进程级别的信息。 +在Linux中,程序中创建的线程(也称为轻量级进程,LWP)会具有和程序的PID相同的“线程组ID”。然后,各个线程会获得其自身的线程ID(TID)。对于Linux内核调度器而言,线程不过是恰好共享特定资源的标准的进程而已。经典的命令行工具,如ps或top,都可以用来显示线程级别的信息,只是默认情况下它们显示进程级别的信息。 这里提供了**在Linux上显示某个进程的线程**的几种方式。 ### 方法一:PS ### -在ps命令中,“-T”选项可以开启线程查看。下面的命令列出了由进程号为的进程创建的所有线程。 +在ps命令中,“-T”选项可以开启线程查看。下面的命令列出了由进程号为\的进程创建的所有线程。 $ ps -T -p @@ -26,7 +26,7 @@ top命令可以实时显示各个线程情况。要在top输出中开启线程 ![](https://farm9.staticflickr.com/8824/17350561070_3dfe447974_c.jpg) -要让top输出某个特定进程并检查该进程内运行的线程状况: +要让top输出某个特定进程\并检查该进程内运行的线程状况: $ top -H -p @@ -36,7 +36,7 @@ top命令可以实时显示各个线程情况。要在top输出中开启线程 一个对用户更加友好的方式是,通过htop查看单个进程的线程,它是一个基于ncurses的交互进程查看器。该程序允许你在树状视图中监控单个独立线程。 -要在htop中启用线程查看,请开启htop,然后按来进入htop的设置菜单。选择“设置”栏下面的“显示选项”,然后开启“树状视图”和“显示自定义线程名”选项。按退出设置。 +要在htop中启用线程查看,请开启htop,然后按\来进入htop的设置菜单。选择“设置”栏下面的“显示选项”,然后开启“树状视图”和“显示自定义线程名”选项。按\退出设置。 ![](https://farm6.staticflickr.com/5338/17350364568_59bce22e7b_b.jpg) @@ -50,7 +50,7 @@ via: http://ask.xmodulo.com/view-threads-process-linux.html 作者:[Dan Nanni][a] 译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From 92a639eeb95824bc53e0d52594c4ef9acb9601d9 Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 15 Jun 2015 15:58:21 +0800 Subject: [PATCH 097/153] PUB:20150521 Linux FAQs with Answers--How to install Unity Tweak Tool on Ubuntu desktop @ictlyh --- ...rs--How to install Unity Tweak Tool on Ubuntu desktop.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20150521 Linux FAQs with Answers--How to install Unity Tweak Tool on Ubuntu desktop.md (86%) diff --git a/translated/tech/20150521 Linux FAQs with Answers--How to install Unity Tweak Tool on Ubuntu desktop.md b/published/20150521 Linux FAQs with Answers--How to install Unity Tweak Tool on Ubuntu desktop.md similarity index 86% rename from translated/tech/20150521 Linux FAQs with Answers--How to install Unity Tweak Tool on Ubuntu desktop.md rename to published/20150521 Linux FAQs with Answers--How to install Unity Tweak Tool on Ubuntu desktop.md index def6860616..273d603c98 100644 --- a/translated/tech/20150521 Linux FAQs with Answers--How to install Unity Tweak Tool on Ubuntu desktop.md +++ b/published/20150521 Linux FAQs with Answers--How to install Unity Tweak Tool on Ubuntu desktop.md @@ -1,4 +1,4 @@ -Linux 有问必答--如何在桌面版 Ubuntu 中安装 Unity Tweak Tool +Linux 有问必答:如何在桌面版 Ubuntu 中安装 Unity Tweak Tool ================================================================================ > **问题**: 我试着给刚安装的桌面版 Ubuntu 自定制桌面。我想使用 Unity Tweak Tool。我怎样才能在 Ubuntu 上安装 Unity Tweak Tool 呢? @@ -6,7 +6,7 @@ Linux 有问必答--如何在桌面版 Ubuntu 中安装 Unity Tweak Tool ![](https://farm6.staticflickr.com/5463/17684020389_25dc7f0db2_b.jpg) -尽管 Unity Tweak Tool 是桌面版 Ubuntu 的重要工具,并没有在桌面版 Ubuntu 中预安装。为了能自定制 Unity 桌面,下面介绍一下如何在桌面版 Ubuntu 中安装 Unity Tweak Tool。 +尽管 Unity Tweak Tool 是桌面版 Ubuntu 的重要工具,但并没有在桌面版 Ubuntu 中预安装。为了能自定制 Unity 桌面,下面介绍一下如何在桌面版 Ubuntu 中安装 Unity Tweak Tool。 ### 在 Ubuntu 13.04 或更高版本中安装 Unity Tweak Tool ### @@ -34,7 +34,7 @@ via: http://ask.xmodulo.com/install-unity-tweak-tool-ubuntu-desktop.html 作者:[Dan Nanni][a] 译者:[ictlyh](https://github.com/ictlyh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From a471b5ddc790953e638069d9c324e9d2118432b0 Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 15 Jun 2015 16:15:33 +0800 Subject: [PATCH 098/153] PUB:20150527 3 Useful Hacks Every Linux User Must Know @goreliu --- ...Useful Hacks Every Linux User Must Know.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) rename {translated/tech => published}/20150527 3 Useful Hacks Every Linux User Must Know.md (79%) diff --git a/translated/tech/20150527 3 Useful Hacks Every Linux User Must Know.md b/published/20150527 3 Useful Hacks Every Linux User Must Know.md similarity index 79% rename from translated/tech/20150527 3 Useful Hacks Every Linux User Must Know.md rename to published/20150527 3 Useful Hacks Every Linux User Must Know.md index 25c1ef3e3d..f4da7cf24b 100644 --- a/translated/tech/20150527 3 Useful Hacks Every Linux User Must Know.md +++ b/published/20150527 3 Useful Hacks Every Linux User Must Know.md @@ -1,9 +1,10 @@ -每个Linux用户都应该知道的3个有用技巧 +Linux 用户的 3 个命令行小技巧 ================================================================================ Linux世界充满了乐趣,我们越深入进去,就会发现越多有趣的事物。我们会努力给你提供一些小技巧,让你和其他人有所不同,下面就是我们准备的3个小技巧。 -### 1. 如何在不使用Cron的情况调度Linux下的作业 ### -在Linux下,调度一个作业/命令可以缩写为Cron。当我们需要调度一个作业时,我们会使用Cron,但你知道我们在不使用Cron的情况也可以调度一个在将来时间运行的作业吗?你可以按照如下建议操作…… +### 1. 如何在不使用Cron的情况调度Linux下的任务 ### + +在Linux下,调度一个任务/命令称之为Cron。当我们需要调度一个任务时,我们会使用Cron,但你知道我们在不使用Cron的情况也可以调度一个在将来时间运行的任务吗?你可以按照如下建议操作…… 每5秒钟运行一个命令(date)然后将结果写入到一个文件(data.txt)。为了实现这一点,我们可以直接在命令提示符运行如下单行脚本。 @@ -21,13 +22,13 @@ Linux世界充满了乐趣,我们越深入进去,就会发现越多有趣的 类似地,我们可以这样运行任何脚本。下边的例子是每100秒运行一个名为`script_name.sh`的脚本。 -另外值得一提的是上边的脚本文件必须处于当前目录中,否则需要使用完整路径(`/home/$USER/…/script_name.sh`)。实现如上功能的单行脚本如下: +另外值得一提的是上面提到的脚本文件必须处于当前目录中,否则需要使用完整路径(`/home/$USER/…/script_name.sh`)。实现如上功能的单行脚本如下: $ while true; do /bin/sh script_name.sh ; sleep 100 ; done & **总结**:上述的单行脚本并不是Cron的替代品,因为Cron工具支持众多选项,更加灵活,可定制性也更高。然而如果我们想运行某些测试,比如I/O评测,上述的单行脚本也管用。 -还可以参考:[11 Linux Cron Job Scheduling Examples][1] +还可以参考:[Linux 下 11 个定时调度任务例子][1] ### 2. 如何不使用clear命令清空终端的内容 ### @@ -37,23 +38,23 @@ Linux世界充满了乐趣,我们越深入进去,就会发现越多有趣的 **总结**:因为`ctrl + l`是一个快捷键,我们不可以在脚本中使用。所以如果我们需要在脚本中清空屏幕内容,还是需要使用`clear`命令。但我能想到的所有其他情况,`ctrl + l`都更加有效。 -### 3. 运行一个命令,然后自动回到当前的工作目录 ### +### 3. 在其它目录运行一个命令,然后自动返回当前工作目录 ### -这是一个很多人可能不知道的令人吃惊的技巧。你可能想运行任何一个命令,然后再回到当前目录。你只需要将命令放在一个圆括号里。 +这是一个很多人可能不知道的令人吃惊的技巧。你可能想在其它目录运行任何一个命令,然后再回到当前目录。要实现这样的目的,你只需要将命令放在一个圆括号里。 我们来看一个例子: avi@deb:~$ (cd /home/avi/Downloads/) -#### 示例输出 #### - - avi@deb:~ +示例输出: + + avi@deb:~ 它首先会cd到Downloads目录,然后又回到了之前的家目录。也许你认为里边的命令根本没有执行,或者是出了某种错误,因为从命令提示符看不出任何变化。让我们简单修改一下这个命令: avi@deb:~$ (cd /home/avi/Downloads/ && ls -l) - -#### 示例输出 #### + +示例输出: -rw-r----- 1 avi avi 54272 May 3 18:37 text1.txt -rw-r----- 1 avi avi 54272 May 3 18:37 text2.txt @@ -70,7 +71,7 @@ via: http://www.tecmint.com/useful-linux-hacks-commands/ 作者:[Avishek Kumar][a] 译者:[goreliu](https://github.com/goreliu) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From 1e2cd00a6919da648a8b5894506b427bab097263 Mon Sep 17 00:00:00 2001 From: DeadFire Date: Mon, 15 Jun 2015 16:25:12 +0800 Subject: [PATCH 099/153] =?UTF-8?q?20150615-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...end Swap Space using Swap file in Linux.md | 73 +++++++ ...er On Ubuntu or CentOS 7.1 or Fedora 22.md | 191 ++++++++++++++++++ ...put Rainbow Of Colors in Linux Terminal.md | 176 ++++++++++++++++ ...0615 How to combine two graphs on Cacti.md | 91 +++++++++ 4 files changed, 531 insertions(+) create mode 100644 sources/tech/20150515 Extend Swap Space using Swap file in Linux.md create mode 100644 sources/tech/20150515 Install Plex Media Server On Ubuntu or CentOS 7.1 or Fedora 22.md create mode 100644 sources/tech/20150515 Lolcat--A Command Line Tool to Output Rainbow Of Colors in Linux Terminal.md create mode 100644 sources/tech/20150615 How to combine two graphs on Cacti.md diff --git a/sources/tech/20150515 Extend Swap Space using Swap file in Linux.md b/sources/tech/20150515 Extend Swap Space using Swap file in Linux.md new file mode 100644 index 0000000000..51b2f2fe55 --- /dev/null +++ b/sources/tech/20150515 Extend Swap Space using Swap file in Linux.md @@ -0,0 +1,73 @@ +Extend Swap Space using Swap file in Linux +================================================================================ +There are some scenarios where our Linux box is running out of swap space so in that case we can extend the swap space using swap partition but due to unavailability of free partitions on the disk, we are unable to extend it. + +So in such cases we can extend or increase swap space using a swap file + +### Below are the Steps to extend Swap Space using Swap File in Linux ### + +Lets first check the size of existing swap space / partition using the command like ‘**free -m‘** and ‘**swapon -s**‘ + +![](http://www.linuxtechi.com/wp-content/uploads/2015/06/free-output-with-swap.jpg) +free-output-with-swap + +In my case size of swap partition is 2 GB. So we will be extending swap space by 1 GB. + +#### Step:1 Create a swap file of size 1 GB using below dd Command #### + + [root@linuxtechi ~]# dd if=/dev/zero of=/swap_file bs=1G count=1 + 1+0 records in + 1+0 records out + 1073741824 bytes (1.1 GB) copied, 414.898 s, 2.6 MB/s + [root@linuxtechi ~]# + +Replace the value of ‘**bs**‘ and ‘**count**‘ according your requirement. + +#### Step:2 Secure the swap file with permissions 644. #### + + [root@linuxtechi ~]# chmod 600 /swap_file + +#### Step:3 Enable the Swap Area on the file (swap_file) #### + +Use mkswap command to enable swap area + + [root@linuxtechi ~]# mkswap /swap_file + Setting up swapspace version 1, size = 1048572 KiB + no label, UUID=f7b3ae59-c09a-4dc2-ba4d-c02abb7db33b + [root@linuxtechi ~]# + +#### Step:4 Add the swap file entry in the fstab file #### + +Add the below entry in the fstab file so that swap file become persistent across every reboot. + + /swap_file swap swap defaults 0 0 + +![swap-file-fstab-entry](http://www.linuxtechi.com/wp-content/uploads/2015/06/swap-file-fstab-entry.jpg) + +#### Step:5 Enable the swap file using ‘mkswap on’ command. #### + + [root@linuxtechi ~]# swapon /swap_file + [root@linuxtechi ~]# + +#### Step:6 Now verify the swap space #### + +![swap-space-after-extension](http://www.linuxtechi.com/wp-content/uploads/2015/06/swap-space-after-extension.jpg) + +**Note**: To disable the swap file for any troubleshooting point of view, use swapoff command as shown below and to re-enable swap file then use swapon command as shown in step5. + + [root@linuxtechi ~]# swapoff /swap_file + [root@linuxtechi ~]# + +Please share your valuable inputs and comments of this article. + +-------------------------------------------------------------------------------- + +via: http://www.linuxtechi.com/extend-swap-space-using-swap-file-in-linux/ + +作者:[Pradeep Kumar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxtechi.com/author/pradeep/ \ No newline at end of file diff --git a/sources/tech/20150515 Install Plex Media Server On Ubuntu or CentOS 7.1 or Fedora 22.md b/sources/tech/20150515 Install Plex Media Server On Ubuntu or CentOS 7.1 or Fedora 22.md new file mode 100644 index 0000000000..837a7a2e73 --- /dev/null +++ b/sources/tech/20150515 Install Plex Media Server On Ubuntu or CentOS 7.1 or Fedora 22.md @@ -0,0 +1,191 @@ +Install Plex Media Server On Ubuntu / CentOS 7.1 / Fedora 22 +================================================================================ +In this article we will show you how easily you can setup Plex Home Media Server on major Linux distributions with their latest releases. After its successful installation of Plex you will be able to use your centralized home media playback system that streams its media to many Plex player Apps and the Plex Home will allows you to setup your environment by adding your devices and to setup a group of users that all can use Plex Together. So let’s start its installation first on Ubuntu 15.04. + +### Basic System Resources ### + +System resources mainly depend on the type and number of devices that you are planning to connect with the server. So according to our requirements we will be using as following system resources and software for a standalone server. + +注:表格 + + + + + + + + + + + + + + + + + + + + + + +
Plex Home Media Server
Base Operating SystemUbuntu 15.04 / CentOS 7.1 / Fedora 22 Work Station
Plex Media ServerVersion 0.9.12.3.1173-937aac3
RAM and CPU1 GB  , 2.0 GHZ
Hard Disk30 GB
+ +### Plex Media Server 0.9.12.3 on Ubuntu 15.04 ### + +We are now ready to start the installations process of Plex Media Server on Ubuntu so let’s start with the following steps to get it ready. + +#### Step 1: System Update #### + +Login to your server with root privileges Make your that your system is upto date if not then do by using below command. + + root@ubuntu-15:~#apt-get update + +#### Step 2: Download the Latest Plex Media Server Package #### + +Create a new directory and download .deb plex Media Package in it from the official website of Plex for Ubuntu using wget command. + + root@ubuntu-15:~# cd /plex/ + root@ubuntu-15:/plex# + root@ubuntu-15:/plex# wget https://downloads.plex.tv/plex-media-server/0.9.12.3.1173-937aac3/plexmediaserver_0.9.12.3.1173-937aac3_amd64.deb + +#### Step 3: Install the Debian Package of Plex Media Server #### + +Now within the same directory run following command to start installation of debian package and then check the status of plekmediaserver. + + root@ubuntu-15:/plex# dpkg -i plexmediaserver_0.9.12.3.1173-937aac3_amd64.deb + +---------- + + root@ubuntu-15:~# service plexmediaserver status + +![Plexmediaserver Service](http://blog.linoxide.com/wp-content/uploads/2015/06/plex-status.png) + +### Plex Home Media Web App Setup on Ubuntu 15.04 ### + +Let's open your web browser within your localhost network and open the Web Interface with your localhost IP and port 32400 and do following steps to configure it: + + http://172.25.10.179:32400/web + http://localhost:32400/web + +#### Step 1:Sign UP before Login #### + +After you have access to the web interface of Plesk Media Server make sure to Sign Up and set your username email ID and Password to login as. + +![Plex Sign In](http://blog.linoxide.com/wp-content/uploads/2015/06/PMS-Login.png) + +#### Step 2: Enter Your Pin to Secure Your Plex Media Home User #### + +![Plex User Pin](http://blog.linoxide.com/wp-content/uploads/2015/06/333.png) + +Now you have successfully configured your user under Plex Home Media. + +![Welcome To Plex](http://blog.linoxide.com/wp-content/uploads/2015/06/3333.png) + +### Opening Plex Web App on Devices Other than Localhost Server ### + +As we have seen in our Plex media home page that it indicates that "You do not have permissions to access this server". Its because of we are on a different network than the Server computer. + +![Plex Server Permissions](http://blog.linoxide.com/wp-content/uploads/2015/06/33.png) + +Now we need to resolve this permissions issue so that we can have access to server on the devices other than the hosted server by doing following setup. + +### Setup SSH Tunnel for Windows System to access Linux Server ### + +First we need to set up a SSH tunnel so that we can access things as if they were local. This is only necessary for the initial setup. + +If you are using Windows as your local system and server on Linux then we can setup SSH-Tunneling using Putty as shown. + +![Plex SSH Tunnel](http://blog.linoxide.com/wp-content/uploads/2015/06/ssh-tunnel.png) + +**Once you have the SSH tunnel set up:** + +Open your Web browser window and type following URL in the address bar. + + http://localhost:8888/web + +The browser will connect to the server and load the Plex Web App with same functionality as on local. +Agree to the terms of Services and start + +![Agree to Plex term](http://blog.linoxide.com/wp-content/uploads/2015/06/5.png) + +Now a fully functional Plex Home Media Server is ready to add new media libraries, channels, playlists etc. + +![PMS Settings](http://blog.linoxide.com/wp-content/uploads/2015/06/8.png) + +### Plex Media Server 0.9.12.3 on CentOS 7.1 ### + +We will follow the same steps on CentOS-7.1 that we did for the installation of Plex Home Media Server on Ubuntu 15.04. + +So lets start with Plex Media Servers Package Installation. + +#### Step 1: Plex Media Server Installation #### + +To install Plex Media Server on centOS 7.1 we need to download the .rpm package from the official website of Plex. So we will use wget command to download .rpm package for this purpose in a new directory. + + [root@linux-tutorials ~]# cd /plex + [root@linux-tutorials plex]# wget https://downloads.plex.tv/plex-media-server/0.9.12.3.1173-937aac3/plexmediaserver-0.9.12.3.1173-937aac3.x86_64.rpm + +#### Step 2: Install .RPM Package #### + +After completion of complete download package we will install this package using rpm command within the same direcory where we installed the .rpm package. + + [root@linux-tutorials plex]# ls + plexmediaserver-0.9.12.3.1173-937aac3.x86_64.rpm + [root@linux-tutorials plex]# rpm -i plexmediaserver-0.9.12.3.1173-937aac3.x86_64.rpm + +#### Step 3: Start Plexmediaservice #### + +We have successfully installed Plex Media Server Now we just need to restart its service and then enable it permanently. + + [root@linux-tutorials plex]# systemctl start plexmediaserver.service + [root@linux-tutorials plex]# systemctl enable plexmediaserver.service + [root@linux-tutorials plex]# systemctl status plexmediaserver.service + +### Plex Home Media Web App Setup on CentOS-7.1 ### + +Now we just need to repeat all steps that we performed during the Web app setup of Ubuntu. +So let's Open a new window in your web browser and access the Plex Media Server Web app using localhost or IP or your Plex server. + + http://172.20.3.174:32400/web + http://localhost:32400/web + +Then to get full permissions on the server you need to repeat the steps to create the SSH-Tunnel. +After signing up with new user account we will be able to access its all features and can add new users, add new libraries and setup it per our needs. + +![Plex Device Centos](http://blog.linoxide.com/wp-content/uploads/2015/06/plex-devices-centos.png) + +### Plex Media Server 0.9.12.3 on Fedora 22 Work Station ### + +The Basic steps to download and install Plex Media Server are the same as its we did for in CentOS 7.1. +We just need to download its .rpm package and then install it with rpm command. + +![PMS Installation](http://blog.linoxide.com/wp-content/uploads/2015/06/plex-on-fedora.png) + +### Plex Home Media Web App Setup on Fedora 22 Work Station ### + +We had setup Plex Media Server on the same host so we don't need to setup SSH-Tunnel in this time scenario. Just open the web browser in your Fedora 22 Workstation with default port 32400 of Plex Home Media Server and accept the Plex Terms of Services Agreement. + +![Plex Agreement](http://blog.linoxide.com/wp-content/uploads/2015/06/Plex-Terms.png) + +**Welcome to Plex Home Media Server on Fedora 22 Workstation** + +Lets login with your plex account and start with adding your libraries for your favorite movie channels , create your playlists, add your photos and enjoy with many other features of Plex Home Media Server. + +![Plex Add Libraries](http://blog.linoxide.com/wp-content/uploads/2015/06/create-library.png) + +### Conclusion ### + +We had successfully installed and configured Plex Media Server on Major Linux Distributions. So, Plex Home Media Server has always been a best choice for media management. Its so simple to setup on cross platform as we did for Ubuntu, CentOS and Fedora. It has simplifies the tasks of organizing your media content and streaming to other computers and devices then to share it with your friends. + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/tools/install-plex-media-server-ubuntu-centos-7-1-fedora-22/ + +作者:[Kashif Siddique][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/kashifs/ \ No newline at end of file diff --git a/sources/tech/20150515 Lolcat--A Command Line Tool to Output Rainbow Of Colors in Linux Terminal.md b/sources/tech/20150515 Lolcat--A Command Line Tool to Output Rainbow Of Colors in Linux Terminal.md new file mode 100644 index 0000000000..6b864db6cb --- /dev/null +++ b/sources/tech/20150515 Lolcat--A Command Line Tool to Output Rainbow Of Colors in Linux Terminal.md @@ -0,0 +1,176 @@ +Lolcat – A Command Line Tool to Output Rainbow Of Colors in Linux Terminal +================================================================================ +For those who believe that Linux Command Line is boring and there isn’t any fun, then you’re wrong here are the articles on Linux, that shows how funny and naughty is Linux.. + +- [20 Funny Commands of Linux or Linux is Fun in Terminal][1] +- [6 Interesting Funny Commands of Linux (Fun in Terminal)][2] +- [Fun in Linux Terminal – Play with Word and Character Counts][3] + +Here in this article, I will be discussing about a small utility called “lolcat” – Which produce rainbow of colors in terminal. + +![Lolcat Command to Output Rainbow of Colors for Terminal](http://www.tecmint.com/wp-content/uploads/2015/06/Linux-Lolcat.png) + +Lolcat Command to Output Rainbow of Colors for Terminal + +#### What is lolcat? #### + +Lolcat is an utility for Linux, BSD and OSX which concatenates like similar to [cat command][4] and adds rainbow coloring to it. Lolcat is primarily used for rainbow coloring of text in Linux Terminal. + +### Installation of Lolcat in Linux ### + +**1. Lolcat utility is available in the repository of lots of Linux distributions, but the available version bit older. Alternatively you can download and install latest version of lolcat from git repository.** + +Lolcat is a ruby gem hence it is essential to have latest version of RUBY installed on your system. + + # apt-get install ruby [On APT based Systems] + # yum install ruby [On Yum based Systems] + # dnf install ruby [On DNF based Systems] + +Once ruby package has been installed, make sure to verify the version of ruby installed. + + # ruby --version + + ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu] + +**2. Next download and install the most recent version of lolcat from the git repository using following commands.** + + # wget https://github.com/busyloop/lolcat/archive/master.zip + # unzip master.zip + # cd lolcat-master/bin + # gem install lolcat + +Once lolcat is installed, you can check the version. + + # lolcat --version + + lolcat 42.0.99 (c)2011 moe@busyloop.net + +### Usage of Lolcat ### + +**3. Before starting usage of lolcat, make sure to know the available options and help using following command.** + + # lolcat -h + +![Lolcat Help](http://www.tecmint.com/wp-content/uploads/2015/06/Lolcat-Help1.png) + +Lolcat Help + +**4. Next, pipeline lolcat with commads say ps, date and cal as:** + + # ps | lolcat + # date | lolcat + # cal | lolcat + +![ps Command Output](http://www.tecmint.com/wp-content/uploads/2015/06/ps-command-output.png) + +ps Command Output + +![Date Output](http://www.tecmint.com/wp-content/uploads/2015/06/Date.png) + +Date Output + +![Calendar Output](http://www.tecmint.com/wp-content/uploads/2015/06/Cal.png) + +Calendar Output + +**5. 3. Use lolcat to display codes of a script file as:** + + # lolcat test.sh + +![Display Codes with Lolcat](http://www.tecmint.com/wp-content/uploads/2015/06/Script-Output.png) + +Display Codes with Lolcat + +**6. Pipeline lolcat with figlet command. Figlet is a utility which displays large characters made up of ordinary screen characters. We can pipeline the output of figlet with lolcat to make the output colorful as:** + + # echo I ❤ Tecmint | lolcat + # figlet I Love Tecmint | lolcat + +![Colorful Texts](http://www.tecmint.com/wp-content/uploads/2015/06/Colorful-Text.png) + +Colorful Texts + +**Note**: Not to mention that ❤ is an unicode character and to install figlet you have to yum and apt to get the required packages as: + + # apt-get figlet + # yum install figlet + # dnf install figlet + +**7. Animate a text in rainbow of colours, as:** + + $ echo I ❤ Tecmit | lolcat -a -d 500 + +![Animated Text](http://www.tecmint.com/wp-content/uploads/2015/06/Animated-Text.gif) + +Animated Text + +Here the option -a is for Animation and -d is for duration. In the above example duration count is 500. + +**8. Read a man page (say man ls) in rainbow of colors as:** + + # man ls | lolcat + +![List Files Colorfully](http://www.tecmint.com/wp-content/uploads/2015/06/List-Files-Colorfully.png) + +List Files Colorfully + +**9. Pipeline lolcat with cowsay. cowsay is a configurable thinking and/or speaking cow, which supports a lot of other animals as well.** + +Install cowsay as: + + # apt-get cowsay + # yum install cowsay + # dnf install cowsay + +After install, print the list of all the animals in cowsay as: + + # cowsay -l + +**Sample Output** + + Cow files in /usr/share/cowsay/cows: + apt beavis.zen bong bud-frogs bunny calvin cheese cock cower daemon default + dragon dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep + ghostbusters gnu head-in hellokitty kiss kitty koala kosh luke-koala + mech-and-cow meow milk moofasa moose mutilated pony pony-smaller ren sheep + skeleton snowman sodomized-sheep stegosaurus stimpy suse three-eyes turkey + turtle tux unipony unipony-smaller vader vader-koala www + +Output of cowsay pipelined with lolcat and ‘gnu‘ cowfile is used. + + # cowsay -f gnu ☛ Tecmint ☚ is the best Linux Resource Available online | lolcat + +![Cowsay with Lolcat](http://www.tecmint.com/wp-content/uploads/2015/06/Cowsay-with-Lolcat.png) + +Cowsay with Lolcat + +**Note**: You can use lolcat with any other command in pipeline and get colored output in terminal. + +**10. You may create alias for the most frequently used commands to get command output in rainbow of colors. You can alias ‘ls -l‘ command which is used for long list the contents of directory as below.** + + # alias lolls="ls -l | lolcat" + # lolls + +![Alias Commands with Colorful](http://www.tecmint.com/wp-content/uploads/2015/06/Alias-Commands-with-Colorful.png) + +Alias Commands with Colorful + +You may create alias for any command as suggested above. To create permanent alias, you have to add the relevant code (above code for ls -l alias) to ~/.bashrc file and also make sure to logout and login back for the changes to be taken into effect. + +That’s all for now. I would like to know if you were aware of lolcat previously? Did you like the post? And suggestion and feedback is welcome in the comment section below. Like and share us and help us get spread. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/lolcat-command-to-output-rainbow-of-colors-in-linux-terminal/ + +作者:[Avishek Kumar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/20-funny-commands-of-linux-or-linux-is-fun-in-terminal/ +[2]:http://www.tecmint.com/linux-funny-commands/ +[3]:http://www.tecmint.com/play-with-word-and-character-counts-in-linux/ +[4]:http://www.tecmint.com/13-basic-cat-command-examples-in-linux/ \ No newline at end of file diff --git a/sources/tech/20150615 How to combine two graphs on Cacti.md b/sources/tech/20150615 How to combine two graphs on Cacti.md new file mode 100644 index 0000000000..aeb2b2ea0c --- /dev/null +++ b/sources/tech/20150615 How to combine two graphs on Cacti.md @@ -0,0 +1,91 @@ +How to combine two graphs on Cacti +================================================================================ +[Cacti][1] a fantastic open source network monitoring system that is widely used to graph network elements like bandwidth, storage, processor and memory utilization. Using its web based interface, you can create and organize graphs easily. However, some advanced features like merging graphs, creating aggregate graphs using multiple sources, migration of Cacti to another server are not provided by default. You might need some experience with Cacti to pull these off. In this tutorial, we will see how we can merge two Cacti graphs into one. + +Consider this example. Client-A has been connected to port 5 of switch-A for the last six months. Port 5 becomes faulty, and so the client is migrated to Port 6. As Cacti uses different graphs for each interface/element, the bandwidth history of the client would be split into port 5 and port 6. So we end up with two graphs for one client - one with six months' worth of old data, and the other that contains ongoing data. + +In such cases, we can actually combine the two graphs so the old data is appended to the new graph, and we get to keep a single graph containing historic and new data for one customer. This tutorial will explain exactly how we can achieve that. + +Cacti stores the data of each graph in its own RRD (round robin database) file. When a graph is requested, the values stored in a corresponding RRD file are used to generate the graph. RRD files are stored in `/var/lib/cacti/rra` in Ubuntu/Debian systems and in `/var/www/cacti/rra` in CentOS/RHEL systems. + +The idea behind merging graphs is to alter these RRD files so the values from the old RRD file are appended to the new RRD file. + +### Scenario ### + +The services for a client is running on eth0 for over a year. Because of hardware failure, the client has been migrated to eth1 interface of another server. We want to graph the bandwidth of the new interface, while retaining the historic data for over a year. The client would see only one graph. + +### Identifying the RRD for the Graph ### + +The first step during graph merging is to identify the RRD file associated with a graph. We can check the file by opening the graph in debug mode. To do this, go to Cacti's menu: Console > Graph Management > Select Graph > Turn On Graph Debug Mode. + +#### Old graph: #### + +![](https://farm4.staticflickr.com/3853/18795518096_f50a78d082_c.jpg) + +#### New graph: #### + +![](https://farm4.staticflickr.com/3674/18634036918_5c4118c4b9_c.jpg) + +From the example output (which is based on a Debian system), we can identify the RRD files for two graphs: + +- **Old graph**: /var/lib/cacti/rra/old_graph_traffic_in_8.rrd +- **New graph**: /var/lib/cacti/rra/new_graph_traffic_in_10.rrd + +### Preparing a Script ### + +We will merge two RRD files using a [RRD splice script][2]. Download this PHP script, and install it as /var/lib/cacti/rra/rrdsplice.php (for Debian/Ubuntu) or /var/www/cacti/rra/rrdsplice.php (for CentOS/RHEL). + +Next, make sure that the file is owned by Apache user. + +On Debian or Ubuntu, run the following command: + + # chown www-data:www-data rrdsplice.php + +and update rrdsplice.php accordingly. Look for the following line: + + chown($finrrd, "apache"); + +and replace it with: + + chown($finrrd, "www-data"); + +On CentOS or RHEL, run the following command: + + # chown apache:apache rrdsplice.php + +### Merging Two Graphs ### + +The syntax usage of the script can easily be found by running it without any parameters. + + # cd /path/to/rrdsplice.php + # php rrdsplice.php + +---------- + + USAGE: rrdsplice.php --oldrrd=file --newrrd=file --finrrd=file + +Now we are ready to merge two RRD files. Simply supply the names of an old RRD file and a new RRD file. We will overwrite the merged result back to the new RRD file. + + # php rrdsplice.php --oldrrd=old_graph_traffic_in_8.rrd --newrrd=new_graph_traffic_in_10.rrd --finrrd=new_graph_traffic_in_10.rrd + +Now the data from the old RRD file should be appended to the new RRD. Any new data will continue to be written by Cacti to the new RRD file. If we click on the graph, we should be able to verify that the weekly, monthly and yearly records have also been added from the old graph. The second graph in the following diagram shows weekly records from the old graph. + +![](https://farm6.staticflickr.com/5493/18821787015_6730164068_b.jpg) + +To sum up, this tutorial showed how we can easily merge two Cacti graphs into one. This trick is useful when a service is migrated to another device/interface and we want to deal with only one graph instead of two. The script is very handy as it can join graphs regardless of the source device e.g., Cisco 1800 router and Cisco 2960 switch. + +Hope this helps. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/combine-two-graphs-cacti.html + +作者:[Sarmed Rahman][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/sarmed +[1]:http://xmodulo.com/install-configure-cacti-linux.html +[2]:http://svn.cacti.net/viewvc/developers/thewitness/rrdsplice/rrdsplice.php \ No newline at end of file From 721288a50f8917cea27708ad36dd0cda357904d6 Mon Sep 17 00:00:00 2001 From: zpl1025 Date: Mon, 15 Jun 2015 17:59:23 +0800 Subject: [PATCH 100/153] [translating] 20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux --- ... Filenames Having Spaces and Special Characters in Linux.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md b/sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md index 03bbb69005..31b28afd01 100644 --- a/sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md +++ b/sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md @@ -1,3 +1,4 @@ +zpl1025 How to Manipulate Filenames Having Spaces and Special Characters in Linux ================================================================================ We come across files and folders name very regularly. In most of the cases file/folder name are related to the content of the file/folder and starts with number and characters. Alpha-Numeric file name are pretty common and very widely used, but this is not the case when we have to deal with file/folder name that has special characters in them. @@ -432,4 +433,4 @@ via: http://www.tecmint.com/manage-linux-filenames-with-special-characters/ [a]:http://www.tecmint.com/author/avishek/ [1]:http://www.tecmint.com/15-basic-ls-command-examples-in-linux/ -[2]:http://www.tecmint.com/8-pratical-examples-of-linux-touch-command/ \ No newline at end of file +[2]:http://www.tecmint.com/8-pratical-examples-of-linux-touch-command/ From 6b7ba41295f51879dc60552cf2a3a6fda1954321 Mon Sep 17 00:00:00 2001 From: Gore Liu Date: Mon, 15 Jun 2015 19:20:38 +0800 Subject: [PATCH 101/153] [Translated] 20150528 11 pointless but awesome Linux terminal tricks.md --- ...tless but awesome Linux terminal tricks.md | 108 ------------------ ...tless but awesome Linux terminal tricks.md | 104 +++++++++++++++++ 2 files changed, 104 insertions(+), 108 deletions(-) delete mode 100644 sources/tech/20150528 11 pointless but awesome Linux terminal tricks.md create mode 100644 translated/tech/20150528 11 pointless but awesome Linux terminal tricks.md diff --git a/sources/tech/20150528 11 pointless but awesome Linux terminal tricks.md b/sources/tech/20150528 11 pointless but awesome Linux terminal tricks.md deleted file mode 100644 index 74baa5fb5b..0000000000 --- a/sources/tech/20150528 11 pointless but awesome Linux terminal tricks.md +++ /dev/null @@ -1,108 +0,0 @@ -Translating by goreliu ... - -11 pointless but awesome Linux terminal tricks -================================================================================ -Here are some great Linux terminal tips and tricks, each one as pointless as it is awesome. - -![](http://images.techhive.com/images/article/2015/05/slide_01-100587352-orig.png) - -### All work and no play... ### - -Linux is one of the most astoundingly functional and utilitarian Operating Systems around when it comes to working from the command line. Need to perform a particular task? Odds are there is an application or script you can use to get it done. Right from the terminal. But, as they say in the good book, "All work and no play make Jack really bored or something." So here is a collection of my favorite pointless, stupid, annoying or amusing things that you can do right in your Linux Terminal. - -![](http://images.techhive.com/images/article/2015/05/slide_02-100587353-orig.png) - -### Give the terminal an attitude ### - -Step 1) Type "sudo visudo". - -Step 2) At the bottom of the "Defaults" (near the top of the file) add, on a new line, "Defaults insults". - -Step 3) Save the file. - -"What did I just do to my computer?" you may be asking yourself. Something wonderful. Now, whenever you issue a sudo command and misstype your password, your computer will call you names. My favorite: "Listen, burrito brains, I don't have time to listen to this trash." - -![](http://images.techhive.com/images/article/2015/05/slide_03-100587354-orig.png) - -### apt-get moo ### - -That screenshot you see? That's what typing "apt-get moo" (on a Debian-based system) does. That's it. Don't go looking for this to do something fancy. It won't. That, I kid you not, is it. But it's one of the most commonly known little Easter eggs on Linux. So I include it here, right near the beginning, so I won't get 5,000 emails telling me I missed it in this list. - -![](http://images.techhive.com/images/article/2015/05/slide_04-100587355-orig.png) - -### aptitude moo ### - -A bit more entertaining is aptitude's take on "moo." Type "aptitude moo" (on Ubuntu and the like) and you'll be corrected about thinking "moo" would do anything. But you know better. Try the same command again, this time with an optional "-v" attribute. Don't stop there. Add v's, one at a time, until aptitude gives you what you want. - -![](http://images.techhive.com/images/article/2015/05/slide_05-100587356-orig.png) - -### Arch: Put Pac-Man in pacman ### - -This is one just for the Arch-lovers out there. The de facto package manager, pacman, is pretty fantastic already. Let's make it even better. - -Step 1) Open "/etc/pacman.conf". - -Step 2) In the "# Misc options", remove the "#" from in front of "Color". - -Step 3) Add "ILoveCandy". - -Now the progress for installing new packages, in pacman, will include a little tiny Pac-Man. Which should really just be the default anyway. - -![](http://images.techhive.com/images/article/2015/05/slide_06-100587358-orig.png) - -### Cowsay! ### - -Making aptitude moo is neat, I guess, but you really can't use it for much. Enter "cowsay." It does what you think. You make a cow say things. Anything you like. And it's not even limited to cows. Calvin, Beavis, and the Ghostbusters logo are all available in full ASCII art glory – type "cowsay -l" for a full list of what's available in this, Linux's most powerful tool. Remember that, like most great terminal applications, you can pipe the output from other applications straight into cowsay (ala "fortune | cowsay"). - -![](http://images.techhive.com/images/article/2015/05/slide_07-100587359-orig.png) - -### Become an 3l33t h@x0r ### - -Typing "nmap" isn't something one typically needs to do on a day-to-day basis. But when one does need to "whip out the nmap," one wants to look as l33t as humanly possible. Add a "-oS" to any nmap command (such as "nmap -oS - google.com"). Bam. You're now in what is officially known as "[Script Kiddie Mode][1]." Angelina Jolie and Keanu Reeves would be proud. - -![](http://images.techhive.com/images/article/2015/05/slide_08-100587360-orig.png) - -### Getting all Discordian ddate ### - -If you've ever been sitting around thinking, "Hey! I want today's date to be written in an essentially useless, but whimsical, way"…try typing "ddate". Results like "Today is Setting Orange, the 72nd day of Discord in the YOLD 3181," can really spice up your server logs. - -Note: Technically, this is a real thing called the [Discordian Calendar][2], used (in theory) by the followers of [Discordianism][3]. Which means I probably offended somebody. Or maybe not. I'm not really sure. Either way, ddate is a handy tool in any office. - -![](http://images.techhive.com/images/article/2015/05/slide_09-100587361-orig.png) - -### I See Colors Everywhere! ### - -Tired of boring old text? Looking to spruce things up and show the world your true style? lolcat. Install it. Use it. Everywhere. It takes any text input and turns it into a rainbow of wonder and enchantment. Piping text into lolcat (ala "fortune | lolcat") is sure to liven up any party. - -![](http://images.techhive.com/images/article/2015/05/slide_10-100587362-orig.png) - -### The Steam Locomotive ### - -Animated ASCII art steam locomotive in your terminal. You want this. You need this. Install and run "sl". Use "sl -l" for a tiny version. Or, if you want to really spend some time on this, "sl-h". This is the full train, including passenger cars. - -![](http://images.techhive.com/images/article/2015/05/slide_11-100587364-orig.png) - -### Reverse any text ### - -Pipe the output of any text into "rev" and it will reverse the text. "fortune | rev" gives you a fortune. In reverse. Which is, as odd as it may seem, not a misfortune. - -![](http://images.techhive.com/images/article/2015/05/slide_12-100587366-orig.png) - -### The Matrix is still cool, right? ### - -Want your terminal to do that scrolling text, l33t, Matrix-y thing? "cmatrix" is your friend. You can even have it output different colors, which is snazzy. Learn how by typing "man cmatrix". Or, better yet, "man cmatrix | lolcat". Which, really, is the most pointless (but wonderful) thing you can do in the Linux Terminal. So that's where I leave you. - --------------------------------------------------------------------------------- - -via: http://www.networkworld.com/article/2926630/linux/11-pointless-but-awesome-linux-terminal-tricks.html - -作者:[Bryan Lunduke][a] -译者:[goreliu](https://github.com/goreliu) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.networkworld.com/author/Bryan-Lunduke/ -[1]:http://nmap.org/book/output-formats-script-kiddie.html -[2]:http://en.wikipedia.org/wiki/Discordian_calendar -[3]:http://en.wikipedia.org/wiki/Discordianism \ No newline at end of file diff --git a/translated/tech/20150528 11 pointless but awesome Linux terminal tricks.md b/translated/tech/20150528 11 pointless but awesome Linux terminal tricks.md new file mode 100644 index 0000000000..e4a33cf48a --- /dev/null +++ b/translated/tech/20150528 11 pointless but awesome Linux terminal tricks.md @@ -0,0 +1,104 @@ +11个让人惊叹的Linux终端彩蛋 +================================================================================ +这里有一些很酷的Linux终端彩蛋,其中的每一个看上去并没有实际用途,但很精彩。 + +![](http://images.techhive.com/images/article/2015/05/slide_01-100587352-orig.png) + +### 只工作不玩耍…… ### + +当我们使用命令行工作时,Linux是功能和实用性最好的操作系统之一。想要执行一个特殊任务?可能一个程序或者脚本就可以帮你搞定。但就像一本书中说到的,只工作不玩耍聪明的孩子也会变傻。下边是我最喜欢的可以在终端做的没有实际用途的、傻傻的、恼人的、可笑的事情。 + +### 给终端一个态度 ### + +* 第一步)敲入`sudo visudo` +* 第二步)在“Defaults”末尾(文件的前半部分)添加一行“Defaults insults”。 +* 第三步)保存文件。 + +“我刚才对电脑做了什么?”你可能这样问自己。一定是美妙的事情吧。现在,在sudo命令提示提示下输出错误的口令,你的电脑就会呼唤你的名字。我最喜欢的一句:“听好了,煎饼一样的脑子,我没有时间听你胡说八道了。” + +![](http://images.techhive.com/images/article/2015/05/slide_02-100587353-orig.png) + +### apt-get moo ### + +你看过这张截图?那就是运行`apt-get moo`(在基于Debian的系统)的结果。对,就是它了。不要对它抱太多幻想,你会失望的,我不骗你。但是这是Linux世界最被人熟知的彩蛋之一。所以我把它包含进来,并且放在前排,然后我也就不会收到5千封邮件,指责我把它遗漏了。 + +![](http://images.techhive.com/images/article/2015/05/slide_03-100587354-orig.png) + +### aptitude moo ### + +更有趣的是将moo应用到aptitude上。敲入`aptitude moo`(在Ubuntu及其衍生版),你对`moo`可以做什么事情的看法会有所变化。你还还会知道更多事情,尝试重新输入这条命令,但这次添加一个`-v`参数。这还没有结束,试着添加更多`v`,一次添加一个,直到aptitude给了你想要的东西。 + +![](http://images.techhive.com/images/article/2015/05/slide_04-100587355-orig.png) + +### Arch: 将吃豆人放入pacman ### + +这里有一个只为Arch爱好者准备的彩蛋。Pacman包管理工具已经很棒了,但我们可以让它变得更棒。 + +* 第一步)打开“/etc/pacman.conf”文件。 +* 第二步)在“# Misc options”部分,去掉“Color”前的“#”。 +* 第三步)添加“ILoveCandy”。 + +现在我们使用pacman安装新软件包时,进度条里会出现一个小吃豆人。真应该默认就是这样的。 + +![](http://images.techhive.com/images/article/2015/05/slide_05-100587356-orig.png) + +### Cowsay! ### + +`aptitude moo`的输出格式很漂亮,但我想你苦于不能自由自在地使用。输入`cowsay`,它会做到你想做的事情。你可以让牛说任何你喜欢的东西。而且不只可以用牛,还可以用Calvin、Beavis和Ghostbusters的ASCII logo——输入`cowsay -l`可以得到所有可用的logo。它是Linux世界的强大工具。像很多其他命令一样,你可以使用管道把其他程序的输出输送给它,比如`fortune | cowsay`。 + +![](http://images.techhive.com/images/article/2015/05/slide_06-100587358-orig.png) + +### 变成3l33t h@x0r ### + +`nmap`并不是我们平时经常使用的基本命令。但如果你想蹂躏`nmap`的话,可能想在它的输出中看到l33t。在任何`nmap`命令(比如`nmap -oS - google.com`)后添加`-oS`。现在你的`nmap`已经处于官方名称是“[Script Kiddie Mode][1]”的模式了。Angelina Jolie和Keanu Reeves会为此骄傲的。 + +![](http://images.techhive.com/images/article/2015/05/slide_07-100587359-orig.png) + +### 获得所有的Discordian日期 ### + +如果你们曾经坐在一起思考,“嗨!我想使用无用但异想天开的方式来书写今天的日期……”试试运行`ddate`。结果类似于“Today is Setting Orange, the 72nd day of Discord in the YOLD 3181”,这会让你的服务树日志平添不少香料。 + +注意:在技术层面,确实有一个[Discordian Calendar][2],理论上被[Discordianism][3]追随者所使用。这意味着我可能得罪某些人。或者不会,我不确定。不管怎样,`ddate`是一个方便的工具。 + +![](http://images.techhive.com/images/article/2015/05/slide_08-100587360-orig.png) + +### 我可以在任何地方看到颜色!### + +厌倦了老旧的文本?想向世界展示出自己的个性?使用`lolcat`。安装它,然后在任何地方使用。它可以接收任何文本,然后将其转换成美轮美奂的彩虹效果。可以使用`fortune | lolcat`体验。 + +![](http://images.techhive.com/images/article/2015/05/slide_09-100587361-orig.png) + +### 蒸汽机车 ### + +在你的终端显示蒸汽机车的ASCII图形。如果你需要它,安装并运行`sl`命令。`sl -l`可以看到一个袖珍版本的。或者,如果你真想在上边花费更多时间,运行`sl -h`。这会显示一个完整的或者,还包括乘客车厢。 + +![](http://images.techhive.com/images/article/2015/05/slide_10-100587362-orig.png) + +### 将任何文本逆序输出 ### + +将任何文本使用管道输送给`rev`命令,它就会将文本内容逆序输出。`fortune | rev`会给你好运。当然,这不意味着rev会将幸运转换成不幸。 + +![](http://images.techhive.com/images/article/2015/05/slide_11-100587364-orig.png) + +### Matrix依然很酷,不是吗? ### + +想让你的终端显示滚动的文字、l33t和Matrix电影中的坠落数码?`cmatrix`是你的朋友。你甚至可以用它输出不同的颜色,非常华丽。使用`man cmatrix`学习使用方法。或者使用更好的方法,“man cmatrix | lolcat”。这确实是你在Linux终端可以做的最没实际用途却又精彩的事情了。 + +![](http://images.techhive.com/images/article/2015/05/slide_12-100587366-orig.png) + +以上就是全部内容了。 + +-------------------------------------------------------------------------------- + +via: http://www.networkworld.com/article/2926630/linux/11-pointless-but-awesome-linux-terminal-tricks.html + +作者:[Bryan Lunduke][a] +译者:[goreliu](https://github.com/goreliu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.networkworld.com/author/Bryan-Lunduke/ +[1]:http://nmap.org/book/output-formats-script-kiddie.html +[2]:http://en.wikipedia.org/wiki/Discordian_calendar +[3]:http://en.wikipedia.org/wiki/Discordianism \ No newline at end of file From 818fbe4ab79d70b5f1e7ce40084a64f28052b71c Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 15 Jun 2015 21:01:38 +0800 Subject: [PATCH 102/153] =?UTF-8?q?=E8=BF=87=E6=9C=9F=E6=92=A4=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 ​No reboot patching comes to Linux 4.0.md | 58 ------------------- 1 file changed, 58 deletions(-) delete mode 100644 sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md diff --git a/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md b/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md deleted file mode 100644 index 6333fea9a7..0000000000 --- a/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md +++ /dev/null @@ -1,58 +0,0 @@ -​No reboot patching comes to Linux 4.0 -================================================================================ -> **Summary**:With the new Linux 4.0 kernel, you'll need to reboot Linux less often than ever. - -With [Linux 4.0][1], you may never need to reboot your operating system again. - -![Using Linux means never having to reboot. -- SUSE ](http://zdnet4.cbsistatic.com/hub/i/r/2015/03/02/5e766833-454b-45b5-a8f7-a55d21e9d26a/resize/270x270/4d0774552c342a1507784ef802619b71/livepatching.jpg) -Using Linux means never having to reboot. -- SUSE - -One reason to love Linux on your servers or in your data-center is that you so seldom needed to reboot it. True, critical patches require a reboot, but you could go months without rebooting. Now, with the latest changes to the Linux kernel you may be able to go years between reboots. - -This is actually a feature that was available in Linux in 2009 thanks to a program called [Ksplice][2]. This program compares the original and patched kernels and then uses a customized kernel module to patch the new code into the running kernel. Each Ksplice-enabled kernel comes with a special set of flags for each function that will be patched. The [Ksplice process][3] then watches for a moment when the code for the function being patched isn't in use, and ta-da, the patch is made and your server runs on. - -[Oracle acquired Ksplice][4] in 2011, and kept it just for its own [Oracle Linux][5], a [Red Hat Enterprise Linux (RHEL)][6] clone, and as a RHEL subscription service. That left all the other enterprise and server Linux back where they started. - -Then [KernelCare released a service that could provide bootless patches][7] for most enterprise Linux distros. This program use proprietary software and is only available as a service with a monthly fee. That was a long way from satisfying many Linux system administrators. - -So, [Red Hat][8] and [SUSE][9] both started working on their own purely open-source means of giving Linux the ability to keep running even while critical patches were being installed. Red Hat's program was named [kpatch][10], while SUSE' is named [kGraft][11]. - -The two companies took different approaches. Kpatch issues a stop_machine() command. After that it looks at the stack of existing processes using [ftrace][12] and, if the patch can be made safely, it redirects the running code to the patched functions and then removes the now outdated code. - -Kgraft also uses ftrace, but it works on the thread level. When an old function is called it makes sure the thread reaches a point that it can switch to the new function. - -While the end result is the same, the operating system keeps running while patches are made, there are significant differences in performance. Kpatch takes from one to forty milliseconds, while kGraft might take several minutes but there's never even a millisecond of down time. - -At the Linux Plumbers Conference in October 2014, the two groups got together and started work on a way to [patch Linux without rebooting that combines the best of both programs][13]. Essentially, what they ended up doing was putting both kpatch and kGraft in the 4.0 Linux kernel. - -Jiri Kosina, a SUSE software engineer and Linux kernel developer, explained, that live-patching in the Linux kernel will "provides a basic infrastructure for function "live patching" (i.e. code redirection), including API [application programming interface] for kernel modules containing the actual patches, and API/ABI [application binary interface] for userspace to be able to operate on the patches. This is "relatively simple and minimalistic, as it's making use of existing kernel infrastructure (namely ftrace) as much as possible. It's also self-contained, in a sense that it doesn't hook itself in any other kernel subsystem (it doesn't even touch any other code)." - -The release candidate for Linux 4.0 is now out. Kosina stated that "It's now implemented for x86 only as a reference architecture, but support for powerpc, s390 and arm is already in the works." And, indeed, the source code for these architectures is already in the [Live Patching Git code][14]. - -Simply having the code in there is just the start. Your Linux distribution will have to support it with patches that can make use of it. With both Red Hat and SUSE behind it, live patching will soon be the default in all serious business Linux distributions. - --------------------------------------------------------------------------------- - -via: http://www.zdnet.com/article/no-reboot-patching-comes-to-linux-4-0/#ftag=RSSbaffb68 - -作者:[Steven J. Vaughan-Nichols][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.zdnet.com/meet-the-team/us/sjvn/ -[1]:http://www.zdnet.com/article/linux-kernel-turns-over-release-odometer-to-4-0/ -[2]:http://www.computerworld.com/article/2466389/open-source-tools/never-reboot-again-with-linux-and-ksplice.html -[3]:http://www.ksplice.com/ -[4]:http://www.zdnet.com/article/oracle-acquires-zero-downtime-linux-upgrade-software/ -[5]:http://www.oracle.com/us/technologies/linux/overview/index.html -[6]:http://www.redhat.com/en/technologies/linux-platforms/enterprise-linux -[7]:http://www.zdnet.com/article/kernelcare-new-no-reboot-linux-patching-system/ -[8]:http://www.redhat.com/ -[9]:http://www.suse.com/ -[10]:http://rhelblog.redhat.com/2014/02/26/kpatch/ -[11]:http://www.zdnet.com/article/suse-gets-live-patching/ -[12]:http://elinux.org/Ftrace -[13]:http://linuxplumbersconf.org/2014/wp-content/uploads/2014/10/LPC2014_LivePatching.txt -[14]:https://kernel.googlesource.com/pub/scm/linux/kernel/git/jikos/livepatching/+/9ec0de0ee0c9f0ffe4f72da9158194121cc22807 \ No newline at end of file From d4f9ac7ac4865e2ee49dddee7e52bae0cdcdd88e Mon Sep 17 00:00:00 2001 From: wi-cuckoo Date: Mon, 15 Jun 2015 22:21:18 +0800 Subject: [PATCH 103/153] translating wi-cuckoo --- sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md b/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md index 6333fea9a7..76a4545bf8 100644 --- a/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md +++ b/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md @@ -1,3 +1,4 @@ +translating wi-cuckoo ​No reboot patching comes to Linux 4.0 ================================================================================ > **Summary**:With the new Linux 4.0 kernel, you'll need to reboot Linux less often than ever. @@ -55,4 +56,4 @@ via: http://www.zdnet.com/article/no-reboot-patching-comes-to-linux-4-0/#ftag=RS [11]:http://www.zdnet.com/article/suse-gets-live-patching/ [12]:http://elinux.org/Ftrace [13]:http://linuxplumbersconf.org/2014/wp-content/uploads/2014/10/LPC2014_LivePatching.txt -[14]:https://kernel.googlesource.com/pub/scm/linux/kernel/git/jikos/livepatching/+/9ec0de0ee0c9f0ffe4f72da9158194121cc22807 \ No newline at end of file +[14]:https://kernel.googlesource.com/pub/scm/linux/kernel/git/jikos/livepatching/+/9ec0de0ee0c9f0ffe4f72da9158194121cc22807 From 96f60b9298235892f846894d3bcfc5d0109db0ab Mon Sep 17 00:00:00 2001 From: wi-cuckoo Date: Mon, 15 Jun 2015 22:26:06 +0800 Subject: [PATCH 104/153] soluted the conflict --- sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md b/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md index 6c3396907c..76a4545bf8 100644 --- a/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md +++ b/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md @@ -1,3 +1,4 @@ +translating wi-cuckoo ​No reboot patching comes to Linux 4.0 ================================================================================ > **Summary**:With the new Linux 4.0 kernel, you'll need to reboot Linux less often than ever. From a0f53e1f6e602f6a3ab8e53843b871698d1dccef Mon Sep 17 00:00:00 2001 From: sevenot Date: Tue, 16 Jun 2015 10:28:57 +0800 Subject: [PATCH 105/153] sevenot translating --- .../talk/20150128 The top 10 rookie open source projects.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/talk/20150128 The top 10 rookie open source projects.md b/sources/talk/20150128 The top 10 rookie open source projects.md index 0dfcb07a48..7dccf38141 100644 --- a/sources/talk/20150128 The top 10 rookie open source projects.md +++ b/sources/talk/20150128 The top 10 rookie open source projects.md @@ -1,3 +1,4 @@ +sevenot translating The top 10 rookie open source projects ================================================================================ Black Duck presents its Open Source Rookies of the Year -- the 10 most exciting, active new projects germinated by the global open source community @@ -150,4 +151,4 @@ via: http://www.infoworld.com/article/2875439/open-source-software/the-top-10-ro [20]:https://www.blackducksoftware.com/open-source-rookies [21]:http://www.infoworld.com/article/2871935/application-development/infoworlds-2015-technology-of-the-year-award-winners.html [22]:http://www.infoworld.com/article/2688104/open-source-software/article.html -[23]:http://www.infoworld.com/article/2854954/microsoft-windows/15-essential-open-source-tools-for-windows-admins.html \ No newline at end of file +[23]:http://www.infoworld.com/article/2854954/microsoft-windows/15-essential-open-source-tools-for-windows-admins.html From 46b40880ede51d5e20c9d3025bd62d52993a709f Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Tue, 16 Jun 2015 10:30:21 +0800 Subject: [PATCH 106/153] Translating by ZTinoZ --- sources/tech/20150526 20 Useful Terminal Emulators for Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index 82a8ff5aff..a15c4ad0d1 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -189,7 +189,7 @@ Gnome Terminal ### 14. Final Term ### -Final Term is a open source stylish terminal emulator that has some exciting capabilities and handy features into one single beautiful interface. It is still under development, but provides significant features such as Semantic text menus, Smart command completion, GUI terminal controls, Omnipotent keybindings, Color support and many more. The following animated screen grab demonstrates some of their features. Please click on image to view demo. +Final Term是一款漂亮的开源终端仿真器,在这一个界面里蕴藏着一些令人激动的功能和特性。虽然它仍然有待改进,但是它提供了一些重要的特性比如Semantic文本菜单、智能的命令行实现、GUI终端控制、全能的快捷键、彩色支持等等。以下动图抓取并演示了它们的一些特性,点开来看看吧。 ![FinalTerm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/FinalTerm.gif) From 19c1a9fdad619600df6e0302e981d2529512d4ae Mon Sep 17 00:00:00 2001 From: wi-cuckoo Date: Tue, 16 Jun 2015 11:05:15 +0800 Subject: [PATCH 107/153] delete a past item --- ...4 ​No reboot patching comes to Linux 4.0.md | 59 ------------------- 1 file changed, 59 deletions(-) delete mode 100644 sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md diff --git a/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md b/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md deleted file mode 100644 index 76a4545bf8..0000000000 --- a/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md +++ /dev/null @@ -1,59 +0,0 @@ -translating wi-cuckoo -​No reboot patching comes to Linux 4.0 -================================================================================ -> **Summary**:With the new Linux 4.0 kernel, you'll need to reboot Linux less often than ever. - -With [Linux 4.0][1], you may never need to reboot your operating system again. - -![Using Linux means never having to reboot. -- SUSE ](http://zdnet4.cbsistatic.com/hub/i/r/2015/03/02/5e766833-454b-45b5-a8f7-a55d21e9d26a/resize/270x270/4d0774552c342a1507784ef802619b71/livepatching.jpg) -Using Linux means never having to reboot. -- SUSE - -One reason to love Linux on your servers or in your data-center is that you so seldom needed to reboot it. True, critical patches require a reboot, but you could go months without rebooting. Now, with the latest changes to the Linux kernel you may be able to go years between reboots. - -This is actually a feature that was available in Linux in 2009 thanks to a program called [Ksplice][2]. This program compares the original and patched kernels and then uses a customized kernel module to patch the new code into the running kernel. Each Ksplice-enabled kernel comes with a special set of flags for each function that will be patched. The [Ksplice process][3] then watches for a moment when the code for the function being patched isn't in use, and ta-da, the patch is made and your server runs on. - -[Oracle acquired Ksplice][4] in 2011, and kept it just for its own [Oracle Linux][5], a [Red Hat Enterprise Linux (RHEL)][6] clone, and as a RHEL subscription service. That left all the other enterprise and server Linux back where they started. - -Then [KernelCare released a service that could provide bootless patches][7] for most enterprise Linux distros. This program use proprietary software and is only available as a service with a monthly fee. That was a long way from satisfying many Linux system administrators. - -So, [Red Hat][8] and [SUSE][9] both started working on their own purely open-source means of giving Linux the ability to keep running even while critical patches were being installed. Red Hat's program was named [kpatch][10], while SUSE' is named [kGraft][11]. - -The two companies took different approaches. Kpatch issues a stop_machine() command. After that it looks at the stack of existing processes using [ftrace][12] and, if the patch can be made safely, it redirects the running code to the patched functions and then removes the now outdated code. - -Kgraft also uses ftrace, but it works on the thread level. When an old function is called it makes sure the thread reaches a point that it can switch to the new function. - -While the end result is the same, the operating system keeps running while patches are made, there are significant differences in performance. Kpatch takes from one to forty milliseconds, while kGraft might take several minutes but there's never even a millisecond of down time. - -At the Linux Plumbers Conference in October 2014, the two groups got together and started work on a way to [patch Linux without rebooting that combines the best of both programs][13]. Essentially, what they ended up doing was putting both kpatch and kGraft in the 4.0 Linux kernel. - -Jiri Kosina, a SUSE software engineer and Linux kernel developer, explained, that live-patching in the Linux kernel will "provides a basic infrastructure for function "live patching" (i.e. code redirection), including API [application programming interface] for kernel modules containing the actual patches, and API/ABI [application binary interface] for userspace to be able to operate on the patches. This is "relatively simple and minimalistic, as it's making use of existing kernel infrastructure (namely ftrace) as much as possible. It's also self-contained, in a sense that it doesn't hook itself in any other kernel subsystem (it doesn't even touch any other code)." - -The release candidate for Linux 4.0 is now out. Kosina stated that "It's now implemented for x86 only as a reference architecture, but support for powerpc, s390 and arm is already in the works." And, indeed, the source code for these architectures is already in the [Live Patching Git code][14]. - -Simply having the code in there is just the start. Your Linux distribution will have to support it with patches that can make use of it. With both Red Hat and SUSE behind it, live patching will soon be the default in all serious business Linux distributions. - --------------------------------------------------------------------------------- - -via: http://www.zdnet.com/article/no-reboot-patching-comes-to-linux-4-0/#ftag=RSSbaffb68 - -作者:[Steven J. Vaughan-Nichols][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.zdnet.com/meet-the-team/us/sjvn/ -[1]:http://www.zdnet.com/article/linux-kernel-turns-over-release-odometer-to-4-0/ -[2]:http://www.computerworld.com/article/2466389/open-source-tools/never-reboot-again-with-linux-and-ksplice.html -[3]:http://www.ksplice.com/ -[4]:http://www.zdnet.com/article/oracle-acquires-zero-downtime-linux-upgrade-software/ -[5]:http://www.oracle.com/us/technologies/linux/overview/index.html -[6]:http://www.redhat.com/en/technologies/linux-platforms/enterprise-linux -[7]:http://www.zdnet.com/article/kernelcare-new-no-reboot-linux-patching-system/ -[8]:http://www.redhat.com/ -[9]:http://www.suse.com/ -[10]:http://rhelblog.redhat.com/2014/02/26/kpatch/ -[11]:http://www.zdnet.com/article/suse-gets-live-patching/ -[12]:http://elinux.org/Ftrace -[13]:http://linuxplumbersconf.org/2014/wp-content/uploads/2014/10/LPC2014_LivePatching.txt -[14]:https://kernel.googlesource.com/pub/scm/linux/kernel/git/jikos/livepatching/+/9ec0de0ee0c9f0ffe4f72da9158194121cc22807 From 90dc2609661be56537692939163c40cb207f990f Mon Sep 17 00:00:00 2001 From: wi-cuckoo Date: Tue, 16 Jun 2015 11:10:12 +0800 Subject: [PATCH 108/153] translating wi-cuckoo --- .../talk/20150615 PHP at 20--From pet project to powerhouse.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/talk/20150615 PHP at 20--From pet project to powerhouse.md b/sources/talk/20150615 PHP at 20--From pet project to powerhouse.md index 610913c846..7ddbf950a9 100644 --- a/sources/talk/20150615 PHP at 20--From pet project to powerhouse.md +++ b/sources/talk/20150615 PHP at 20--From pet project to powerhouse.md @@ -1,3 +1,4 @@ +translating wi-cuckoo PHP at 20: From pet project to powerhouse ================================================================================ ![](http://images.techhive.com/images/article/2015/06/13049862325_8c97a11878_z-100590275-primary.idge.jpg) @@ -79,4 +80,4 @@ via: http://www.infoworld.com/article/2933858/php/php-at-20-from-pet-project-to- [8]:https://wiki.php.net/todo/php70#timetable [9]:http://talks.php.net/velocity15 [10]:http://www.php-fig.org/psr/psr-7/ -[11]:http://phpmentoring.org/ \ No newline at end of file +[11]:http://phpmentoring.org/ From 133f48756d30a5a9de509cc0e8f28b4ca112670d Mon Sep 17 00:00:00 2001 From: struggling <630441839@qq.com> Date: Tue, 16 Jun 2015 11:20:34 +0800 Subject: [PATCH 109/153] Update 20150515 Extend Swap Space using Swap file in Linux.md --- .../20150515 Extend Swap Space using Swap file in Linux.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150515 Extend Swap Space using Swap file in Linux.md b/sources/tech/20150515 Extend Swap Space using Swap file in Linux.md index 51b2f2fe55..9b1cb3f8b7 100644 --- a/sources/tech/20150515 Extend Swap Space using Swap file in Linux.md +++ b/sources/tech/20150515 Extend Swap Space using Swap file in Linux.md @@ -1,3 +1,4 @@ +Translating by strugglingyouth Extend Swap Space using Swap file in Linux ================================================================================ There are some scenarios where our Linux box is running out of swap space so in that case we can extend the swap space using swap partition but due to unavailability of free partitions on the disk, we are unable to extend it. @@ -70,4 +71,4 @@ via: http://www.linuxtechi.com/extend-swap-space-using-swap-file-in-linux/ 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]:http://www.linuxtechi.com/author/pradeep/ \ No newline at end of file +[a]:http://www.linuxtechi.com/author/pradeep/ From 44c36764ceba054e981c2da64adcb8638cd1415c Mon Sep 17 00:00:00 2001 From: wxy Date: Tue, 16 Jun 2015 12:51:58 +0800 Subject: [PATCH 110/153] PUB:20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules @wwy-hust --- ...ng Mod_Security and Mod_evasive Modules.md | 160 +++++++++--------- 1 file changed, 82 insertions(+), 78 deletions(-) rename {translated/tech => published}/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md (58%) diff --git a/translated/tech/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md b/published/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md similarity index 58% rename from translated/tech/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md rename to published/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md index 1f645595b7..44ba66e7d5 100644 --- a/translated/tech/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md +++ b/published/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md @@ -1,14 +1,15 @@ -在Apache中使用Mod_Security和Mod_evasive来抵御暴力破解和DDos攻击 +在Apache中使用mod\_security和mod\_evasive来抵御暴力破解和DDos攻击 ================================================================================ -对于那些托管主机或者需要将您的主机暴露在因特网中的人来说,保证您的系统在面对攻击时安全是一个重要的事情。 -mod_security(一个开源的可以无缝接入Web服务器的用于Web应用入侵检测和防护的引擎)和mod_evasive是两个在服务器端对抗暴力破解和(D)Dos攻击的非常重要的工具。 +对于那些需要在因特网上提供服务或托管主机的人来说,保证您的系统在面对攻击时的安全是一个重要的事情。 -mod_evasive,如它的名字一样,在受攻击时提供避实就虚的功能,它像一个雨伞一样保护Web服务器免受那些威胁。 +mod\_security(一个开源的用于Web应用入侵检测及防护的引擎,可以无缝地集成到Web服务器)和mod\_evasive是两个在服务器端对抗暴力破解和(D)Dos攻击的非常重要的工具。 + +mod\_evasive,如它的名字一样,在受攻击时提供避实就虚的功能,它像一个雨伞一样保护Web服务器免受那些威胁。 ![](http://www.tecmint.com/wp-content/uploads/2012/06/Install-Mod_Security-Mod_evasive-in-CentOS.jpg) -安装Mod_Security和Mod_Evasive来保护Apache +*安装mod\_security和mod\_evasive来保护Apache* 在这篇文章中我们将讨论如何安装、配置以及在RHEL/CentOS6、7和Fedora 21-15上将它们整合到Apache。另外,我们会模拟攻击以便验证服务器做出了正确的反应。 @@ -16,91 +17,77 @@ mod_evasive,如它的名字一样,在受攻击时提供避实就虚的功能 - [在RHEL/CentOS 7中安装LAMP][1] -如果您在运行RHEL/CentOS 7或Fedora 21,您还需要安装iptables作为默认[防火墙][2]前端以取代firewalld。这样做是为了在RHEL/CentOS 7或Fedora 21中使用同样的工具。 +(LCTT 译注:本文有修改。原文为了在RHEL/CentOS 7或Fedora 21中使用同样的工具,而删除了自带的 firewalld,使用了旧式的iptables。译者以为这样并不恰当,因此,译文中做了相应删节,并增加了firewalld的相应脚本。) -### 步骤 1: 在RHEL/CentOS 7和Fedora 21上安装Iptables防火墙 ### - -用下面的命令停止和禁用firewalld: - - # systemctl stop firewalld - # systemctl disable firewalld - -![](http://www.tecmint.com/wp-content/uploads/2012/06/Disable-Firewalld-Service.png) -禁用firewalld服务 - -接下来在使能iptables之前安装iptables-services包: - - # yum update && yum install iptables-services - # systemctl enable iptables - # systemctl start iptables - # systemctl status iptables - -![](http://www.tecmint.com/wp-content/uploads/2012/06/Install-Iptables-Firewall.png) -安装Iptables防火墙 - -### 步骤 2: 安装Mod_Security和Mod_evasive ### +### 步骤 1: 安装mod\_security和mod\_evasive ### 另外,在安装LAMP后,您还需要在RHEL/CentOS 7/6中[开启EPEL仓库][3]来安装这两个包。Fedora用户不需要开启这个仓库,因为epel已经是Fedora项目的一部分了。 # yum update && yum install mod_security mod_evasive -当安装结束后,您会在/etc/httpd/conf.d下找到两个工具的配置文件。 +当安装结束后,您会在/etc/httpd/conf.d下找到这两个工具的配置文件。 # ls -l /etc/httpd/conf.d ![](http://www.tecmint.com/wp-content/uploads/2012/06/mod_security-mod_evasive-Configurations.png) -mod_security + mod_evasive 配置文件 -现在,为了整合这两个模块到Apache,并在启动时加载它们。请确保下面几行出现在mod_evasive.conf和mod_security.conf的顶层部分,它们分别为: +*mod\_security + mod\_evasive 配置文件* + +现在,为了整合这两个模块到Apache,并在启动时加载它们。请确保下面几行出现在mod\_evasive.conf和mod\_security.conf的顶层部分,它们分别为: LoadModule evasive20_module modules/mod_evasive24.so LoadModule security2_module modules/mod_security2.so -请注意modules/mod_security2.so和modules/mod_evasive24.so都是从/etc/httpd到模块源文件的相对路径。您可以通过列出/etc/httpd/modules的内容来验证(如果需要的话,修改它): +请注意modules/mod\_security2.so和modules/mod\_evasive24.so都是从/etc/httpd到模块源文件的相对路径。您可以通过列出/etc/httpd/modules的内容来验证(如果需要的话,修改它): # cd /etc/httpd/modules # pwd # ls -l | grep -Ei '(evasive|security)' ![](http://www.tecmint.com/wp-content/uploads/2012/06/Verify-mod_security-mod_evasive-Modules.png) -验证mod_security + mod_evasive模块 -接下来重启Apache并且核实它已加载了mod_evasive和mod_security: +*验证mod\_security + mod\_evasive模块* + +接下来重启Apache并且核实它已加载了mod\_evasive和mod\_security: # service httpd restart [在RHEL/CentOS 6和Fedora 20-18上] # systemctl restart httpd [在RHEL/CentOS 7和Fedora 21上] ---------- - [输出已加载的静态模块和动态模块列表] - - # httpd -M | grep -Ei '(evasive|security)' + # httpd -M | grep -Ei '(evasive|security)' [输出已加载的静态模块和动态模块列表] ![](http://www.tecmint.com/wp-content/uploads/2012/06/Check-mod_security-mod_evasive-Loaded.png) -检查mod_security + mod_evasive模块已加载 -### 步骤 3: 安装一个核心规则集并且配置Mod_Security ### +*检查mod\_security + mod\_evasive模块已加载* -简单来说,一个核心规则集(即CRS)为web服务器提供特定状况下如何反应的指令。mod_security的开发者们提供了一个免费的CRS,叫做OWASP([开放Web应用安全项目])ModSecurity CRS,可以从下面的地址下载和安装。 +### 步骤 2: 安装一个核心规则集并且配置mod\_security ### -1. 下载OWASP CRS到为之创建的目录 +简单来说,一个核心规则集(即CRS)为web服务器提供特定状况下如何反应的指令。mod\_security的开发者们提供了一个免费的CRS,叫做OWASP([开放Web应用安全项目])ModSecurity CRS,可以从下面的地址下载和安装。 - # mkdir /etc/httpd/crs-tecmint - # cd /etc/httpd/crs-tecmint +####下载OWASP CRS到为之创建的目录#### + + # mkdir /etc/httpd/crs-tecmint + # cd /etc/httpd/crs-tecmint # wget https://github.com/SpiderLabs/owasp-modsecurity-crs/tarball/master ![](http://www.tecmint.com/wp-content/uploads/2012/06/Download-mod_security-Core-Rules.png) -下载mod_security核心规则 -2. 解压CRS文件并修改文件夹名称 +*下载mod\_security核心规则* + +#### 解压CRS文件并修改文件夹名称#### # tar xzf master # mv SpiderLabs-owasp-modsecurity-crs-ebe8790 owasp-modsecurity-crs -![](http://www.tecmint.com/wp-content/uploads/2012/06/Extract-mod_security-Core-Rules.png) -解压mod_security核心规则 -3. 现在,是时候配置mod_security了。将同样的规则文件(owasp-modsecurity-crs/modsecurity_crs_10_setup.conf.example)拷贝至另一个没有.example扩展的文件。 +![](http://www.tecmint.com/wp-content/uploads/2012/06/Extract-mod_security-Core-Rules.png) + +*解压mod\_security核心规则* + +####现在,是时候配置mod\_security了#### + +将示例的规则文件(owasp-modsecurity-crs/modsecurity_crs_10_setup.conf.example)拷贝为同名的配置文件。 # cp modsecurity_crs_10_setup.conf.example modsecurity_crs_10_setup.conf @@ -111,7 +98,7 @@ mod_security + mod_evasive 配置文件 Include crs-tecmint/owasp-modsecurity-crs/base_rules/*.conf -最后,建议您在/etc/httpd/modsecurity.d目录下创建自己的配置文件,在那里我们可以用我们自定义的文件夹(接下来的示例中,我们会将其命名为tecmint.conf)而无需修改CRS文件的目录。这样做能够在CRSs发布新版本时更加容易的升级。 +最后,建议您在/etc/httpd/modsecurity.d目录下创建自己的配置文件,在那里我们可以用我们自定义的文件夹(接下来的示例中,我们会将其命名为tecmint.conf)而无需修改CRS文件的目录。这样做能够在CRS发布新版本时更加容易的升级。 SecRuleEngine On @@ -121,13 +108,13 @@ mod_security + mod_evasive 配置文件 SecDataDir /tmp -您可以在[SpiderLabs的ModSecurity GitHub][5]仓库中参考关于mod_security目录的更完整的解释。 +您可以在[SpiderLabs的ModSecurity GitHub][5]仓库中参考关于mod\_security目录的更完整的解释。 -### 步骤 4: 配置Mod_Evasive ### +### 步骤 3: 配置mod\_evasive ### -mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。与mod_security不同,由于在包升级时没有规则来更新,因此我们不需要独立的文件来添加自定义指令。 +mod\_evasive被配置为使用/etc/httpd/conf.d/mod\_evasive.conf中的指令。与mod\_security不同,由于在包升级时没有规则来更新,因此我们不需要独立的文件来添加自定义指令。 -默认的mod_evasive.conf开启了下列的目录(注意这个文件被详细的注释了,因此我们剔掉了注释以重点显示配置指令): +默认的mod\_evasive.conf开启了下列的目录(注意这个文件被详细的注释了,因此我们剔掉了注释以重点显示配置指令): DOSHashTableSize 3097 @@ -140,8 +127,8 @@ mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。 这些指令的解释: -- DOSHashTableSize: 这个指令指明了哈希表的大小,它用来追踪基于IP地址的活动。增加这个数字将使查询站点访问历史变得更快,但如果被设置的太高则会影响整体性能。 -- DOSPageCount: 在DOSPageInterval间隔内可由一个用户发起的面向特定的URI(例如,一个Apache托管的文件)的同一个请求的数量。 +- DOSHashTableSize: 这个指令指明了哈希表的大小,它用来追踪基于IP地址的活动。增加这个数字将使得站点访问历史的查询变得更快,但如果被设置的太大则会影响整体性能。 +- DOSPageCount: 在DOSPageInterval间隔内可由一个用户发起的针对特定的URI(例如,一个Apache 提供服务的文件)的同一个请求的数量。 - DOSSiteCount: 类似DOSPageCount,但涉及到整个站点总共有多少的请求可以在DOSSiteInterval间隔内被发起。 - DOSBlockingPeriod: 如果一个用户超过了DOSSPageCount的限制或者DOSSiteCount,他的源IP地址将会在DOSBlockingPeriod期间内被加入黑名单。在DOSBlockingPeriod期间,任何从这个IP地址发起的请求将会遭遇一个403禁止错误。 @@ -149,7 +136,7 @@ mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。 **一个小警告**: 如果这些值设置的不合适,则您会蒙受阻挡合法用户的风险。 -您也许想考虑下其他有用的指令: +您也许还会用到以下其它有用的指令: #### DOSEmailNotify #### @@ -157,11 +144,11 @@ mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。 # setsebool -P httpd_can_sendmail 1 -接下来,将这个指令和其他指令一起加入到mod_evasive.conf文件。 +接下来,将这个指令和其他指令一起加入到mod\_evasive.conf文件。 DOSEmailNotify you@yourdomain.com -如果这个值被合适的设置并且您的邮件服务器在正常的运行,则当一个IP地址被加入黑名单时,会有一封邮件被发送到相应的地址。 +如果这个指令设置了合适的值,并且您的邮件服务器在正常的运行,则当一个IP地址被加入黑名单时,会有一封邮件被发送到相应的地址。 #### DOSSystemCommand #### @@ -169,31 +156,47 @@ mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。 DOSSystemCommand
-这个指令指定当一个IP地址被加入黑名单时执行的命令。它通常结合shell脚本来使用,在脚本中添加一条防火墙规则来阻挡某个IP进一步的连接。 +这个指令指定当一个IP地址被加入黑名单时执行的命令。它通常结合shell脚本来使用,比如在脚本中添加一条防火墙规则来阻挡某个IP进一步的连接。 -**写一个shell脚本在防火墙阶段处理IP黑名单** +#####写一个shell脚本在防火墙阶段处理IP黑名单##### 当一个IP地址被加入黑名单,我们需要阻挡它进一步的连接。我们需要下面的shell脚本来执行这个任务。在/usr/local/bin下创建一个叫做scripts-tecmint的文件夹(或其他的名字),以及一个叫做ban_ip.sh的文件。 +**用于iptables防火墙** + #!/bin/sh # 由mod_evasive检测出,将被阻挡的IP地址 IP=$1 # iptables的完整路径 IPTABLES="/sbin/iptables" # mod_evasive锁文件夹 - MOD_EVASIVE_LOGDIR=/var/log/mod_evasive + mod_evasive_LOGDIR=/var/log/mod_evasive # 添加下面的防火墙规则 (阻止所有从$IP流入的流量) $IPTABLES -I INPUT -s $IP -j DROP # 为了未来的检测,移除锁文件 - rm -f "$MOD_EVASIVE_LOGDIR"/dos-"$IP" + rm -f "$mod_evasive_LOGDIR"/dos-"$IP" + +**用于firewalld防火墙** + + #!/bin/sh + # 由mod_evasive检测出,将被阻挡的IP地址 + IP=$1 + # firewalld-cmd的完整路径 + FIREWALL_CMD="/usr/bin/firewall-cmd" + # mod_evasive锁文件夹 + mod_evasive_LOGDIR=/var/log/mod_evasive + # 添加下面的防火墙规则 (阻止所有从$IP流入的流量) + $FIREWALL_CMD --zone=drop --add-source $IP + # 为了未来的检测,移除锁文件 + rm -f "$mod_evasive_LOGDIR"/dos-"$IP" 我们的DOSSystemCommand指令应该是这样的: DOSSystemCommand "sudo /usr/local/bin/scripts-tecmint/ban_ip.sh %s" -上面一行的%s代表了由mod_evasive检测到的攻击IP地址。 +上面一行的%s代表了由mod\_evasive检测到的攻击IP地址。 -**将apache用户添加到sudoers文件** +#####将apache用户添加到sudoers文件##### 请注意,如果您不给予apache用户以无需终端和密码的方式运行我们脚本(关键就是这个脚本)的权限,则这一切都不起作用。通常,您只需要以root权限键入visudo来存取/etc/sudoers文件,接下来添加下面的两行即可: @@ -201,14 +204,16 @@ mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。 Defaults:apache !requiretty ![](http://www.tecmint.com/wp-content/uploads/2012/06/Add-Apache-User-to-Sudoers.png) -添加Apache用户到Sudoers -**重要**: 作为默认的安全策略,您只能在终端中运行sudo。由于这个时候我们需要在没有tty的时候运行sudo,我们像下面图片中那样必须注释掉下面这一行: +*添加Apache用户到Sudoers* + +**重要**: 在默认的安全策略下您只能在终端中运行sudo。由于这个时候我们需要在没有tty的时候运行sudo,我们必须像下图中那样注释掉下面这一行: #Defaults requiretty ![](http://www.tecmint.com/wp-content/uploads/2012/06/Disable-tty-for-Sudo.png) -为Sudo禁用tty + +*为Sudo禁用tty* 最后,重启web服务器: @@ -219,7 +224,7 @@ mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。 有许多工具可以在您的服务器上模拟外部的攻击。您可以google下“tools for simulating ddos attacks”来找一找相关的工具。 -注意,您(也只有您)将负责您模拟所造成的结果。请不要考虑向不在您网络中的服务器发起模拟攻击。 +注意,您(也只有您)将负责您模拟所造成的结果。请不要考虑向不在您自己网络中的服务器发起模拟攻击。 假如您想对一个由别人托管的VPS做这些事情,您需要向您的托管商发送适当的警告或就那样的流量通过他们的网络获得允许。Tecmint.com不会为您的行为负责! @@ -228,21 +233,20 @@ mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。 我们的测试环境由一个CentOS 7服务器[IP 192.168.0.17]和一个Windows组成,在Windows[IP 192.168.0.103]上我们发起攻击: ![](http://www.tecmint.com/wp-content/uploads/2012/06/Confirm-Host-IPAddress.png) -确认主机IP地址 -请播放下面的视频,并跟从列出的步骤来模拟一个Dos攻击: +*确认主机IP地址* -注:youtube视频,发布的时候不行做个链接吧 - +请播放下面的视频(YT 视频,请自备梯子: https://www.youtube.com/-U_mdet06Jk ),并跟从列出的步骤来模拟一个Dos攻击: -然后攻击者的IP将被iptables阻挡: +然后攻击者的IP将被防火墙阻挡: ![](http://www.tecmint.com/wp-content/uploads/2012/06/Blocked-Attacker-IP.png) -阻挡攻击者的IP地址 + +*阻挡攻击者的IP地址* ### 结论 ### -在开启mod_security和mod_evasive的情况下,模拟攻击会导致CPU和RAM用量在源IP地址被加入黑名单之前出现短暂几秒的使用峰值。如果没有这些模块,模拟攻击绝对会很快将服务器击溃,并使服务器在攻击期间无法提供服务。 +在开启mod\_security和mod\_evasive的情况下,模拟攻击会导致CPU和RAM用量在源IP地址被加入黑名单之前出现短暂几秒的使用峰值。如果没有这些模块,模拟攻击绝对会很快将服务器击溃,并使服务器在攻击期间无法提供服务。 我们很高兴听见您打算使用(或已经使用过)这些工具。我们期望得到您的反馈,所以,请在留言处留下您的评价和问题,谢谢! @@ -253,18 +257,18 @@ mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。 -------------------------------------------------------------------------------- -via: http://www.tecmint.com/protect-apache-using-mod_security-and-mod_evasive-on-rhel-centos-fedora/ +via: http://www.tecmint.com/protect-apache-using-mod\_security-and-mod\_evasive-on-rhel-centos-fedora/ 作者:[Gabriel Cánepa][a] 译者:[wwy-hust](https://github.com/wwy-hust) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/gacanepa/ [1]:http://www.tecmint.com/install-lamp-in-centos-7/ -[2]:http://www.tecmint.com/configure-firewalld-in-centos-7/ -[3]:http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/ +[2]:https://linux.cn/article-4425-1.html +[3]:https://linux.cn/article-2324-1.html [4]:https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project [5]:https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#Configuration_Directives [6]:https://www.modsecurity.org/ From 34f4ca0f21e3c3039ef2b829383797545da83d49 Mon Sep 17 00:00:00 2001 From: carolinewuyan <309866211@qq.com> Date: Tue, 16 Jun 2015 13:16:25 +0800 Subject: [PATCH 111/153] =?UTF-8?q?=E5=B7=B2=E6=A0=A1=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Beautiful Arc GTK+ Flat Theme on Linux.md | 35 +++++-------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/translated/share/20150603 Here's How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md b/translated/share/20150603 Here's How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md index f8d1c56d41..4c25b0e60d 100644 --- a/translated/share/20150603 Here's How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md +++ b/translated/share/20150603 Here's How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md @@ -1,18 +1,18 @@ 如何在Linux中安装漂亮的扁平化Arc GTK+主题 ================================================================================ -> 易于看懂的每步都有的教程 +> 易于理解的分步教程 -**今天我们将向你介绍最新发布的GTK+主题,它拥有透明和扁平元素,并且与多个桌面环境和Linux发行版见荣发。[这个主题叫Arc][1]。** +**今天我们将向你介绍最新发布的GTK+主题,它拥有透明和扁平元素,并且与多个桌面环境和Linux发行版兼容。[这个主题叫Arc][1]。** -开始讲细节之前,我建议你快速地看一下下面的图,这样你有会对这个主题就会有一个基本的概念了。同样你应该意识到它目前可以工作在GTK+ 2.x、GTK+ 3.x、GNOME-Shell、 Budgie、 Unity和Pantheon用户界面,它们都使用了GNOME栈。 +开始讲细节之前,我建议你快速浏览一下下面的图,这样你有会对这个主题就会有一个基本的概念了。同样你应该知道它目前可以工作在GTK+ 2.x、GTK+ 3.x、GNOME-Shell、 Budgie、 Unity和Pantheon用户界面,它们都使用了GNOME栈。 -同样、Arc主题的开发者提醒我们它已经成功地在Ubuntu 15.04(Vivid Vervet)、 Arch Linux、 elementary OS 0.3 Freya、 Fedora 21、 Fedora 22、 Debian GNU/Linux 8.0 (Jessie)、 Debian Testing、 Debian Unstable、 openSUSE 13.2、 openSUSE Tumbleweed和Gentoo测试过了。 +同样、Arc主题的开发者告诉我们它已经成功地在Ubuntu 15.04(Vivid Vervet)、 Arch Linux、 elementary OS 0.3 Freya、 Fedora 21、 Fedora 22、 Debian GNU/Linux 8.0 (Jessie)、 Debian Testing、 Debian Unstable、 openSUSE 13.2、 openSUSE Tumbleweed和Gentoo测试过了。 ### 要求和安装指导 ### -要构建Arc主题,你需要先安装一些包,比如autoconf、 automake、 pkg-config (对Fedora的pkgconfig)、基于Debian/Ubuntu-based发行版的libgtk-3-dev或者基于RPM的gtk3-devel、 git、 gtk2-engines-pixbuf和gtk-engine-murrine (对Fedora的gtk-murrine-engine)。 +要构建Arc主题,你需要先安装一些包,比如autoconf、 automake、 pkg-config (对Fedora的pkgconfig)、基于Debian/Ubuntu-based发行版的libgtk-3-dev或者基于RPM的gtk3-devel、 git、 gtk2-engines-pixbuf和gtk-engine-murrine (对于Fedora则是gtk-murrine-engine)。 -Arc主题还没有二进制包,因此你需要从git仓库中取下最新的源码并编译。这样,打开终端并运行下面的命令,一行行地,并在每行的末尾按下回车键并等待上一步完成来继续一步。 +Arc主题还没有二进制包,因此你需要从git仓库中取下最新的源码并编译。这样,打开终端并运行下面的命令,一行行地,并在每行的末尾按下回车键并等待上一步完成来继续下一步。 git clone https://github.com/horst3180/arc-theme --depth 1 && cd arc-theme git fetch --tags @@ -20,7 +20,7 @@ Arc主题还没有二进制包,因此你需要从git仓库中取下最新的 ./autogen.sh --prefix=/usr sudo make install -就是这样!此时你已经在你的GNU/Linux发行版中安装了Arc主题,如果你使用GNOME可以使用GONME Tweak工具或者如果你使用Unity可以使用Unity Tweak工具来激活主题。玩得开心也不要忘了在下面的评论栏里留下你的截图。 +就是这样!此时你已经在你的GNU/Linux发行版中安装了Arc主题,如果你使用GNOME可以使用GONME Tweak工具,如果你使用Ubuntu的Unity可以使用Unity Tweak工具来激活主题。玩得开心但不要忘了在下面的评论栏里留下你的截图。 ![](http://i1-news.softpedia-static.com/images/news2/Here-s-How-to-Install-the-Beautiful-Arc-GTK-plus-Flat-Theme-on-Linux-483143-2.jpg) @@ -34,28 +34,9 @@ via: http://news.softpedia.com/news/Here-s-How-to-Install-the-Beautiful-Arc-GTK- 作者:[Marius Nestor][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://news.softpedia.com/editors/browse/marius-nestor [1]:https://github.com/horst3180/Arc-theme -[2]: -[3]: -[4]: -[5]: -[6]: -[7]: -[8]: -[9]: -[10]: -[11]: -[12]: -[13]: -[14]: -[15]: -[16]: -[17]: -[18]: -[19]: -[20]: From 3e54ac0873a7c79499bfcf7da0325d0ad4c6eb7f Mon Sep 17 00:00:00 2001 From: carolinewuyan <309866211@qq.com> Date: Tue, 16 Jun 2015 13:17:08 +0800 Subject: [PATCH 112/153] =?UTF-8?q?=E5=B7=B2=E6=A0=A1=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/share/20150603 Here's How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md b/translated/share/20150603 Here's How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md index 4c25b0e60d..93f7b004e1 100644 --- a/translated/share/20150603 Here's How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md +++ b/translated/share/20150603 Here's How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md @@ -10,7 +10,7 @@ ### 要求和安装指导 ### -要构建Arc主题,你需要先安装一些包,比如autoconf、 automake、 pkg-config (对Fedora的pkgconfig)、基于Debian/Ubuntu-based发行版的libgtk-3-dev或者基于RPM的gtk3-devel、 git、 gtk2-engines-pixbuf和gtk-engine-murrine (对于Fedora则是gtk-murrine-engine)。 +要构建Arc主题,你需要先安装一些包,比如autoconf、 automake、 pkg-config (对于Fedora则是pkgconfig)、基于Debian/Ubuntu-based发行版的libgtk-3-dev或者基于RPM的gtk3-devel、 git、 gtk2-engines-pixbuf和gtk-engine-murrine (对于Fedora则是gtk-murrine-engine)。 Arc主题还没有二进制包,因此你需要从git仓库中取下最新的源码并编译。这样,打开终端并运行下面的命令,一行行地,并在每行的末尾按下回车键并等待上一步完成来继续下一步。 From 7879931b0dde38f7962bbd984506c23fdaadf47a Mon Sep 17 00:00:00 2001 From: struggling <630441839@qq.com> Date: Tue, 16 Jun 2015 14:13:39 +0800 Subject: [PATCH 113/153] Create 20150515 Extend Swap Space using Swap file in Linux.md --- ...end Swap Space using Swap file in Linux.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 translated/tech/20150515 Extend Swap Space using Swap file in Linux.md diff --git a/translated/tech/20150515 Extend Swap Space using Swap file in Linux.md b/translated/tech/20150515 Extend Swap Space using Swap file in Linux.md new file mode 100644 index 0000000000..473e24ea0d --- /dev/null +++ b/translated/tech/20150515 Extend Swap Space using Swap file in Linux.md @@ -0,0 +1,76 @@ +在linux上使用交换文件扩展交换空间 +================================================================================ +想像一种情景,当我们的Linux系统用尽交换空间时,在这种情况下, +我们想要使用swap分区扩展交换空间,但在某些情况下磁盘上的空闲分区是不可用的, +致使我们不能把它扩大。 + +因此,在这种情况下,我们可以使用交换文件增加swap空间。 + +### 以下是使用交换文件在Linux上扩展swap空间的方法 ### + +让我们首先检查现有的交换空间/分区的大小,使用命令 ‘**free -m‘** 或者 ‘**swapon -s**‘ + +![](http://www.linuxtechi.com/wp-content/uploads/2015/06/free-output-with-swap.jpg) +free-output-with-swap + +我的交换分区大小是2 GB,我们将把交换空间扩展1GB。 + +#### 第一步:使用下面的dd命令创建大小为1GB交换文件d #### + + [root@linuxtechi ~]# dd if=/dev/zero of=/swap_file bs=1G count=1 + 1+0 records in + 1+0 records out + 1073741824 bytes (1.1 GB) copied, 414.898 s, 2.6 MB/s + [root@linuxtechi ~]# + +根据你的需要替换 ‘**bs**‘ 和 ‘**count**‘ 的大小. + +####第二步:设置交换文件权限为644. #### + + [root@linuxtechi ~]# chmod 600 /swap_file + +#### 第三步:用文件开启交换区(swap_file)#### + +用mkswap命令开启交换区 + + [root@linuxtechi ~]# mkswap /swap_file + Setting up swapspace version 1, size = 1048572 KiB + no label, UUID=f7b3ae59-c09a-4dc2-ba4d-c02abb7db33b + [root@linuxtechi ~]# + +#### 第四步:在fstab文件中添加交换文件条目 #### + +在fstab文件中添加以下条目,以便交换文件每次重启后互能继续使用. + + /swap_file swap swap defaults 0 0 + +![swap-file-fstab-entry](http://www.linuxtechi.com/wp-content/uploads/2015/06/swap-file-fstab-entry.jpg) + +#### 第五步:用命令 ‘mkswap on’ 启用交换文件. #### + + [root@linuxtechi ~]# swapon /swap_file + [root@linuxtechi ~]# + +#### 第六步:现在查看交换空间 #### + +![swap-space-after-extension](http://www.linuxtechi.com/wp-content/uploads/2015/06/swap-space-after-extension.jpg) + +**Note**: 为了避免出现意外的情况,如下所示使用swapoff命令关闭它, +仅在需要使用时,使用步骤5所示的swapon命令,重新启用交换文件。. + + [root@linuxtechi ~]# swapoff /swap_file + [root@linuxtechi ~]# + +请分享您的宝贵意见或者评论此文章. + +-------------------------------------------------------------------------------- + +via: http://www.linuxtechi.com/extend-swap-space-using-swap-file-in-linux/ + +作者:[Pradeep Kumar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxtechi.com/author/pradeep/ From 640fe12e08a2aedd8be1dc95fb2fcf1ea2c942e3 Mon Sep 17 00:00:00 2001 From: wxy Date: Tue, 16 Jun 2015 14:17:59 +0800 Subject: [PATCH 114/153] PUB:20150225 How to make remote incremental backup of LUKS-encrypted disk or partition @GOLinux --- ...backup of LUKS-encrypted disk or partition.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename {translated/tech => published}/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md (81%) diff --git a/translated/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md b/published/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md similarity index 81% rename from translated/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md rename to published/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md index 645ade2261..122787ee3d 100644 --- a/translated/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md +++ b/published/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md @@ -1,16 +1,16 @@ -为LUKS——加密的磁盘/分区做增量备份 +为LUKS加密的磁盘/分区做增量备份 ================================================================================ -我们中有些人出于安全原因,在家里或者[VPS][1]上通过[Linux统一密钥配置(LUKS)][2]为硬盘驱动器加密,而这些驱动器的容量很快会增长到数十或数百GB。因此,虽然我们享受着LUKS设备带来的安全感,但是我们也该开始考虑一个可能的远程备份方案了。对于安全的非现场备份,我们将需要在LUKS加密的设备上以块级别操作的东西。因此,最后我们发现这么个状况,我们每次都需要传输想要做备份的LUKS设备(比如说200GB)。很明显,这是不可行的。我们该怎么来处理这个问题呢? +我们中有些人出于安全原因,在家里或者[VPS][1]上通过[Linux统一密钥配置(LUKS)][2]为硬盘驱动器加密,而这些驱动器的容量很快会增长到数十或数百GB。因此,虽然我们享受着LUKS设备带来的安全感,但是我们也该开始考虑一个可能的远程备份方案了。对于安全的非现场备份,我们将需要能在LUKS加密的设备上以块级别操作的东西。因此,最后我们发现这么个状况,我们每次都需要传输想要做备份的整个LUKS设备(比如说200GB大)。很明显,这是不可行的。我们该怎么来处理这个问题呢? ### 一个解决方案: Bdsync ### -这时,一个卓越的开源工具来拯救我们了,它叫[Bdsync][3](多亏了Rolf Fokkens)。顾名思义,Bdsync可以通过网络同步“块设备”。对于快速同步,Bdsync会生成并对比本地/远程块设备的块MD5校验和,只同步差异部分。rsync在文件系统级别可以做的,Bdsync可以在块设备级别完成。很自然,对于LUKS加密的设备它也能工作得很好。相当地灵巧! +这时,一个卓越的开源工具来拯救我们了,它叫[Bdsync][3](多亏了Rolf Fokkens)。顾名思义,Bdsync可以通过网络同步“块设备”。对于快速同步,Bdsync会生成并对比本地/远程块设备的块的MD5校验和,只同步差异部分。rsync在文件系统级别可以做的,Bdsync可以在块设备级别完成。很自然,对于LUKS加密的设备它也能工作得很好。相当地灵巧! 使用Bdsync,首次备份将拷贝整个LUKS块设备到远程主机,因而会花费大量时间来完成。然而,在初始备份后,如果我们在LUKS设备新建一些文件,再次备份就会很快完成,因为我们只需拷贝修改过的块。经典的增量备份在起作用了! ### 安装Bdsync到Linux ### -Bdsync并不包含在[Linux][4]发行版的标准仓库中,因而你需要从源代码来构建它。使用以下针对特定版本的指令来安装Bdsync及其手册页到你的系统中。 +Bdsync并不包含在Linux发行版的标准仓库中,因而你需要从源代码来构建它。使用以下针对特定版本的指令来安装Bdsync及其手册页到你的系统中。 #### Debian,Ubuntu或Linux Mint #### @@ -46,7 +46,7 @@ Bdsync并不包含在[Linux][4]发行版的标准仓库中,因而你需要从 你第一次运行上面的命令的时候,它会花费很长一段时间,这取决于你的互联网/局域网速度,以及/dev/LOCDEV的大小。记住,你必须有两个大小相同的块设备(/dev/LOCDEV和/dev/REMDEV)。 -下一步是要将补丁文件从本地主机拷贝到远程主机。一种可能是使用scp: +下一步是要将补丁文件从本地主机拷贝到远程主机。一种方式是使用scp: # scp /some_local_path/DEV.bdsync.gz root@remote_host:/remote_path @@ -58,7 +58,7 @@ Bdsync并不包含在[Linux][4]发行版的标准仓库中,因而你需要从 ### 尾声 ### -小结之,我们演示了如何使用Bdsync来为LUKS设备实施增量备份。和rsync一样,每次备份只有一小部分数据,而不是整个LUKS设备,需要被推送到非现场备份点,这样会节省带宽和备份时间。剩下来,需要保证所有数据传输通过SSH或SCP加固安全,事实上设备自身是由LUKS加密的。也可以通过使用可以运行bdsync的专用用户(而非root)来改善该配置。我们也可以将bdsync用于任何块设备,如LVM卷或RAID磁盘,也可以很轻易地设置Bdsync备份本地磁盘到USB驱动器上。如你所见,它有着无限可能性! +小结之,我们演示了如何使用Bdsync来为LUKS设备实施增量备份。和rsync一样,每次备份只有一小部分数据,而不是整个LUKS设备,需要被推送到非现场备份点,这样会节省带宽和备份时间。剩下来,需要通过SSH或SCP来保证所有数据传输的安全,事实上设备自身是由LUKS加密的。也可以通过使用可以运行bdsync的专用用户(而非root)来改进该配置。我们也可以将bdsync用于任何块设备,如LVM卷或RAID磁盘,也可以很轻易地设置Bdsync备份本地磁盘到USB驱动器上。如你所见,它有着无限可能性! 随时分享你的想法。 @@ -68,7 +68,7 @@ via: http://xmodulo.com/remote-incremental-backup-luks-encrypted-disk-partition. 作者:[Iulian Murgulet][a] 译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 @@ -77,4 +77,4 @@ via: http://xmodulo.com/remote-incremental-backup-luks-encrypted-disk-partition. [2]:http://xmodulo.com/how-to-create-encrypted-disk-partition-on-linux.html [3]:http://bdsync.rolf-fokkens.nl/ [4]:http://xmodulo.com/recommend/linuxbook -[5]:http://xmodulo.com/how-to-enable-ssh-login-without.html +[5]:https://linux.cn/article-5444-1.html From 2c7380a8caf07fc3bc900f18411e844830de39b3 Mon Sep 17 00:00:00 2001 From: DeadFire Date: Tue, 16 Jun 2015 15:54:00 +0800 Subject: [PATCH 115/153] =?UTF-8?q?20150616-1=20=E9=80=89=E9=A2=98=20sorry?= =?UTF-8?q?:=E6=98=A8=E5=A4=A9=E7=9A=84=E6=96=87=E7=AB=A0=E5=B1=85?= =?UTF-8?q?=E7=84=B6=E6=96=87=E4=BB=B6=E5=90=8D=E6=A0=87=E9=94=99=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...PHP or PhpMyAdmin in RHEL or CentOS 7.0.md | 238 ++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 sources/tech/20150616 Installing LAMP Linux, Apache, MariaDB, PHP or PhpMyAdmin in RHEL or CentOS 7.0.md diff --git a/sources/tech/20150616 Installing LAMP Linux, Apache, MariaDB, PHP or PhpMyAdmin in RHEL or CentOS 7.0.md b/sources/tech/20150616 Installing LAMP Linux, Apache, MariaDB, PHP or PhpMyAdmin in RHEL or CentOS 7.0.md new file mode 100644 index 0000000000..82be4748e0 --- /dev/null +++ b/sources/tech/20150616 Installing LAMP Linux, Apache, MariaDB, PHP or PhpMyAdmin in RHEL or CentOS 7.0.md @@ -0,0 +1,238 @@ +Installing LAMP (Linux, Apache, MariaDB, PHP/PhpMyAdmin) in RHEL/CentOS 7.0 +================================================================================ +Skipping the LAMP introduction, as I’m sure that most of you know what is all about. This tutorial will concentrate on how to install and configure famous LAMP stack – Linux Apache, MariaDB, PHP, PhpMyAdmin – on the last release of Red Hat Enterprise Linux 7.0 and CentOS 7.0, with the mention that both distributions have upgraded httpd daemon to Apache HTTP 2.4. + +![Install LAMP in CentOS 7](http://www.tecmint.com/wp-content/uploads/2014/07/Install-LAMP-in-CentOS-7.jpg) + +Install LAMP in RHEL/CentOS 7.0 + +#### Requirements #### + +Depending on the used distribution, RHEL or CentOS 7.0, use the following links to perform a minimal system installation, using a static IP Address for network configuration. + +**For RHEL 7.0** + +- [RHEL 7.0 Installation Procedure][1] +- [Register and Enable Subscriptions/Repositories on RHEL 7.0][2] + +**For CentOS 7.0** + +- [CentOS 7.0 Installation Procedure][3] + +### Step 1: Install Apache Server with Basic Configurations ### + +**1. After performing a minimal system installation and configure your server network interface with a [Static IP Address on RHEL/CentOS 7.0][4], go ahead and install Apache 2.4 httpd service binary package provided form official repositories using the following command.** + + # yum install httpd + +![Install Apache in CentOS 7](http://www.tecmint.com/wp-content/uploads/2014/07/Install-Apache-in-CentOS-7.png) + +Install Apache Web Server + +**2. After yum manager finish installation, use the following commands to manage Apache daemon, since RHEL and CentOS 7.0 both migrated their init scripts from SysV to systemd – you can also use SysV and Apache scripts the same time to manage the service.** + + # systemctl status|start|stop|restart|reload httpd + + OR + + # service httpd status|start|stop|restart|reload + + OR + + # apachectl configtest| graceful + +![Start Apache in CentOS 7](http://www.tecmint.com/wp-content/uploads/2014/07/Start-Apache-in-CentOS-7.png) + +Start Apache Web Server + +**3. On the next step start Apache service using systemd init script and open RHEL/CentOS 7.0 Firewall rules using firewall-cmd, which is the default command to manage iptables through firewalld daemon.** + + # firewall-cmd --add-service=http + +**NOTE**: Make notice that using this rule will lose its effect after a system reboot or firewalld service restart, because it opens on-fly rules, which are not applied permanently. To apply consistency iptables rules on firewall use –permanent option and restart firewalld service to take effect. + + # firewall-cmd --permanent --add-service=http + # systemctl restart firewalld + +![Enable Firewall in CentOS 7](http://www.tecmint.com/wp-content/uploads/2014/07/Enable-Firewall-in-CentOS-7.png) + +Enable Firewall in CentOS 7 + +Other important Firewalld options are presented below: + + # firewall-cmd --state + # firewall-cmd --list-all + # firewall-cmd --list-interfaces + # firewall-cmd --get-service + # firewall-cmd --query-service service_name + # firewall-cmd --add-port=8080/tcp + +**4. To verify Apache functionality open a remote browser and type your server IP Address using HTTP protocol on URL (http://server_IP), and a default page should appear like in the screenshot below.** + +![Apache Default Page](http://www.tecmint.com/wp-content/uploads/2014/07/Apache-Default-Page.png) + +Apache Default Page + +**5. For now, Apache DocumentRoot path it’s set to /var/www/html system path, which by default doesn’t provide any index file. If you want to see a directory list of your DocumentRoot path open Apache welcome configuration file and set Indexes statement from – to + on directive, using the below screenshot as an example.** + + # nano /etc/httpd/conf.d/welcome.conf + +![Apache Directory Listing](http://www.tecmint.com/wp-content/uploads/2014/07/Apache-Directory-Listing.png) + +Apache Directory Listing + +**6. Close the file, restart Apache service to reflect changes and reload your browser page to see the final result.** + + # systemctl restart httpd + +![Apache Index File](http://www.tecmint.com/wp-content/uploads/2014/07/Apache-Index-File.png) + +Apache Index File + +### Step 2: Install PHP5 Support for Apache ### + +**7. Before installing PHP5 dynamic language support for Apache, get a full list of available PHP modules and extensions using the following command.** + + # yum search php + +![Install PHP in CentOS 7](http://www.tecmint.com/wp-content/uploads/2014/07/Install-PHP-in-CentOS-7.png) + +Install PHP in CentOS 7 + +**8. Depending on what type of applications you want to use, install the required PHP modules from the above list, but for a basic MariaDB support in PHP and PhpMyAdmin you need to install the following modules.** + + # yum install php php-mysql php-pdo php-gd php-mbstring + +![Install PHP Modules in CentOS 7](http://www.tecmint.com/wp-content/uploads/2014/07/Install-PHP-Modules-in-CentOS-7.png) + +Install PHP Modules + +![Install PHP mbstring Module](http://www.tecmint.com/wp-content/uploads/2014/07/Install-PHP-mbstring-in-CentOs-7.png) + +Install PHP mbstring Module + +**9. To get a full information list on PHP from your browser, create a info.php file on Apache Document Root using the following command from root account, restart httpd service and direct your browser to the http://server_IP/info.php address.** + + # echo "" > /var/www/html/info.php + # systemctl restart httpd + +![Check PHP Info in CentOS 7](http://www.tecmint.com/wp-content/uploads/2014/07/Check-PHP-Info-in-CentOS-7.png) + +Check PHP Info in CentOS 7 + +**10. If you get an error on PHP Date and Timezone, open php.ini configuration file, search and uncomment date.timezone statement, append your physical location and restart Apache daemon.** + + # nano /etc/php.ini + +Locate and change date.timezone line to look like this, using [PHP Supported Timezones list][5]. + + date.timezone = Continent/City + +![Set Timezone in PHP](http://www.tecmint.com/wp-content/uploads/2014/07/Set-Time-Zone-in-CentOS.png) + +Set Timezone in PHP + +### Step 3: Install and Configure MariaDB Database ### + +**11. Red Hat Enterprise Linux/CentOS 7.0 switched from MySQL to MariaDB for its default database management system. To install MariaDB database use the following command.** + + # yum install mariadb-server mariadb + +![Install MariaDB in CentOS 7](http://www.tecmint.com/wp-content/uploads/2014/07/Install-MariaDB-in-CentOs-7.png) + +Install MariaDB in CentOS 7 + +**12. After MariaDB package is installed, start database daemon and use mysql_secure_installation script to secure database (set root password, disable remotely logon from root, remove test database and remove anonymous users).** + + # systemctl start mariadb + # mysql_secure_installation + +![Start MariaDB Database](http://www.tecmint.com/wp-content/uploads/2014/07/Start-MariaDB-in-CentOS-7.png) + +Start MariaDB Database + +![Secure MySQL Installation](http://www.tecmint.com/wp-content/uploads/2014/07/Secure-MySQL-Installation.png) + +Secure MySQL Installation + +**13. To test database functionality login to MariaDB using its root account and exit using quit statement.** + + mysql -u root -p + MariaDB > SHOW VARIABLES; + MariaDB > quit + +![Connect MySQL Database in CentOS](http://www.tecmint.com/wp-content/uploads/2014/07/Connect-MySQL-Installation.png) + +Connect MySQL Database + +### Step 4: Install PhpMyAdmin ### + +**14. By default official RHEL 7.0 or CentOS 7.0 repositories doesn’t provide any binary package for PhpMyAdmin Web Interface. If you are uncomfortable using MySQL command line to manage your database you can install PhpMyAdmin package by enabling CentOS 7.0 rpmforge repositories using the following command.** + + # yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm + +After enabling rpmforge repository, next install PhpMyAdmin. + + # yum install phpmyadmin + +![Enable RPMForge in CentOS 7](http://www.tecmint.com/wp-content/uploads/2014/07/Enable-RPMForge-in-CentOS-7.png) + +Enable RPMForge Repository + +**15. Next configure PhpMyAdmin to allow connections from remote hosts by editing phpmyadmin.conf file, located on Apache conf.d directory, commenting the following lines.** + + # nano /etc/httpd/conf.d/phpmyadmin.conf + +Use a # and comment this lines. + + # Order Deny,Allow + # Deny from all + # Allow from 127.0.0.1 + +![Allow Remote PhpMyAdmin Access](http://www.tecmint.com/wp-content/uploads/2014/07/Allow-Remote-PhpMyAdmin-Access.png) + +Allow Remote PhpMyAdmin Access + +**16. To be able to login to PhpMyAdmin Web interface using cookie authentication method add a blowfish string to phpmyadmin config.inc.php file like in the screenshot below using the [generate a secret string][6], restart Apache Web service and direct your browser to the URL address http://server_IP/phpmyadmin/.** + + # nano /etc/httpd/conf.d/phpmyadmin.conf + # systemctl restart httpd + +![Add Blowfish in PhpMyAdmin](http://www.tecmint.com/wp-content/uploads/2014/07/Add-Blowfish-PhpMyAdmin.png) + +Add Blowfish in PhpMyAdmin + +![PhpMyAdmin Dashboard](http://www.tecmint.com/wp-content/uploads/2014/07/Login-to-PhpMyAdmin.png) + +PhpMyAdmin Dashboard + +### Step 5: Enable LAMP System-wide ### + +**17. If you need MariaDB and Apache services to be automatically started after reboot issue the following commands to enable them system-wide.** + + # systemctl enable mariadb + # systemctl enable httpd + +![Enable Services System Wide](http://www.tecmint.com/wp-content/uploads/2014/07/Enable-Services-System-Wide.png) + +Enable Services System Wide + +That’s all it takes for a basic LAMP installation on Red Hat Enterprise 7.0 or CentOS 7.0. The next series of articles related to LAMP stack on CentOS/RHEL 7.0 will discuss how to create Virtual Hosts, generate SSL Certificates and Keys and add SSL transaction support for Apache HTTP Server. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-lamp-in-centos-7/ + +作者:[Matei Cezar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/cezarmatei/ +[1]:http://www.tecmint.com/redhat-enterprise-linux-7-installation/ +[2]:http://www.tecmint.com/enable-redhat-subscription-reposiories-and-updates-for-rhel-7/ +[3]:http://www.tecmint.com/centos-7-installation/ +[4]:http://www.tecmint.com/configure-network-interface-in-rhel-centos-7-0/ +[5]:http://php.net/manual/en/timezones.php +[6]:http://www.question-defense.com/tools/phpmyadmin-blowfish-secret-generator \ No newline at end of file From 0df0743ac5412bbc0c3af5fe739cb15bdfd0248c Mon Sep 17 00:00:00 2001 From: DeadFire Date: Tue, 16 Jun 2015 16:23:21 +0800 Subject: [PATCH 116/153] =?UTF-8?q?20150616-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0150616 Linux Humor on the Command-line.md | 127 +++++++++++++ ...20150616 LINUX 101--POWER UP YOUR SHELL.md | 177 ++++++++++++++++++ 2 files changed, 304 insertions(+) create mode 100644 sources/share/20150616 Linux Humor on the Command-line.md create mode 100644 sources/tech/20150616 LINUX 101--POWER UP YOUR SHELL.md diff --git a/sources/share/20150616 Linux Humor on the Command-line.md b/sources/share/20150616 Linux Humor on the Command-line.md new file mode 100644 index 0000000000..84c808e555 --- /dev/null +++ b/sources/share/20150616 Linux Humor on the Command-line.md @@ -0,0 +1,127 @@ +Linux Humor on the Command-line +================================================================================ +The desktop is full of eye candy. It enhances the visual experience and, in some cases, can also increase functionality of software. But it also makes software fun. Working on the command-line does not have to be always serious. If you want some fun on the command-line, there are lots of commands to raise a smile. + +Linux is a fun operating system. Linux offers a vast collection of small open source utilities that perform functions ranging from the obvious to the bizarre. It is the quality and selection of these tools that help Linux stand out. Check out these 7 small utilities. + +### lolcat ### + +![lolcat](http://www.linuxlinks.com/portal/content/reviews/Misc/Screenshot-lolcat.png) + +lolcat is a program that concatenates files, or standard input, to standard output (like the generic cat), and adds rainbow coloring to it. + +lolcat is often combined with other tools such as toilet or figlet to generate text. This software should not be confused with a lolcat; an image macro of one or more cats. + +lolcat was written by Moe. + +Website: [github.com][1] + +### cowsay ### + +![cowsay](http://www.linuxlinks.com/portal/content/reviews/Misc/Screenshot-cowsay.png) + +cowsay is a configurable open source program which generates ASCII pictures of a cow with a message in a speech bubble. cowsay is written in Perl. + +cowsay is not limited to generating pictures of cows. It can generate pre-made images of other animals including a duck, elephant, koala, moose, pony, sheep, stegosaurus, and turkey, as well as cheese, snowman, and a skeleton. + +There is a related program called cowthink, which generates cows with thought bubbles, as opposed to speech bubbles. + +Features include: + +- Make scripts more interesting +- Borg mode +- Ways to alter the way the cow looks, for example making the cow look greedy, paranoid, stoned, tired, wired, youthful and more +- xcowsay variant available + +Website: [nog.net][2] + +### doge ### + +![doge](http://www.linuxlinks.com/portal/content/reviews/Misc/Screenshot-doge.png) + +doge is a simple motd script based on the slightly stupid but very funny doge meme. It prints random grammatically incorrect statements that are sometimes based on things from your computer. + +Doge is an Internet meme that became popular in 2013. The meme typically consists of a picture of a Shiba Inu accompanied by multicolored text in Comic Sans font in the foreground. The text, representing a kind of internal monologue, is deliberately written in a form of broken English. + +- Randomly placed and colored random strings, complete with broken english +- Awesome Shibe in the terminal +- Fetching of system data, such as hostname, running processes, current user and $EDITOR +- If you have lolcat, you can do this gem: while true; do doge | lolcat -a -d 100 -s 100 -p 1; done +- stdin support: ls /usr/bin | doge will doge-print some of the executables found in /usr/bin. wow. There are also multiple command line switches that control filtering and statistical frequency of words + +Website: [github.com/thiderman/doge][3] + +### ASCIIQuarium ### + +![Asciiquarium](http://www.linuxlinks.com/portal/content/reviews/Misc/Screenshot-Asciiquarium.png) + +ASCIIQuarium is an aquarium/sea animation in ASCII art. Enjoy the fascinating creatures that live in the water from your computer. + +To run ASCIIQuarium you need to have installed Perl's curses package, and the Term::Animation module. To install the former, type sudo apt-get install libcurses-perl. To install the latter, type sudo cpan Term::Animation, both at the command line. + +Features include: + +- Multicolored fish +- Amusing animations, including a fish hook +- There are swans, ducks, dolphins, and ships too + +Website: [www.robobunny.com][4] + +### sl - Steam Locomotive ### + +![sl](http://www.linuxlinks.com/portal/content/reviews/Misc/Screenshot-sl.png) + +sl is an amusing command line tool that displays animations to correct users who accidentally type sl instead of ls. + +I'm rather sloppy at typing, preferring speed to accuracy. But typos can be a tad dangerous on the command line. So sl can serve as a practical reminder of curing a bad habit of mistyping. It always raises a chuckle too. + +Features include: + +- With -F, train flies +- With -l, it shows a small train +- With -a, an accident seems to happen + +Website: [github.com/mtoyoda/sl][5] + +### aafire ### + +![aafire](http://www.linuxlinks.com/portal/content/reviews/Misc/Screenshot-aafire.png) + +aafire displays burning ASCII art flames in the terminal. It demonstrates the the capabilities of the aalib library, an ascii art library. + +Website: [aa-project.sourceforge.net/aalib][6] + +### CMatrix ### + +![CMatrix](http://www.linuxlinks.com/portal/content/reviews/Misc/Screenshot-CMatrix.png) + +CMatrix is an ncurses program that simulates the display from "The Matrix". If you have been living in a cave for the past 15 years, you might not know The Matrix is a 1999 American science fiction acting film starring Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving, and Joe Pantoliano. + +It works with terminal settings up to 132x300 and can scroll lines all at the same rate or asynchronously and at a user-defined speed. + +Features include: + +- Change the text colour +- Turn on bold characters +- Asynchronous scroll +- Use old-style scrolling +- "Screensaver" mode + +Website: [www.asty.org/cmatrix][7] + +-------------------------------------------------------------------------------- + +via: http://www.linuxlinks.com/article/20150614112018846/Humor.html + +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://github.com/busyloop/lolcat +[2]:https://web.archive.org/web/20120225123719/http://www.nog.net/%7Etony/warez/cowsay.shtml +[3]:https://github.com/thiderman/doge +[4]:http://www.robobunny.com/projects/asciiquarium/html/ +[5]:https://github.com/mtoyoda/sl +[6]:http://aa-project.sourceforge.net/aalib/ +[7]:http://www.asty.org/cmatrix/ \ No newline at end of file diff --git a/sources/tech/20150616 LINUX 101--POWER UP YOUR SHELL.md b/sources/tech/20150616 LINUX 101--POWER UP YOUR SHELL.md new file mode 100644 index 0000000000..ef9f3d4937 --- /dev/null +++ b/sources/tech/20150616 LINUX 101--POWER UP YOUR SHELL.md @@ -0,0 +1,177 @@ +LINUX 101: POWER UP YOUR SHELL +================================================================================ +> Get a more versatile,featureful and colourful command line interface with our guide to shell basics. + +**WHY DO THIS?** + +- Make life at the shell prompt easier and faster. +- Resume sessions after losing a connection. +- Stop pushing around that fiddly rodent! + +![bash1](http://www.linuxvoice.com/wp-content/uploads/2015/02/bash1-large15.png) + +Here’s our souped-up prompt on steroids. It’s a bit long for this small terminal window, but you can tweak it to your liking. + +As a Linux user, you’re probably familiar with the shell (aka command line). You may pop up the occasional terminal now and then for some essential jobs that you can’t do at the GUI, or perhaps you live in a tiling window manager environment and the shell is your main way of interacting with your Linux box. + +In either case, you’re probably using the stock Bash configuration that came with your distro – and while it’s powerful enough for most jobs, it could still be a lot better. In this tutorial we’ll show you how to pimp up your shell to make it more informative, useful and pleasant to work in. We’ll customise the prompt to make it provide better feedback than the defaults, and we’ll show you how to manage sessions and run multiple programs together with the incredibly cool tmux tool. And for a bit of eye candy, we’ll look at colour schemes as well. So, onwards! + +### Make your prompt sing ### + +Most distributions ship with very plain prompts – they show a bit of information, and generally get you by, but the prompt can do so much more. Take the default prompt on a Debian 7 installation, for instance: + + mike@somebox:~$ + +This shows the user, hostname, current directory and account type symbol (if you switch to root, the **$** changes to #). But where is this information stored? The answer is in the **PS1** environment variable. If you enter **echo $PS1** you’ll see this at the end of the text string that appears: + + u@h:w$ + +This looks a bit ugly, and at first glance you might start screaming, assuming it to be a dreaded regular expression, but we’re not going to fry our brains with the complexity of those. No, the slashes here are escape sequences, telling the prompt to do special things. The **u** part, for instance, tells the prompt to show the username, while w means the working directory. + +Here’s a list of things you can use in the prompt: + +- d The current date. +- h The hostname. +- n A newline character. +- A The current time (HH:MM). +- u The current user. +- w (lowercase) The whole working directory. +- W (uppercase) The basename of the working directory. +- $ A prompt symbol that changes to # for root. +- ! The shell history number of this command. + +To clarify the difference in the **w** and **W** options: with the former, you’ll see the whole path for the directory in which you’re working (eg **/usr/local/bin**), whereas for the latter it will just show the **bin** part. + +Now, how do you go about changing the prompt? You need to modify the contents of the **PS1** environment variable. Try this: + + export PS1=”I am u and it is A $” + +Now your prompt will look something like: + + I am mike and it is 11:26 $ + +From here you can experiment with the other escape sequences shown above to create the prompt of your dreams. But wait a second – when you log out, all of your hard work will be lost, because the value of the **PS1** environment variable is reset each time you start a terminal. The simplest way to fix this is to open the **.bashrc** configuration file (in your home directory) and add the complete export command to the bottom. This **.bashrc** file will be read by Bash every time you start a new shell session, so your beefed-up prompt will always appear. You can also spruce up your prompt with extra colour. This is a bit tricky at first, as you have to use some rather odd-looking escape sequences, but the results can be great. Add this to a point in your **PS1** string and it will change the text to red: + + [e[31m] + +You can change 31 here to other numbers for different colours: + +- 30 Black +- 32 Green +- 33 Yellow +- 34 Blue +- 35 Magenta +- 36 Cyan +- 37 White + +So, let’s finish off this section by creating the mother of all prompts, using the escape sequences and colours we’ve already looked at. Take a deep breath, flex your fingers, and then type this beast: + + export PS1=”(!) [e[31m][A] [e[32m]u@h [e[34m]w [e[30m]$ “ + +This provides a Bash command history number, current time, and colours for the user/hostname combination and working directory. If you’re feeling especially ambitious, you can change the background colours as well as the foreground ones, for really striking combinations. The ever useful Arch wiki has a full list of colour codes: [http://tinyurl.com/3gvz4ec][1]. + +> ### Shell essentials ### +> +> If you’re totally new to Linux and have just picked up this magazine for the first time, you might find the tutorial a bit heavy going. So here are the basics to get you familiar with the shell. It’s usually found as Terminal, XTerm or Konsole in your menus, and when you start it the most useful commands are: +> +> **ls** (list files); **cp one.txt two.txt** (copy file); **rm file.txt** (remove file); **mv old.txt new.txt** (move or rename); +> +> **cd /some/directory** (change directory); **cd ..** (change to directory above); **./program** (run program in current directory); **ls > list.txt** (redirect output to a file). +> +> Almost every command has a manual page explaining options (eg **man ls** – press Q to quit the viewer). There you can learn about command options, so you can see that **ls -la** shows a detailed list including hidden files. Use the up and down cursor keys to cycle through previous commands, and use Tab after entering part of a file or directory name to auto-complete it. + +### Tmux: A window manager for your shell ### + +A window manager inside a text mode environment – it sounds crazy, right? Well, do you remember when web browsers first implemented tabbed browsing? It was a major step forward in usability at the time, and reduced clutter in desktop taskbars and window lists enormously. Instead of having taskbar or pager icons for every single site you had open, you just had the one button for your browser, and then the ability to switch sites inside the browser itself. It made an awful lot of sense. + +If you end up running several terminals at the same time, a similar situation occurs; you might find it annoying to keep jumping between them, and finding the right one in your taskbar or window list each time. With a text-mode window manager you can not only run multiple shell sessions simultaneously inside the same terminal window, but you can even arrange them side-by-side. + +And there’s another benefit too: detaching and reattaching. The best way to see how this works is to try it yourself. In a terminal window, enter **screen** (it’s installed by default on most distros, or will be available in your package repositories). Some welcome text appears – just hit Enter to dismiss it. Now run an interactive text mode program, such as **nano**, and close the terminal window. + +In a normal shell session, the act of closing the window would terminate every process running inside it – so your Nano editing session would be a goner. But not with screen. Open a new terminal and enter: + + screen -r + +And voilà: the Nano session you started before is back! + +When you originally ran **screen**, it created a new shell session that was independent and not tied to a specific terminal window, so it could be detached and reattached (hence the **-r** option) later. + +This is especially useful if you’re using SSH to connect to another machine, doing some work, and don’t want a flaky connection to ruin all your progress. If you do your work inside a **screen** session and your connection goes down (or your laptop battery dies, or your computer explodes), you can simply reconnect/recharge/buy a new computer, then SSH back in to the remote box, run **screen -r** to reattach and carry on from where you left off. + +Now, we’ve been talking about GNU **screen** here, but the title of this section mentions tmux. Essentially, **tmux** (terminal multiplexer) is like a beefed up version of **screen** with lots of useful extra features, so we’re going to focus on it here. Some distros include **tmux** by default; in others it’s usually just an **apt-get, yum install** or **pacman -S** command away. + +Once you have it installed, enter **tmux** to start it. You’ll notice right away that there’s a green line of information along the bottom. This is very much like a taskbar from a traditional window manager: there’s a list of running programs, the hostname of the machine, a clock and the date. Now run a program, eg Nano again, and hit Ctrl+B followed by C. This creates a new window inside the tmux session, and you can see this in the taskbar at the bottom: + + 0:nano- 1:bash* + +Each window has a number, and the currently displayed program is marked with an asterisk symbol. Ctrl+B is the standard way of interacting with tmux, so if you hit that key combo followed by a window number, you’ll switch to that window. You can also use Ctrl+B followed by N and P to switch to the next and previous windows respectively – or use Ctrl+B followed by L to switch between the two most recently used windows (a bit like the classic Alt+Tab behaviour on the desktop). To get a window list, use Ctrl+B followed by W. + +So far, so good: you can now have multiple programs running inside a single terminal window, reducing clutter (especially if you often have multiple SSH logins active on the same remote machine). But what about seeing two programs at the same time? + +For this, tmux uses “panes”. Hit Ctrl+B followed by % and the current window will be split into two sections, one on the left and one on the right. You can switch between them Using Ctrl+B followed by O. This is especially useful if you want to see two things at the same time – eg a manual page in one pane, and an editor with a configuration file in another. + +Sometimes you’ll want to resize the individual panes, and this is a bit trickier. First you have to hit Ctrl+B followed by : (colon), which turns the tmux bar along the bottom into a dark orange colour. You’re now in command mode, where you can type in commands to operate tmux. Enter **resize-pane -R** to resize the current pane one character to the right, or use **-L** to resize in a leftward direction. These may seem like long commands for a relatively simple operation, but note that the tmux command mode (started with the aforementioned colon) has tab completion. So you don’t have to type the whole command – just enter “**resi**” and hit Tab to complete. Also note that the **tmux** command mode also has a history, so if you want to repeat the resize operation, hit Ctrl+B followed by colon and then use the up cursor key to retrieve the command that you entered previously. + +Finally, let’s look at detaching and reattaching – the awesome feature of screen we demonstrated earlier. Inside tmux, hit Ctrl+B followed by D to detach the current tmux session from the terminal window, which leaves everything running in the background. To reattach to the session use **tmux a**. But what happens if you have multiple tmux sessions running? Use this command to list them: + + tmux ls + +This shows a number for each session; if you want to reattach to session 1, use tmux a -t 1. tmux is hugely configurable, with the ability to add custom keybindings and change colour schemes, so once you’re comfortable with the main features, delve into the manual page to learn more. + +tmux: a window manager for your shell + +![tmux](http://www.linuxvoice.com/wp-content/uploads/2015/02/tmux-large13.jpg) + +Here’s tmux with two panes open: the left has Vim editing a configuration file, while the right shows a manual page + +> ### Zsh: an alternative shell ### +> +> Choice is good, but standardisation is also important as well. So it makes sense that almost every mainstream Linux distribution uses the Bash shell by default – although there are others. Bash provides pretty much everything you need from a shell, including command history, filename completion and lots of scripting ability. It’s mature, reliable and well documented – but it’s not the only shell in town. +> +> Many advanced users swear by Zsh, the Z Shell. This is a replacement for Bash that offers almost all of the same functionality, with some extra features on top. For instance, in Zsh you can enter **ls** - and hit Tab to get quick descriptions of the various options available for **ls**. No need to open the manual page! +> +> Zsh sports other great auto-completion features: type **cd /u/lo/bi** and hit Tab, for instance, and the full path of **/usr/local/bin** will appear (providing there aren’t other paths containing **u**, **lo** and **bi**). Or try **cd** on its own followed by Tab, and you’ll see nicely coloured directory listings – much better than the plain ones used by Bash. +> +> Zsh is available in the package repositories of all major distros; install it and enter **zsh** to start it. To change your default shell from Bash to Zsh, use the **chsh** command. And for more information visit [www.zsh.org][2]. + +### The terminals of the Future ### + +You might be wondering why the application that contains your command prompt is called a terminal. Back in the early days of Unix, people tended to work on multi-user machines, with a giant mainframe computer occupying a room somewhere in a building, and people connected to it using screen and keyboard combinations at the end of some wires. These terminal machines were often called “dumb”, because they didn’t do any important processing themselves – they just displayed whatever was sent down the wire from the mainframe, and sent keyboard presses back to it. + +Today, almost all of us do the actual processing on our own machines, so our computers are not terminals in a traditional sense. This is why programs like **XTerm**, Gnome Terminal, Konsole etc. are called “terminal emulators” – they provide the same facilities as the physical terminals of yesteryear. And indeed, in many respects they haven’t moved on much. Sure, we have anti-aliased fonts now, better colours and the ability to click on URLs, but by and large they’ve been working in the same way for decades. + +Some programmers are trying to change this though. **Terminology** ([http://tinyurl.com/osopjv9][3]), from the team behind the ultra-snazzy Enlightenment window manager, aims to bring terminals into the 21st century with features such as inline media display. You can enter **ls** in a directory full of images and see thumbnails, or even play videos from directly inside your terminal. This makes the terminal work a bit more like a file manager, and means that you can quickly check the contents of media files without having to open them in a separate application. + +Then there’s Xiki ([www.xiki.org][4]), which describes itself as “the command revolution”. It’s like a cross between a traditional shell, a GUI and a wiki; you can type commands anywhere, store their output as notes for reference later, and create very powerful custom commands. It’s hard to describe it in mere words, so the authors have made a video (see the Screencasts section of the **Xiki** site) which shows how much potential it has. + +And Xiki is definitely not a flash in the pan project that will die of bitrot in a few months. The authors ran a successful Kickstarter campaign to fund its development, netting over $84,000 at the end of July. Yes, you read that correctly – $84K for a terminal emulator. It might be the most unusual crowdfunding campaign since some crazy guys decided to start their own Linux magazine… + +### Next-gen terminals ### + +Many command line and text-based programs match their GUI equivalents for feature parity, and are often much faster and more efficient to use. Our recommendations: **Irssi** (IRC client); **Mutt** (mail client); **rTorrent** (BitTorrent); **Ranger** (file manager); **htop** (process monitor). ELinks does a decent job for web browsing, given the limitations of the terminal, and it’s useful for reading text-heavy websites such as Wikipedia. + +> ### Fine-tune your colour scheme ### +> +> We’re not obsessed with eye-candy at Linux Voice, but we do recognise the importance of aesthetics when you’re staring at something for several hours every day. Many of us love to tweak our desktops and window managers to perfection, crafting pixel-perfect drop shadows and fiddling with colour schemes until we’re 100% happy. (And then fiddling some more out of habit.) +> +> But then we tend to ignore the terminal window. Well, that deserves some love too, and at [http://ciembor.github.io/4bit][5] you’ll find a highly awesome colour scheme designer that can export settings for all of the popular terminal emulators (**XTerm, Gnome Terminal, Konsole and Xfce4 Terminal are among the apps supported.**) Move the sliders until you attain colour scheme nirvana, then click on the Get Scheme button at the top-right of the page. +> +> Similarly, if you spend a lot of time in a text editor such as Vim or Emacs, it’s worth using a well-crafted palette there as well. **Solarized at** [http://ethanschoonover.com/solarized][6] is an excellent scheme that’s not just pretty, but designed for maximum usability, with plenty of research and testing behind it. + +-------------------------------------------------------------------------------- + +via: http://www.linuxvoice.com/linux-101-power-up-your-shell-8/ + +作者:[Ben Everard][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxvoice.com/author/ben_everard/ +[1]:http://tinyurl.com/3gvz4ec +[2]:http://www.zsh.org/ +[3]:http://tinyurl.com/osopjv9 +[4]:http://www.xiki.org/ +[5]:http://ciembor.github.io/4bit +[6]:http://ethanschoonover.com/solarized \ No newline at end of file From 9e661a759aeb9ced869d008b7b972c3aa1f12e29 Mon Sep 17 00:00:00 2001 From: DeadFire Date: Tue, 16 Jun 2015 16:34:57 +0800 Subject: [PATCH 117/153] =?UTF-8?q?20150616-3=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20150616 XBMC--build a remote control.md | 264 ++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 sources/tech/20150616 XBMC--build a remote control.md diff --git a/sources/tech/20150616 XBMC--build a remote control.md b/sources/tech/20150616 XBMC--build a remote control.md new file mode 100644 index 0000000000..25de9fd06f --- /dev/null +++ b/sources/tech/20150616 XBMC--build a remote control.md @@ -0,0 +1,264 @@ +XBMC: build a remote control +================================================================================ +**Take control of your home media player with a custom remote control running on your Android phone.** + +**XBMC** is a great piece of software, and can turn almost can computer into a media centre. It can play music and videos, display pictures, and even fetch a weather forecast. To make it easy to use in a home theatre setup, you can control it via mobile phone apps that access a server running on the XBMC machine via Wi-Fi. There are loads of these available for almost all smartphone systems. + +> ### Kodi ### +> +> By the time you read this, **XBMC** may be no more. The project team have decided to rename it **Kodi** for legal reasons (and because **XBMC**, or X**-Box Media Centre**, refers to older hardware that is no longer supported). Other than the name, though, nothing has changed. Or at least nothing other than the usual raft of improvements you’d expect from a new release. This shouldn’t affect the remote software though, and it should work on both existing **XBMC** systems, and newer Kodi systems. + +We’ve recently set up an **XBMC** system for playing music, and none of the XBMC remotes we found really excel at this task, especially when the TV attached to the media centre is turned off. They were all a bit too complex, as they packed too much functionality into small screens. We wanted a system designed from the ground up to just access a music library and a radio addon, so we decided to build one ourselves. It didn’t need to be able to access the full capabilities of XBMC, because for tasks other than music, we’d simply switch back to a general-purpose XBMC remote control. Our test system was a Raspberry Pi running the RaspBMC distribution, but nothing here is specific to either the Pi or that distro, and it should work on any Linux-based XBMC system provided the appropriate packages are available. + +The first thing a remote control needs is a user interface. Many XBMC remote controls are written as standalone apps. However, this is just for our music, and we want to be accessible to guests without them having to install anything. The obvious solution is to make a web interface. XBMC does have a built-in web server, but to give us more control, we decided to use a separate web framework. There’s no problem running more than one web server on a computer at a time, but they can’t run on the same port. + +There are quite a few web frameworks available. We’ve used Bottle because it’s a simple, fast framework, and we don’t need any complex functions. Bottle is a Python module, so that’s the language in which we’ll write the server. + +You’ll probably find Bottle in your package manager. In Debian-based systems (including Raspbmc), you can grab it with: + + sudo apt-get install python-bottle + +A remote control is really just a layer that connects the user to a system. Bottle provides what we need to interact with the user, and we’ll interact with **XBMC** using its JSON API. This enables us to control the media player by sending JSON-encoded information. + +We’re going to use a simple wrapper around the XBMC JSON API called xbmcjson. It’s just enough to allow you send requests without having to worry about the actual JSON formatting or any of the banalities of communicating with a server. It’s not included in the PIP package manager, so you need to install it straight from **GitHub**: + + git clone https://github.com/jcsaaddupuy/python-xbmc.git + cd python-xbmc + sudo python setup.py install + +This is everything you need, so let’s get coding. + +#### Get started with Bottle #### + +The basic structure of our program is: + + from xbmcjson import XBMC + from bottle import route, run, template, redirect, static_file, request + import os + xbmc = XBMC(“http://192.168.0.5/jsonrpc”, “xbmc”, “xbmc”) + @route(‘/hello/’) + def index(name): + return template(‘

Hello {{name}}!

’, name=name) + run(host=”0.0.0.0”, port=8000) + +This connects to **XBMC** (though doesn’t actually use it); then Bottle starts serving up the website. In this case, it listens on host 0.0.0.0 (which is every hostname), and port 8000. It only has one site, which is /hello/XXXX where XXXX can be anything. Whatever XXXX is gets passed to index() as the parameter name. This then passes it to the template, which substitutes it into the HTML. + +You can try this out by entering the above into a file (we’ve called it remote.py), and starting it with: + + python remote.py + +You can then point your browser to localhost:8000/hello/world to see the template in action. + +@route() sets up a path in the web server, and the function index() returns the data for that path. Usually, this means returning HTML that’s generated via a template, but it doesn’t have to be (as we’ll see later). + +As we go on, we’ll add more routes to the application to make it a fully-featured XBMC remote control, but it will still be structured in the same way. + +The XBMC JSON API can be accessed by any computer on the same network as the XBMC machine. This means that you can develop it on your desktop, then deploy it to your media centre rather than fiddle round uploading every change to your home theatre PC. + +Templates – like the simple one in the previous example – are a way of combining Python and HTML to control the output. In principal, they can do quite a bit of processing, but they can get messy. We’ll use them just to format the data correctly. Before we can do that, though, we have to have some data. + +> ### Paste ### +> +> Bottle includes its own web server, which is what we’ve been using for testing the remote control. However, we found that it didn’t always perform well. When we put the remote into action, we wanted something that could deliver pages a bit quicker. Bottle can work with quite a few different web servers, and we found Paste worked quite well. In order to use this, just install it (in the package python-paste on Debian), and change the run call to: +> +> run(host=hostname, port=hostport, server=”paste”) +> +> You can see details of how to use other servers at [http://bottlepy.org/docs/dev/deployment.html][1]. + +#### Getting data from XBMC #### + +The XBMC JSON API is split up into 14 namespaces: JSONRPC, Player, Playlist, Files, AudioLibrary, VideoLibrary, Input, Application, System, Favourites, Profiles, Settings, Textures and XBMC. Each of these is available from an XBMC object in Python (apart from Favourites, in an apparent oversight). In each of these namespaces there are methods that you can use to control the application. For example, Playlist.GetItems() can be used to get the items on a particular playlist. The server returns data to us in JSON, but the xbmcjson module converts it to a Python dictionary for us. + +There are two items in XBMC that we need to use to control playback: players and playlists. Players hold a playlist and move through it item by item as each song finishes. In order to see what’s currently playing, we need to get the ID of the active player, and through that find out the ID of the current playlist. We’ve done this with the following function: + + def get_playlistid(): + player = xbmc.Player.GetActivePlayers() + if len(player[‘result’]) > 0: + playlist_data = xbmc.Player.GetProperties({“playerid”:0, “properties”:[“playlistid”]}) + if len(playlist_data[‘result’]) > 0 and “playlistid” in playlist_data[‘result’].keys(): + return playlist_data[‘result’][‘playlistid’] + return -1 + +If there isn’t a currently active player (that is, if the length of the results section in the returned data is 0), or if the current player has no playlist, this will return -1. Otherwise, it will return the numeric ID of the current playlist. + +Once we’ve got the ID of the current playlist, we can get the details of it. For our purposes, two things are important: the list of items in the playlist, and the position we are in the playlist (items aren’t removed from the playlist after they’ve been played; the current position just marches on). + + def get_playlist(): + playlistid = get_playlistid() + if playlistid >= 0: + data = xbmc.Playlist.GetItems({“playlistid”:playlistid, “properties”: [“title”, “album”, “artist”, “file”]}) + position_data = xbmc.Player.GetProperties({“playerid”:0, ‘properties’:[“position”]}) + position = int(position_data[‘result’][‘position’]) + return data[‘result’][‘items’][position:], position + return [], -1 + +This returns the current playlist starting with the item that’s currently playing (since we don’t care about stuff that’s finished), and it also includes the position as this is needed for removing items from the playlist. + +![Image](http://www.linuxvoice.com/wp-content/uploads/2015/04/xbmc2-large.jpg) + +The API is documented at [http://wiki.xbmc.org/?title=JSON-RPC_API/v6][2]. It lists all the available functions, but it a little short on details of how to use them. + +> ### JSON ### +> +> JSON stands for JavaScript Object Notation, and was originally designed as a way of serialising JavaScript Objects. It still is used for that, but it’s also a useful way of encoding all sorts of data. +> +> JSON objects always have the form: +> +> {property1:value1, property2:value2, property3:value3} +> +> For an arbitrary number of property/value pairs. To Python programmers, this all looks suspiciously similar to dictionaries, and the two are very similar. +> +> As with dictionaries, the value can itself be another JSON object, or a list, so the following is perfectly valid: +> +> {“name”:“Ben”, “jobs”:[“cook”, “bottle-washer”], “appearance”: {“height”:195, “skin”:“fair”}} +> +> JSON is often used in web services to send data back and fourth, and it’s well supported by most programming languages, so if Python’s not your thing, you should easily be able to use the same functions to control XBMC from software written in the language of your choice. + +#### Bringing them together #### + +The code to link the previous functions to a HTML page is simply: + + @route(‘/juke’) + def index(): + current_playlist, position = get_playlist() + return template(‘list’, playlist=current_playlist, offset = position) + +This only has to grab the playlist (using the function we defined above), and pass it to a template that handles the display. + +The main part of the template that handles the display of this data is: + +

Currently Playing:

+ % if playlist is not None: + % position = offset + % for song in playlist: + {{song[‘title’]}} + % if song[‘type’] == ‘unknown’: + Radio + % else: + {{song[‘artist’][0]}} + % end + % if position != offset: + remove + % else: + skip + % end +
+ % position += 1 + % end + +As you can see, templates are mostly written in HTML, but with a few extra bits to control output. Variables enclosed by double parenthesise are output in place (as we saw in the first ‘hello world’ example). You can also include Python code on lines starting with a percentage sign. Since indents aren’t used, you need a % end to close any code block (such as a loop or if statement). + +This template first checks that the playlist isn’t empty, then loops through every item on the playlist. Each item is displayed as the song title in bold, then the name of the artist, then a link to either skip it (if it’s the currently playing song), or remove it from the playlist. All songs have a type of ‘song’, so if the type is ‘unknown’, then it isn’t a song, but a radio station. + +The /remove/ and /skip/ routes are simple wrappers around XBMC controls that reload /juke after the change has taken effect: + + @route(‘/skip/’) + def index(position): + print xbmc.Player.GoTo({‘playerid’:0, ‘to’:’next’}) + redirect(“/juke”) + @route(‘/remove/’) + def index(position): + playlistid = get_playlistid() + if playlistid >= 0: + xbmc.Playlist.Remove({‘playlistid’:int(playlistid), ‘position’:int(position)}) + redirect(“/juke”) + +Of course, it’s no good being able to manage your playlist if you can’t add music to it. + +This is complicated slightly by the fact that once a playlist finishes, it disappears, so you need to create a new one. Rather confusingly, playlists are created by calling the Playlist.Clear() method. This can also be used to kill a playlist that is currently playing a radio station (where the type is unknown). The other complication is that radio streams sit in the playlist and never leave, so if there’s currently a radio station playing, we need to clear the playlist as well. + +These pages include a link to play the songs, which points to /play/. This page is handled by: + + @route(‘/play/’) + def index(id): + playlistid = get_playlistid() + playlist, not_needed= get_playlist() + if playlistid < 0 or playlist[0][‘type’] == ‘unknown’: + xbmc.Playlist.Clear({“playlistid”:0}) + xbmc.Playlist.Add({“playlistid”:0, “item”:{“songid”:int(id)}}) + xbmc.Player.open({“item”:{“playlistid”:0}}) + playlistid = 0 + else: + xbmc.Playlist.Add({“playlistid”:playlistid, “item”:{“songid”:int(id)}}) + remove_duplicates(playlistid) + redirect(“/juke”) + +The final thing here is a call to remove_duplicates. This isn’t essential – and some people may not like it – but it makes sure that no song appears in the playlist more than once. + +We also have pages that list all the artists in the collection, and list the songs and albums by particular artists. These are quite straightforward, and work in the same basic way as /juke. + +![Image](http://www.linuxvoice.com/wp-content/uploads/2015/04/xbmc1-large.jpg) + +The UI still needs a bit of attention, but it’s working. + +> ### Logging ### +> +> It’s not always clear how to do something using the XBMC JSON API, and the documentation is sometimes a little opaque. One way of finding out how to do something is seeing how other remote controls do it. If you turn on logging, you can see what API calls are being performed as you use another remote control, then incorporate these into your code. +> +> To turn on logging, hook your XBMC media centre up to a display and go to Settings > System > Debugging, and turn on Enable Debug Logging. With logging turned on, you need to access the XBMC machine (eg via SSH), then you can view the log. Its location should be displayed in the top-left corner of the XBMC display. In RaspBMC, it’s at /home/pi/.xbmc/temp/xbmc.log. You can then keep an eye on what API calls are being performed in real time using: +> +> cd /home/pi/.xbmc/temp +> tail -f xbmc.log | grep “JSON” + +#### Adding functionality #### + +The above code all works with songs in the XBMC library, but we also wanted to be able to play radio stations. Addons each have their own plugin URL that can be used to pull information out of them using the usual XBMC JSON commands. For example, to get the selected stations from the radio plugin, we use: + + @route(‘/radio/’) + def index(): + my_stations = xbmc.Files.GetDirectory({“directory”:”plugin://plugin.audio.radio_de/stations/my/”, “properties”: + [“title”,”thumbnail”,”playcount”,”artist”,”album”,”episode”,”season”,”showtitle”]}) + if ‘result’ in my_stations.keys(): + return template(‘radio’, stations=my_stations[‘result’][‘files’]) + else: + return template(‘error’, error=’radio’) + +This includes a file that can be added to a playlist just as any song can be. However, these files never finish playing, so (as we saw before) you need to recreate the playlist before adding any songs to it. + +#### Sharing songs #### + +As well as serving up templates, Bottle can serve static files. These are useful whenever you need things that don’t change based on the user input. That could be a CSS file, an image or an MP3. In our simple controller there’s not (yet) any CSS or images to make things look pretty, but we have added a way to download the songs. This lets the media centre act as a sort of NAS box for songs. If you’re transferring large amounts of data, it’s probably best to use something like Samba, but serving static files is a good way of grabbing a couple of tunes on your phone. + +The Bottle code to download a song by its ID is : + + @route(‘/download/’) + def index(id): + data = xbmc.AudioLibrary.GetSongDetails({“songid”:int(id), “properties”:[“file”]}) + full_filename = data[‘result’][‘songdetails’][‘file’] + path, filename = os.path.split(full_filename) + return static_file(filename, root=path, download=True) + +To use this, we just put a link to the appropriate ID in the /songsby/ page. + +We’ve gone through all the mechanics of the code, but there are a few more bits that just tie it all together. You can see for yourself at the GitHub page:[https://github.com/ben-ev/xbmc-remote][3]. + +> ### Setting up ### +> +> Once you’ve developed your remote control, you’ll need a way of ensuring that it starts every time you turn on your media centre. There are a few ways of doing this, but the easiest is just to add a command launching it to /etc/rc.local. We installed our file to /opt/xbmc-remote/remote.py with all the other files alongside it. We then added the following line to /etc/rc.local before the final exit 0 line. +> +> cd /opt/xbmc-remote && python remote.py & + +> ### GitHub ### +> +> This project is quite bare-bones at the moment, but – the business of running a magazine means we don’t have as much time as we’d like to program. However, we’ve set up a GitHub project where we hope to keep working on it, and if you think you’d benefit from the project as well, we’d love your input. +> +> To see what’s going on, head over to [https://github.com/ben-ev/xbmc-remote][4] and take a look at what state it’s in. You can get a copy of the latest code from that web page, or clone it from the command line. +> +> If you want to improve it, you can fork the project to develop in your own branch, and then send a pull request when your features are working. For more information on working with GitHub, head to [https://github.com/features][5]. + +-------------------------------------------------------------------------------- + +via: http://www.linuxvoice.com/xbmc-build-a-remote-control/ + +作者:[Ben Everard][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxvoice.com/author/ben_everard/ +[1]:http://bottlepy.org/docs/dev/deployment.html +[2]:http://wiki.xbmc.org/?title=JSON-RPC_API/v6 +[3]:https://github.com/ben-ev/xbmc-remote +[4]:https://github.com/ben-ev/xbmc-remote +[5]:https://github.com/features \ No newline at end of file From 3ae5914617207278cc61bedf801ba4b5aede922e Mon Sep 17 00:00:00 2001 From: wwy Date: Tue, 16 Jun 2015 19:31:34 +0800 Subject: [PATCH 118/153] [Translating] 20141219 What is good audio editing software on Linux.md --- .../20141219 What is good audio editing software on Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20141219 What is good audio editing software on Linux.md b/sources/tech/20141219 What is good audio editing software on Linux.md index ccc6a0883b..da015adf14 100644 --- a/sources/tech/20141219 What is good audio editing software on Linux.md +++ b/sources/tech/20141219 What is good audio editing software on Linux.md @@ -1,3 +1,5 @@ +translating by wwy-hust + What is good audio editing software on Linux ================================================================================ From f42f3c51c04c2fe38305ef233741ed05dffe9daf Mon Sep 17 00:00:00 2001 From: struggling <630441839@qq.com> Date: Tue, 16 Jun 2015 23:22:28 +0800 Subject: [PATCH 119/153] Delete 20150515 Extend Swap Space using Swap file in Linux.md --- ...end Swap Space using Swap file in Linux.md | 74 ------------------- 1 file changed, 74 deletions(-) delete mode 100644 sources/tech/20150515 Extend Swap Space using Swap file in Linux.md diff --git a/sources/tech/20150515 Extend Swap Space using Swap file in Linux.md b/sources/tech/20150515 Extend Swap Space using Swap file in Linux.md deleted file mode 100644 index 9b1cb3f8b7..0000000000 --- a/sources/tech/20150515 Extend Swap Space using Swap file in Linux.md +++ /dev/null @@ -1,74 +0,0 @@ -Translating by strugglingyouth -Extend Swap Space using Swap file in Linux -================================================================================ -There are some scenarios where our Linux box is running out of swap space so in that case we can extend the swap space using swap partition but due to unavailability of free partitions on the disk, we are unable to extend it. - -So in such cases we can extend or increase swap space using a swap file - -### Below are the Steps to extend Swap Space using Swap File in Linux ### - -Lets first check the size of existing swap space / partition using the command like ‘**free -m‘** and ‘**swapon -s**‘ - -![](http://www.linuxtechi.com/wp-content/uploads/2015/06/free-output-with-swap.jpg) -free-output-with-swap - -In my case size of swap partition is 2 GB. So we will be extending swap space by 1 GB. - -#### Step:1 Create a swap file of size 1 GB using below dd Command #### - - [root@linuxtechi ~]# dd if=/dev/zero of=/swap_file bs=1G count=1 - 1+0 records in - 1+0 records out - 1073741824 bytes (1.1 GB) copied, 414.898 s, 2.6 MB/s - [root@linuxtechi ~]# - -Replace the value of ‘**bs**‘ and ‘**count**‘ according your requirement. - -#### Step:2 Secure the swap file with permissions 644. #### - - [root@linuxtechi ~]# chmod 600 /swap_file - -#### Step:3 Enable the Swap Area on the file (swap_file) #### - -Use mkswap command to enable swap area - - [root@linuxtechi ~]# mkswap /swap_file - Setting up swapspace version 1, size = 1048572 KiB - no label, UUID=f7b3ae59-c09a-4dc2-ba4d-c02abb7db33b - [root@linuxtechi ~]# - -#### Step:4 Add the swap file entry in the fstab file #### - -Add the below entry in the fstab file so that swap file become persistent across every reboot. - - /swap_file swap swap defaults 0 0 - -![swap-file-fstab-entry](http://www.linuxtechi.com/wp-content/uploads/2015/06/swap-file-fstab-entry.jpg) - -#### Step:5 Enable the swap file using ‘mkswap on’ command. #### - - [root@linuxtechi ~]# swapon /swap_file - [root@linuxtechi ~]# - -#### Step:6 Now verify the swap space #### - -![swap-space-after-extension](http://www.linuxtechi.com/wp-content/uploads/2015/06/swap-space-after-extension.jpg) - -**Note**: To disable the swap file for any troubleshooting point of view, use swapoff command as shown below and to re-enable swap file then use swapon command as shown in step5. - - [root@linuxtechi ~]# swapoff /swap_file - [root@linuxtechi ~]# - -Please share your valuable inputs and comments of this article. - --------------------------------------------------------------------------------- - -via: http://www.linuxtechi.com/extend-swap-space-using-swap-file-in-linux/ - -作者:[Pradeep Kumar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.linuxtechi.com/author/pradeep/ From 383804437197bac1609d63700bb392b5ddf5e52e Mon Sep 17 00:00:00 2001 From: struggling <630441839@qq.com> Date: Tue, 16 Jun 2015 23:27:22 +0800 Subject: [PATCH 120/153] Update 20150515 Extend Swap Space using Swap file in Linux.md --- .../tech/20150515 Extend Swap Space using Swap file in Linux.md | 1 + 1 file changed, 1 insertion(+) diff --git a/translated/tech/20150515 Extend Swap Space using Swap file in Linux.md b/translated/tech/20150515 Extend Swap Space using Swap file in Linux.md index 473e24ea0d..0b1a5c0597 100644 --- a/translated/tech/20150515 Extend Swap Space using Swap file in Linux.md +++ b/translated/tech/20150515 Extend Swap Space using Swap file in Linux.md @@ -1,3 +1,4 @@ +translated by strugglingyouth 在linux上使用交换文件扩展交换空间 ================================================================================ 想像一种情景,当我们的Linux系统用尽交换空间时,在这种情况下, From ed895abe7f18d024699d5f46eb8c0ef7542cc070 Mon Sep 17 00:00:00 2001 From: wxy Date: Wed, 17 Jun 2015 10:22:40 +0800 Subject: [PATCH 121/153] PUB:20150504 Useful Commands to Create Commandline Chat Server and Remove Unwanted Packages in Linux @wi-cuckoo --- ...r and Remove Unwanted Packages in Linux.md | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) rename {translated/tech => published}/20150504 Useful Commands to Create Commandline Chat Server and Remove Unwanted Packages in Linux.md (80%) diff --git a/translated/tech/20150504 Useful Commands to Create Commandline Chat Server and Remove Unwanted Packages in Linux.md b/published/20150504 Useful Commands to Create Commandline Chat Server and Remove Unwanted Packages in Linux.md similarity index 80% rename from translated/tech/20150504 Useful Commands to Create Commandline Chat Server and Remove Unwanted Packages in Linux.md rename to published/20150504 Useful Commands to Create Commandline Chat Server and Remove Unwanted Packages in Linux.md index cd90e2bfb7..786e06b436 100644 --- a/translated/tech/20150504 Useful Commands to Create Commandline Chat Server and Remove Unwanted Packages in Linux.md +++ b/published/20150504 Useful Commands to Create Commandline Chat Server and Remove Unwanted Packages in Linux.md @@ -2,33 +2,35 @@ Linux中,创建聊天服务器、移除冗余软件包的实用命令 ============================================================================= 这里,我们来看Linux命令行实用技巧的下一个部分。如果你错过了Linux Tracks之前的文章,可以从这里找到。 -- [5 Linux Command Line Tracks][1] +- [5个有趣的Linux命令行技巧][1] 本篇中,我们将会介绍6个命令行小技巧,包括使用Netcat命令创建Linux命令行聊天,从某个命令的输出中对某一列做加法,移除Debian和CentOS上多余的包,从命令行中获取本地与远程的IP地址,在终端获得彩色的输出与解码各样的颜色,最后是Linux命令行里井号标签的使用。让我们来一个一个地看一下。 ![Linux Commandline Chat Server](http://www.tecmint.com/wp-content/uploads/2015/04/linux-commandline-chat-server.jpg) -6个实用的命令行技巧 + +*6个实用的命令行技巧* ### 1. 创建Linux命令行聊天服务 ### -我们大家使用聊天服务都有很长一段时间了。对于Google Chat,Hangout,Facebook Chat,Whatsapp,Hike和其他一些应用与集成的聊天服务,我们都很熟悉了。那你知道Linux的nc命令可以使你的Linux盒子变成一个聊天服务器,而仅仅只需要一行命令吗。什么是nc命令,它又是怎么工作的呢? -nc是Linux netcat命令的旧版。nc就像瑞士军刀一样,内建呢大量的功能。nc可用做调式工具,调查工具,使用TCP/UDP读写网络连接,DNS正向/反向检查。 +我们大家使用聊天服务都有很长一段时间了。对于Google Chat,Hangout,Facebook Chat,Whatsapp,Hike和其他一些应用与集成的聊天服务,我们都很熟悉了。那你知道Linux的nc命令可以使你的Linux机器变成一个聊天服务器,而仅仅只需要一行命令吗。什么是nc命令,它又是怎么工作的呢? + +nc即Linux netcat命令。nc就像瑞士军刀一样,内建了大量的功能。nc可用做调式工具,调查工具,使用TCP/UDP读写网络连接,DNS正向/反向查询等等。 nc主要用在端口扫描,文件传输,后台和端口监听。nc可以使用任何闲置的端口和任何本地网络源地址。 使用nc命令(在192.168.0.7的服务器上)创建一个命令行即时信息传输服务器。 - $ nc -l -vv 11119 + $ nc -l -vv -p 11119 对上述命令的解释。 -- -v : 表示 Verbose -- -vv : 更多的 Verbose +- -v : 显示冗余信息 +- -vv : 显示更多的冗余信息 - -p : 本地端口号 你可以用任何其他的本地端口号替换11119。 -接下来在客户端机器(IP地址:192.168.0.15),运行下面的命令初始化聊天会话(信息传输服务正在运行)。 +接下来在客户端机器(IP地址:192.168.0.15),运行下面的命令初始化聊天会话(这里需要上面提到的信息服务器正在运行)。 $ nc 192.168.0.7:11119 @@ -38,7 +40,7 @@ nc主要用在端口扫描,文件传输,后台和端口监听。nc可以使 ### 2. Linux中如何统计某一列的总值 ### -如何统计在终端里,某个命令的输出中,其中一列的数值总和, +如何在终端里统计某个命令的输出中其中一列的数值总和, ‘ls -l’命令的输出。 @@ -64,7 +66,7 @@ nc主要用在端口扫描,文件传输,后台和端口监听。nc可以使 废弃包是指那些作为其他包的依赖而被安装,但是当源包被移除之后就不再需要的包。 -假设我们安装了gtprogram,依赖是gtdependency。除非我们安装了gtdependency,否则安装不了gtprogram。 +假设我们安装了一个叫gtprogram的软件包,其依赖是gtdependency。除非我们安装了gtdependency,否则安装不了gtprogram。 当我们移除gtprogram的时候,默认并不会移除gtdependency。并且如果我们不移除gtdependency的话,它就会遗留下来成为废弃包,与其他任何包再无联系。 @@ -116,13 +118,13 @@ nc主要用在端口扫描,文件传输,后台和端口监听。nc可以使 ### 5.如何在Linux终端彩色输出 ### -你可能在终端看见过彩色的输出。同时你也可能知道在终端里允许/禁用彩色输出。如果都不知道的话,里可以参考下面的步骤。 +你可能在终端看见过彩色的输出。同时你也可能知道在终端里允许/禁用彩色输出。如果都不知道的话,你可以参考下面的步骤。 在Linux中,每个用户都有`'.bashrc'`文件,被用来管理你的终端输出。打开并且编辑该文件,用你喜欢的编辑器。注意一下,这个文件是隐藏的(文件开头为点的代表隐藏文件)。 $ vi /home/$USER/.bashrc -确保以下的行没有被注释掉。ie.,行开头没有#。 +确保以下的行没有被注释掉。即,行开头没有#。 if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dirc$ @@ -139,27 +141,27 @@ nc主要用在端口扫描,文件传输,后台和端口监听。nc可以使 完成后!保存并退出。为了让改动生效,需要注销账户后再次登录。 -现在,你会看见列出的文件和文件夹名字有着不同的颜色,根据文件类型来决定。为了解码颜色,可以运行下面的命令。 +现在,你会看见列出的文件和文件夹名字有着不同的颜色,根据文件类型来决定。要了解所用的颜色代码,可以运行下面的命令。 $ dircolors -p | less ![Linux Color Output](http://www.tecmint.com/wp-content/uploads/2015/04/Linux-Color-Output.gif) -### 6.如何用井号标记和Linux命令和脚本 ### +### 6.如何用#号标记Linux命令和脚本 ### -我们一直在Twitter,Facebook和Google Plus(可能是其他我们没有提到的地方)上使用井号标签。那些井号标签使得其他人搜索一个标签更加容易。可是很少人知道,我们可以在Linux命令行使用井号标签。 +我们一直在Twitter,Facebook和Google Plus(可能是其他我们没有提到的地方)上使用#号标签。那些#号标签使得其他人搜索一个标签更加容易。可是很少人知道,我们可以在Linux命令行使用#号标签。 我们已经知道配置文件里的`#`,在大多数的编程语言中,这个符号被用作注释行,即不被执行。 -运行一个命令,然后为这个命令创建一个井号标签,这样之后我们就可以找到它。假设我们有一个很长的脚本,就上面第四点被执行的命令。现在为它创建一个井号标签。我们知道ifconfig可以被sudo或者root执行,因此用root来执行。 +运行一个命令,然后为这个命令创建一个#号标签,这样之后我们就可以找到它。假设我们有一个很长的脚本,就上面第四点被执行的命令。现在为它创建一个#号标签。我们知道ifconfig可以被sudo或者root执行,因此用root来执行。 # ifconfig | grep "inet addr:" | awk '{print $2}' | grep -v '127.0.0.1' | cut -f2 -d: #myip -上述脚本被’mytag‘给标记了。现在在reverse-i-search(按下ctrl+r)搜索一下这个标签,在终端里,并输入’mytag‘。你可以从这里开始执行。 +上述脚本被’myip‘给标记了。现在在reverse-i-search(按下ctrl+r)搜索一下这个标签,在终端里,并输入’myip‘。你可以从这里开始执行。 ![Create Command Hash Tags](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Command-Hash-Tags.gif) -你可以创建很多的井号标签,为每个命令,之后使用reverse-i-search找到它。 +你可以为每个命令创建#号标签,之后使用reverse-i-search找到它。 目前就这么多了。我们一直在辛苦的工作,创造有趣的,有知识性的内容给你。你觉得我们是如何工作的呢?欢迎咨询任何问题。你可以在下面评论。保持联络!Kudox。 @@ -169,9 +171,9 @@ via: http://www.tecmint.com/linux-commandline-chat-server-and-remove-unwanted-pa 作者:[Avishek Kumar][a] 译者:[wi-cuckoo](https://github.com/wi-cuckoo) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/5-linux-command-line-tricks/ +[1]:https://linux.cn/article-5485-1.html From 5fa0173972d15ace430badb5c50e3d0f93e98d33 Mon Sep 17 00:00:00 2001 From: wxy Date: Wed, 17 Jun 2015 10:24:15 +0800 Subject: [PATCH 122/153] PUB:20150410 7 Command Line Tools for Browsing Websites and Downloading Files i @fyh --- ...ng Websites and Downloading Files in Linux.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename {translated/tech => published}/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md (92%) diff --git a/translated/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md b/published/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md similarity index 92% rename from translated/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md rename to published/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md index 0d73e957de..db3aa23b6e 100644 --- a/translated/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md +++ b/published/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md @@ -1,8 +1,8 @@ -Linux中7个用来浏览网页和下载文件的命令 +Linux中7个用来浏览网页和下载文件的命令 ================================================================================ 上一篇文章中,我们提到了`rTorrent`、`wget`、`cURL`、`w3m`、`Elinks`等几个有用的工具,很多人回信说还有其它几个类似的工具也值得讨论,所以就有了这篇文章。如果错过了第一部分的讨论,可以通过下面的链接来回顾。 -- [5个下载文件和浏览网页的命令行工具][1] +- [5 个基于Linux命令行的文件下载和网站浏览工具][1] 这篇文章介绍了Linux下用于浏览网页和下载文件的其它几个命令行工具。 @@ -23,7 +23,7 @@ Links是用C语言写的一个开源web浏览器,支持包括Linux、Windows ![](http://www.tecmint.com/wp-content/uploads/2015/04/links-browse-websites-terminal.gif) -如何你想安装links的图形界面版本,可能需要从[http://links.twibright.com/download/][2]下载最新的版本tarball(version 2.9)的源代码。 +如何你想安装links的图形界面版本,可能需要从[http://links.twibright.com/download/][2]下载最新的版本(version 2.9)的源代码压缩包。 同样,也可以像下面那样使用wget下载安装。 @@ -34,7 +34,7 @@ Links是用C语言写的一个开源web浏览器,支持包括Linux、Windows # make # make install -**注意**:links源代码的编译需要安装libpng, libjpeg, TIFF library, SVGAlib, XFree86, C Compiler and make这几个包。 +**注意**:links源代码的编译需要安装libpng, libjpeg, TIFF library, SVGAlib, XFree86, C Compiler 和 make这几个包。 ### 2. links2 ### @@ -49,7 +49,7 @@ Links是Twibright实验室编写的web浏览器,而Links2是基于它的一个 lynx是一个基于文本的web浏览器,使用GNU GPLv2协议发布,用ISO C编写。lynx是一个可高度配置的web浏览器,是许多系统管理员的救世主,有最悠久的web浏览器之称,并且至今仍然处在积极开发中。 -通过下面的命令安装lyns。 +通过下面的命令安装lynx。 # apt-get install lynx # yum install lynx @@ -125,7 +125,7 @@ aria2安装完成后,可以像下图那样运行这个命令下载任意文件 ![Aria2: Linux的命令行下载工具 ](http://www.tecmint.com/wp-content/uploads/2015/04/Download-Files-in-Terminal.gif) -Aria2: Linux命令行下载工具 +*Aria2: Linux命令行下载工具* 目前就这么多了。稍后咱们讨论另一个有意思的话题。请保持联系,常来Tecmint逛逛。别忘了在评论中给我们提供您的宝贵反馈,您的喜爱和分享帮助我们不断前行。 @@ -135,12 +135,12 @@ via: http://www.tecmint.com/command-line-web-browser-download-file-in-linux/ 作者:[Avishek Kumar][a] 译者:[fyh](https://github.com/fyh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/linux-command-line-tools-for-downloading-files/ +[1]:https://linux.cn/article-5546-1.html [2]:http://links.twibright.com/download/ [3]:http://www.tecmint.com/command-line-web-browsers/ [4]:http://www.tecmint.com/install-youtube-dl-command-line-video-download-tool/ From ac6bd1e261c7683bd74aa979006d4f57b581ed53 Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Wed, 17 Jun 2015 10:35:36 +0800 Subject: [PATCH 123/153] Translating by ZTinoZ --- .../20150526 20 Useful Terminal Emulators for Linux.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index a15c4ad0d1..8938b6049b 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -199,11 +199,11 @@ FinalTerm Terminal ### 15. Terminology ### -Terminology is yet another new modern terminal emulator created for the Enlightenment desktop, but also can be used in different desktop environments. It has some awesome unique features, which do not have in any other terminal emulator. +Terminology是一款新的现代化终端仿真器,为Enlightenment桌面创造,但也能用于其它桌面环境。它有一些独一无二的棒极了的特性,这是其它终端仿真器所不具备的。 -Apart features, terminology offers even more things that you wouldn’t assume from a other terminal emulators, like preview thumbnails of images, videos and documents, it also allows you to see those files directly from Terminology. +抛开这些特性,terminology甚至还提供了你无法从其它仿真器看到的东西,比如图像、视频和文档的缩略图预览,它允许你从Terminology直接就能看到那些文件。 -You can watch a following demonstrations video created by the Terminology developer (the video quality isn’t clear, but still it’s enough to get the idea about Terminology). +你可以来看看Terminology的开发人员制作的小视频(视频画质不太清晰,但足以让你了解Terminology了)。 @@ -211,7 +211,7 @@ You can watch a following demonstrations video created by the Terminology develo ### 16. Xfce4 terminal ### -Xfce terminal is a lightweight modern and easy to use terminal emulator specially designed for Xfce desktop environment. The latest release of xfce terminal has some new cool features such as search dialog, tab color changer, drop-down console like Guake or Yakuake and many more. +Xfce终端是一款轻量级的现代化终端仿真器,它简单易用,为Xfce桌面环境设计。它最新的一个版本有许多新的炫酷特性比如搜索会话、标签颜色转换器、像Guake或Yakuake一样的下拉式控制台等等。 ![Xfce Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/xfce-terminal.jpg) From c95bd80913b0de6ff515da57eb8c0d4ea0d5c2c8 Mon Sep 17 00:00:00 2001 From: DeadFire Date: Wed, 17 Jun 2015 14:41:19 +0800 Subject: [PATCH 124/153] =?UTF-8?q?20150617-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20150617 The Art of Command Line.md | 435 ++++++++++++++++++ 1 file changed, 435 insertions(+) create mode 100644 sources/tech/20150617 The Art of Command Line.md diff --git a/sources/tech/20150617 The Art of Command Line.md b/sources/tech/20150617 The Art of Command Line.md new file mode 100644 index 0000000000..d7fb3a5aff --- /dev/null +++ b/sources/tech/20150617 The Art of Command Line.md @@ -0,0 +1,435 @@ +The Art of Command Line +================================================================================ +- [Basics](#basics) +- [Everyday use](#everyday-use) +- [Processing files and data](#processing-files-and-data) +- [System debugging](#system-debugging) +- [One-liners](#one-liners) +- [Obscure but useful](#obscure-but-useful) +- [More resources](#more-resources) +- [Disclaimer](#disclaimer) + + +![curl -s 'https://raw.githubusercontent.com/jlevy/the-art-of-command-line/master/README.md' | egrep -o '`\w+`' | tr -d '`' | cowsay -W50](https://github.com/jlevy/the-art-of-command-line/blob/master/cowsay.png) + +Fluency on the command line is a skill often neglected or considered arcane, but it improves your flexibility and productivity as an engineer in both obvious and subtle ways. This is a selection of notes and tips on using the command-line that I've found useful when working on Linux. Some tips are elementary, and some are fairly specific, sophisticated, or obscure. This page is not long, but if you can use and recall all the items here, you know a lot. + +Much of this +[originally](http://www.quora.com/What-are-some-lesser-known-but-useful-Unix-commands) +[appeared](http://www.quora.com/What-are-the-most-useful-Swiss-army-knife-one-liners-on-Unix) +on [Quora](http://www.quora.com/What-are-some-time-saving-tips-that-every-Linux-user-should-know), +but given the interest there, it seems it's worth using Github, where people more talented than I can readily suggest improvements. If you see an error or something that could be better, please submit an issue or PR! + +Scope: + +- The goals are breadth and brevity. Every tip is essential in some situation or significantly saves time over alternatives. +- This is written for Linux. Many but not all items apply equally to MacOS (or even Cygwin). +- The focus is on interactive Bash, though many tips apply to other shells and to general Bash scripting. +- Descriptions are intentionally minimal, with the expectation you'll use `man`, `apt-get`/`yum`/`dnf` to install, and Google for more background. + + +## Basics + +- Learn basic Bash. Actually, type `man bash` and at least skim the whole thing; it's pretty easy to follow and not that long. Alternate shells can be nice, but Bash is powerful and always available (learning *only* zsh, fish, etc., while tempting on your own laptop, restricts you in many situations, such as using existing servers). + +- Learn at least one text-based editor well. Ideally Vim (`vi`), as there's really no competition for random editing in a terminal (even if you use Emacs, a big IDE, or a modern hipster editor most of the time). + +- Learn about redirection of output and input using `>` and `<` and pipes using `|`. Learn about stdout and stderr. + +- Learn about file glob expansion with `*` (and perhaps `?` and `{`...`}`) and quoting and the difference between double `"` and single `'` quotes. (See more on variable expansion below.) + +- Be familiar with Bash job management: `&`, **ctrl-z**, **ctrl-c**, `jobs`, `fg`, `bg`, `kill`, etc. + +- Know `ssh`, and the basics of passwordless authentication, via `ssh-agent`, `ssh-add`, etc. + +- Basic file management: `ls` and `ls -l` (in particular, learn what every column in `ls -l` means), `less`, `head`, `tail` and `tail -f` (or even better, `less +F`), `ln` and `ln -s` (learn the differences and advantages of hard versus soft links), `chown`, `chmod`, `du` (for a quick summary of disk usage: `du -sk *`), `df`, `mount`. + +- Basic network management: `ip` or `ifconfig`, `dig`. + +- Know regular expressions well, and the various flags to `grep`/`egrep`. The `-i`, `-o`, `-A`, and `-B` options are worth knowing. + +- Learn to use `apt-get`, `yum`, or `dnf` (depending on distro) to find and install packages. And make sure you have `pip` to install Python-based command-line tools (a few below are easiest to install via `pip`). + + +## Everyday use + +- In Bash, use **ctrl-r** to search through command history. + +- In Bash, use **ctrl-w** to delete the last word, and **ctrl-u** to delete the whole line. Use **alt-b** and **alt-f** to move by word, and **ctrl-k** to kill to the end of the line. See `man readline` for all the default keybindings in Bash. There are a lot. For example **alt-.** cycles through previous arguments, and **alt-*** expands a glob. + +- To go back to the previous working directory: `cd -` + +- If you are halfway through typing a command but change your mind, hit **alt-#** to add a `#` at the beginning and enter it as a comment (or use **ctrl-a**, **#**, **enter**). You can then return to it later via command history. + +- Use `xargs` (or `parallel`). It's very powerful. Note you can control how many items execute per line (`-L`) as well as parallelism (`-P`). If you're not sure if it'll do the right thing, use `xargs echo` first. Also, `-I{}` is handy. Examples: +```bash + find . -name '*.py' | xargs grep some_function + cat hosts | xargs -I{} ssh root@{} hostname +``` + +- `pstree -p` is a helpful display of the process tree. + +- Use `pgrep` and `pkill` to find or signal processes by name (`-f` is helpful). + +- Know the various signals you can send processes. For example, to suspend a process, use `kill -STOP [pid]`. For the full list, see `man 7 signal` + +- Use `nohup` or `disown` if you want a background process to keep running forever. + +- Check what processes are listening via `netstat -lntp`. + +- See also `lsof` for open sockets and files. + +- In Bash scripts, use `set -x` for debugging output. Use strict modes whenever possible. Use `set -e` to abort on errors. Use `set -o pipefail` as well, to be strict about errors (though this topic is a bit subtle). For more involved scripts, also use `trap`. + +- In Bash scripts, subshells (written with parentheses) are convenient ways to group commands. A common example is to temporarily move to a different working directory, e.g. +```bash + # do something in current dir + (cd /some/other/dir; other-command) + # continue in original dir +``` + +- In Bash, note there are lots of kinds of variable expansion. Checking a variable exists: `${name:?error message}`. For example, if a Bash script requires a single argument, just write `input_file=${1:?usage: $0 input_file}`. Arithmetic expansion: `i=$(( (i + 1) % 5 ))`. Sequences: `{1..10}`. Trimming of strings: `${var%suffix}` and `${var#prefix}`. For example if `var=foo.pdf`, then `echo ${var%.pdf}.txt` prints `foo.txt`. + +- The output of a command can be treated like a file via `<(some command)`. For example, compare local `/etc/hosts` with a remote one: +```sh + diff /etc/hosts <(ssh somehost cat /etc/hosts) +``` + +- Know about "here documents" in Bash, as in `cat <logfile 2>&1`. Often, to ensure a command does not leave an open file handle to standard input, tying it to the terminal you are in, it is also good practice to add ` foo: + rename 's/\.bak$//' *.bak + # Full rename of filenames, directories, and contents foo -> bar: + repren --full --preserve-case --from foo --to bar . +``` + +- Use `shuf` to shuffle or select random lines from a file. + +- Know `sort`'s options. Know how keys work (`-t` and `-k`). In particular, watch out that you need to write `-k1,1` to sort by only the first field; `-k1` means sort according to the whole line. + +- Stable sort (`sort -s`) can be useful. For example, to sort first by field 2, then secondarily by field 1, you can use `sort -k1,1 | sort -s -k2,2` + +- If you ever need to write a tab literal in a command line in Bash (e.g. for the -t argument to sort), press **ctrl-v** **[Tab]** or write `$'\t'` (the latter is better as you can copy/paste it). + +- For binary files, use `hd` for simple hex dumps and `bvi` for binary editing. + +- Also for binary files, `strings` (plus `grep`, etc.) lets you find bits of text. + +- To convert text encodings, try `iconv`. Or `uconv` for more advanced use; it supports some advanced Unicode things. For example, this command lowercases and removes all accents (by expanding and dropping them): +```sh + uconv -f utf-8 -t utf-8 -x '::Any-Lower; ::Any-NFD; [:Nonspacing Mark:] >; ::Any-NFC; ' < input.txt > output.txt +``` + +- To split files into pieces, see `split` (to split by size) and `csplit` (to split by a pattern). + +- Use `zless`, `zmore`, `zcat`, and `zgrep` to operate on compressed files. + + +## System debugging + +- For web debugging, `curl` and `curl -I` are handy, or their `wget` equivalents, or the more modern [`httpie`](https://github.com/jakubroztocil/httpie). + +- To know disk/cpu/network status, use `iostat`, `netstat`, `top` (or the better `htop`), and (especially) `dstat`. Good for getting a quick idea of what's happening on a system. + +- For a more in-depth system overview, use [`glances`](https://github.com/nicolargo/glances). It presents you with several system level statistics in one terminal window. Very helpful for quickly checking on various subsystems. + +- To know memory status, run and understand the output of `free` and `vmstat`. In particular, be aware the "cached" value is memory held by the Linux kernel as file cache, so effectively counts toward the "free" value. + +- Java system debugging is a different kettle of fish, but a simple trick on Oracle's and some other JVMs is that you can run `kill -3 ` and a full stack trace and heap summary (including generational garbage collection details, which can be highly informative) will be dumped to stderr/logs. + +- Use `mtr` as a better traceroute, to identify network issues. + +- For looking at why a disk is full, `ncdu` saves time over the usual commands like `du -sh *`. + +- To find which socket or process is using bandwidth, try `iftop` or `nethogs`. + +- The `ab` tool (comes with Apache) is helpful for quick-and-dirty checking of web server performance. For more complex load testing, try `siege`. + +- For more serious network debugging, `wireshark`, `tshark`, or `ngrep`. + +- Know about `strace` and `ltrace`. These can be helpful if a program is failing, hanging, or crashing, and you don't know why, or if you want to get a general idea of performance. Note the profiling option (`-c`), and the ability to attach to a running process (`-p`). + +- Know about `ldd` to check shared libraries etc. + +- Know how to connect to a running process with `gdb` and get its stack traces. + +- Use `/proc`. It's amazingly helpful sometimes when debugging live problems. Examples: `/proc/cpuinfo`, `/proc/xxx/cwd`, `/proc/xxx/exe`, `/proc/xxx/fd/`, `/proc/xxx/smaps`. + +- When debugging why something went wrong in the past, `sar` can be very helpful. It shows historic statistics on CPU, memory, network, etc. + +- For deeper systems and performance analyses, look at `stap` ([SystemTap](https://sourceware.org/systemtap/wiki)), [`perf`](http://en.wikipedia.org/wiki/Perf_(Linux)), and [`sysdig`](https://github.com/draios/sysdig). + +- Confirm what Linux distribution you're using (works on most distros): `lsb_release -a` + +- Use `dmesg` whenever something's acting really funny (it could be hardware or driver issues). + + +## One-liners + +A few examples of piecing together commands: + +- It is remarkably helpful sometimes that you can do set intersection, union, and difference of text files via `sort`/`uniq`. Suppose `a` and `b` are text files that are already uniqued. This is fast, and works on files of arbitrary size, up to many gigabytes. (Sort is not limited by memory, though you may need to use the `-T` option if `/tmp` is on a small root partition.) See also the note about `LC_ALL` above. +```sh + cat a b | sort | uniq > c # c is a union b + cat a b | sort | uniq -d > c # c is a intersect b + cat a b b | sort | uniq -u > c # c is set difference a - b +``` + +- Summing all numbers in the third column of a text file (this is probably 3X faster and 3X less code than equivalent Python): +```sh + awk '{ x += $3 } END { print x }' myfile +``` + +- If want to see sizes/dates on a tree of files, this is like a recursive `ls -l` but is easier to read than `ls -lR`: +```sh + find . -type f -ls +``` + +- Use `xargs` or `parallel` whenever you can. Note you can control how many items execute per line (`-L`) as well as parallelism (`-P`). If you're not sure if it'll do the right thing, use xargs echo first. Also, `-I{}` is handy. Examples: +```sh + find . -name '*.py' | xargs grep some_function + cat hosts | xargs -I{} ssh root@{} hostname +``` + +- Say you have a text file, like a web server log, and a certain value that appears on some lines, such as an `acct_id` parameter that is present in the URL. If you want a tally of how many requests for each `acct_id`: +```sh + cat access.log | egrep -o 'acct_id=[0-9]+' | cut -d= -f2 | sort | uniq -c | sort -rn +``` + +- Run this function to get a random tip from this document (parses Markdown and extracts an item): +```sh + function taocl() { + curl -s https://raw.githubusercontent.com/jlevy/the-art-of-command-line/master/README.md | + pandoc -f markdown -t html | + xmlstarlet fo --html --dropdtd | + xmlstarlet sel -t -v "(html/body/ul/li[count(p)>0])[$RANDOM mod last()+1]" | + xmlstarlet unesc | fmt -80 + } +``` + + +## Obscure but useful + +- `expr`: perform arithmetic or boolean operations or evaluate regular expressions + +- `m4`: simple macro processor + +- `screen`: powerful terminal multiplexing and session persistence + +- `yes`: print a string a lot + +- `cal`: nice calendar + +- `env`: run a command (useful in scripts) + +- `look`: find English words (or lines in a file) beginning with a string + +- `cut `and `paste` and `join`: data manipulation + +- `fmt`: format text paragraphs + +- `pr`: format text into pages/columns + +- `fold`: wrap lines of text + +- `column`: format text into columns or tables + +- `expand` and `unexpand`: convert between tabs and spaces + +- `nl`: add line numbers + +- `seq`: print numbers + +- `bc`: calculator + +- `factor`: factor integers + +- `gpg`: encrypt and sign files + +- `toe`: table of terminfo entries + +- `nc`: network debugging and data transfer + +- `ngrep`: grep for the network layer + +- `dd`: moving data between files or devices + +- `file`: identify type of a file + +- `stat`: file info + +- `tac`: print files in reverse + +- `shuf`: random selection of lines from a file + +- `comm`: compare sorted files line by line + +- `hd` and `bvi`: dump or edit binary files + +- `strings`: extract text from binary files + +- `tr`: character translation or manipulation + +- `iconv `or uconv: conversion for text encodings + +- `split `and `csplit`: splitting files + +- `7z`: high-ratio file compression + +- `ldd`: dynamic library info + +- `nm`: symbols from object files + +- `ab`: benchmarking web servers + +- `strace`: system call debugging + +- `mtr`: better traceroute for network debugging + +- `cssh`: visual concurrent shell + +- `wireshark` and `tshark`: packet capture and network debugging + +- `host` and `dig`: DNS lookups + +- `lsof`: process file descriptor and socket info + +- `dstat`: useful system stats + +- [`glances`](https://github.com/nicolargo/glances): high level, multi-subsystem overview + +- `iostat`: CPU and disk usage stats + +- `htop`: improved version of top + +- `last`: login history + +- `w`: who's logged on + +- `id`: user/group identity info + +- `sar`: historic system stats + +- `iftop` or `nethogs`: network utilization by socket or process + +- `ss`: socket statistics + +- `dmesg`: boot and system error messages + +- `hdparm`: SATA/ATA disk manipulation/performance + +- `lsb_release`: Linux distribution info + +- `lshw`: hardware information + +- `fortune`, `ddate`, and `sl`: um, well, it depends on whether you consider steam locomotives and Zippy quotations "useful" + + +## More resources + +- [awesome-shell](https://github.com/alebcay/awesome-shell): A curated list of shell tools and resources. +- [Strict mode](http://redsymbol.net/articles/unofficial-bash-strict-mode/) for writing better shell scripts. + + +## Disclaimer + +With the exception of very small tasks, code is written so others can read it. With power comes responsibility. The fact you *can* do something in Bash doesn't necessarily mean you should! ;) + +-------------------------------------------------------------------------------- + +via: https://github.com/jlevy/the-art-of-command-line + +作者:[jlevy][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://github.com/jlevy +[1]: +[2]: +[3]: +[4]: +[5]: +[6]: +[7]: +[8]: +[9]: +[10]: +[11]: +[12]: +[13]: +[14]: +[15]: +[16]: +[17]: +[18]: +[19]: +[20]: \ No newline at end of file From 46c69fc92dde46a82975a504280b0da0cad0758c Mon Sep 17 00:00:00 2001 From: DeadFire Date: Wed, 17 Jun 2015 16:31:54 +0800 Subject: [PATCH 125/153] =?UTF-8?q?20150617-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ser for Anonymous Web Browsing in Linux.md | 206 ++++++++++++++++++ 1 file changed, 206 insertions(+) create mode 100644 sources/tech/20150617 Tor Browser--An Ultimate Web Browser for Anonymous Web Browsing in Linux.md diff --git a/sources/tech/20150617 Tor Browser--An Ultimate Web Browser for Anonymous Web Browsing in Linux.md b/sources/tech/20150617 Tor Browser--An Ultimate Web Browser for Anonymous Web Browsing in Linux.md new file mode 100644 index 0000000000..92fe36dae2 --- /dev/null +++ b/sources/tech/20150617 Tor Browser--An Ultimate Web Browser for Anonymous Web Browsing in Linux.md @@ -0,0 +1,206 @@ +Tor Browser: An Ultimate Web Browser for Anonymous Web Browsing in Linux +================================================================================ +Most of us give a considerable time of ours to Internet. The primary Application we require to perform our internet activity is a browser, a web browser to be more perfect. Over Internet most of our’s activity is logged to Server/Client machine which includes IP address, Geographical Location, search/activity trends and a whole lots of Information which can potentially be very harmful, if used intentionally the other way. + +![Install Tor Browser in Linux](http://www.tecmint.com/wp-content/uploads/2014/04/Install-tor-browser-in-linux.jpg) + +Tor Browser: Anonymous Browsing + +Moreover the National Security Agency (NSA) aka International Spying Agency keeps tracks of ours digital footprints. Not to mention a restricted proxy server which again can be used as data ripping server is not the answer. And most of the corporates and companies wont allow you to access a proxy server. + +So, what we need here is an application, preferably small in size and let it be standalone, portable and which servers the purpose. Here comes an application – the Tor Browser, which has all the above discussed features and even beyond that. + +In this article we will be discussing Tor browser, its features, its usages and Area of Application, Installation and other important aspects of The Tor Browser Application. + +#### What is Tor Browser? #### + +Tor is a Freely distributed Application Software, released under BSD style Licensing which allows to surf Internet anonymously, through its safe and reliable onion like structure. Tor previously was called as ‘The Onion Router‘ because of its structure and functioning mechanism. This Application is written in C programming Language. + +#### Features of Tor Browser #### + +- Cross Platform Availability. i.e., this application is available for Linux, Windows as well as Mac. +- Complex Data encryption before it it sent over Internet. +- Automatic data decryption at client side. +- It is a combination of Firefox Browser + Tor Project. +- Provides anonymity to servers and websites. +- Makes it possible to visit locked websites. +- Performs task without revealing IP of Source. +- Capable of routing data to/from hidden services and application behind firewall. +- Portable – Run a preconfigured web browser directly from the USB storage Device. No need to install it locally. +- Available for architectures x86 and x86_64. +- Easy to set FTP with Tor using configuration as “socks4a” proxy on “localhost” port “9050” +- Tor is capable of handling thousands of relay and millions of users. + +#### How Tor Browser Works? #### + +Tor works on the concept of Onion routing. Onion routing resemble to onion in structure. In onion routing the layers are nested one over the other similar to the layers of onion. This nested layer is responsible for encrypting data several times and sends it through virtual circuits. On the client side each layer decrypt the data before passing it to the next level. The last layer decrypts the innermost layer of encrypted data before passing the original data to the destination. + +In this process of decryption all the layers function so intelligently that there is no need to reveal IP and Geographical location of User thus limiting any chance of anybody watching your internet connection or the sites you are visiting. + +All these working seems a bit complex, but the end user execution and working of Tor browser is nothing to worry about. In-fact Tor browser resembles any other browser (Especially Mozilla Firefox) in functioning. + +### Installation of Tor Browser in Linux ### + +As discussed above, Tor browser is available for Linux, Windows and Mac. The user need to download the latest version (i.e. Tor Browser 4.0.4) application from the link below as per their system and architecture. + +- [https://www.torproject.org/download/download-easy.html.en][1] + +After downloading the Tor browser, we need to install it. But the good thing with ‘Tor’ is that we don’t need to install it. It can run directly from a Pen Drive and the browser can be preconfigured. That means plug and Run Feature in perfect sense of Portability. + +After downloading the Tar-ball (*.tar.xz) we need to Extract it. + +**On 32-Bit System** + + $ wget https://www.torproject.org/dist/torbrowser/4.0.4/tor-browser-linux32-4.0.4_en-US.tar.xz + $ tar xpvf tor-browser-linux32-4.0.4_en-US.tar.xz + +**On 64-Bit System** + + $ wget https://www.torproject.org/dist/torbrowser/4.0.4/tor-browser-linux64-4.0.4_en-US.tar.xz + $ tar -xpvf tor-browser-linux64-4.0.4_en-US.tar.xz + +**Note** : In the above command we used ‘$‘ which means that the package is extracted as user and not root. It is strictly suggested to extract and run tor browser not as root. + +After successful extraction, we can move the extracted browser to anywhere/USB Mass Storage device. And run the application from the extracted folder and run ‘start-tor-browser’ strictly not as root. + + $ cd tor-browser_en-US + $ ./start-tor-browser + +![Starting Tor Browser](http://www.tecmint.com/wp-content/uploads/2014/04/Starting-Tor-Network.jpg) + +Starting Tor Browser + +**1. Trying to connect to the Tor Network. Click “Connect” and Tor will do rest of the settings for you.** + +![Connecting to Tor Network](http://www.tecmint.com/wp-content/uploads/2014/04/Tor-Network-Settings.jpg) + +Connecting to Tor Network + +**2. The welcome Window/Tab.** + +![Tor Welcome Screen](http://www.tecmint.com/wp-content/uploads/2014/04/Tor-Welcome-Screen.png) + +Tor Welcome Screen + +**3. Tor Browser Running a Video from Youtube.** + +![Watching Video on Youtube](http://www.tecmint.com/wp-content/uploads/2014/04/Watching-Video-on-Youtube.jpg) + +Watching Video on Youtube + +**4. Opening a banking site for online Purchasing/Transaction.** + +![Browsing a Banking Site](http://www.tecmint.com/wp-content/uploads/2014/04/Browsing-Site.jpg) + +Browsing a Banking Site + +**5. The browser showing my current proxy IP. Note that the text that reads “Proxy Server detected”.** + +![Checking IP Address](http://www.tecmint.com/wp-content/uploads/2014/04/Checking-IP-Address.jpg) + +Checking IP Address + +**Note**: That you need to point to the Tor startup script using text session, everytime you want to run Tor. Moreover a terminal will be busy all the time till you are running tor. How to overcome this and create a desktop/dock-bar Icon? + +6. We need to create `tor.desktop` file inside the directory where extracted files resides. + +$ touch tor.desktop + +Now edit the file using your favourite editor with the text below. Save and exit. I used nano. + + $ nano tor.desktop + +---------- + + #!/usr/bin/env xdg-open + [Desktop Entry] + Encoding=UTF-8 + Name=Tor + Comment=Anonymous Browse + Type=Application + Terminal=false + Exec=/home/avi/Downloads/tor-browser_en-US/start-tor-browser + Icon=/home/avi/Downloads/tor-browser_en-US/Browser/browser/icons/mozicon128.png + StartupNotify=true + Categories=Network;WebBrowser; + +**Note**: Make sure to replace the path with the location of your tor browser in the above. + +**7. Once done! Double click the file `tor.desktop` to fire Tor browser. You may need to trust it for the first time.** + +![Tor Application Launcher](http://www.tecmint.com/wp-content/uploads/2014/04/Tor-Application-Launcher.jpg) + +Tor Application Launcher + +**8. Once you trust you might note that the icon of `tor.desktop` changed.** + +![Tor icon Changed](http://www.tecmint.com/wp-content/uploads/2014/04/Tor-icon-changed.jpg) + +Tor icon Changed + +9. You may drag and drop the `tor.desktop` icon to create shortcut on Desktop and Dock Bar. + +![Add Tor Shortcut on Desktop](http://www.tecmint.com/wp-content/uploads/2014/04/Add-Tor-Shortcut-on-Desktop.jpg) + +Add Tor Shortcut on Desktop + +**10. About Tor Browser.** + +![About Tor Browser](http://www.tecmint.com/wp-content/uploads/2014/04/About-Tor-Browser.jpg) + +About Tor Browser + +**Note**: If you are using older version of Tor, you may update it from the above window. + +#### Usability/Area of Application #### + +- Anonymous communication over web. +- Surf to Blocked web Pages. +- Link other Application Viz (FTP) to this secure Internet Browsing Application. + +#### Controversies of Tor-browser #### + +- No security at the boundary of Tor Application i.e., Data Entry and Exit Points. +- A study in 2011 reveals that a specific way of attacking Tor will reveal IP address of BitTorrent Users. +- Some protocols shows the tendency of leaking IP address, revealed in a study. +- Earlier version of Tor bundled with older versions of Firefox browser were found to be JavaScript Attack Vulnerable. +- Tor Browser Seems to Work slow. + +#### Real world Implementation of Tor-browser #### + +- Vuze BitTorrent Client +- Anonymous Os +- Os’es from Scratch +- whonix, etc. + +#### Future of Tor Browser #### + +Tor browser is promising. Perhaps the first application of its kind is implemented very brilliantly. Tor browser must invest for Support, Scalability and research for securing the data from latest attacks. This application is need of the future. + +#### Download Free eBook #### + +Unofficial Guide to Tor Private Browsing + +[![](http://img.tradepub.com/free/w_make129/images/w_make129c4.gif)][2] + +### Conclusion ### + +Tor bowser is a must tool in the present time where the organization you are working for don’t allow you to access certain websites or if you don’t want others to look into your private business or you don’t want to provide your digital footprints to NSA. + +**Note**: Tor Browser don’t provide any safety from Viruses, Trojans or other threats of this kind. Moreover by writing an article of this we never mean to indulge into illegal activity by hiding our identity over Internet. This Post is totally for educational Purpose and for any illegal use of it neither the author of the post nor Tecmint will be responsible. It is the sole responsibility of user. + +Tor-browser is a wonderful application and you must give it a try. That’s all for now. I’ll be here again with another interesting article you people will love to read. Till then stay tuned and connected to Tecmint. Don’t forget to provide us with your value-able feedback in our comment section below. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/tor-browser-for-anonymous-web-browsing/ + +作者:[Avishek Kumar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:https://www.torproject.org/download/download-easy.html.en +[2]:http://tecmint.tradepub.com/free/w_make129/prgm.cgi \ No newline at end of file From c627fb4eb5fc9b793424107ba00548081d2c9dca Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Wed, 17 Jun 2015 16:39:11 +0800 Subject: [PATCH 126/153] Translating by ZTinoZ --- sources/tech/20150526 20 Useful Terminal Emulators for Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index 8938b6049b..9b6db95726 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -221,7 +221,7 @@ Xfce Terminal ### 17. xterm ### -The xterm application is a standard terminal emulator for the X Window System. It maintain DEC VT102 and Tektronix 4014 compatible terminals for applications that can’t use the window system directly. +xterm应用程序是一款标准的在X Window系统上的终端仿真器。It maintain DEC VT102 and Tektronix 4014 compatible terminals for applications that can’t use the window system directly. ![xterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/xterm.jpg) From d1f9adf935781a9aabb16e7c4b6f8cdc94ac3de1 Mon Sep 17 00:00:00 2001 From: sevenot Date: Thu, 18 Jun 2015 00:38:22 +0800 Subject: [PATCH 127/153] sevenot translated --- ... The top 10 rookie open source projects.md | 154 ------------------ ... The top 10 rookie open source projects.md | 153 +++++++++++++++++ 2 files changed, 153 insertions(+), 154 deletions(-) delete mode 100644 sources/talk/20150128 The top 10 rookie open source projects.md create mode 100644 translated/talk/20150128 The top 10 rookie open source projects.md diff --git a/sources/talk/20150128 The top 10 rookie open source projects.md b/sources/talk/20150128 The top 10 rookie open source projects.md deleted file mode 100644 index 7dccf38141..0000000000 --- a/sources/talk/20150128 The top 10 rookie open source projects.md +++ /dev/null @@ -1,154 +0,0 @@ -sevenot translating -The top 10 rookie open source projects -================================================================================ -Black Duck presents its Open Source Rookies of the Year -- the 10 most exciting, active new projects germinated by the global open source community - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_01-100564902-orig.jpeg) - -### Open Source Rookies of the Year ### - -Each year sees the start of thousands of new open source projects. Only a handful gets real traction. Some projects gain momentum by building on existing, well-known technologies; others truly break new ground. Many projects are created to solve a simple development problem, while others begin with loftier intentions shared by like-minded developers around the world. - -Since 2009, the open source software logistics company Black Duck has identified the [Open Source Rookies of the Year][1], based on activity tracked by its [Open Hub][2] (formerly Ohloh) site. This year, we're delighted to present 10 winners and two honorable mentions for 2015, selected from thousands of open source projects. Using a weighted scoring system, points were awarded based on project activity, the pace of commits, and several other factors. - -Open source has become the industry's engine of innovation. This year, for example, growth in projects related to Docker containerization trumped every other rookie area -- and not coincidentally reflected the most exciting area of enterprise technology overall. At the very least, the projects described here provide a window on what the global open source developer community is thinking, which is fast becoming a good indicator of where we're headed. - -### 2015 Open Source Rookie of the Year: DebOps ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_02-100564903-orig.jpeg) - -[DebOps][3] is a collection of [Ansible][4] playbooks and roles, scalable from one container to an entire data center. Founder Maciej Delmanowski open-sourced DebOps to ensure his work outlived his current work environment and could grow in strength and depth from outside contributors. - -DebOps began at a small university in Poland that ran its own data center, where everything was configured by hand. Crashes sometimes led to days of downtime -- and Delmanowski realized that a configuration management system was needed. Starting with a Debian base, DebOps is a group of Ansible playbooks that configure an entire data infrastructure. The project has been implemented in many different working environments, and the founders plan to continue supporting and improving it as time goes on. - -### 2015 Open Source Rookie of the Year: Code Combat ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_03-100564904-gallery.idge.jpg) - -The traditional pen-and-paper way of learning falls short for technical subjects. Games, however, are all about engagement -- which is why the founders of [CodeCombat][5] went about creating a multiplayer programming game to teach people how to code. - -At its inception, CodeCombat was an idea for a startup, but the founders decided to create an open source project instead. The idea blossomed within the community, and the project gained contributors at a steady rate. A mere two months after its launch, the game was accepted into Google’s Summer of Code. The game reaches a broad audience and is available in 45 languages. CodeCombat hopes to become the standard for people who want to learn to code and have fun at the same time. - -### 2015 Open Source Rookie of the Year: Storj ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_04-100564905-gallery.idge.jpg) - -[Storj][6] is a peer-to-peer cloud storage network that implements end-to-end encryption, enabling users to transfer and share data without reliance on a third party. Based on bitcoin blockchain technology and peer-to-peer protocols, Storj provides secure, private, and encrypted cloud storage. - -Opponents of cloud-based data storage worry about cost efficiencies and vulnerability to attack. Intended to address both concerns, Storj is a private cloud storage marketplace where space is purchased and traded via Storjcoin X (SJCX). Files uploaded to Storj are shredded, encrypted, and stored across the community. File owners are the sole individuals who possess keys to the encrypted information. - -The proof of concept for this decentralized cloud storage marketplace was first presented at the Texas Bitcoin Conference Hackathon in 2014. After winning first place in the hackathon, the project founders and leaders used open forums, Reddit, bitcoin forums, and social media to grow an active community, now an essential part of the Storj decision-making process. - -### 2015 Open Source Rookie of the Year: Neovim ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_05-100564906-orig.jpg) - -Since its inception in 1991, Vim has been a beloved text editor adopted by millions of software developers. [Neovim][6] is the next generation. - -The software development ecosystem has experienced exponential growth and innovation over the past 23 years. Neovim founder Thiago de Arruda knew that Vim was lacking in modern-day features and development speed. Although determined to preserve the signature features of Vim, the community behind Neovim seeks to improve and evolve the technology of its favorite text editor. Crowdfunding initially enabled de Arruda to focus six uninterrupted months on launching this endeavor. He credits the Neovim community for supporting the project and for inspiring him to continue contributing. - -### 2015 Open Source Rookie of the Year: CockroachDB ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_06-100564907-orig.jpg) - -Former Googlers are bringing a big-company data solution to open source in the form of [CockroachDB][8], a scalable, geo-replicated, transactional data store. - -To maintain the terabytes of data transacted over its global online properties, Google developed Spanner. This powerful tool provides Google with scalability, survivability, and transactionality -- qualities that the team behind CockroachDB is serving up to the open source community. Like an actual cockroach, CockroachDB can survive without its head, tolerating the failure of any node. This open source project has a devoted community of experienced contributors, actively cultivated by the founders via social media, GitHub, networking, conferences, and meet-ups. - -### 2015 Open Source Rookie of the Year: Kubernetes ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_07-100564908-orig.jpg) - -In introducing containerized software development to the open source community, [Docker][9] has become the backbone of a strong, innovative set of tools and technologies. [Kubernetes][10], which Google introduced last June, is an open source container management tool used to accelerate development and simplify operations. - -Google has been using containers for years in its internal operations. At the summer 2014 DockerCon, the Internet giant open-sourced Kubernetes, which was developed to meet the needs of the exponentially growing Docker ecosystem. Through collaborations with other organizations and projects, such as Red Hat and CoreOS, Kubernetes project managers have grown their project to be the No. 1 downloaded tool on the Docker Hub. The Kubernetes team hopes to expand the project and grow the community, so software developers can spend less time managing infrastructure and more time building the apps they want. - -### 2015 Open Source Rookie of the Year: Open Bazaar ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_08-100564909-orig.jpg) - -[OpenBazaar][11] is a decentralized marketplace for trading with anyone using bitcoin. The proof of concept for OpenBazaar was born at a hackathon, where its founders combined BitTorent, bitcoin, and traditional financial server methodologies to create a censorship-resistant trading platform. The OpenBazaar team sought new members, and before long they were able to expand the OpenBazaar community immensely. The table stakes of OpenBazaar -- transparency and a common goal to revolutionize trade and commerce -- are helping founders and contributors work toward a real-world, uncontrolled, and decentralized marketplace. - -### 2015 Open Source Rookie of the Year: IPFS ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_09-100564910-orig.jpg) - -[IPFS (InterPlanetary File System)][12] is a global, versioned, peer-to-peer file system.It synthesizes many of the ideas behind Git, BitTorrent, and HTTP to bring a new data and data structure transport protocol to the open Web. - -Open source is known for developing simple solutions to complex problems that result in many innovations, but these powerful projects represent only one slice of the open source community. IFPS belong to a more radical group whose proof of concept seems daring, outrageous, and even unattainable -- in this case, a peer-to-peer distributed file system that seeks to connect all computing devices. This possible HTTP replacement maintains a community through multiple mediums, including the Git community and an IRC channel that has more than 100 current contributors. This “crazy” idea will be available for alpha testing in 2015. - -### 2015 Open Source Rookie of the Year: cAdvisor ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_10-100564911-orig.jpg) - -[cAdvisor (Container Advisor)][13] is a daemon that collects, aggregates, processes, and exports information about running containers, providing container users with an understanding of resource usage and performance characteristics. For each container, cAdvisor keeps resource isolation parameters, historical resource usage, histograms of complete historical resource usage, and network statistics. This data is exported by container and across machines. - -cAdvisor can run on most Linux distros and supports many container types, including Docker. It has become the de facto monitoring agent for containers, has been integrated into many systems, and is one of the most downloaded images on the Docker Hub. The team hopes to grow cAdvisor to understand application performance more deeply and to integrate this information into clusterwide systems. - -### 2015 Open Source Rookie of the Year: Terraform ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_11-100564912-orig.jpg) - -[Terraform][14] provides a common configuration to launch infrastructure, from physical and virtual servers to email and DNS providers. The idea is to encompass everything from custom in-house solutions to services offered by public cloud platforms. Once launched, Terraform enables ops to change infrastructure safely and efficiently as the configuration evolves. - -Working at a devops company, Terraform.io's founders identified a pain point in codifying the knowledge required to build a complete data center, from plugged-in servers to a fully networked and functional data center. Infrastructure is described using a high-level configuration syntax, which allows a blueprint of your data center to be versioned and treated as you would any other code. Sponsorship from the well-respected open source company HashiCorp helped launch the project. - -### Honorable mention: Docker Fig ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_12-100564913-orig.jpg) - -[Fig][15] provides fast, isolated development environments using [Docker][16]. It moves the configuration required to orchestrate Docker into a simple fig.yml file. It handles all the work of building and running containers and forwarding their ports, as well as sharing volumes and linking them. - -Orchard formed Fig last year to create a new system of tools to make Docker work. It was developed as a way of setting up development environments with Docker, enabling users to define the exact environment for their apps, while also running databases and caches inside Docker. Fig solved a major pain point for developers. Docker fully supports this open source project and [recently purchased Orchard][17] to expand the reach of Fig. - -### Honorable mention: Drone ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_13-100564916-orig.jpg) - -[Drone][18] is a Continuous Integration platform built on Docker and [written in Go][19]. The Drone project grew out of frustration with existing available technologies and processes for setting up development environments. - -Drone provides a simple approach to automated testing and continuous delivery: Simply pick a Docker image tailored to your needs, connect GitHub, and commit. Drone uses Docker containers to provision isolated testing environments, giving every project complete control over its stack without the burden of traditional server administration. The community behind Drone is 100 contributors strong and hopes to bring this project to the enterprise and to mobile app development. - -### Open source rookies ### - -![](http://images.techhive.com/images/article/2015/01/open_source_rookies_14-100564941-orig.jpg) - -- [Open Source Rookies of the 2014 Year][20] -- [InfoWorld's 2015 Technology of the Year Award winners][21] -- [Bossies: The Best of Open Source Software Awards][22] -- [15 essential open source tools for Windows admins][23] - --------------------------------------------------------------------------------- - -via: http://www.infoworld.com/article/2875439/open-source-software/the-top-10-rookie-open-source-projects.html - -作者:[Black Duck Software][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.infoworld.com/author/Black-Duck-Software/ -[1]:https://www.blackducksoftware.com/open-source-rookies -[2]:https://www.openhub.net/ -[3]:https://github.com/debops/debops -[4]:http://www.infoworld.com/article/2612397/data-center/review--ansible-orchestration-is-a-veteran-unix-admin-s-dream.html -[5]:https://codecombat.com/ -[6]:http://storj.io/ -[7]:http://neovim.org/ -[8]:https://github.com/cockroachdb/cockroach -[9]:http://www.infoworld.com/resources/16373/application-virtualization/the-beginners-guide-to-docker -[10]:http://kubernetes.io/ -[11]:https://openbazaar.org/ -[12]:http://ipfs.io/ -[13]:https://github.com/google/cadvisor -[14]:https://www.terraform.io/ -[15]:http://www.fig.sh/ -[16]:http://www.infoworld.com/resources/16373/application-virtualization/the-beginners-guide-to-docker -[17]:http://www.infoworld.com/article/2608546/application-virtualization/docker-acquires-orchard-in-a-sign-of-rising-ambitions.html -[18]:https://drone.io/ -[19]:http://www.infoworld.com/article/2683845/google-go/164121-Fast-guide-to-Go-programming.html -[20]:https://www.blackducksoftware.com/open-source-rookies -[21]:http://www.infoworld.com/article/2871935/application-development/infoworlds-2015-technology-of-the-year-award-winners.html -[22]:http://www.infoworld.com/article/2688104/open-source-software/article.html -[23]:http://www.infoworld.com/article/2854954/microsoft-windows/15-essential-open-source-tools-for-windows-admins.html diff --git a/translated/talk/20150128 The top 10 rookie open source projects.md b/translated/talk/20150128 The top 10 rookie open source projects.md new file mode 100644 index 0000000000..c642786914 --- /dev/null +++ b/translated/talk/20150128 The top 10 rookie open source projects.md @@ -0,0 +1,153 @@ +sevenot translated +排名前十的年度开源项目新秀 +================================================================================ +黑鸭(Black Duck)软件公布了一份名叫“年度开源项目新秀”的报告,介绍了由全球开源协会发起的10个最有趣、最活跃的新项目。 + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_01-100564902-orig.jpeg) + +### 年度开源项目新秀 ### + +每年都有上千新的开源项目问世,但只有少数能够真正的吸引我们的关注。一些项目因为利用了当前比较流行的技术而发展壮大,有一些则真正地开启了一个新的邻域。很多开源项目建立的初衷是为了解决一些生产上的问题,还有一些项目则是世界各地志同道合的开发者们共同发起的一个宏伟项目。 + +从2009年起,开源软件公司黑鸭便发起了[年度开源项目新秀][1]这一活动,它的评选根据[Open Hub][2] 网站(即以前的Ohloh)。今年,我们很荣幸能够报道2015年10大开源项目新秀的得主和2名荣誉奖得主,它们是从上千个开源项目中脱颖而出的。评选采用了加权评分系统,得分标准基于项目的活跃度,交付速度,和几个其它因数。 + +开源俨然成为了产业创新的引擎,就拿今年来说,和Docker容器相关的开源项目在全球各地新起,这也不恰巧反映了企业最感兴趣的技术邻域吗?最后,我们接下来介绍的项目,将会让你了解到全球开源项目的开发者们的在思考什么,这很快将会成为一个指引我们发展的领头羊。 + +### 2015年度开源项目新秀: DebOps ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_02-100564903-orig.jpeg) + +[DebOps][3]收集打包了一套[Ansible][4] (Ansible是一种自动化运维工具)方案和规则,可以从1个容器扩展到一个完整的数据中心。它的创始人Maciej Delmanowski将DebOps开源来保证项目长久进行,从而更好的利用外部贡献者来发展下去 + +DebOps始创于波兰的一个不起眼大学校园里,在自己的数据中心上运行,一切都是手工配置的。有时系统崩溃而导致几天的宕机,这时Delmanowski意识到一个配置管理系统是很有必要的。从Debian的基础做起,DebOps是一组配置一整个数据基础设施Ansible方案。此项目已经在许多不同的工作环境下实现,而创始者们则打算继续支持和开发这个项目。 + +###2015年度开源项目新秀: Code Combat ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_03-100564904-gallery.idge.jpg) + +传统的纸笔学习方法已近不能满足技术学科了。然而游戏都是关于参与者,这也就是为什么[CodeCombat][5] 的创始人会去开发一款多人协同编程游戏来教人们如何编码。 + +刚开始CodeCombat是一个创业想法,但其创始人决定创建一个开源项目将其取代。此想法在社区传播开来,很快不少贡献者加入到项目中来。项目发起仅仅两个月后,这款游戏就被收入Google’s Summer of Code。这款游戏吸引了大量玩家,并被翻译成45种语言。CodeCombat希望成为那些想要一边学习代码同时获得乐趣的同学的风向标。 + +### 2015年度开源项目新秀: Storj ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_04-100564905-gallery.idge.jpg) + +[Storj][6]是一个点对点的云存储网络,可实现端到端加密,保证用户不用依赖第三方即可传输、共享数据。基于比特币block chain技术和点对点协议,Storj提供安全、私密、加密的云存储。 + +云数据存储的反对者担心成本开销和漏洞攻击。为了做到没有死角,Storj是一个私有云存储市场,用户可以通过Storjcoin X(SJCX) 购买交易存储空间。上传到Storj的文件会被粉碎、加密和存储到整个社区。只有文件所有者拥有密钥加密的信息 + +在2014年举办的Texas Bitcoin Conference Hackathon会议上,云存储市场概念首次被提出并证明可行。在第一次赢得黑客马拉松活动后,项目创始人们和领导团队利用开源论坛Reddit、比特币论坛和社交媒体推广此项目。如今,它们已成为Storj决策过程的一个重要组成部分。 + +### 2015年度开源项目新秀: Neovim ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_05-100564906-orig.jpg) + +自1991年提出概念以来,Vim已经成为数以百万计软件开发人员所钟爱的文本编辑器。 [Neovim][6] 是它的下一个版本。 + +  在过去的23年里,软件开发生态系统经历了无数增长和创新。Neovim创始人Thiago de Arruda知道Vim缺少当代元素,跟不上时代的发展。在保留Vim的签名功能的前提下,Neovim团队同样在寻求最受欢迎的文本编辑器改善和发展技术。集资初期,Thiago de Arruda连续6个月时间关注推出此项目。他相信他的团队和支持他激励他继续发展Neovim。 + +### 2015年度开源项目新秀: CockroachDB ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_06-100564907-orig.jpg) + +前谷歌员工开发了一个开源的企业数据存储项目[CockroachDB][8],它是一个可扩展的、跨地域复制且支持事务的数据存储的解决方案。 + +为了保证在线百万兆字节流量业务的质量,Google公开了他们的Spanner系统,这是一个可扩展的,稳定的,支持事务的系统。许多参与开发CockroachDB的团队现在都服务与开源社区。就像真正的蟑螂一样,CockroachDB可以在没有数据头、没有任何节点的情况下正常运行。这个开源项目有很多富有经验的贡献者,创始人们通过社会媒体、Github、网络、会议和聚会结识他们并鼓励他们参与其中。 + +### 2015年度开源项目新秀: Kubernetes ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_07-100564908-orig.jpg) + +在介绍集装箱化的软件对开源社区的发展时,[Docker][9]是一匹黑马,它在技术和工具的设置上做了创新。去年6月谷歌推出了[Kubernetes][10],这是一款开源的容器管理工具,用来加快开发和简化操作。 + +谷歌在它的网络系统上使用容器技术多年了。在2014年夏天的DockerCon上大会上,谷歌这个互联网巨头开源了Kubernetes,Kubernetes的开发是为了满足迅速增长的Docker生态系统的需要。通过和其它的组织、项目合作,比如 Red Hat和CoreOS,Kubernetes的管理者们促使它登上了Docker Hub的工具下载榜榜首。Kubernetes的开发团队希望扩大这个项目,发展它的社区,这样的话软件开发者就能花更少的时间在管理基础设施上,而更多的去开发他们自己的APP。 + +### 2015年度开源项目新秀: Open Bazaar ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_08-100564909-orig.jpg) + +OpenBazaar是一个使用比特币和其他人交易的市场。OpenBazaar这一概念最早在编程马拉松(hackathon)活动中被提出,它的创始人结合了BitTorent,比特币和传统的金融服务方式,创造了一个不受审查的交易平台。OpenBazaar的开发团队在寻求新的成员,而且不久以后他们将无限扩大Open Bazaar的社区。Open Bazaar旨在透明度和同一个目标去在商务交易中掀起一场革命,这会帮助创始人和贡献者向着一个真实的世界奋斗,一个没有控制,分散的市场。 + +### 2015年度开源项目新秀: IPFS ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_09-100564910-orig.jpg) + +IPFS 是一个全球的点对点式的分布式版本文件系统。它综合了Git,BitTorrent,HTTP的思想,开启了一个新的数据和数据结构传输协议。 + +开源被人们所知晓的原因,是它本意用简单的方法解决复杂的问题,这样产生许多新颖的想法,但是着些强大的项目仅仅是开源社区的冰山一角。IFPS有一个积极的团队,这个概念的提出是大胆的,令人惊讶的,有点甚至高不可攀。这样来看,一个点对点的分布是文件系统是在寻找所有连在一起的计算设备。也许HTTP的更换可以靠着通过多种手段继续保持一个社区,包括Git社区和超过100名贡献者的IRC。这个疯狂的想法将在2015年进行软件内部测试。 + +### 2015年度开源项目新秀: cAdvisor ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_10-100564911-orig.jpg) + +[cAdvisor (Container Advisor)][13] 是一个针对在运行中的容器进行收集,合计,处理和输出信息的工具,它可以给容器的使用者提供资源的使用情况和工作特性。对于每一个容器,cAdvisor记录着资源的分离参数,资源使用历史,资源使用历史对比框图,网络状态。这些从容器输出的数据在机器中传递。 + +cAdvisor可以在绝大多数的Linux上运行,并且支持包括Docker在内的多种容器类型。事实上它成为了一种容器的代理,并被集成在了很多系统中。cAdvisor在DockerHub下载量也是位居前茅。cAdvisor的开发团队希望把cAdvisor发展到能够更深入地理解应用并且集成到集群系统。 + +### 2015年度开源项目新秀: Terraform ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_11-100564912-orig.jpg) + +[Terraform][14]提供了一些列的设置来创建一个基础设施,从物理机到虚拟机再到email服务器、DNS服务器。这个概念包括从家庭个人机解决方案到公共云平台提供的服务。一旦建立好了以后,Terraform便进行一系列的操作来改变你的基础设施,安全又高效,就如同配置一样。 + +如果你在Devops模式下的公司里工作,Terraform.io的创始者找到了一个窍门把建立一个完整的数据中心所需的知识结合在一起,从插入服务器到整个网络和功能齐备的数据中心。基础设施的描述采用高级的配置语法,允许你把数据中心的蓝图做成多版本并且可以使用多种代码。著名开源公司HashiCorp赞助开发这个项目。 + +### 荣誉奖: Docker Fig ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_12-100564913-orig.jpg) + +[Fig][15] 为[Docker][16]的使用提供了一个快速的,分离的开发环境。Docker的移植只需要将配置信息放到一个简单的 fig.yml文件里。它会处理所有工作,包括建立、运行,端口转发,分享磁盘和容器链接。 + Fig solved a major pain point for developers. Docker fully supports this open source project and [recently purchased Orchard][17] to expand the reach of Fig. +Orchard去年发起了Fig,来创造一个使Docker工作的系统工具。它的开发像是为Docker设置开发环境,为了确保用户能够为他们的APP准确定义环境,在Docker中会运行数据库和缓存。Fig解决了开发者的一个难题。Docker全面支持这个开源项目,最近将买下Orchard来扩张这个项目。 + +### 荣誉奖: Drone ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_13-100564916-orig.jpg) + +[Drone][18]是一个基于Docker的持续集成平台,而且它是用Go语言写的。Drone项目不满于现存的技术和流程,它旨在开发环境。 + +Drone提供了一个简单的自动测试和持续交付的方法:简单选择一个Docker形象来满足你的需求,连接并提交至GitHub即可。Drone使用Docker容器来提供隔离的测试环境,让每个项目完全自主控制堆栈,没有传统的服务器管理的负担。Drone背后的100位社区贡献者强烈希望把这个项目带到企业和移动应用程序开发中 +### 开源新秀 ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_14-100564941-orig.jpg) + +- [2014年度开源项目新秀][20] +- [InfoWorld2015年年度技术奖][21] +- [Bossies: 开源软件最高荣誉][22] +- [ Windows管理员15个必不可少的开源工具][23] + +-------------------------------------------------------------------------------- + +via: http://www.infoworld.com/article/2875439/open-source-software/the-top-10-rookie-open-source-projects.html + +作者:[Black Duck Software][a] +译者:[sevenot](https://github.com/sevenot) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.infoworld.com/author/Black-Duck-Software/ +[1]:https://www.blackducksoftware.com/open-source-rookies +[2]:https://www.openhub.net/ +[3]:https://github.com/debops/debops +[4]:http://www.infoworld.com/article/2612397/data-center/review--ansible-orchestration-is-a-veteran-unix-admin-s-dream.html +[5]:https://codecombat.com/ +[6]:http://storj.io/ +[7]:http://neovim.org/ +[8]:https://github.com/cockroachdb/cockroach +[9]:http://www.infoworld.com/resources/16373/application-virtualization/the-beginners-guide-to-docker +[10]:http://kubernetes.io/ +[11]:https://openbazaar.org/ +[12]:http://ipfs.io/ +[13]:https://github.com/google/cadvisor +[14]:https://www.terraform.io/ +[15]:http://www.fig.sh/ +[16]:http://www.infoworld.com/resources/16373/application-virtualization/the-beginners-guide-to-docker +[17]:http://www.infoworld.com/article/2608546/application-virtualization/docker-acquires-orchard-in-a-sign-of-rising-ambitions.html +[18]:https://drone.io/ +[19]:http://www.infoworld.com/article/2683845/google-go/164121-Fast-guide-to-Go-programming.html +[20]:https://www.blackducksoftware.com/open-source-rookies +[21]:http://www.infoworld.com/article/2871935/application-development/infoworlds-2015-technology-of-the-year-award-winners.html +[22]:http://www.infoworld.com/article/2688104/open-source-software/article.html +[23]:http://www.infoworld.com/article/2854954/microsoft-windows/15-essential-open-source-tools-for-windows-admins.html From 3ba301d27e497c72fd32071b48c583d97f933bb4 Mon Sep 17 00:00:00 2001 From: joeren Date: Thu, 18 Jun 2015 09:07:36 +0800 Subject: [PATCH 128/153] Update 20150617 The Art of Command Line.md --- sources/tech/20150617 The Art of Command Line.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150617 The Art of Command Line.md b/sources/tech/20150617 The Art of Command Line.md index d7fb3a5aff..d951d1d45f 100644 --- a/sources/tech/20150617 The Art of Command Line.md +++ b/sources/tech/20150617 The Art of Command Line.md @@ -1,3 +1,4 @@ +Translating by GOLinux! The Art of Command Line ================================================================================ - [Basics](#basics) @@ -432,4 +433,4 @@ via: https://github.com/jlevy/the-art-of-command-line [17]: [18]: [19]: -[20]: \ No newline at end of file +[20]: From 8060d5563571f07ef871b1d2a05dcdf00fba7437 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 18 Jun 2015 10:10:39 +0800 Subject: [PATCH 129/153] =?UTF-8?q?PUB:20150515=20Install=20'Tails=201.4?= =?UTF-8?q?=E2=80=B2=20Linux=20Operating=20System=20to=20Preserve=20Privac?= =?UTF-8?q?y=20and=20Anonymity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @FSSlc --- ... System to Preserve Privacy and Anonymity.md | 112 ++++++++++-------- 1 file changed, 62 insertions(+), 50 deletions(-) rename {translated/tech => published}/20150515 Install 'Tails 1.4′ Linux Operating System to Preserve Privacy and Anonymity.md (57%) diff --git a/translated/tech/20150515 Install 'Tails 1.4′ Linux Operating System to Preserve Privacy and Anonymity.md b/published/20150515 Install 'Tails 1.4′ Linux Operating System to Preserve Privacy and Anonymity.md similarity index 57% rename from translated/tech/20150515 Install 'Tails 1.4′ Linux Operating System to Preserve Privacy and Anonymity.md rename to published/20150515 Install 'Tails 1.4′ Linux Operating System to Preserve Privacy and Anonymity.md index a7e9d4e6b8..4266bba59c 100644 --- a/translated/tech/20150515 Install 'Tails 1.4′ Linux Operating System to Preserve Privacy and Anonymity.md +++ b/published/20150515 Install 'Tails 1.4′ Linux Operating System to Preserve Privacy and Anonymity.md @@ -1,41 +1,41 @@ -安装 Tails 1.4 Linux 操作系统来保护隐私和保持匿名 +用 Tails 1.4 Linux 系统来保护隐私和保持匿名 ================================================================================ -在这个互联网世界和互联网的世界中,我们在线执行我们的大多数任务,无论是订票,汇款,研究,商务,娱乐,社交网络,还是其他。每天我们花费大部分时间在网络上。在每个逝去的日子里,在网络中保持匿名变得越来越难,尤其是在被某些机构例如 NSA (National Security Agency,国安局) 植入后门的情况下,这些机构嗅探着我们在网络中的所有动作。在网络中,我们有着极少,或者说根本就没有隐私。基于用户浏览网络的活动和机器的活动的搜索都被记录了下来。 +在这个互联网世界和互联网的世界中,我们在线执行我们的大多数任务,无论是订票,汇款,研究,商务,娱乐,社交网络,还是其它。每天我们花费大部分时间在网络上。在过去这些的日子里,在网络中保持匿名变得越来越难,尤其是在被某些机构例如 NSA (National Security Agency) 植入后门的情况下,他们嗅探着我们在网络中的所有动作。在网络中,我们有着极少的,或者说根本就没有隐私。基于用户浏览网络的活动和机器的活动的搜索都被记录了下来。 -一个来自于 Tor 项目的绝妙浏览器正被上百万人使用,它帮助我们匿名地浏览网络,即使这样,跟踪你的浏览习惯也并不难,所以只使用 Tor 并不能保证你的网络安全。你可以从下面的链接中查看 Tor 的特点及安装指南。 +一款来自于 Tor 项目的绝妙浏览器正被上百万人使用,它帮助我们匿名地浏览网络,即使这样,跟踪你的浏览习惯也并不难,所以只使用 Tor 并不能保证你的网络安全。你可以从下面的链接中查看 Tor 的特点及安装指南。 - [使用 Tor 来进行匿名网络浏览][1] -Tor 项目中有一个名为 Tails 的操作系统。Tails (The Amnesic Incognito Live System) 是一个 live 操作系统,基于 Debian Linux 发行版本,主要着眼于在浏览网络时在网络中保护隐私和匿名,这意味着所有的外向连接都强制通过 Tor 来连接,直接的(非匿名的) 连接请求都会被阻挡。该系统被设计为可在任何可启动介质上运行,例如 USB 或 DVD。 +Tor 项目中有一个名为 Tails 的操作系统。Tails (The Amnesic Incognito Live System) 是一个 live 操作系统,基于 Debian Linux 发行版本,主要着眼于在浏览网络时在网络中保护隐私和匿名,这意味着所有的外向连接都强制通过 Tor 来连接,直接的(非匿名的) 连接请求都会被阻挡。该系统被设计为可在任何可启动介质上运行,例如 USB 棒或 DVD。 -Tails OS 的最新稳定发行版本为 1.4 , 于 2015 年 5 月 12 日发行。Tails 由开源单片 Linux 内核支持,构建在 Debian GNU/Linux 之上,着眼于个人电脑市场, 使用 GNOME 3 作为其默认的用户界面。 +Tails OS 的最新稳定发行版本为 1.4 , 于 2015 年 5 月 12 日发行。Tails 由开源的 Linux 宏内核所驱动,构建在 Debian GNU/Linux 之上,着眼于个人电脑市场, 使用 GNOME 3 作为其默认的用户界面。 #### Tails OS 1.4 的特点 #### -- Tails 是一个 free 的操作系统, free 的意义正如 免费(free)啤酒和言论自由(free) 中的 free +- Tails 是一个 free 的操作系统, free 的意义不仅是免费(free)啤酒的免费,也是言论自由(free) 中的自由 - 构建在 Debian/GNU Linux 操作系统之上, Debian 是使用最广泛的通用操作系统 - 着眼于安全的发行版本 -- 有 Windows 8 外观作为其伪装 +- 伪装成 Windows 8 外观 - 不必安装就可以使用 Live Tails CD/DVD 来匿名浏览网络 -- 当 Tails 运行时,不留下任何痕迹 +- 当 Tails 运行时,不会在计算机上留下任何痕迹 - 使用先进的加密工具来加密任何相关文件,邮件等内容 - 通过 Tor 网络来发送和接收流量 -- 在真正意义上为任何人在任何地方保护隐私 -- 在 Live 环境中带有一些可用的应用 +- 真正意义地无论何时何处保护隐私 +- 在 Live 环境中带有一些立即可用的应用 - 系统自带的所有软件都预先配置好只通过 Tor 网络来连接到互联网 -- 任何不通过 Tor 网络而尝试连接网络的应用都将被自动阻拦。 +- 任何不通过 Tor 网络而尝试连接网络的应用都将被自动阻拦 - 限制那些想查看你正在浏览什么网站的人的行动,并限制网站获取你的地理位置 - 连接到那些被墙或被审查的网站 -- 特别设计不使用主操作系统的空间,即使在 swap 空间还有空余的情况下 -- 整个操作系统加载在 RAM 中,在每次重启或关机后会自动擦除掉,所以不会留下任何运行的痕迹。 +- 特别设计不使用主操作系统的空间,即便是 swap 空间也不用 +- 整个操作系统加载在内存中,在每次重启或关机后会自动擦除掉,所以不会留下任何运行的痕迹。 - 先进的安全实现,通过加密 USB 磁盘, HTTPS 应答加密和对邮件,文档进行签名。 -#### 在 Tails 1.4 中可期待的东西 #### +#### 在 Tails 1.4 中所期待的东西 #### - 带有安全滑块的 Tor 浏览器 4.5 - Tor 被升级到版本 0.2.6.7 - 修补了几个安全漏洞 -- 针对诸如 curl, OpenJDK 7, tor Network, openldap 等应用, 许多漏洞被修复并打上了补丁 +- 针对诸如 curl、 OpenJDK 7、 tor Network、 openldap 等应用, 许多漏洞被修复并打上了补丁 要得到完整的更改记录,你需要访问 [这里][2] @@ -43,7 +43,7 @@ Tails OS 的最新稳定发行版本为 1.4 , 于 2015 年 5 月 12 日发行 #### 为什么我应该使用 Tails 操作系统 #### -你需要 Tails 因为你想: +你需要 Tails 因为你想: - 在网络监控下保持自由 - 捍卫自由,隐私和秘密 @@ -62,85 +62,96 @@ Tails OS 的最新稳定发行版本为 1.4 , 于 2015 年 5 月 12 日发行 - [tails-i386-1.4.iso][3] - [tails-i386-1.4.torrent][4] -2. 下载后,可使用 SHA256SUM 来获取 ISO 文件的哈希值并与官方提供的值相比较,以核实 ISO 文件的完整性 +2. 下载后,可使用 sha256sum 来获取 ISO 文件的哈希值并与官方提供的值相比较,以核实 ISO 文件的完整性 $ sha256sum tails-i386-1.4.iso 339c8712768c831e59c4b1523002b83ccb98a4fe62f6a221fee3a15e779ca65d -假如你熟悉 OpenPGP ,将 Tails 的签名密钥与 Debian 的 keyring 相比较以验证其签名,若想了解任何有关 Tails 的加密签名,请将浏览器指向 [这里][5] +假如你熟悉 OpenPGP ,将 Tails 的签名密钥与 Debian 的 keyring 相比较以验证其签名,若想了解任何有关 Tails 的加密签名,请用浏览器访问 [这里][5] -3. 下一步,你需要将镜像写入 USB 或 DVD ROM 中。或许你需要看看这篇文章 [如何创建一个 Live 可启动的 USB][6] 以了解如何使得一个闪存驱动器变得可启动并向它写入 ISO 镜像文件。 +3. 下一步,你需要将镜像写入 USB 棒或 DVD ROM 中。或许你需要看看这篇文章 “[如何创建一个 Live 可启动的 USB棒][6] ”以了解如何使得一个闪存盘变得可启动并向它写入 ISO 镜像文件。 -4. 插入 Tails OS 可启动闪存驱动器或 DVD ROM,并从那里启动 (在 BIOS 中选择该介质来启动)。第一个屏幕中会有两个选项 'Live' 和 'Live (failsafe)' 让你选择。选择 'Live' 并确定。 +4. 插入 Tails OS 的可启动闪存盘或 DVD ROM,并从那里启动 (在 BIOS 中选择该介质来启动)。第一个屏幕中会有两个选项 'Live' 和 'Live (failsafe)' 让你选择。选择 'Live' 并确定。 ![Tails 启动菜单](http://www.tecmint.com/wp-content/uploads/2015/05/1.png) -Tails 启动菜单 + +*Tails 启动菜单* 5. 在登录之前,你有两个选项, 假如你想配置并设定高级选项,点击 '更多选项' 否则点击 'NO'。 ![Tails 欢迎界面](http://www.tecmint.com/wp-content/uploads/2015/05/2.png) -Tails 欢迎界面 -6. 在点击高级选项后,你需要设置 root 密码。假如你想升级它,这是非常重要的。这个 root 密码将会一直有效,知道你关机或重启。 +*Tails 欢迎界面* -另外,若你想开启 Windows 伪装,假如你想在一个公共场所运行这个操作系统,这将使得看起来你正在运行 Windows 8 操作系统。这真是一个好的选项!不是吗?另外,你还有一个选项来配置 网络和 Mac 地址,当一切准备完毕后,点击 '登录' ! +6. 在点击高级选项后,你需要设置 root 密码。假如你想升级它,这是非常重要的。这个 root 密码的有效期将持续到你关机或重启。 + +另外,若你想开启 Windows 伪装,假如你想在一个公共场所运行这个操作系统,这将使得看起来你正在运行 Windows 8 操作系统。这真是一个好的选项!不是吗?另外,你还有一个选项来配置网络和 Mac 地址,当一切准备完毕后,点击 '登录' ! ![Tails OS 的配置](http://www.tecmint.com/wp-content/uploads/2015/05/3.png) -Tails OS 的配置 + +*Tails OS 的配置* 7. 这是使用 Windows 皮肤伪装的 Tails GNU/Linux OS: ![Tails 的 Windows 伪装](http://www.tecmint.com/wp-content/uploads/2015/05/4.jpg) -Tails 的 Windows 伪装 -8. 系统将在后台启动 Tor 网络。在屏幕的右上角查看通知 – Tor 已经准备好了 或现在你已经连接上了互联网。 +*Tails 的 Windows 伪装* -你也可以在 Internet 菜单下查看它包含了哪些东西。 注意 – 它包含有 Tor 浏览器(安全的) 和 不安全的网络浏览器(其中的向内和向外数据不通过 Tor 网络) 和其他应用。 +8. 系统将在后台启动 Tor 网络。在屏幕的右上角查看通知 :“Tor 已经准备好了,现在你已经连接上了互联网”。 + +你也可以在 Internet 菜单下查看它包含了哪些东西。 注意 :它包含有 Tor 浏览器(安全的) 和 不安全的网络浏览器(其中的向内和向外数据不通过 Tor 网络) 和其他应用。 ![Tails 菜单和工具](http://www.tecmint.com/wp-content/uploads/2015/05/5.jpg) -Tails 菜单和工具 + +*Tails 菜单和工具* 9. 点击 Tor 并检查你的 IP 地址。 它确认我的物理位置没有被分享以及我的隐私未被触动。 ![在 Tails 上检查隐私](http://www.tecmint.com/wp-content/uploads/2015/05/6.jpg) -在 Tails 上检查隐私 -10. 你还可以激活 Tails 安装器来从 ISO 镜像文件中 克隆和安装, 克隆和升级以及升级系统。 +*在 Tails 上检查隐私* + +10. 你还可以激活 Tails 安装器来“克隆和安装”, “克隆和升级”以及“从 ISO 镜像文件中升级系统”。 ![Tails 安装器选项](http://www.tecmint.com/wp-content/uploads/2015/05/7.jpg) -Tails 安装器选项 -11. 其他选项为选择 Tor 不带有高级选项,就在登录之前。(查看上面的第 5 步). +*Tails 安装器选项* -![Tails 未带有高级选项](http://www.tecmint.com/wp-content/uploads/2015/05/8.png) -Tails 未带有高级选项 +11. 如果选择另外的那个不带有高级选项的方式,那就直接登录。(查看上面的第 5 步). -12. 你将登录到 Gnome3 桌面环境。 +![不设置高级选项的 Tails](http://www.tecmint.com/wp-content/uploads/2015/05/8.png) + +*不设置高级选项的 Tails* + +12. 这将登录到 Gnome3 桌面环境。 ![Tails Gnome 桌面](http://www.tecmint.com/wp-content/uploads/2015/05/9.png) -Tails Gnome 桌面 -13. 假如你点击启动不安全的浏览器,无论在带有伪装,还是没有带有伪装的情况下,你都将会收到弹窗通知。 +*Tails Gnome 桌面* + +13. 假如你点击启动不安全的浏览器,无论是否带有地址伪装,你都将会收到弹窗通知。 ![Tails 浏览通知](http://www.tecmint.com/wp-content/uploads/2015/05/10.png) -Tails 浏览通知 + +*Tails 浏览通知* 假如你仍启动不安全的浏览器,你将在浏览器中看到如下网页: ![Tails 浏览警告](http://www.tecmint.com/wp-content/uploads/2015/05/11.png) -Tails 浏览警告 + +*Tails 浏览警告* #### Tails 适合我吗?#### 要想得到上面问题的答案,首先回答如下的问题: -- 在上网时,你想你的隐私未被触动吗? -- 你想在身份信息窃取者的眼皮底下保持隐身吗? +- 在上网时,你想你的隐私不被触动吗? +- 你想在窃取身份信息的人的眼皮底下保持隐身吗? - 你想在你的网上私人聊天过程中被他人嗅探吗? - 你真的想向任何人展示你的地理位置吗? - 你开展银行网上交易吗? -- 你愿意受政府和 ISP(注:网络提供商) 的审查吗? +- 你愿意受政府和 ISP的审查吗? 假如以上问题中,任意一个问题的答案为 'YES',则你最好需要 Tails。假如上面所有的问题的答案都是 'NO',则或许你不需要它。 @@ -150,27 +161,28 @@ Tails 浏览警告 ### 总结 ### -对于那些工作在不安全环境中的人来说,Tails 是一个必需的操作系统。Tails 还是一个着眼于安全的操作系统,现在为止,包含一大批应用 – Gnome 桌面, Tor, Firefox (Iceweasel), Network Manager, Pidgin, Claws mail, Liferea feed addregator, Gobby, Aircrack-ng, I2P。 +对于那些工作在不安全环境中的人来说,Tails 是一个必需的操作系统。Tails 还是一个着眼于安全的操作系统,现在为止,包含了一大批应用 – Gnome 桌面、Tor、 Firefox (Iceweasel)、 Network Manager、 Pidgin、 Claws mail、 Liferea feed addregator、 Gobby、 Aircrack-ng、 I2P。 -同时,它含有一些有关加密和隐私的工具,即 UKS, GNUPG, PWGen, Shamir’s Secret Sharing, Virtual Keyboard (against Hardware Keylogging), MAT, KeePassX Password Manager 等。 +同时,它含有一些有关加密和隐私的工具,即 UKS、 GnuPG、 PWGen、 Shamir's Secret Sharing、 Virtual Keyboard (对付硬件的键盘记录器)、 MAT、 KeePassX Password Manager 等。 -这就是全部了。关注 Tecmint。请分享你的有关 Tails GNU/Linux 操作系统的想法。对于这个项目的未来,你怎么看?同时在实际中测试它,并让我们获知你的体验感受。 +这就是全部了。关注我们。请分享你的有关 Tails GNU/Linux 操作系统的想法。对于这个项目的未来,你怎么看?同时在实际中测试它,并让我们获知你的体验感受。 -你也可以在 [Virtualbox][8] 中运行它。 Tails 在 RAM 中加载整个操作系统,所以在 VM 中你需要给定足够的 RAM 来运行 Tails。 +你也可以在 [Virtualbox][8] 中运行它。 Tails 在内存中加载整个操作系统,所以在虚拟机中你需要给定足够的内存来运行 Tails。 + +我在 1GB 内存的环境中测试了 Tails,它工作起来毫无滞后感。谢谢我们的所有用户的支持。使我们成为一个包含所有 Linux 相关信息的地方,你的支持是必需的。 Kudos! -我在 1GB 的环境中测试了 Tails,它工作起来毫无滞后感。谢谢我们的所有用户的支持。使 Tecmint 成为一个包含所有 Linux 相关信息的地方,你的合作是必需的。 Kudos! -------------------------------------------------------------------------------- via: http://www.tecmint.com/install-tails-1-4-linux-operating-system-to-preserve-privacy-and-anonymity/ 作者:[Avishek Kumar][a] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/tor-browser-for-anonymous-web-browsing/ +[1]:https://linux.cn/article-3566-1.html [2]:https://tails.boum.org/news/version_1.4/index.en.html [3]:http://dl.amnesia.boum.org/tails/stable/tails-i386-1.4/tails-i386-1.4.iso [4]:https://tails.boum.org/torrents/files/tails-i386-1.4.torrent From db2ecdf6aeefbe17eab97dd7faa46ce771bfafff Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Thu, 18 Jun 2015 10:33:59 +0800 Subject: [PATCH 130/153] Update 20150616 LINUX 101--POWER UP YOUR SHELL.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 准备翻译该篇. --- sources/tech/20150616 LINUX 101--POWER UP YOUR SHELL.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150616 LINUX 101--POWER UP YOUR SHELL.md b/sources/tech/20150616 LINUX 101--POWER UP YOUR SHELL.md index ef9f3d4937..94102a58a6 100644 --- a/sources/tech/20150616 LINUX 101--POWER UP YOUR SHELL.md +++ b/sources/tech/20150616 LINUX 101--POWER UP YOUR SHELL.md @@ -1,3 +1,5 @@ +FSSlc translating + LINUX 101: POWER UP YOUR SHELL ================================================================================ > Get a more versatile,featureful and colourful command line interface with our guide to shell basics. @@ -174,4 +176,4 @@ via: http://www.linuxvoice.com/linux-101-power-up-your-shell-8/ [3]:http://tinyurl.com/osopjv9 [4]:http://www.xiki.org/ [5]:http://ciembor.github.io/4bit -[6]:http://ethanschoonover.com/solarized \ No newline at end of file +[6]:http://ethanschoonover.com/solarized From ae2ab64b4d4e3b2a5711467f2808bf563f6b3d9e Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 18 Jun 2015 10:40:43 +0800 Subject: [PATCH 131/153] PUB:20150515 Extend Swap Space using Swap file in Linux @strugglingyouth --- ...tend Swap Space using Swap file in Linux.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) rename {translated/tech => published}/20150515 Extend Swap Space using Swap file in Linux.md (81%) diff --git a/translated/tech/20150515 Extend Swap Space using Swap file in Linux.md b/published/20150515 Extend Swap Space using Swap file in Linux.md similarity index 81% rename from translated/tech/20150515 Extend Swap Space using Swap file in Linux.md rename to published/20150515 Extend Swap Space using Swap file in Linux.md index 0b1a5c0597..b92b4a8a36 100644 --- a/translated/tech/20150515 Extend Swap Space using Swap file in Linux.md +++ b/published/20150515 Extend Swap Space using Swap file in Linux.md @@ -1,9 +1,6 @@ -translated by strugglingyouth 在linux上使用交换文件扩展交换空间 ================================================================================ -想像一种情景,当我们的Linux系统用尽交换空间时,在这种情况下, -我们想要使用swap分区扩展交换空间,但在某些情况下磁盘上的空闲分区是不可用的, -致使我们不能把它扩大。 +想像一种情景,当我们的Linux系统用尽交换空间时,在这种情况下,我们想要使用swap分区扩展交换空间,但在某些情况下磁盘上已经没有可用的空闲分区了,致使我们不能把它扩大。 因此,在这种情况下,我们可以使用交换文件增加swap空间。 @@ -16,7 +13,7 @@ free-output-with-swap 我的交换分区大小是2 GB,我们将把交换空间扩展1GB。 -#### 第一步:使用下面的dd命令创建大小为1GB交换文件d #### +#### 第一步:使用下面的dd命令创建大小为1GB交换文件 #### [root@linuxtechi ~]# dd if=/dev/zero of=/swap_file bs=1G count=1 1+0 records in @@ -26,7 +23,7 @@ free-output-with-swap 根据你的需要替换 ‘**bs**‘ 和 ‘**count**‘ 的大小. -####第二步:设置交换文件权限为644. #### +#### 第二步:设置交换文件权限为600 #### [root@linuxtechi ~]# chmod 600 /swap_file @@ -56,21 +53,20 @@ free-output-with-swap ![swap-space-after-extension](http://www.linuxtechi.com/wp-content/uploads/2015/06/swap-space-after-extension.jpg) -**Note**: 为了避免出现意外的情况,如下所示使用swapoff命令关闭它, -仅在需要使用时,使用步骤5所示的swapon命令,重新启用交换文件。. +**Note**: 为了避免出现意外的情况,如下所示使用swapoff命令关闭它,仅在需要使用时,使用步骤5所示的swapon命令,重新启用交换文件。 [root@linuxtechi ~]# swapoff /swap_file [root@linuxtechi ~]# -请分享您的宝贵意见或者评论此文章. +请分享您的宝贵意见或者评论此文章。 -------------------------------------------------------------------------------- via: http://www.linuxtechi.com/extend-swap-space-using-swap-file-in-linux/ 作者:[Pradeep Kumar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[strugglingyouth](https://github.com/strugglingyouth) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From 449936748ed07bf642fef1e564c8da75bd4709b6 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 18 Jun 2015 11:13:03 +0800 Subject: [PATCH 132/153] PUB:20150604 Read about The Document Foundation achievements in 2014--download the Annual Report @sevenot --- ...chievements in 2014--download the Annual Report.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) rename {translated/share => published}/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md (70%) diff --git a/translated/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md b/published/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md similarity index 70% rename from translated/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md rename to published/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md index 678abbb6fd..9bb73fc944 100644 --- a/translated/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md +++ b/published/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md @@ -1,14 +1,12 @@ -sevenot translated 下载年度报告,了解The Document Foundation2014年的成果 ================================================================================ ![](https://documentfoundation.files.wordpress.com/2015/06/tdf-report.jpg) - -TDF ReportThe Document Foundation (TDF)郑重地发布了2014年度报告,你可以点击这里下载: [http://tdf.io/report2014][1] (3.2 MB PDF)。高清质量的可以点击这里下载 [http://tdf.io/report2014hq][2] (15.9 MB PDF)。 +The Document Foundation (TDF)郑重地发布了2014年度报告,你可以点击这里下载: [http://tdf.io/report2014][1] (3.2 MB PDF)。高清质量的可以点击这里下载 [http://tdf.io/report2014hq][2] (15.9 MB PDF)。 TDF年度报告中,以回顾2014年开始了这篇报告,其中包括了TDF和LibreOffice的精彩集锦,并且总结了财务情况和预算。 -该报告涉及到项目和活动的会议包括:2014年在伯尔尼的LibreOffice大会,在布鲁塞尔、大加那利岛、巴黎、波士顿和土鲁斯的认证项目,网站与质量保证,Hackfests项目,本土语言项目,基础设施,文档项目,市场设计与营销。 +该报告涉及到项目和活动的会议包括:2014年在伯尔尼的LibreOffice大会,在布鲁塞尔、大加那利岛、巴黎、波士顿和土鲁斯的认证项目、网站与质量保证、Hackfests项目等,本土语言项目,基础设施,文档项目,市场设计与营销。 该报告涉及到的软件开发活动和代码包括:工程指导委员会的活动,LibreOffice的开发,文档解放项目,LibreOffice的安卓移植。 @@ -17,8 +15,7 @@ TDF年度报告中,以回顾2014年开始了这篇报告,其中包括了TDF TDF 2014年度报告的编辑工作由Sophie Gautier, Alexander Werner, Christian Lohmaier, Florian Effenberger, Italo Vignoli 和 Robinson Tryon完成,由Barak Paz设计样式,Libreoffice社区协助完成。 -为了使该文档分布达到最大程度的分布,采用了CC3 认证发布,除非特殊标注,TDF成员和自由软件基金会拥有其所有权。 -[德语版年度报告下载请点击[http://tdf.io/bericht2014][3]]. +为了最大程度的传播该文档,采用了CC3 认证发布,除非特殊标注,TDF成员和自由软件基金会拥有其所有权。 -------------------------------------------------------------------------------- @@ -26,7 +23,7 @@ via: http://blog.documentfoundation.org/2015/06/03/read-about-the-document-found 作者:italovignoli 译者:[sevenot](https://github.com/sevenot) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From ad76750d4db8b80d2fd693768d1e9d8be46e9e0d Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 18 Jun 2015 11:56:30 +0800 Subject: [PATCH 133/153] PUB:20150527 3 Open Source Python Shells @wi-cuckoo --- .../20150527 3 Open Source Python Shells.md | 102 ++++++++++++++++++ .../20150527 3 Open Source Python Shells.md | 100 ----------------- 2 files changed, 102 insertions(+), 100 deletions(-) create mode 100644 published/20150527 3 Open Source Python Shells.md delete mode 100644 translated/share/20150527 3 Open Source Python Shells.md diff --git a/published/20150527 3 Open Source Python Shells.md b/published/20150527 3 Open Source Python Shells.md new file mode 100644 index 0000000000..86c6b7ee96 --- /dev/null +++ b/published/20150527 3 Open Source Python Shells.md @@ -0,0 +1,102 @@ +3个开源的Python Shell +========================================================================= + +Python是一个高级、通用、结构化且强大的开源编程语言,广泛用于各种编程工作。它拥有一个全动态类型系统和自动内存管理,与Scheme,Ruby,Perl和Tcl的十分相似,避免编译型语言的许多复杂地方和难以理解。Python于1991年由Guido van Rossum创造,然后逐渐成长,流行。 + +Python是一个非常实用,而且流行的计算机编程语言。使用一个如Python这样的解释型语言的好处之一就是,可以借助其交互的shell探索式地编程。你可以试着代码,而不必专门写一个脚本。但是Python shell也有一些局限性。基本来说,有许多很漂亮的Python shell可选择,都是在基础shell上扩展的。他们每一个都提供了一个极好的交互性的Python 体验。 + +### bpython ### + +![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-bpython.png) + +对于Linux,BSD,OS X和Windows来说,bpython是一个不错的Python解释器的界面。 + +其想法是提供给用户所有的内置功能,很像现在的IDE(集成开发环境),但是是在一个简单,轻量级的包里,可以在终端窗口里面运行。 + +bpython并不追求创造任何新的或者开创性的东西。相反,它聚集了一些简洁的理念,关注于实用性和操作性。 + +功能包括: + +- 内置的语法高亮 - 使用Pygments排版你敲出的代码,并合理配色 +- 根据你的行为,显示自动补全的建议 +- 为任何Python函数列出所期望的参数 - 可以显示你调用的任何函数的参数列表 +- “Rewind”功能会调出内存里的最后一行代码并重新执行 +- 可以将你输入的代码送到pastebin +- 可以将你输入的代码保存到一个文件 +- 自动缩进 +- 支持Python 3 + +--- + +- 网址: [www.bpython-interpreter.org][1] +- 开发者: Bob Farrell and contributors +- 证书: MIT License +- 版本号: 0.14.1 + +### IPython ### + +![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-ipython.png) + +IPython是Python shell的一个交互加强版。她提供了一个丰富的工具集合,帮助你交互式地充分利用Python。 + +IPython可以用来取代标准的Python shell,也可以与标准Python科学和数值处理工具配合,用做一个科学计算(如Matlab或者Mathematical)的完整工作环境。她支持动态对象内省,有限的输入/输出提示,一个宏系统,会话日志,会话恢复,访问完整的系统外壳,详尽且彩色的追踪报告,自动圆括号补全,自动引号补全和可嵌入其他Python程序。 + +功能包括: + +- 强大的交互Shell(基于终端或者Qt) +- 一个基于浏览器的记事本,支持代码,富文本,数学表达式,内置图表和其他富媒介。 +- 支持交互式的数据可视化和使用GUI工具箱 +- 灵活,嵌入式的解释器可以加载进你自己的项目里 +- 易于使用,高效的并行运算工具 + +--- + +- 网址: [ipython.org][2] +- 开发者: The IPython Development Team +- 证书: BSD +- 版本号: 3.1 + +### DreamPie ### + +![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-DreamPie.png) + +DreamPie是一个为可靠性和趣味性设计的Python shell。 + +DreamPie可以用于任何Python解释器(Jython,IronPython,PyPy)。 + +功能包括: + +- 一个新式的交互shell:窗口被分成历史区域和代码区域,历史区域可以让你看到之前的命令及其输出,代码区域是里敲代码的地方。这样,你可以编辑任意多的代码,就好像在你最喜欢的编辑器里一样,并且适当时候可以执行它。你也可以从其他地方复制代码,编辑并马上运行它 +- “只复制代码”命令可以复制你想要的代码,以便你可以把它存入一个文件。代码已经用四个空格缩进进行格式化 +- 自动补全属性和文件名字 +- 自动显示函数参数和文档 +- 在结果历史中保存你最近的结果,备以后用 +- 可以自动折叠很长的输出,以便你可以专注于重要的地方 +- 保存会话的历史记录为一个HTML文件,备以后查询。你可以加载历史文件到DreamPie里,并且快速重复之前的命令。 +- 自动添加圆括号与可选的引号,当你在函数与方法后按下空格键。例如,键入execfile后按下空格会提示execfile("fn") +- 支持交互的matplotlib绘图 +- 支持Python 2.5,Python 2.6,Python 3.1,Jython 2.5,IronPython 2.6和PyPy +- 难以置信的快速反应 + +--- + +- 网址: [www.dreampie.org][3] +- 开发者: Noam Yorav-Raphael +- 证书: GNU GPL v3 +- 版本号: 1.2.1 + +-------------------------------------------------------------------------------- + +via: http://www.linuxlinks.com/article/20150523032756576/PythonShells.html + +作者:Frazer Kline +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://www.bpython-interpreter.org/ +[2]:http://ipython.org/ +[3]:http://www.dreampie.org/ + +-------------------------------------------------------------------------------- diff --git a/translated/share/20150527 3 Open Source Python Shells.md b/translated/share/20150527 3 Open Source Python Shells.md deleted file mode 100644 index 24b81d697a..0000000000 --- a/translated/share/20150527 3 Open Source Python Shells.md +++ /dev/null @@ -1,100 +0,0 @@ -3个开源的Python Shell -========================================================================= -Python是一个高级,通用,结构化且强大的开源编程语言,用于广泛的编程工作。它拥有一个完全的动态类型系统和自动内存管理,与Scheme,Ruby,Perl和Tcl的十分相似,避免编译型语言的许多复杂地方和难以理解。Python于1991年由Guido van Rossum创造,然后逐渐成长,流行。 - -Python是一个非常实用,而且流行的计算机编程语言。使用一个如Python这样的解释型语言的好处之一就是,可以借助其交互的shell考察式地编程。你可以试用代码,而不必写一个脚本。但是Python shell也有一些局限性。基本来说,有许多很nice的Python shell可选择,都是在基础shell上扩展的。他们每一个都提供了一个极好的交互性的Python 体验。 - --------------- - -### bpython ### - -![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-bpython.png) - -对于Linux,BSD,OS X和Windows来说,bpython是Python解释器一个受欢迎的接口。 - -想法是提供给用户所有的内置功能,很像现在的IDEs(集成开发环境),但是是在一个简单,轻量级的包里,可以在终端窗口里面运行。 - -bpython并不追求创造任何新的或者开创性的东西。相反,她聚集了一些简洁的理念,关注于实用性和操作性。 - -功能包括: - -- 内置的语法高亮 - 使用Pygments排版你敲出的代码,并合理地上色 -- 根据你的行为,显示自动补全的建议。 -- 为任何Python函数列出期望的参数 - 力求显示一列参数,为你调用的任何函数 -- “Rewind”功能,弹出内存里的最后一行代码并重新评定 -- 发送你已经解除占用的代码到粘贴缓存 -- 保存你已经输入到一个文件里的代码 -- 自动缩进 -- 支持Python 3 - -- 网址: [www.bpython-interpreter.org][1] -- 开发者: Bob Farrell and contributors -- 证书: MIT License -- 版本号: 0.14.1 - ----------- - -### IPython ### - -![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-ipython.png) - -IPython是Python shell的一个交互加强版。她提供了一个丰富的工具集合,帮助你交互式地充分利用Python。 - -IPython可以用来取代标准的Python shell,或者当与标准Python 科学和数值处理工具配合,用做一个科学计算(如Matlab或者Mathematical)的完整工作环境。她支持动态对象内省,有限的输入/输出提示,一个宏观系统,会话登录,会话恢复,完整的系统接入,详尽且彩色的追踪报告,自动圆括号,自动应用和可嵌入其他Python程序。 - -功能包括: - -- 强大的交互Shell(终端或者基于Qt) -- 一个基于浏览器的记事本,支持代码,多样文本,数学表达式,内置飞行图表和其他丰富媒介。 -- 支持交互式的数据虚拟化和GUI工具箱使用 -- 灵活,嵌入式的解释器可以加载进你自己的项目里 -- 易于使用,高效的并行运算工具 - -- 网址: [ipython.org][2] -- 开发者: The IPython Development Team -- 证书: BSD -- 版本号: 3.1 - ----------- - -### DreamPie ### - -![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-DreamPie.png) - -DreamPie是一个为可靠性和兴趣设计的Python shell。 - -DreamPie可以用于任何Python解释器(Jython,IronPython,PyPy)。 - -功能包括: - -- 一个交互shell的新概念:窗口被分成历史区域和代码区域,历史区域可以让你看到之前的命令及其输出,代码区域是里敲代码的地方。这样,你可以编辑任意数量的代码,就好像在你最喜欢的编辑器里一样,并且适当时候可以执行它。你也可以从其他地方复制你想保存的代码,所以你可以把它存入一个文件。代码可以很好地格式化为四级缩进。 -- 自动补全属性和文件名字 -- 自动显示函数参数和文档 -- 在结果历史中保存你最近的结果,备以后用 -- 可以自动展开很长的输出,所以你可以专注于重要的地方 -- 保存会话的历史记录为一个HTML文件,备以后查询。你可以加载历史文件到DreamPie里,并且快速回退到之前的命令。 -- 自动添加圆括号与可选的引用,当你在函数与方法后按下空格键。例如,键入execfile fn并且获得execfile("fn") -- 支持交互的matplotlib绘图 -- 支持Python 2.5,Python 2.6,Python 3.1,Jython 2.5,IronPython 2.6和PyPy -- 难以置信的快速反应 - -- 网址: [www.dreampie.org][3] -- 开发者: Noam Yorav-Raphael -- 证书: GNU GPL v3 -- 版本号: 1.2.1 - --------------------------------------------------------------------------------- - -via: http://www.linuxlinks.com/article/20150523032756576/PythonShells.html - -作者:Frazer Kline -译者:[wi-cuckoo](https://github.com/wi-cuckoo) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[1]:http://www.bpython-interpreter.org/ -[2]:http://ipython.org/ -[3]:http://www.dreampie.org/ - --------------------------------------------------------------------------------- From da1385f081b57619bf0549f5a82c03a9ef1342c6 Mon Sep 17 00:00:00 2001 From: DeadFire Date: Thu, 18 Jun 2015 15:20:04 +0800 Subject: [PATCH 134/153] =?UTF-8?q?20150618-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ll be the future of Linux without Linus.md | 185 ++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 sources/talk/20150618 What will be the future of Linux without Linus.md diff --git a/sources/talk/20150618 What will be the future of Linux without Linus.md b/sources/talk/20150618 What will be the future of Linux without Linus.md new file mode 100644 index 0000000000..e042fdbe61 --- /dev/null +++ b/sources/talk/20150618 What will be the future of Linux without Linus.md @@ -0,0 +1,185 @@ +What will be the future of Linux without Linus? +================================================================================ +![](http://i2.wp.com/www.linuxveda.com/wp-content/uploads/2015/06/linus-torvalds-painting.jpg) + +The interview was conducted back in 2007 for Linux For You magazine and we are publishing it here for archival purposes. + +**Q: What are the future enhancements/paths/plans for the Linux kernel?** + +Linus: I’ve never been much of a visionary — instead of looking at huge plans for the future, I tend to have a rather short time frame of ‘issues in the next few months’. I’m a big believer in that the ‘details’ matter, and if you take care of the details, the big issues will end up sorting themselves out on their own. + +So I really don’t have any great vision for what the kernel will look like in five years — just a very general plan to make sure that we keep our eye on the ball. In fact, when it comes to me personally, one of the things I worry about the most isn’t even the technical issues, but making sure that the ‘process’ works, and that people can work well with each other. + +**Q: How do you see the relationship of Linux and Solaris evolving in the future? How will it benefit the users? ** + +Linus: I don’t actually see a whole lot of overlap, except that I think Solaris will start using more of the Linux user space tools (which I obviously don’t personally have a lot to do with — I really only do the kernel). The Linux desktop is just so much better than what traditional Solaris has, and I expect Solaris to move more and more towards a more Linux-like model there. + +On the pure kernel side, the licensing differences mean that there’s not much cooperation, but it will be very interesting to see if that will change. Sun has been making noises about licensing Solaris under the GPL (either v2 or v3), and if the licence differences go away, that could result in some interesting technology. But I’m taking a wait-and-see attitude to that. + +**Q: Now that the GPLv3 has been finalised and released, do you foresee any circumstance that would encourage you to begin moving the kernel to it? Or, from your perspective, is it so bad that you would never consider it?** + +Linus: I think it is much improved over the early drafts, and I don’t think it’s a horrible licence. I just don’t think it’s the same kind of ‘great’ licence that the GPLv2 is. + +So in the absence of the GPLv2, I could see myself using the GPLv3. But since I have a better choice, why should I? + +That said, I try to always be pragmatic, and the fact that I think the GPLv3 is not as good a licence as the GPLv2 is not a ‘black and white’ question. It’s a balancing act. And if there are other advantages to the GPLv3, maybe those other advantages would be big enough to tilt the balance in favour of the GPLv3. + +Quite frankly, I don’t really see any, but if Solaris really is to be released under the GPLv3, maybe the advantage of avoiding unnecessary non-compatible licence issues could be enough of an advantage that it might be worth trying to re-license the Linux kernel under the GPLv3 too. + +Don’t get me wrong — I think it’s unlikely. But I do want to make it clear that I’m not a licence bigot, per se. I think the GPLv2 is clearly the better licence, but licences aren’t everything. + +After all, I use a lot of programs that are under other licences. I might not put a project I start myself under the BSD (or the X11-MIT) licence, but I think it’s a great licence, and for other projects it may well be the right one. + +**Q: Currently are there any Indians who you’d like to highlight as key contributors to the Linux kernel?** + +Linus: I have to admit that I don’t directly work with anybody that I actually realise as being from India. That said, I should clarify a bit: I’ve very consciously tried to set up the kernel development so that I don’t end up working personally with a huge number of people. + +I have this strong conviction that most humans are basically wired up to know a few people really well (your close family and friends), and I’ve tried to make the development model reflect that: with a ‘network of developers’, where people interact with maybe a dozen other people they trust, and those other people in turn interact with ‘their’ set of people they trust. + +So while I’m in occasional contact with hundreds of developers who send me a random patch or two, I’ve tried to set up an environment where the bulk of what I do happens through a much smaller set of people that I know, just because I think that’s how people work. It’s certainly how I like to work. + +Also, in all honesty, I don’t even know where a lot of the people I work with live. Location ends up being pretty secondary. So while I’m pretty sure that none of the top 10-15 I work with most closely, are in India, maybe after this goes public, it might get pointed out that there is actually somebody from there! + +**Q: Since the Linux Kernel Development depends so heavily on you, how do you plan to organise/reorganise it for it to continue progressing without you, in case you decide to dedicate more time to your own life and family?** + +Linus: I’ve long since come to the realisation that Linux is much bigger than me. Yes, I’m intimately involved in it still, and I have a fairly large day-to-day impact on it, and I end up being the person who, in some sense, acts as the central point for a lot of kernel activities; but no — I wouldn’t say that Linux ‘depends heavily’ on me. + +So if I had a heart attack and died tomorrow (happily not likely: I’m apparently healthy as anything), people would certainly notice, but there are thousands of people involved in just the kernel, and there’re more than a few that could take over for me with little real confusion. + +**Q: India is one of the major producers of software engineers, yet we don’t contribute much to the Linux domain. What do you think is keeping Indians from becoming proactive on that front? How do you feel we could encourage Indians to get involved and contribute heavily? You have a fan following in India; could your iconic image be used to inspire enthusiasts?** + +Linus: This is actually a very hard question for me to answer. Getting into open source is such a complicated combination of both infrastructure (Internet access, education, you name it), flow of information and simply culture that I can’t even begin to guess what the biggest stumbling block could be. + +In many ways, at least those with an English-speaking culture in India should have a rather easy time getting involved with Linux and other open source projects, if only thanks to the lack of a language barrier. Certainly much easier than many parts of Asia or even some parts of Europe. + +Of course, while that is a lot of people, it’s equally obviously not the majority in India, and I personally simply don’t know enough about the issues in India to be able to make an even half-way intelligent guess about what the best way forward is. I suspect that an enthusiastic local user community is always the best way, and I think you do have that. + +As to my ‘iconic image’, I tend to dislike that part personally. I’m not a great public speaker, and I’ve avoided travelling for the last several years because I’m not very comfortable being seen as this iconic ‘visionary’. I’m just an engineer, and I just happen to love doing what I do, and to work with other people in public. + +**Q: What would be a good reason for you to consider visiting India?** + +Linus: As mentioned in the first answer, I absolutely detest public speaking, so I tend to avoid conferences, etc. I’d love to go to India for a vacation some day, but if I do, I’d likely just do it incognito — not tell anybody beforehand and just go as a tourist to see the country! + +**Q: Recently, you seemed to slam Subversion and CVS, questioning their basic architecture. Now that you’ve got responses from the Subversion community, do you stand corrected, or are you still unconvinced?** + +Linus: I like making strong statements, because I find the discussion interesting. In other words, I actually tend to ‘like’ arguing. Not mindlessly, but I certainly tend to prefer the discussion a bit more heated, and not just entirely platonic. + +And making strong arguments occasionally ends up resulting in a very valid rebuttal, and then I’ll happily say: “Oh, ok, you’re right.” + +But no, that didn’t happen on SVN/CVS. I suspect a lot of people really don’t much like CVS, so I didn’t really even expect anybody to argue that CVS was really anything but a legacy system. And while I’ve gotten a few people who argued that I shouldn’t have been quite so impolite against SVN (and hey, that’s fair — I’m really not a very polite person!), I don’t think anybody actually argued that SVN was ‘good’. + +SVN is, I think, a classic case of ‘good enough’. It’s what people are used to, and it’s ‘good enough’ to be used fairly widely, but it’s good enough in exactly the sense DOS and Windows were ‘good enough’. Not great technology, just very widely available, and it works well enough for people and looks familiar enough that people use it. But very few people are ‘proud’ of it, or excited about it. + +Git, on the other hand, has some of the ‘UNIX philosophy’ behind it. Not that it is about UNIX, per se, but like original UNIX, it had a fundamental idea behind it. For UNIX, the underlying philosophy was/is that, “Everything is a file.” For git, it’s, Everything is just an object in the content-addressable database.” + +**Q: Is having so many distros a good or bad idea? Choice is fine, but one does not need to be pampered with choices. Instead of so many man hours being spent in building hundreds of distros, wouldn’t it be easier to get into the enterprise and take on the MS challenge if people could come together and support fewer distros (1 for each use maybe)? What’s your view on that?** + +Linus: I think having multiple distros is an inevitable part of open source. And can it be confusing? Sure. Can it be inefficient? Yes. But I’d just like to compare it to politics: ‘democracy’ has all those confusing choices, and often none of the choices is necessarily what you ‘really’ want either, and sometimes you might feel like things would be smoother and more efficient if you didn’t have to worry about the whole confusion of voting, different parties, coalitions, etc. + +But in the end, choice may be inefficient, but it’s also what keeps everybody involved at least ‘somewhat’ honest. We all probably wish our politicians were more honest than they are, and we all probably wish that the different distros sometimes made other choices than they do, but without that choice, we’d be worse off. + +**Q: Why do you think CFS is better than SD?** + +Linus: Part of it is that I have worked with Ingo [Molnar] for a long time, which means that I know him, and know that he’ll be very responsive to any issues that come up. That kind of thing is very important. + +But part of it is simply about numbers. Most people out there actually say that CFS is better than SD. Including, very much, on 3D games (which people claimed was a strong point of SD). + +At the same time, though, I don’t think any piece of code is ever ”perfect”. The best thing to happen is that the people who want to be proponents of SD will try to improve that so much that the balance tips over the other way — and we’ll keep both camps trying interesting things because the internal competition motivates them. + +**Q: In a talk you had at Google about git, someone asked you how you would take an extremely large code base that is currently handled with something centralised and transition to git without stopping business for six months. What was your response to that?** + +Linus: Ahh. That was the question where I couldn’t hear the questioner well (the questions were much more audible in the recordings), and I noticed afterwards, when I went back and listened to the recorded audio, that I didn’t answer the question he asked, but the question I thought he’d asked. + +Anyway, we do have lots of import tools, so that you can actually just import a large project from just about any other previous SCM into git. But the problem, of course, often doesn’t end up being the act of importing itself, but just having to ‘get used to’ the new model! + +And quite frankly, I don’t think there is any other answer to that ‘get used to it’ but to just start out and try it. You obviously do not want to start out by importing the biggest and most central project you have; that would indeed just make everything come to a standstill, and make everybody very unhappy indeed. + +So nobody sane would advocate moving everything over to git overnight, and forcing people to change their environment. No. You’d start with a smaller project inside a company, perhaps something that just one group mostly controls and maintains, and start off by converting that to git. That way you get people used to the model, and you start having a core group with the knowledge about how git works and how to use it within the company. + +And then you just extend on that. Not in one go. You’d import more and more of the projects — even if you have the ‘one big repository’ model at your company; you also almost certainly have that repository as a set of modules, because having everybody check out everything is just not a workable mode of operation (unless ‘everything’ is just not very large). + +So you’d basically migrate one module at a time, until you get to the point where you’re so comfortable with git that you can just migrate the rest (or the ‘rest’ is so legacy that nobody even cares). + +And one of the nice features of git is that it actually plays along pretty well with a lot of other SCMs. That’s how a lot of git users use it: ‘they’ may use git, but sometimes the people they work with don’t even realise, because they see the results of it propagated into some legacy SCM. + +**Q: Did they ever experiment with alternate instruction set implementations at Transmeta? [Transmeta Crusoe chip seemed like a very soft CPU — reminding one of Burroughs B1000 interpretive machine, which actually implemented multiple virtual machines. There was one for system software, another for Cobol, another for Fortran; If that is correct, then one could implement Burroughs 6/7000 or HP3000 like stack architecture on the chip or an instruction set suitable for JVM, etc]** + +Linus: We did indeed have some alternate instruction set, and while I still am not really supposed to talk about it, I can say that we did have a public demonstration of mixing instruction sets. We had a technology showcase where you could run x86 instructions side-by-side with Java byte code (actually, it was a slightly extended pico-java, iirc). + +I think the app we showed running was running DOOM on top of Linux, where the Linux parts were a totally standard x86 distribution, but the DOOM binary was a specially compiled version where part of the game was actually compiled pico-Java. And the CPU ended up running them both the same way — as a JIT down to the native VLIW instruction set. + +(The reason for picking DOOM was just that source code was available, and the core parts of the game were small enough that it was easy to set it up as a demonstration — and it was obviously visually interesting.) + +There were more things going on internally, but I can’t really talk about them. And I wasn’t actually personally involved with the Java one either. + +**Q: 386BSD, from which NetBSD, FreeBSD and OpenBSD were derived, was there well before Linux, but Linux spread much more than 386BSD and its derivatives. How much of this do you attribute to the choice of the licence and how much to the development process you chose? Don’t you think that the GPLv3 protects the freedom that has bred Linux better than the BSDs till now, more than the GPLv2 can?** + +Linus: I think there’s both a licence issue, and a community and personality issue. The BSD licences always encouraged forking, but also meant that if somebody gets really successful and makes a commercial fork, you cannot necessarily join back. And so even if that doesn’t actually happen (and it did, in the BSD cases — with BSDi), people can’t really ‘trust’ each other as much. + +In contrast, the GPLv2 also encourages forking, but it not only encourages the branching off part, it also encourages (and ‘requires’) the ability to merge back again. So now you have a whole new level of trust: you ‘know’ that everybody involved will be bound by the licence, and won’t try to take advantage of you. + +So I see the GPLv2 as the licence that allows people the maximum possible freedom within the requirement that you can always join back together again from either side. Nobody can stop you from taking the improvements to the source code. + +So is the BSD licence even more ‘free’? Yes. Unquestionably. But I just wouldn’t want to use the BSD licence for any project I care about, because I not only want the freedom, I also want the trust so that I can always use the code that others write for my projects. + +So to me, the GPLv2 ends up being a wonderful balance of ‘as free as you can make it’, considering that I do want everybody to be able to trust so that they can always get the source code and use it. + +Which is why I think the GPLv3 ends up being a much less interesting licence. It’s no longer about that trust about “getting the source code back”; it has degenerated into a “I wrote the code, so I should be able to control how you use it.” + +In other words, I just think the GPLv3 is too petty and selfish. I think the GPLv2 has a great balance between ‘freedom’ and ‘trust’. It’s not as free as the BSD licences are, but it gives you peace of mind in return, and matches what I consider ‘tit-for-tat': I give source code, you give me source code in return. + +The GPLv3 tries to control the ‘use’ of that source code. Now it’s, “I give you my source code, so if you use it, you’d better make your devices hackable by me.” See? Petty and small-minded, in my opinion. + +**Q: Slowly but steadily, features of the -rt tree are getting integrated into the mainline. What are your current thoughts regarding a merger of the remaining -rt tree into the mainline (and I’m not talking about the CFS)?** + +Linus: I won’t guarantee that everything from -rt will ‘ever’ be merged into the standard kernel (there may be pieces that simply don’t end up making sense in the generic kernel), but yes, over the years we’ve actually integrated most of it, and the remaining parts could end up making it one of these days. + +I’m a big fan of low-latency work, but at the same time I’m pretty conservative, and I pushed back on some of the more aggressive merging, just because I want to make sure that it all makes sense for not just some extreme real time perspective, but also for ‘normal’ users who don’t need it. And that explains why the process has been a pretty slow but steady trickle of code that has gotten merged, as it was sufficiently stable and made sense. + +That, by the way, is not just an -rt thing; it’s how a lot of the development happens. -rt just happens to be one of the more ‘directed’ kernel projects, and one where the main developer is pretty directly involved with the normal kernel too. But quite often the migration of other features (security, virtual memory changes, virtualisation, etc) follows a similar path: they get written up in a very targeted environment, and then pieces of the features get slowly but surely merged into the standard kernel. + +**Q: I’m very curious about what the future holds for file systems in the kernel. What do you think about Reiser4, XFS4, ZFS and the new project founded by Oracle? ZFS has been receiving a lot of press these days. Reiser4 delivers very good benchmarks, and xfs4 is trying to keep up, whereas the one by Oracle has a lot of the same specs as Sun’s ZFS. Where are we heading? Which FS looks the most promising in your opinion?** + +Linus: Actually, just yesterday we had a git performance issue, where ZFS was orders of magnitude slower than UFS for one user (not under Linux, but git is gaining a lot of traction even outside of kernel development). So I think a lot of the ‘new file system’ mania is partly fed by knowing about the issues with old file systems, and then the (somewhat unrealistic) expectation that a ‘new and improved’ file system will make everything perfect. + +In the end, this is one area where you just let people fight it out. See who comes out the winner — and it doesn’t need to be (and likely will not) be a single winner. Almost always, the right choice of file system ends up depending on the load and circumstances. + +One thing that I’m personally more excited about than any of the file systems you mention is actually the fact that Flash-based hard disks are quickly becoming available even for ‘normal’ users. Sure, they’re still expensive (and fairly small), but Flash-based storage has such a different performance profile from rotating media, that I suspect that it will end up having a large impact on file system design. Right now, most file systems tend to be designed with the latencies of rotating media in mind. + +**Q: The operating system is becoming less and less important. You have said several times that the user is not supposed to ‘see’ the operating system at all. It is the applications that matter. Browser-based applications, like Google’s basic office applications, are making an impact. Where do you think operating systems are headed?** + +Linus: I don’t really believe in the ‘browser OS’, because I think that people will always want to do some things locally. It might be about security, or simply about privacy reasons. And while connectivity is widely available, it certainly isn’t ‘everywhere’. + +So I think the whole ‘Web OS’ certainly is part of the truth, but another part that people seem to dismiss is that operating systems have been around for decades, and it’s really a fairly stable and well-known area of endeavour. People really shouldn’t expect the OS to magically change: it’s not like people were ‘stupid’ back in the 60s either, or even that hardware was ‘that’ fundamentally different back then! + +So don’t expect a revolution. I think OSs will largely continue to do what they do, and while we’ll certainly evolve, I don’t think they’ll change radically. What may change radically are the interfaces and the things you do on top of the OS (and certainly the hardware beneath the OS will continue to evolve too), and that’s what people obviously care about. + +The OS? It’s just that hidden thing that makes it all possible. You really shouldn’t care about it, unless you find it very interesting to know what is really going on in the machine. + +**Q: The last I heard, you were using a PPC G4/5 for your main personal machine — what are you using now, and why?** + +Linus: I ended up giving up on the PowerPC, since nobody is doing any workstations any more, and especially since x86-64 has become such an undeniable powerhouse. So these days, I run a bog-standard PC, with a normal Core 2 Duo on it. + +It was a lot of fun to run another architecture (I ran with alpha as my main architecture way back then, for a few years, so it wasn’t the first time either), but commodity CPUs is where it is at. The only thing that I think can really ever displace the x86 architecture would come from below, i.e., if something makes us not use x86 as our main ISA in a decade, I think it would be ARM, thanks to the mobile device market. + +**Q: What does Linux mean to you — a hobby, philosophy, the meaning of life, a job, the best OS, something else…?** + +Linus: It’s some of all of that. It’s a hobby, but a deeply meaningful one. The best hobbies are the ones that you care ‘really’ deeply about. And these days it’s obviously also my work, and I’m very happy to be able to combine it all. + +I don’t know about a ‘philosophy’, and I don’t really do Linux for any really deeply held moral or philosophical reasons (I literally do it because it’s interesting and fun), but it’s certainly the case that I have come to appreciate the deeper reasons why I think open source works so well. So I may not have started to do Linux for any such deep reasons, and I cannot honestly say that that is what motivates me, but I do end up thinking about why it all works. + +**Q: Did Microsoft’s ‘Men in Black’ ever talk to you?** + +Linus: I’ve never really talked to MS, no. I’ve occasionally been at the same conferences with some MS people (I used to go to more conferences than I do these days), but I’ve never really had anything to do with them. I think there is a mutual wariness. + +-------------------------------------------------------------------------------- + +via: http://www.linuxveda.com/2015/06/17/what-happens-to-linux-after-linus/ + +作者:[Swapnil Bhartiya][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxveda.com/author/arnieswap/ \ No newline at end of file From 914e800ce23ffce018f9c8e047d9fe8c9459bc46 Mon Sep 17 00:00:00 2001 From: DeadFire Date: Thu, 18 Jun 2015 15:46:48 +0800 Subject: [PATCH 135/153] =?UTF-8?q?20150618-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... on Ubuntu 15.04 with Different Methods.md | 263 ++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md diff --git a/sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md b/sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md new file mode 100644 index 0000000000..85fd9d3312 --- /dev/null +++ b/sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md @@ -0,0 +1,263 @@ +How to Setup Node.JS on Ubuntu 15.04 with Different Methods +================================================================================ +This is such an important article to guide you about the installation and setup of Node.js on Ubuntu 15.04. Node.js is basically a server side java script programming to provide you bindings for enabling the input and output socket bios and streams. It has a high through put and non-blocking IO in a single threaded event loop. It’s also a platform layer that provides the functionality to interact with the Operating system to write file, read files and to do networking operations. So in this article we will perform different installation methods to setup Node.Js on Ubuntu 15.04 server. + +### Methods to Install Node.JS ### + +Their are different ways to install Node.Js and we can prefer to choose any one. Following are some important ways to install Node.Js that we will use to guide you about their each setup on Ubuntu 15.04 so make sure to remove the previous previous packages to avoid from any package conflict. + +- Installation of Node.JS from Source Code +- Installation of Node.JS from Package Manager +- Installation of Node.JS from Github Repository +- Installation of Node.JS with NVM + +### 1) Installing from Source Code ### + +Let's start with installation of Node.JS from the Source Code, so make sure that your system is up to date and dependent packages are pre installed. So follow the below steps and start the setup. + +#### STEP 1: System Update #### + +Use following commands and update Operating system and ten install the required packages are necessary for Node.JS setup. + + root@ubuntu-15:~# apt-get update + + root@ubuntu-15:~# apt-get install python gcc make g++ + +#### STEP 2: Get Source Code of Node.JS #### + +After we had installed the dependent packages now from the official web link of Node.JS just download its source code package and extract it as in following commands. + + root@ubuntu-15:~# wget http://nodejs.org/dist/v0.12.4/node-v0.12.4.tar.gz + root@ubuntu-15:~# tar zxvf node-v0.12.4.tar.gz + +#### STEP 3: Starting Installation #### + +Now move to the source code directory and execute the .configuration file + +![NodeJS Configure](http://blog.linoxide.com/wp-content/uploads/2015/06/13.png) + + root@ubuntu-15:~# ls + node-v0.12.4 node-v0.12.4.tar.gz + root@ubuntu-15:~# cd node-v0.12.4/ + root@ubuntu-15:~/node-v0.12.4# ./configure + root@ubuntu-15:~/node-v0.12.4# make install + +### Testing after Installation of Node.Js from Source Code ### + +Once the installation is done after running make installa command, we check its version and test that Node.Js is working fine by executing some test out puts. + + root@ubuntu-15:~/node-v0.12.4# node -v + v0.12.4 + +![Node.Js Test](http://blog.linoxide.com/wp-content/uploads/2015/06/21.png) + +Create a new file with .js extension execute it with Node command. + + root@ubuntu-15:~/node-v0.12.4# touch helo_test.js + root@ubuntu-15:~/node-v0.12.4# vim helo_test.js + console.log('Hello World'); + +Now execute it with Node command. + + root@ubuntu-15:~/node-v0.12.4# node helo_test.js + Hello World + +The out put shows that we had successfully installed Node.JS on Ubuntu 15.04 which is now ready to create applications on it using java scripts. + +### 2) Installing from Package Manager ### + +The installation of Node.JS through Package Manager is also a very simple process to setup on Ubuntu through NodeSource by adding its Personal Package Archives (PPA). + +We will go through the following steps to install Node.JS through PPA. + +#### STEP 1: Get the Source Code using Curl #### + +Before getting the source code by using the Curl command we must update our system and then run the curl command to fetch the NodeSource into local repository. + + root@ubuntu-15:~#apt-get update + root@ubuntu-15:~# curl -sL https://deb.nodesource.com/setup | sudo bash - + +The curl will execute the following tasks. + + ## Installing the NodeSource Node.js 0.10 repo... + ## Populating apt-get cache... + ## Confirming "vivid" is supported... + ## Adding the NodeSource signing key to your keyring... + ## Creating apt sources list file for the NodeSource Node.js 0.10 repo... + ## Running `apt-get update` for you... + Fetched 6,411 B in 5s (1,077 B/s) + Reading package lists... Done + ## Run `apt-get install nodejs` (as root) to install Node.js 0.10 and npm + +#### STEP 2: Installation of NodeJS and NPM #### + +As per the output of Curl we had fetched the NodeSource to our local repository now through apt-get commands we will install the NodeJS and NPM packages. + + root@ubuntu-15:~# apt-get install nodejs + +![NodeJS Install](http://blog.linoxide.com/wp-content/uploads/2015/06/31.png) + +#### STEP 3: Installing Build Essentials Tool #### + +To compile and install native addons from npm we may also need to install build tools using following command as. + + root@ubuntu-15:~# apt-get install -y build-essential + +### Testing With Node.JS Shell ### + +Testing of Node.Js is similar to the one that we did after installation from the source Code. +so lets start with the node command as follow and get its output result to see if Node.JS is fully functional. + + root@ubuntu-15:~# node + > console.log('Node.js Installed Using Package Manager'); + Node.js Installed Using Package Manager + +---------- + + root@ubuntu-15:~# node + > a = [1,2,3,4,5] + [ 1, 2, 3, 4, 5 ] + > typeof a + 'object' + > 5 + 2 + 7 + > + (^C again to quit) + > + root@ubuntu-15:~# + +### REPL For Your NodeJS Apps ### + +REPL is the Node.js shell, any valid Javascript which can be written in a script can be passed to the REPL. So lets see how REPL works with NodeJS. + + root@ubuntu-15:~# node + > var repl = require("repl"); + undefined + > repl.start("> "); + + Press Enter and it will show out put like this: + > { domain: null, + _events: {}, + _maxListeners: 10, + useGlobal: false, + ignoreUndefined: false, + eval: [Function], + inputStream: + { _connecting: false, + _handle: + { fd: 0, + writeQueueSize: 0, + owner: [Circular], + onread: [Function: onread], + reading: true }, + _readableState: + { highWaterMark: 0, + buffer: [], + length: 0, + pipes: null, + ... + ... + +Here is the list of command line help that we can use to work with REPL. + +![REPL Manual](http://blog.linoxide.com/wp-content/uploads/2015/06/4.png) + +### Working with NodeJS Packet Manager ### + +NPM is simple CLI tool for ensuring that a given node script runs continuously. It helps to Install and manage dependencies through the file package.json. We will start its using init command as. + + root@ubuntu-15:~# npm init + +![NPM starting](http://blog.linoxide.com/wp-content/uploads/2015/06/51.png) + +### 3) Installing from Github Repository ### + +In this method to install Node.JS we will consider few simple steps to directory clone the Node.JS repository from the github. + +Before the start of configurations through the the cloned package of Node.JS make sure that we must have following dependent packages installed with us. + + root@ubuntu-15:~# apt-get install g++ curl make libssl-dev apache2-utils git-core + +Now start the clone with git command and change the directory to its configuration file. + + root@ubuntu-15:~# git clone git://github.com/ry/node.git + root@ubuntu-15:~# cd node/ + +![Git Clone NodeJS](http://blog.linoxide.com/wp-content/uploads/2015/06/61.png) + +To install from the cloned repository now lets run the .config command and then make install to complete the setup of Node.Js . + + root@ubuntu-15:~# ./configure + +![Configure Node](http://blog.linoxide.com/wp-content/uploads/2015/06/7.png) + +Run the make install command that will takes few minutes so be patient and get it ready finalize the setup on Node.JS package for you. + + root@ubuntu-15:~/node# make install + + root@ubuntu-15:~/node# node -v + v0.13.0-pre + +### Testing with Node.JS ### + + root@ubuntu-15:~/node# node + > a = [1,2,3,4,5,6,7] + [ 1, 2, 3, 4, 5, 6, 7 ] + > typeof a + 'object' + > 6 + 5 + 11 + > + (^C again to quit) + > + root@ubuntu-15:~/node# + +### 4) Installing Node.JS Using Node Version Manager ### + +In this last method we show you we can easily install Node.JS with NVM method. This is one of the best method to install and configure Node.JS it provides us with facility to control versions. + +So before starting with this method make sure that the previously installed package is not already present there if you are working on the same machine. + +#### STEP 1: Installing Prerequisites #### + +Let's start with the system update and then install the following prerequisites for the Ubuntu Server to setup Node.JS using NodeJS Versions Manager System. Using the Curl command we will get NVM from the git to our local repository. + + root@ubuntu-15:~# apt-get install build-essential libssl-dev + root@ubuntu-15:~# curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh + +![NVM Curl](http://blog.linoxide.com/wp-content/uploads/2015/06/81.png) + +#### STEP 2: Update Home Environment #### + +After the curl command downloads the necessary packages for the NVM in the home directory of the user it also make changes to the bash profile. so in order to update those change and get access to NVM we must relogin to the terminal or we can update it using the source command as below. + + root@ubuntu-15:~# source ~/.profile + +Now we can use the NVM to choose the default NVM version or by moving to the previous version of NVM that we can do so by using the following commands. + + root@ubuntu-15:~# nvm ls + root@ubuntu-15:~# nvm alias default 0.12.4 + +![NVM Default](http://blog.linoxide.com/wp-content/uploads/2015/06/91.png) + +#### STEP 3: Using NodeJS Versions Manager #### + +We have successfully setup the NodeJS with NVM package and now can use it with its useful commands. + +![NVM Manual](http://blog.linoxide.com/wp-content/uploads/2015/06/101.png) + +### CONCLUSION ### + +Now we are ready to go with building server side applications with Node.JS and you are free to choose the best installation setup of your choice as we had done with four optional installations of Node.Js on the latest version of Ubuntu 15.04 with priority installation sequence, now its up to you to follow the one of your own choice and start coding with NodeJS. + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/setup-node-js-ubuntu-15-04-different-methods/ + +作者:[Kashif Siddique][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/kashifs/ \ No newline at end of file From 3af50c80dd032b61c1e50273e763eba5ba823e70 Mon Sep 17 00:00:00 2001 From: NearTan Date: Thu, 18 Jun 2015 20:35:04 +0800 Subject: [PATCH 136/153] translating --- ...w to Setup Node.JS on Ubuntu 15.04 with Different Methods.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md b/sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md index 85fd9d3312..83b08328e0 100644 --- a/sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md +++ b/sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md @@ -1,3 +1,5 @@ +translating by NearTan + How to Setup Node.JS on Ubuntu 15.04 with Different Methods ================================================================================ This is such an important article to guide you about the installation and setup of Node.js on Ubuntu 15.04. Node.js is basically a server side java script programming to provide you bindings for enabling the input and output socket bios and streams. It has a high through put and non-blocking IO in a single threaded event loop. It’s also a platform layer that provides the functionality to interact with the Operating system to write file, read files and to do networking operations. So in this article we will perform different installation methods to setup Node.Js on Ubuntu 15.04 server. From 5fac86010f7d43f160bb7baa7f8757d708661e5a Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Fri, 19 Jun 2015 12:28:52 +0800 Subject: [PATCH 137/153] Translating by ZTinoZ --- ...526 20 Useful Terminal Emulators for Linux.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index 9b6db95726..42a6137296 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -231,14 +231,14 @@ xterm Terminal ### 18. LilyTerm ### -The LilyTerm is a another less known open source terminal emulator based off of libvte that desire to be fast and lightweight. LilyTerm also include some key features such as: +LilyTerm是一款基于libvte的开源终端仿真器,这款不太出名的仿真器追求的是快速和轻量级。LilyTerm也包括一些关键特性: -- Support for tabbing, coloring and reordering tabs -- Ability to manage tabs through keybindings -- Support for background transparency and saturation. -- Support for user specific profile creation. -- Several customization options for profiles. -- Extensive UTF-8 support. +- 支持标签移动、着色以及标签重新排序 +- 通过快捷键管理标签 +- 支持背景透明化和饱和度调整 +- 支持为特定用户创建配置文件 +- 若干个自定义选项 +- 广泛支持UTF-8 ![Lilyterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Lilyterm.jpg) @@ -248,7 +248,7 @@ Lilyterm Terminal ### 19. Sakura ### -The sakura is a another less known Unix style terminal emulator developed for command line purpose as well as text-based terminal programs. Sakura is based on GTK and livte and provides not more advanced features but some customization options such as multiple tab support, custom text color, font and background images, speedy command processing and few more. +Sakura是另一款不知名的Unix风格终端仿真器,按照命令行模式和基于文本的终端程序开发。Sakura基于GTK和livte,自身特性不多,不过还是有一些自定义选项比如多标签支持、自定义文本颜色、字体和背景图片、快速命令处理等等。 ![Sakura Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/sakura.jpg) From 0c9966c5c3ec45b881346d196d6f7488cd0f0a2d Mon Sep 17 00:00:00 2001 From: wi-cuckoo Date: Fri, 19 Jun 2015 13:49:40 +0800 Subject: [PATCH 138/153] translated wi-cuckoo --- ...P at 20--From pet project to powerhouse.md | 83 ------------------- ...P at 20--From pet project to powerhouse.md | 81 ++++++++++++++++++ 2 files changed, 81 insertions(+), 83 deletions(-) delete mode 100644 sources/talk/20150615 PHP at 20--From pet project to powerhouse.md create mode 100644 translated/talk/20150615 PHP at 20--From pet project to powerhouse.md diff --git a/sources/talk/20150615 PHP at 20--From pet project to powerhouse.md b/sources/talk/20150615 PHP at 20--From pet project to powerhouse.md deleted file mode 100644 index 7ddbf950a9..0000000000 --- a/sources/talk/20150615 PHP at 20--From pet project to powerhouse.md +++ /dev/null @@ -1,83 +0,0 @@ -translating wi-cuckoo -PHP at 20: From pet project to powerhouse -================================================================================ -![](http://images.techhive.com/images/article/2015/06/13049862325_8c97a11878_z-100590275-primary.idge.jpg) - -Credit: [Steve Jurvetson via Flickr][1] - -> The one-time ‘silly little project’ has transformed into a Web powerhouse, thanks to flexibility, pragmatism, and a vibrant community of Web devs - -When Rasmus Lerdorf released “[a set of small tight CGI binaries written in C][2],” he had no idea how much his creation would impact Web development. Delivering the opening keynote at this year’s SunshinePHP conference in Miami, Lerdorf quipped, “In 1995, I thought I had unleashed a C API upon the Web. Obviously, that’s not what happened, or we’d all be C programmers.” - -In fact, when Lerdorf released version 1.0 of Personal Home Page Tools -- as PHP was then known -- the Web was very young. HTML 2.0 would not be published until November of that year, and HTTP/1.0 not until May the following year. NCSA HTTPd was the most widely deployed Web server, and Netscape Navigator was the most popular Web browser, with Internet Explorer 1.0 to arrive in August. In other words, PHP’s beginnings coincided with the eve of the browser wars. - -Those early days speak volumes about PHP’s impact on Web development. Back then, our options were limited when it came to server-side processing for Web apps. PHP stepped in to fill our need for a tool that would enable us to do dynamic things on the Web. That practical flexibility captured our imaginations, and PHP has since grown up with the Web. Now powering [more than 80 percent of the Web][3], PHP has matured into a scripting language that is especially suited to solve the Web problem. Its unique pedigree tells a story of pragmatism over theory and problem solving over purity. - -### The Web glue we got hooked on ### - -PHP didn’t start out as a language, and this is clear from its design -- or lack thereof, as detractors point out. It began as an API to help Web developers access lower-level C libraries. The first version was a small CGI binary that provided form-processing functionality with access to request parameters and the mSQL database. And its facility with a Web app’s database would prove key in sparking our interest in PHP and PHP’s subsequent ascendancy. - -By version 2 -- aka PHP/FI -- database support had expanded to include PostgreSQL, MySQL, Oracle, Sybase, and more. It supported these databases by wrapping their C libraries, making them a part of the PHP binary. PHP/FI could also wrap the GD library to create and manipulate GIF images. It could be run as an Apache module or compiled with FastCGI support, and it introduced the PHP script language with support for variables, arrays, language constructs, and functions. For many of us working on the Web at that time, PHP was the kind of glue we'd been looking for. - -As PHP folded in more and more programming language features, morphing into version 3 and onward, it never lost this gluelike aspect. Through repositories like PECL (PHP Extension Community Library), PHP could tie together libraries and expose their functionality to the PHP layer. This capacity to bring together components became a significant facet of the beauty of PHP, though it was not limited to its source code. - -### The Web as a community of coders ### - -PHP’s lasting impact on Web development isn’t limited to what can be done with the language itself. How PHP work is done and who participates -- these too are important parts of PHP’s legacy. - -As early as 1997, PHP user groups began forming. One of the earliest was the Midwest PHP User’s Group (later known as Chicago PHP), which held its [first meeting in February 1997][4]. This was the beginning of what would become a vibrant, energetic community of developers assembled over an affinity for a little tool that helped them solve problems on the Web. The ubiquity of PHP made it a natural choice for Web development. It became especially popular in the shared hosting world, and its low barrier to entry was attractive to many early Web developers. - -With a growing community came an assortment of tools and resources for PHP developers. The year 2000 -- a watershed moment for PHP -- witnessed the first PHP Developers’ Meeting, a gathering of the core developers of the programming language, who met in Tel Aviv to discuss the forthcoming 4.0 release. PHP Extension and Application Repository (PEAR) also launched in 2000 to provide high-quality userland code packages following standards and best practices. The first PHP conference, PHP Kongress, was held in Germany soon after. [PHPDeveloper.org][5] came online, and to this day, it is the most authoritative news source in the PHP community. - -This communal momentum proved vital to PHP’s growth in subsequent years, and as the Web development industry erupted, so did PHP. PHP began powering more and larger websites. More user groups formed around the world. Mailing lists; online forums; IRC; conferences; trade journals such as php[architect], the German PHP Magazin, and International PHP Magazine -- the vibrancy of the PHP community had a significant impact on the way Web work would be done: collectively and openly, with an emphasis on code sharing. - -Then, 10 years ago, shortly after the release of PHP 5, an interesting thing happened in Web development that created a general shift in how the PHP community built libraries and applications: Ruby on Rails was released. - -### The rise of frameworks ### - -The Ruby on Rails framework for the Ruby programming language created an increased focus and attention on the MVC (model-view-controller) architectural pattern. The Mojavi PHP framework a few years prior had used this pattern, but the hype around Ruby on Rails is what firmly cemented MVC in the PHP frameworks that followed. Frameworks exploded in the PHP community, and frameworks have changed the way developers build PHP applications. - -Many important projects and developments have arisen, thanks to the proliferation of frameworks in the PHP community. The PHP [Framework Interoperability Group][6] formed in 2009 to aid in establishing coding standards, naming conventions, and best practices among frameworks. Codifying these standards and practices helped provide more interoperable software for developers using member projects’ code. This interoperability meant that each framework could be split into components and stand-alone libraries could be used together with monolithic frameworks. With interoperability came another important milestone: The Composer project was born in 2011. - -Inspired by Node.js’s NPM and Ruby’s Bundler, Composer has ushered in a new era of PHP application development, creating a PHP renaissance of sorts. It has encouraged interoperability between packages, standard naming conventions, adoption of coding standards, and increased test coverage. It is an essential tool in any modern PHP application. - -### The need for speed and innovation ### - -Today, the PHP community has a thriving ecosystem of applications and libraries. Some of the most widely installed PHP applications include WordPress, Drupal, Joomla, and MediaWiki. These applications power the Web presence of businesses of all sizes, from small mom-and-pop shops to sites like whitehouse.gov and Wikipedia. Six of the Alexa top 10 sites use PHP to serve billions of pages a day. As a result, PHP applications have been optimized for speed -- and much innovation has gone into PHP core to improve performance. - -In 2010, Facebook unveiled its HipHop for PHP source-to-source compiler, which translates PHP code into C++ code and compiles it into a single executable binary application. Facebook’s size and growth necessitated the move away from standard interpreted PHP code to a faster, optimized executable. However, Facebook wanted to continue using PHP for its ease of use and rapid development cycles. HipHop for PHP evolved into HHVM, a JIT (just-in-time) compilation-based execution engine for PHP, which included a new language based on PHP: [Hack][7]. - -Facebook’s innovations, as well as other VM projects, created competition at the engine level, leading to discussions about the future of the Zend Engine that still powers PHP’s core, as well as the question of a language specification. In 2014, a language specification project was created “to provide a complete and concise definition of the syntax and semantics of the PHP language,” making it possible for compiler projects to create interoperable PHP implementations. - -The next major version of PHP became a topic of intense debate, and a project known as phpng (next generation) was offered as an option to clean up, refactor, optimize, and improve the PHP code base, which also showed substantial improvements to the performance of real-world applications. After deciding to name the next major version “PHP 7,” due to a previous, unreleased PHP 6.0 version, the phpng branch was merged in, and plans were made to proceed with PHP 7, working in many of the language features offered by Hack, such as scalar and return type hinting. - -With the [first PHP 7 alpha release due out today][8] and benchmarks showing [performance as good as or better than that of HHVM][9] in many cases, PHP is keeping up with the pace of modern Web development needs. Likewise, the PHP-FIG continues to innovate and push frameworks and libraries to collaborate and cooperate -- most recently with the adoption of [PSR-7][10], which will change the way PHP projects handle HTTP. User groups, conferences, publications, and initiatives like [PHPMentoring.org][11] continue to advocate best practices, coding standards, and testing to the PHP developer community. - -PHP has seen the Web mature through various stages, and PHP has matured. Once a simple API wrapper around lower-level C libraries, PHP has become a full-fledged programming language in its own right. Its developer community is vibrant and helpful, priding themselves in pragmatism and welcoming newcomers. PHP has stood the test of time for 20 years, and current activity in the language and community is ensuring it will be a relevant and useful language for years to come. - -During his SunshinePHP keynote, Rasmus Lerdorf reflected, “Did I think I’d be here 20 years later talking about this silly little project I did? No, I didn’t.” - -Here’s to Lerdorf and the rest of the PHP community for transforming this “silly little project” into a lasting, powerful component of the Web today. - --------------------------------------------------------------------------------- - -via: http://www.infoworld.com/article/2933858/php/php-at-20-from-pet-project-to-powerhouse.html - -作者:[Ben Ramsey][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.infoworld.com/author/Ben-Ramsey/ -[1]:https://www.flickr.com/photos/jurvetson/13049862325 -[2]:https://groups.google.com/d/msg/comp.infosystems.www.authoring.cgi/PyJ25gZ6z7A/M9FkTUVDfcwJ -[3]:http://w3techs.com/technologies/overview/programming_language/all -[4]:http://web.archive.org/web/20061215165756/http://chiphpug.php.net/mpug.htm -[5]:http://www.phpdeveloper.org/ -[6]:http://www.php-fig.org/ -[7]:http://www.infoworld.com/article/2610885/facebook-q-a--hack-brings-static-typing-to-php-world.html -[8]:https://wiki.php.net/todo/php70#timetable -[9]:http://talks.php.net/velocity15 -[10]:http://www.php-fig.org/psr/psr-7/ -[11]:http://phpmentoring.org/ diff --git a/translated/talk/20150615 PHP at 20--From pet project to powerhouse.md b/translated/talk/20150615 PHP at 20--From pet project to powerhouse.md new file mode 100644 index 0000000000..2dd4765a42 --- /dev/null +++ b/translated/talk/20150615 PHP at 20--From pet project to powerhouse.md @@ -0,0 +1,81 @@ +PHP 20岁了:从兴趣工程到强大的组织 +============================================================================= +![](http://images.techhive.com/images/article/2015/06/13049862325_8c97a11878_z-100590275-primary.idge.jpg) + +信任: [Steve Jurvetson via Flickr][1] + +> 曾经的‘丑小鸭工程’已经转变为一个网络世界的强大组织,感谢网络世界的灵活,实用与充满生气的社区 + +当Rasmus Lerdorf发布“[一个用C写的紧凑的CGI可执行程序集合][2],” 他没有想到他的创造会对网络发展产生多大的影响。今年在Miami举行的SunshinePHP大会上,Lerdorf做了开场演讲,他自嘲到,“在1995年的时候,我以为我已经解除了C API的束缚,在网络之上。显然,事情并非那样,或者我们都已经是C程序员了。” + +实际上,当Lerdorf发布个人主页工具 -- 后来以PHP闻名的1.0版本时 -- 那时的网络还是如此的年轻。HTML 2.0还没有公布,直到那年的十一月份,而且HTTP/1.0也是次年的五月份才出现。NCSA HTTPd是使用最广泛的网络浏览器,而网景的Navigator则是最流行的网络浏览器,八月份的时候,IE1.0才到来。换句话说,PHP的开端刚好撞上了浏览器战争的前夜。 + +早些时候,说了大堆关于PHP对网络发展的影响。回到那时候,我们的选择是有限的,当说到服务器方面对于网络软件的进展。PHP满足了我们对于一个工具的需求,就是可以使得我们在网络上做一些动态的事情。实用的灵活性束缚了我们的想像,PHP从那时起便与网络共同成长。现在,PHP占据了网络语言超过80%的份额,已经是成熟的脚本语言,特别适合解决网络问题。她独一无二的血统讲述一个故事,实用高于理论,解决问题高于纯粹。 + +### 把我们钩住的网络魔力 ### + +PHP一开始并不是一门编程语言,从她的设计就很明星 -- 或者她本来就缺,正如那些贬低者指出的那样。最初,她是作为一种API帮助网络开发者能够接入底层的C语言封装库。第一个版本是一组小的CGI可执行程序,提供表单处理功能,通过接入需要的参数和mSQL数据库。而且她如此容易地处理一个网络应用的数据库,证明了其在激发我们对于PHP的兴趣和PHP后来的支配地位的关键作用。 + +到了第二版 -- aka PHP/FI -- 数据库的支持已经扩展到包括PostgreSQL、MySQL、Oracle、Sybase等等。她通过包括他们的C语言库来支持其数据库,将他们作为PHP库的一部分。PHP/FI也可以包括GD库,创建并管理GIF镜像。她可以作为一个Apache模块运行,或者有FastCGI支持的时候被编译,并且她展示了支持变量,数组,语言结构和函数的PHP脚本语言。对于那个时候大多数在网络这块工作的人来说,PHP是我们一直在寻求的那款“胶水”。 + +当PHP吸纳越来越多的编程语言分支,演变为第三版和之后的版本,她从来没有失去连接的特性。通过仓库如PECL(PHP Extension Community Library),PHP可以把库都连在一起,暴露他们的函数给PHP层。这种将组件结合在一起的能力,成为PHP之美的一个重要方面,尽管她没有被限制在其资源代码上。 + +### 网络,一个码农们的社区 ### + +PHP在网络发展上的持续影响并不局限于能用这种语言干什么。PHP如何完成工作,谁参与近进来 -- 这些都是PHP传奇很重要的部分。 + +早在1997年,PHP的用户群体开始形成。其中最早的是中东的PHP用户群(后来以Chiago PHP闻名),并[1997年二月份的时候举行了第一次聚会][4]。这是一个充满生气,饱含激情的开发者社区形成的开端,聚合成一种吸引力 -- 在网络上很少的工具就可以帮助他们解决问题。PHP这种普遍存在的特性使得她成为网络开发一个很自然的选择。在分享主导的世界里,她开始盛行,而且低入的门槛对于许多早期的网络开发者来说是十分有吸引力的。 + +伴随着社区的成长,为开发者带来了一堆工具和资源。这一年2000年 -- PHP的一个转折点 -- 见证了第一次PHP开发者大会,编程语言的核心开发者的一次聚集,在Tel Aviv见面,讨论即将到来的4.0版本的发布。PHP扩展和应用仓库(PEAR)也于2000发起,提供高质量的用户代码包,根据标准且最好的操作。第一届PHP大会,PHP Kongress,不久之后在德国举行。[PHPDeveloper.org][5]随后上线,直到今天。这是在PHP社区里最权威的新闻资源。 + +这种公社的势头(有待校正)证明了接下来几年里PHP成长的关键所在,且随着网络开发产业的爆发,PHP也获得发展。PHP开始占领更多,更大的网站。越来越多的用户群在世界范围内形成。邮件列表;在线论坛;IRC;大会;交易日记如php[架构],德国PHP杂志,国际PHP杂志 -- PHP社区的活力在完成网络工作的方式上有极其重要的影响:共同地,开放地,倡导代码共享。 + +然后,10年前,PHP 5发布后不久,在网络发展史上一个有趣地事情发生了,导致了PHP社区如何构建库和应用的转变:Ruby on Rails发布了。 + +### 框架的异军突起 ### + +针对Ruby编程语言的Ruby on Rails,在MVC(模型-视图-控制)架构模型上获得了不断增长的焦点与关注。Mojavi PHP框架几年前已经使用该模型了,但是Ruby on Rails的高明之处在于巩固了MVC。框架在PHP社区炸开了,并且框架已经改变了开发者构建PHP应用程序的方式。 + +许多重要的项目和发展已经起势,这归功于PHP社区框架的生长。PHP[框架互用性组织][6]成立于2009年,致力于在框架间建立编码标准,命名约定与最佳操作。编纂这些标准和操作帮助为开发者提供了越来越多的互动性软件,使用成员项目的代码。互用性意味着每个框架可以拆分为组块和独立的库,可以被一起使用作为整体的框架。互用性带来了另一个重要的里程碑:Composer项目于2011年诞生了。 + +从Node.js的NPM和Ruby的Bundler获得灵感,Composer开辟了PHP应用开发的新纪元,创造了一次PHP“文艺复兴”。它激起了包,标准命名约定,编码标准的采用与成长中的覆盖测试间的互用性。它是任何现代PHP应用中的一个基本工具。 + +### 加速和创新的需要 ### + +如今,PHP社区有一个生机勃勃应用和库的生态系统,一些被广泛安装的PHP应用包括WordPress,Drupal,Joomla和MediaWiki。这些应用占据了所有规模的商业的网络形式,从小型的夫妻店到站点如whitehouse.gov和Wikipeida。Alexa前十的站点中,6个使用PHP在一天内服务数十亿的页面。结果,PHP应用已成加速需要的首选 -- 并且许多创新也加入到PHP的核心来提升表现。 + +在2010年,Facebook公开了其用作PHP源对源的编译器的HipHop,翻译PHP代码为C++代码,并且编译为一个单独的可执行二进制应用。Facebook的规模和成长需要从标准互用的PHP代码迁移到更快,最佳的可执行的代码。尽管如此,Facebook想继续使用PHP,由于PHP的易用和快速开发周期。HipHop进化为HHVM,一个针对PHP的JIT(just-in-time)编译基础的执行引擎,其包含一个基于PHP的新的语言:[Hack][7]。 + +Facebook的创新,和其他的VM项目,创建了在引擎水平上的比较,引起了关于Zend引擎未来的讨论。Zend引擎依然占据PHP和一种语言表述的问题的核心。在2004年,一个语言表述项目被创建,“为提供一个完整的,简明的语句定义,和PHP语言的语义学,”使得对编译器项目来说,创建共用的PHP实现成为可能。 + +下一个PHP的主要版本成为了激烈争论的话题,一个著名的pgpng项目(下一代)作为一个能清理,重构,优化和提升PHP代码基础的选项被提出来,这也展示了对真实世界应用的性能的实质上的提升。由于之前未发布的PHP 6.0版本,在决定命名下一个主要版本为“PHP 7”后,phpng分支被合并了,并制定了计划开发PHP 7,Hack提供了很多语言中拥有的功能,如scalar和返回键入提示。 + +随着[今天第一版PHP 7 alpha发布][8],标准检测程序显示在许多方面[与HHVM的一样或者更好的性能][9],PHP正与现代网络开发需求保持一致的步伐。同样地,PHP-FIG继续创新和推送框架与库用于协作 -- 最近由于[PSR-7][10]的采纳,这将会改变PHP项目处理HTTP的方式。用户组,会议,公众和积极性如[PHPMentoring.org][11]继续在PHP开发者社区提倡最好的操作,编码标准和测试 + +PHP从各个方面见证了网络的成熟,而且PHP自己也成熟了。曾经一个单一的低层次的C语言库的API包装,PHP以她自己的方式,已经成为一个羽翼丰满的编程语言。她的开发者社区是一个充满生气,乐于帮助,在实用方面以自己为傲,并且欢迎新入者的地方。PHP已经经受了20年的考验,而且目前在语言与社区里活跃性,会保证她将会是一个中肯的,有用的的语言,在接下来的几年里。 + +他的SunshinePHP的关键发言中,Rasmus Lerdorf回忆到,“我曾想过我会在20年之后与我当初做的这个愚蠢的小项目交流吗?没有。” + +-------------------------------------------------------------------------------- + +via: http://www.infoworld.com/article/2933858/php/php-at-20-from-pet-project-to-powerhouse.html + +作者:[Ben Ramsey][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.infoworld.com/author/Ben-Ramsey/ +[1]:https://www.flickr.com/photos/jurvetson/13049862325 +[2]:https://groups.google.com/d/msg/comp.infosystems.www.authoring.cgi/PyJ25gZ6z7A/M9FkTUVDfcwJ +[3]:http://w3techs.com/technologies/overview/programming_language/all +[4]:http://web.archive.org/web/20061215165756/http://chiphpug.php.net/mpug.htm +[5]:http://www.phpdeveloper.org/ +[6]:http://www.php-fig.org/ +[7]:http://www.infoworld.com/article/2610885/facebook-q-a--hack-brings-static-typing-to-php-world.html +[8]:https://wiki.php.net/todo/php70#timetable +[9]:http://talks.php.net/velocity15 +[10]:http://www.php-fig.org/psr/psr-7/ +[11]:http://phpmentoring.org/ +这里向Lerdorf和PHP社区的其他人致敬,感谢他们把这个“愚蠢的小项目”变成了一个如今网络上持久的,强大的组块。 From 981f7e86dbe89fc117feac258e96665e7e56fdfe Mon Sep 17 00:00:00 2001 From: wwy-hust Date: Fri, 19 Jun 2015 17:22:25 +0800 Subject: [PATCH 139/153] translated --- ...is good audio editing software on Linux.md | 84 ------------------- ...is good audio editing software on Linux.md | 67 +++++++++++++++ 2 files changed, 67 insertions(+), 84 deletions(-) delete mode 100644 sources/tech/20141219 What is good audio editing software on Linux.md create mode 100644 translated/tech/20141219 What is good audio editing software on Linux.md diff --git a/sources/tech/20141219 What is good audio editing software on Linux.md b/sources/tech/20141219 What is good audio editing software on Linux.md deleted file mode 100644 index da015adf14..0000000000 --- a/sources/tech/20141219 What is good audio editing software on Linux.md +++ /dev/null @@ -1,84 +0,0 @@ -translating by wwy-hust - -What is good audio editing software on Linux -================================================================================ - -Whether you are an amateur musician or just a student recording his professor, you need to edit and work with audio recordings. If for a long time such task was exclusively attributed to Macintosh, this time is over, and Linux now has what it takes to do the job. In short, here is a non-exhaustive list of good audio editing software, fit for different tasks and needs. - -### 1. Audacity ### - -![](https://farm9.staticflickr.com/8572/15405018653_83ba3e718d_c.jpg) - -Let's get started head on with my personal favorite. [Audacity][1] works on Windows, Mac, and Linux. It is open source. It is easy to use. You get it: Audacity is almost perfect. This program lets you manipulate the audio waveform from a clean interface. In short, you can overlay tracks, cut and edit them easily, apply effects, perform advanced sound analysis, and finally export to a plethora of format. The reason I like it so much is that it combines both basic features with more complicated ones, but maintain an easy leaning curve. However, it is not a fully optimized software for hardcore musicians, or people with professional knowledge. - -### 2. Jokosher ### - -![](https://farm8.staticflickr.com/7524/15998875136_82903a9b4a_c.jpg) - -On a different level, [Jokosher][2] focuses more on the multi-track aspect for musical artists. Developed in Python and using the GTK+ interface with GStreamer for audio back-end, Jokosher really impressed me with its slick interface and its extensions. If the editing features are not the most advanced, the language is clear and directed to musicians. And I really like the association between tracks and instruments for example. In short, if you are starting as a musician, it might be a good place to get some experience before moving on to more complex suites. - -### 3. Ardour ### - -![](https://farm9.staticflickr.com/8577/16024644385_d8cd8073a3_c.jpg) - -And talking about compex suites, [Ardour][3] is complete software for recording, editing, and mixing. Designed this time to appeal to all professionals, Ardour features in term of sound routing and plugins go way beyond my comprehension. So if you are looking for a beast and are not afraid to tame it, Ardour is probably a good pick. Again, the interface contributes to its charm, as well as its extensive documentation. I particularly appreciated the first-launch configuration tool. - -### 4. Kwave ### - -![](https://farm8.staticflickr.com/7557/15402389884_633a8b04c5_c.jpg) - -For all KDE lovers, [KWave][4] corresponds to your idea of design and features. There are plenty of shortcuts and interesting options, like memory management. Even if the few effects are nice, we are more dealing with a simple tool to cut/paste audio together. It becomes shard not to compare it with Audacity unfortunately. And on top of that, the interface did not appeal to me that much. - -### 5. Qtractor ### - -![](https://farm8.staticflickr.com/7551/16022707501_68c39f37e5_c.jpg) - -If Kwave is too simplistic for you but a Qt-based program really has some appeal, then [Qtractor][5] might be your option. It aims to be "simple enough for the average home user, and yet powerful enough for the professional user." Indeed the quantity of features and options is almost overwhelming. My favorite being of course customizable shortcuts. Apart from that, Qtractor is probably one of my favorite tools to deal with MIDI files. - -### 6. LMMS ### - -![](https://farm8.staticflickr.com/7509/15838603239_ef0ecbc8d2_c.jpg) - -Standing for Linux MultiMedia Studio, LMMS is directly targeted for music production. If you do not have prior experience and do not want to spend too much time getting some, go elsewhere. LMMS is one of those complex but powerful software that only a few will truly master. The number of features and effects is simply too long to list, but if I had to pick one, I would say that the Freeboy plugin to emulate Game Boy sound system is just magical. Past that, go see their amazing documentation. - -### 7. Traverso ### - -![](https://farm8.staticflickr.com/7537/15838603279_70ee925057_c.jpg) - -Finally, Traverso stood out to me for its unlimited track count and its direct integration with CD burning capacities. Aside from that, it appeared to me as a middle man between a simplistic software and a professional program. The interface is very KDE-like, and the keyboard configuration is always welcome. And cherry on the cake, Traverso monitors your resources and make sure that your CPU or hard drive does not go overboard. - -To conclude, it is always a pleasure to see such a large diversity of applications on Linux. It makes finding the software that best fits your needs always possible. While my personal favorite stays Audacity, I was very surprised by the design of programs like LMMS or Jokosher. - -Did we miss one? What do you use for audio editing on Linux? And why? Let us know in the comments. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/good-audio-editing-software-linux.html - -作者:[Adrien Brochard][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://xmodulo.com/author/adrien -[1]:http://audacity.sourceforge.net/ -[2]:https://launchpad.net/jokosher/ -[3]:http://ardour.org/ -[4]:http://kwave.sourceforge.net/ -[5]:http://qtractor.sourceforge.net/qtractor-index.html -[6]: -[7]: -[8]: -[9]: -[10]: -[11]: -[12]: -[13]: -[14]: -[15]: -[16]: -[17]: -[18]: -[19]: -[20]: diff --git a/translated/tech/20141219 What is good audio editing software on Linux.md b/translated/tech/20141219 What is good audio editing software on Linux.md new file mode 100644 index 0000000000..c3f9c76d61 --- /dev/null +++ b/translated/tech/20141219 What is good audio editing software on Linux.md @@ -0,0 +1,67 @@ +LinuxƵ༭ +================================================================================ + +һְ߻ֻһҪ¼ʦѧҪ¼Ƶͱ༭ƵĹҪMacintoshǸʱѾȥLinuxҲʤЩˡ֮һݲȫƵ༭бڲͬ + +### 1. Audacity ### + +![](https://farm9.staticflickr.com/8572/15405018653_83ba3e718d_c.jpg) + +ǴҸϲʼ[Audacity][1]WindowsMacLinuxϡǿԴģʹáãAudacityġڸɾĽϲƵΡ򵥵˵Ը졢к޸졢Чִи߼ȻǵһѿõĸʽϲԭĹܺ͸ӵĹܽһұһ򵥵ѧϰߡȻһȫŻǶּҺרҵ֪ʶˡ + +### 2. Jokosher ### + +![](https://farm8.staticflickr.com/7524/15998875136_82903a9b4a_c.jpg) + +ڲͬIJϣ[Jokosher][2]ľ۽ڶ췽档ʹPythonGTK+Ϊǰ˽ڣʹGStreamerΪƵˡJokosherƽĽչԸ̵ӡҲ༭ĹܲȽģʮʺּҡ磬ʮϲϡ֮һּңôתƵһǰʵĺûᡣ + +### 3. Ardour ### + +![](https://farm9.staticflickr.com/8577/16024644385_d8cd8073a3_c.jpg) + +̸һЩӵĹߣ[Ardour][3]һĿ¼ơ༭ͻеרҵԱArdourͲ泬ҵѰһͷҰ޲ҲѱôArdourȡһѡٴΣĽӿںḻĵ״ʱù߶һ֡ + +### 4. Kwave ### + +![](https://farm8.staticflickr.com/7557/15402389884_633a8b04c5_c.jpg) + +KDEȰߣ[KWave][4]Էƺ͹ܵзḻĿݼԼܶȤѡڴܺܶЧܲǸӦùעЩƵ/ճĹߡϧ޷AudacityȣҪǣýӿڲûôҡ + +### 5. Qtractor ### + +![](https://farm8.staticflickr.com/7551/16022707501_68c39f37e5_c.jpg) + +Kwave˵ڼ򵥣QtijȴЩô˵Ҳ[Qtractor][5]һѡһڼͥû˵㹻򵥣ҶרҵԱ˵㹻ǿʵܺѡѹԵġϲĵȻǿɶƵĿݼ֮⣬QtractorϲһMIDIļĹߡ + +### 6. LMMS ### + +![](https://farm8.staticflickr.com/7509/15838603239_ef0ecbc8d2_c.jpg) + +ΪLinuxý幤ңLMMSֱĿ֮ǰûʲô鲢Ҳ˷̫ʱ䣬ôȥ𴦰ɡLMMSһӵǿֻ̫ĹܺЧ޷һһгұһһ˵ģGame BoyϵͳFreeboyֱħһȻȥǾ˵ĵɡ + +### 7. Traverso ### + +![](https://farm8.staticflickr.com/7537/15838603279_70ee925057_c.jpg) + +վǰTraverso֧ƵֱCD¼Ĺܡ⣬˵ǽڼ򵥵רҵ֮ijĽKDEʽģúܼ򵥡ȤǣTraversoϵͳԴȷᳬCPUӲ + +֮ܶLinuxϵͳϿô಻ͬӦóһĵ¡ʹԶҵʺԼһȻϲӦAudacityҷdzLMMSJokosherơ + +©ʲôôLinuxʹһأԭʲôأԴ֪ + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/good-audio-editing-software-linux.html + +ߣ[Adrien Brochard][a] +ߣ[wwy-hust](https://github.com/wwy-hust) +Уԣ[УID](https://github.com/УID) + + [LCTT](https://github.com/LCTT/TranslateProject) ԭ룬[Linuxй](http://linux.cn/) Ƴ + +[a]:http://xmodulo.com/author/adrien +[1]:http://audacity.sourceforge.net/ +[2]:https://launchpad.net/jokosher/ +[3]:http://ardour.org/ +[4]:http://kwave.sourceforge.net/ +[5]:http://qtractor.sourceforge.net/qtractor-index.html \ No newline at end of file From 85525e10ac3aa43555ed061493b91106a7437fe3 Mon Sep 17 00:00:00 2001 From: zpl1025 Date: Fri, 19 Jun 2015 18:01:28 +0800 Subject: [PATCH 140/153] [translated] 20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md --- ... Spaces and Special Characters in Linux.md | 436 ------------------ ... Spaces and Special Characters in Linux.md | 435 +++++++++++++++++ 2 files changed, 435 insertions(+), 436 deletions(-) delete mode 100644 sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md create mode 100644 translated/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md diff --git a/sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md b/sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md deleted file mode 100644 index 31b28afd01..0000000000 --- a/sources/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md +++ /dev/null @@ -1,436 +0,0 @@ -zpl1025 -How to Manipulate Filenames Having Spaces and Special Characters in Linux -================================================================================ -We come across files and folders name very regularly. In most of the cases file/folder name are related to the content of the file/folder and starts with number and characters. Alpha-Numeric file name are pretty common and very widely used, but this is not the case when we have to deal with file/folder name that has special characters in them. - -**Note**: We can have files of any type but for simplicity and easy implementation we will be dealing with Text file (.txt), throughout the article. - -Example of most common file names are: - - abc.txt - avi.txt - debian.txt - ... - -Example of numeric file names are: - - 121.txt - 3221.txt - 674659.txt - ... - -Example of Alpha-Numeric file names are: - - eg84235.txt - 3kf43nl2.txt - 2323ddw.txt - ... - -Examples of file names that has special character and is not very common: - - #232.txt - #bkf.txt - #bjsd3469.txt - #121nkfd.txt - -2232.txt - -fbjdew.txt - -gi32kj.txt - --321.txt - --bk34.txt - ... - -One of the most obvious question here is – who on earth create/deal with files/folders name having a Hash `(#)`, a semi-colon `(;)`, a dash `(-)` or any other special character. - -I Agree to you, that such file names are not common still your shell should not break/give up when you have to deal with any such file names. Also speaking technically every thing be it folder, driver or anything else is treated as file in Linux. - -### Dealing with file that has dash (-) in it’s name ### - -Create a file that starts with a dash `(-)`, say -abx.txt. - - $ touch -abc.txt - -#### Sample Output #### - - touch: invalid option -- 'b' - Try 'touch --help' for more information. - -The reason for above error, that shell interprets anything after a dash `(-)`, as option, and obviously there is no such option, hence is the error. - -To resolve such error, we have to tell the Bash shell (yup this and most of the other examples in the article is for BASH) not to interpret anything after special character (here dash), as option. - -There are two ways to resolve this error as: - - $ touch -- -abc.txt [Option #1] - $ touch ./-abc.txt [Option #2] - -You may verify the file thus created by both the above ways by running commands ls or [ls -l][1] for long listing. - - $ ls -l - - total 0 - -rw-r--r-- 1 avi avi 0 Jun 8 11:05 -abc.txt - -To edit the above file you may do: - - $ nano -- -abc.txt - or - $ nano ./-abc.txt - -**Note**: You may replace nano with any other editor of your choice say vim as: - - $ vim -- -abc.txt - or - $ vim ./-abc.txt - -Similarly to move such file you have to do: - - $ mv -- -abc.txt -a.txt - or - $ mv -- -a.txt -abc.txt - -and to Delete this file, you have to do: - - $ rm -- -abc.txt - or - $ rm ./-abc.txt - -If you have lots of files in a folder the name of which contains dash, and you want to delete all of them at once, do as: - - $ rm ./-* - -**Important to Note:** - -1. The same rule as discussed above follows for any number of hypen in the name of the file and their occurrence. Viz., -a-b-c.txt, ab-c.txt, abc-.txt, etc. - -2. The same rule as discussed above follows for the name of the folder having any number of hypen and their occurrence, except the fact that for deleting the folder you have to use ‘rm -rf‘ as: - - $ rm -rf -- -abc - or - $ rm -rf ./-abc - -### Dealing with files having HASH (#) in the name ### - -The symbol `#` has a very different meaning in BASH. Anything after a `#` is interpreted as comment and hence neglected by BASH. - -**Understand it using examples:** - -create a file #abc.txt. - - $ touch #abc.txt - -#### Sample Output #### - - touch: missing file operand - Try 'touch --help' for more information. - -The reason for above error, that Bash is interpreting #abc.txt a comment and hence ignoring. So the [command touch][2] has been passed without any file Operand, and hence is the error. - -To resolve such error, you may ask BASH not to interpret # as comment. - - $ touch ./#abc.txt - or - $ touch '#abc.txt' - -and verify the file just created as: - - $ ls -l - - total 0 - -rw-r--r-- 1 avi avi 0 Jun 8 12:14 #abc.txt - -Now create a file the name of which contains # anywhere except at the begging. - - $ touch ./a#bc.txt - $ touch ./abc#.txt - - or - $ touch 'a#bc.txt' - $ touch 'abc#.txt' - -Run ‘ls -l‘ to verify it: - - $ ls -l - - total 0 - -rw-r--r-- 1 avi avi 0 Jun 8 12:16 a#bc.txt - -rw-r--r-- 1 avi avi 0 Jun 8 12:16 abc#.txt - -What happens when you create two files (say a and #bc) at once: - - $ touch a.txt #bc.txt - -Verify the file just created: - - $ ls -l - - total 0 - -rw-r--r-- 1 avi avi 0 Jun 8 12:18 a.txt - -Obvious from the above example it only created file ‘a‘ and file ‘#bc‘ has been ignored. To execute the above situation successfully we can do, - - $ touch a.txt ./#bc.txt - or - $ touch a.txt '#bc.txt' - -and verify it as: - - $ ls -l - - total 0 - -rw-r--r-- 1 avi avi 0 Jun 8 12:20 a.txt - -rw-r--r-- 1 avi avi 0 Jun 8 12:20 #bc.txt - -You can move the file as: - - $ mv ./#bc.txt ./#cd.txt - or - $ mv '#bc.txt' '#cd.txt' - -Copy it as: - - $ cp ./#cd.txt ./#de.txt - or - $ cp '#cd.txt' '#de.txt' - -You may edit it as using your choice of editor as: - - $ vi ./#cd.txt - or - $ vi '#cd.txt' - ----------- - - $ nano ./#cd.txt - or - $ nano '#cd.txt' - -And Delete it as: - - $ rm ./#bc.txt - or - $ rm '#bc.txt' - -To delete all the files that has hash (#) in the file name, you may use: - - # rm ./#* - -### Dealing with files having semicolon (;) in its name ### - -In case you are not aware, semicolon acts as a command separator in BASH and perhaps other shell as well. Semicolon lets you execute several command in one go and acts as separator. Have you ever deal with any file name having semicolon in it? If not here you will. - -Create a file having semi-colon in it. - - $ touch ;abc.txt - -#### Sample Output #### - - touch: missing file operand - Try 'touch --help' for more information. - bash: abc.txt: command not found - -The reason for above error, that when you run the above command BASH interpret touch as a command but could not find any file operand before semicolon and hence it reports error. It also reports another error that ‘abc.txt‘ command not found, only because after semicolon BASH was expecting another command and ‘abc.txt‘, is not a command. - -To resolve such error, tell BASH not to interpret semicolon as command separator, as: - - $ touch ./';abc.txt' - or - $ touch ';abc.txt' - -**Note**: We have enclosed the file name with single quote ''. It tells BASH that ; is a part of file name and not command separator. - -Rest of the action (viz., copy, move, delete) on the file and folder having semicolon in its name can be carried out straight forward by enclosing the name in single quote. - -### Dealing with other special characters in file/folder name ### - -#### Plus Sign (+) in file name #### - -Don’t requires anything extra, just do it normal way, as simple file name as shown below. - - $ touch +12.txt - -#### Dollar sign ($) in file name #### - -You have to enclose file name in single quote, as we did in the case of semicolon. Rest of the things are straight forward.. - - $ touch '$12.txt' - -#### Percent (%) in file name #### - -You don’t need to do anything differently, treat it as normal file. - - $ touch %12.txt - -#### Asterisk (*) in file name #### - -Having Asterisk in file name don’t change anything and you can continue using it as normal file. - - $ touch *12.txt - -Note: When you have to delete a file that starts with *, Never use following commands to delete such files. - - $ rm * - or - $ rm -rf * - -Instead use, - - $ rm ./*.txt - -#### Exclamation mark (!) in file name #### - -Just Enclose the file name in single quote and rest of the things are same. - - $ touch '!12.txt' - -#### At Sign (@) in file name #### - -Nothing extra, treat a filename having At Sign as nonrmal file. - - $ touch '@12.txt' - -#### ^ in file name #### - -No extra attention required. Use a file having ^ in filename as normal file. - - $ touch ^12.txt - -#### Ampersand (&) in file name #### - -Filename should be enclosed in single quotes and you are ready to go. - - $ touch '&12.txt' - -#### Parentheses () in file name #### - -If the file name has Parenthesis, you need to enclose filename with single quotes. - - $ touch '(12.txt)' - -#### Braces {} in file name #### - -No Extra Care needed. Just treat it as just another file. - - $ touch {12.txt} - -#### Chevrons <> in file name #### - -A file name having Chevrons must be enclosed in single quotes. - - $ touch '<12.txt>' - -#### Square Brackets [ ] in file name #### - -Treat file name having Square Brackets as normal files and you need not take extra care of it. - - $ touch [12.txt] - -#### Under score (_) in file name #### - -They are very common and don’t require anything extra. Just do what you would have done with a normal file. - - $ touch _12.txt - -#### Equal-to (=) in File name #### - -Having an Equal-to sign do not change anything, you can use it as normal file. - - $ touch =12.txt - -#### Dealing with back slash (\) #### - -Backslash tells shell to ignore the next character. You have to enclose file name in single quote, as we did in the case of semicolon. Rest of the things are straight forward. - - $ touch '\12.txt' - -#### The Special Case of Forward Slash #### - -You cannot create a file the name of which includes a forward slash (/), until your file system has bug. There is no way to escape a forward slash. - -So if you can create a file such as ‘/12.txt’ or ‘b/c.txt’ then either your File System has bug or you have Unicode support, which lets you create a file with forward slash. In this case the forward slash is not a real forward slash but a Unicode character that looks alike a forward slash. - -#### Question Mark (?) in file name #### - -Again, an example where you don’t need to put any special attempt. A file name having Question mark can be treated in the most general way. - - $ touch ?12.txt - -#### Dot Mark (.) in file name #### - -The files starting with dot `(.)` are very special in Linux and are called dot files. They are hidden files generally a configuration or system files. You have to use switch ‘-a‘ or ‘-A‘ with ls command to view such files. - -Creating, editing, renaming and deleting of such files are straight forward. - - $ touch .12.txt - -Note: In Linux you may have as many dots `(.)` as you need in a file name. Unlike other system dots in file name don’t means to separate name and extension. You can create a file having multiple dots as: - - $ touch 1.2.3.4.5.6.7.8.9.10.txt - -and check it as: - - $ ls -l - - total 0 - -rw-r--r-- 1 avi avi 0 Jun 8 14:32 1.2.3.4.5.6.7.8.9.10.txt - -#### Comma (,) in file name #### - -You can have comma in a file name, as many as you want and you Don’t requires anything extra. Just do it normal way, as simple file name. - - $ touch ,12.txt - or - $ touch ,12,.txt - -#### Colon (:) in File name #### - -You can have colon in a file name, as many as you want and you Don’t requires anything extra. Just do it normal way, as simple file name. - - $ touch :12.txt - or - $ touch :12:.txt - -#### Having Quotes (single and Double) in file name #### - -To have quotes in file name, we have to use the rule of exchange. I.e, if you need to have single quote in file name, enclose the file name with double quotes and if you need to have double quote in file name, enclose it with single quote. - - $ touch "15'.txt" - - and - - $ touch '15”.txt' - -#### Tilde (~) in file name #### - -Some Editors in Linux like emacs create a backup file of the file being edited. The backup file has the name of the original file plus a tilde at the end of the file name. You can have a file that name of which includes tilde, at any location simply as: - - $ touch ~1a.txt - or - $touch 2b~.txt - -#### White Space in file name #### - -Create a file the name of which has space between character/word, say “hi my name is avishek.txt”. - -It is not a good idea to have file name with spaces and if you have to distinct readable name, you should use, underscore or dash. However if you have to create such a file, you have to use backward slash which ignores the next character to it. To create above file we have to do it this way.. - - $ touch hi\ my\ name\ is\ avishek.txt - - hi my name is avishek.txt - -I have tried covering all the scenario you may come across. Most of the above implementation are explicitly for BASH Shell and may not work in other shell. - -If you feel that I missed something (that is very common and human nature), you may include your suggestion in the comments below. Keep Connected, Keep Commenting. Stay Tuned and connected! Like and share us and help us get spread! - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/manage-linux-filenames-with-special-characters/ - -作者:[Avishek Kumar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/avishek/ -[1]:http://www.tecmint.com/15-basic-ls-command-examples-in-linux/ -[2]:http://www.tecmint.com/8-pratical-examples-of-linux-touch-command/ diff --git a/translated/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md b/translated/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md new file mode 100644 index 0000000000..61a320aeb8 --- /dev/null +++ b/translated/tech/20150610 How to Manipulate Filenames Having Spaces and Special Characters in Linux.md @@ -0,0 +1,435 @@ +Linux 下如何处理包含空格和特殊字符的文件名 +================================================================================ +我们经常会看到文件名和文件夹名。大多数时候文件/文件夹的名字和内容相关并以数字和字母开头。字母-数字文件名最常见,应用也很广泛,但总会需要处理一些包含特殊字符的文件名/文件夹名。 + +** 注意 **:我们可能有各种类型的文件,但是为了简单以及方便实现,在本文中我们只处理文本文件(.txt)。 + +最常见的文件名例子: + + abc.txt + avi.txt + debian.txt + ... + +数字文件名例子: + + 121.txt + 3221.txt + 674659.txt + ... + +字母数字文件名例子: + + eg84235.txt + 3kf43nl2.txt + 2323ddw.txt + ... + +包含特殊字符的文件名的例子,并不常见: + + #232.txt + #bkf.txt + #bjsd3469.txt + #121nkfd.txt + -2232.txt + -fbjdew.txt + -gi32kj.txt + --321.txt + --bk34.txt + ... + +一个显而易见的问题是 - 在这个星球上有谁会创建/处理包含井号`(#)`,分号`(;)`,破折号`(-)`或其他特殊字符的文件/文件夹啊。 + +我和你想的一样,这种文件名确实不常见,不过在你必须得处理这种文件名的时候你的 shell 也不应该出错或罢工。而且技术上来说,Linux 下的一切比如文件夹,驱动器或其他所有的都被当作文件处理。 + +### 处理名字包含破折号(-)的文件 ### + +创建以破折号`(-)`开头的文件,比如 -abx.txt。 + + $ touch -abc.txt + +#### 测试输出 #### + + touch: invalid option -- 'b' + Try 'touch --help' for more information. + +出现上面错误的原因是,shell 把破折号`(-)`之后的内容认作参数了,而很明显没有这样的参数,所以报错。 + +要解决这个问题,我们得告诉 Bash shell(是的,这里以及本文后面的大多数例子都是基于 BASH 环境)不要将特殊字符(这里是破折号)后的字符解释为参数。 + +有两种方法解决这个错误: + + $ touch -- -abc.txt [方法 #1] + $ touch ./-abc.txt [方法 #2] + +你可以通过运行命令 ls 或 [ls -l][1] 列出详细信息来检查通过上面两种方式创建的文件。 + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 11:05 -abc.txt + +要编辑上述文件可以这样: + + $ nano -- -abc.txt + 或者 + $ nano ./-abc.txt + +**注意**:你可以将 nano 替换为任何其他你喜欢的编辑器比如说 vim: + + $ vim -- -abc.txt + 或者 + $ vim ./-abc.txt + +如果只是简单地移动文件可以这样: + + $ mv -- -abc.txt -a.txt + 或者 + $ mv -- -a.txt -abc.txt + +删除这种文件,可以这样: + + $ rm -- -abc.txt + 或者 + $ rm ./-abc.txt + +如果一个目录下有大量这种名字包含破折号的文件,要一次全部删除的话,可以这样: + + $ rm ./-* + +**重要:** + +1. 上面讨论的规则可以同样应用于名字中包含任意数量以及位置连接符号的文件。就是说,-a-b-c.txt,ab-c.txt,abc-.txt,等等。 + +2. 上面讨论的规则可以同样应用于名字中包含任意数量以及位置连接符号的文件夹,除了一种情况,在删除一个文件夹的时候你得这样使用`rm -rf`: + + $ rm -rf -- -abc + 或者 + $ rm -rf ./-abc + +### 处理名字包含井号(#)的文件 ### + +符号`#`在 BASH 里有非常特别的含义。`#`之后的一切都会被认为是评论,因此会被 BASH 忽略。 + +**通过例子来加深理解:** + +创建一个名字是 #abc.txt 的文件: + + $ touch #abc.txt + +#### 测试输出 #### + + touch: missing file operand + Try 'touch --help' for more information. + +出现上面错误的原因是,BASH 将 #abc.txt 解释为评论而忽略了。所以[命令 touch][2]没有收到任何文件作为参数,所以导致这个错误。 + +要解决这个问题,你肯能需要告诉 BASH 不要将 # 解释为评论。 + + $ touch ./#abc.txt + 或者 + $ touch '#abc.txt' + +检查刚创建的文件: + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 12:14 #abc.txt + +现在创建名字中除了开头的其他地方包含 # 的文件。 + + $ touch ./a#bc.txt + $ touch ./abc#.txt + + 或者 + $ touch 'a#bc.txt' + $ touch 'abc#.txt' + +运行 ‘ls -l‘ 来检查: + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 12:16 a#bc.txt + -rw-r--r-- 1 avi avi 0 Jun 8 12:16 abc#.txt + +如果同时创建两个文件(比如 a 和 #bc)会怎么样: + + $ touch a.txt #bc.txt + +检查刚创建的文件: + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 12:18 a.txt + +很明显上面的例子中只创建了文件 `a` 而文件 `#bc` 被忽略了。对于上面的情况我们可以这样做, + + $ touch a.txt ./#bc.txt + 或者 + $ touch a.txt '#bc.txt' + +检查一下: + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 12:20 a.txt + -rw-r--r-- 1 avi avi 0 Jun 8 12:20 #bc.txt + +可以这样移动文件: + + $ mv ./#bc.txt ./#cd.txt + 或者 + $ mv '#bc.txt' '#cd.txt' + +这样拷贝: + + $ cp ./#cd.txt ./#de.txt + 或者 + $ cp '#cd.txt' '#de.txt' + +可以使用你喜欢的编辑器来编辑文件: + + $ vi ./#cd.txt + 或者 + $ vi '#cd.txt' + +---------- + + $ nano ./#cd.txt + 或者 + $ nano '#cd.txt' + +这样删除: + + $ rm ./#bc.txt + 或者 + $ rm '#bc.txt' + +要删除所有以井号(#)开头的文件,可以这样: + + # rm ./#* + +### 处理名字包含分号(;)的文件 ### + +如果你还不知道的话,分号在 BASH 里起到命令分隔的作用,其他 shell 可能也是一样的。分号作为分隔符可以让你一次执行几个命令。你碰到过名字包含分号的文件吗?如果没有的话,这里有例子。 + +创建一个名字包含分号的文件。 + + $ touch ;abc.txt + +#### 测试输出 #### + + touch: missing file operand + Try 'touch --help' for more information. + bash: abc.txt: command not found + +出现上面错误的原因是,在运行上面命令的时候 BASH 会把 touch 解释为一个命令但是在分号前没有任何文件参数,所以报告错误。然后报告的另一个错误找不到命令 `abc.txt`,只是因为在分号后 BASH 会期望另一个新的命令,而 `abc.txt` 并不是一个命令。 + +要解决这个问题,我们得告诉 BASH 不要将分号解释为命令分隔符,例如: + + $ touch ./';abc.txt' + 或者 + $ touch ';abc.txt' + +**注意**:我们将文件名用单引号 '' 包含起来。这样可以告诉 BASH 分号 ; 是文件名的一部分而不是命令分隔符。 + +对名字包含分号的文件和文件夹的其他操作(就是,拷贝、移动、删除)可以直接将名字用单引号包含起来就好了。 + +### 处理名字包含其他特殊字符的文件/文件夹 ### + +#### 文件名包含加号 (+) #### + +不需要任何特殊处理,按平时的方式做就好了,比如下面测试的文件名。 + + $ touch +12.txt + +#### 文件名包含美元符 ($) #### + +你需要将文件名用单引号括起来,像处理分号那样的方式。然后就很简单了。 + + $ touch '$12.txt' + +#### 文件名包含百分号 (%) #### + +不需要任何特殊处理,当作一个普通文件就可以了。 + + $ touch %12.txt + +#### 文件名包含星号 (*) #### + +名字包含星号的文件没有改变太多,你仍然可以把它当作一个普通文件。(注:星号在 shell 里有特殊意义,用作文件名最好用单引号括起来或使用反斜杠转义) + + $ touch *12.txt + +注意:当你需要删除星号开头的文件时,千万不要用类似下面的命令。 + + $ rm * + 或者 + $ rm -rf * + +而是用这样的命令,(注:这个命令是删除当前目录所有.txt文件。。。) + + $ rm ./*.txt + +#### 文件名包含叹号 (!) #### + +只要将文件名用单引号括起来,其他的就一样了。 + + $ touch '!12.txt' + +#### 文件名包含小老鼠 (@) #### + +没有什么特别的,可以将名字包含小老鼠的文件当作普通文件。 + + $ touch '@12.txt' + +#### 文件名包含 ^ #### + +不需要特殊处理。可以将名字包含 ^ 的文件当作普通文件。 + + $ touch ^12.txt + +#### 文件名包含 (&) #### + +将文件名用单引号括起来,然后就可以操作了。 + + $ touch '&12.txt' + +#### 文件名包含括号 () #### + +如果文件名包含括号,你需要将文件名用单引号括起来。 + + $ touch '(12.txt)' + +#### 文件名包含花括号 {} #### + +不需要特别注意。可以当作普通文件处理。(注:花括号在 shell 里有特殊意义,用作文件名最好用单引号括起来或使用反斜杠转义) + + $ touch {12.txt} + +#### 文件名包含尖括号 <> #### + +名字包含尖括号的文件需要用单引号括起来。 + + $ touch '<12.txt>' + +#### 文件名包含方括号 [ ] #### + +名字包含方括号的文件可以当作普通文件,不用特别处理。(注:方括号在 shell 里有特殊意义,用作文件名最好用单引号括起来或使用反斜杠转义) + + $ touch [12.txt] + +#### 文件名包含下划线 (_) #### + +这个非常普遍不需要特殊对待。当作普通文件随意处理。 + + $ touch _12.txt + +#### 文件名包含等号 (=) #### + +文件名包含等号不会改变任何事情,你可以当作普通文件。(注:等号在 shell 里有特殊意义,用作文件名最好用单引号括起来或使用反斜杠转义) + + $ touch =12.txt + +#### 处理反斜杠 (\) #### + +反斜杠会告诉 shell 忽略后面字符的特殊含义。你必须将文件名用单引号括起来,就像处理分号那样。其他的就没什么了。 + + $ touch '\12.txt' + +#### 包含斜杠的特殊情形 #### + +除非你的文件系统有问题,否则你不能创建名字包含斜杠的文件。没办法转义斜杠。 + +所以如果你能创建类似 ‘/12.txt’ 或者 ‘b/c.txt’ 这样的文件,那要么你的文件系统有问题,或者支持 Unicode,这样你可以创建包含斜杠的文件。只是这样并不是真的斜杠,而是一个看起来像斜杠的 Unicode 字符。 + +#### 文件名包含问号 (?) #### + +再一次,这个也是不需要特别处理的情况。名字包含问号的文件可以和大多数情况一样对待。(注:问号在 shell 里有特殊意义,用作文件名最好用单引号括起来或使用反斜杠转义) + + $ touch ?12.txt + +#### 文件名包含点 (.) #### + +在 Linux 里以点 `(.)` 开头的文件非常特别,被称为点文件。它们通常是隐藏的配置文件或系统文件。你需要使用 ls 命令的 ‘-a‘ 或 ‘-A‘ 开关来查看这种文件。 + +创建,编辑,重命名和删除这种文件很直接。 + + $ touch .12.txt + +注意:在 Linux 里你可能碰到名字包含许多点 `(.)` 的文件。不像其他操作系统,文件名里的点并不意味着分隔名字和扩展后缀。你可以创建名字包含多个点的文件: + + $ touch 1.2.3.4.5.6.7.8.9.10.txt + +检查一下: + + $ ls -l + + total 0 + -rw-r--r-- 1 avi avi 0 Jun 8 14:32 1.2.3.4.5.6.7.8.9.10.txt + +#### 文件名包含逗号 (,) #### + +你可以在文件名中使用逗号,可以有任意多个而不用特殊对待。就像平时普通名字文件那样处理。 + + $ touch ,12.txt + 或者 + $ touch ,12,.txt + +#### 文件名包含冒号 (:) #### + +你可以在文件名中使用冒号,可以有任意多个而不用特殊对待。就像平时普通名字文件那样处理。(注:冒号在 shell 里有特殊意义,用作文件名最好用单引号括起来或使用反斜杠转义) + + $ touch :12.txt + 或者 + $ touch :12:.txt + +#### 文件名包含引号(单引号和双引号) #### + +要在文件名里使用引号,我们需要使用交替规则。例如,如果你需要在文件名里使用单引号,那就用双引号把文件名括起来。而如果你需要在文件名里使用双引号,那就用单引号把文件名括起来。 + + $ touch "15'.txt" + + 以及 + + $ touch '15”.txt' + +#### 文件名包含波浪号 (~) #### + +Linux 下一些像 emacs 这样的文本编辑器在编辑文件的时候会创建备份文件。这个备份文件的名字是在原文件名后面附加一个波浪号。你可以在文件名任意位置使用波浪号,例如:(注:波浪号在 shell 里有特殊意义,用作文件名最好用单引号括起来或使用反斜杠转义) + + $ touch ~1a.txt + 或者 + $touch 2b~.txt + +#### 文件名包含空格 #### + +创建名字的字符/单词之间包含空格的文件,比如 “hi my name is avishek.txt”。 + +最好不要在文件名里使用空格,如果你必须要分隔可读的名字,可以使用下划线或横杠。不过,你还是需要创建这样的文件的话,你可以用反斜杠来转义下一个字符。要创建上面名字的文件可以这样做。 + + $ touch hi\ my\ name\ is\ avishek.txt + + hi my name is avishek.txt + +我已经尝试覆盖你可能碰到的所有情况。上面大多数测试都在 BASH Shell 里完成,可能在其他 shell 下会有差异。 + +如果你觉得我遗漏了什么(这很正常也符合人性),请把你的建议发表到下面的评论里。保持联系,多评论。不要走开!求点赞求分享求扩散! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/manage-linux-filenames-with-special-characters/ + +作者:[Avishek Kumar][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/15-basic-ls-command-examples-in-linux/ +[2]:http://www.tecmint.com/8-pratical-examples-of-linux-touch-command/ From fa23a186b3e1abf88165c7751220115eb0785370 Mon Sep 17 00:00:00 2001 From: zpl1025 Date: Fri, 19 Jun 2015 18:07:39 +0800 Subject: [PATCH 141/153] [translating] 20150616 XBMC--build a remote control.md --- sources/tech/20150616 XBMC--build a remote control.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150616 XBMC--build a remote control.md b/sources/tech/20150616 XBMC--build a remote control.md index 25de9fd06f..5066e28ce2 100644 --- a/sources/tech/20150616 XBMC--build a remote control.md +++ b/sources/tech/20150616 XBMC--build a remote control.md @@ -1,3 +1,4 @@ +zpl1025 XBMC: build a remote control ================================================================================ **Take control of your home media player with a custom remote control running on your Android phone.** @@ -261,4 +262,4 @@ via: http://www.linuxvoice.com/xbmc-build-a-remote-control/ [2]:http://wiki.xbmc.org/?title=JSON-RPC_API/v6 [3]:https://github.com/ben-ev/xbmc-remote [4]:https://github.com/ben-ev/xbmc-remote -[5]:https://github.com/features \ No newline at end of file +[5]:https://github.com/features From d9b893261b8b9577da1b4fe012ce5b64c022a230 Mon Sep 17 00:00:00 2001 From: wwy Date: Sat, 20 Jun 2015 00:39:46 +0800 Subject: [PATCH 142/153] Update 20150617 Tor Browser--An Ultimate Web Browser for Anonymous Web Browsing in Linux.md --- ...ltimate Web Browser for Anonymous Web Browsing in Linux.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20150617 Tor Browser--An Ultimate Web Browser for Anonymous Web Browsing in Linux.md b/sources/tech/20150617 Tor Browser--An Ultimate Web Browser for Anonymous Web Browsing in Linux.md index 92fe36dae2..39d25f0456 100644 --- a/sources/tech/20150617 Tor Browser--An Ultimate Web Browser for Anonymous Web Browsing in Linux.md +++ b/sources/tech/20150617 Tor Browser--An Ultimate Web Browser for Anonymous Web Browsing in Linux.md @@ -1,3 +1,5 @@ +translating by wwy-hust + Tor Browser: An Ultimate Web Browser for Anonymous Web Browsing in Linux ================================================================================ Most of us give a considerable time of ours to Internet. The primary Application we require to perform our internet activity is a browser, a web browser to be more perfect. Over Internet most of our’s activity is logged to Server/Client machine which includes IP address, Geographical Location, search/activity trends and a whole lots of Information which can potentially be very harmful, if used intentionally the other way. @@ -203,4 +205,4 @@ via: http://www.tecmint.com/tor-browser-for-anonymous-web-browsing/ [a]:http://www.tecmint.com/author/avishek/ [1]:https://www.torproject.org/download/download-easy.html.en -[2]:http://tecmint.tradepub.com/free/w_make129/prgm.cgi \ No newline at end of file +[2]:http://tecmint.tradepub.com/free/w_make129/prgm.cgi From 1596b1beb60bc4be50a386155b71a6a304c6b7e4 Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 20 Jun 2015 07:08:33 +0800 Subject: [PATCH 143/153] PUB:20150507 Install uGet Download Manager 2.0 in Debian Ubuntu Linux Mint and Fedora @FSSlc --- ... in Debian Ubuntu Linux Mint and Fedora.md | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) rename {translated/tech => published}/20150507 Install uGet Download Manager 2.0 in Debian Ubuntu Linux Mint and Fedora.md (74%) diff --git a/translated/tech/20150507 Install uGet Download Manager 2.0 in Debian Ubuntu Linux Mint and Fedora.md b/published/20150507 Install uGet Download Manager 2.0 in Debian Ubuntu Linux Mint and Fedora.md similarity index 74% rename from translated/tech/20150507 Install uGet Download Manager 2.0 in Debian Ubuntu Linux Mint and Fedora.md rename to published/20150507 Install uGet Download Manager 2.0 in Debian Ubuntu Linux Mint and Fedora.md index d5c2fc98f5..569a50d667 100644 --- a/translated/tech/20150507 Install uGet Download Manager 2.0 in Debian Ubuntu Linux Mint and Fedora.md +++ b/published/20150507 Install uGet Download Manager 2.0 in Debian Ubuntu Linux Mint and Fedora.md @@ -1,37 +1,37 @@ 在 Debian, Ubuntu, Linux Mint 及 Fedora 中安装 uGet 下载管理器 2.0 ================================================================================ -在经历了一段漫长的开发期后,期间发布了超过 11 个开发版本,最终 uGet 项目小组高兴地宣布 uGet 的最新稳定版本 uGet 2.0 已经可以下载使用了。最新版本包含许多吸引人的特点,例如一个新的设定对话框,改进了 aria2 插件对 BitTorrent 和 Metalink 协议的支持,同时对位于横栏中的 uGet RSS 信息提供了更好的支持,其他特点包括: +在经历了一段漫长的开发期后,并发布了超过 11 个开发版本,最终 uGet 项目小组高兴地宣布 uGet 的最新稳定版本 uGet 2.0 已经可以下载使用了。最新版本包含许多吸引人的特点,例如一个新的设定对话框,改进了 aria2 插件对 BitTorrent 和 Metalink 协议的支持,同时对位于横幅中的 uGet RSS 信息提供了更好的支持,其他特点包括: -- 一个新的 “检查更新” 按钮,提醒您有关新的发行版本的信息; +- 新增一个 “检查更新” 按钮,提醒您有关新的发行版本的信息; - 增添新的语言支持并升级了现有的语言; -- 增加了一个新的 “信息横栏” ,允许开发者轻松地向所有的用户提供有关 uGet 的信息; -- 通过对文档、提交反馈和错误报告等内容的链接,增强了帮助菜单; +- 新增一个 “信息横幅” ,可以让开发者轻松地向所有的用户提供有关 uGet 的信息; +- 增强了帮助菜单,包括文档、提交反馈和错误报告等内容的链接; - 将 uGet 下载管理器集成到了 Linux 平台下的两个主要的浏览器 Firefox 和 Google Chrome 中; - 改进了对 Firefox 插件 ‘FlashGot’ 的支持; ### 何为 uGet ### -uGet (先前名为 UrlGfe) 是一个开源,免费,且极其强大的基于 GTK 的多平台下载管理器应用程序,它用 C 语言写就,在 GPL 协议下发布。它提供了一大类的功能,如恢复先前的下载任务,支持多重下载,使用一个独立的配置来支持分类,剪贴板监视,下载队列,从 HTML 文件中导出 URL 地址,集成在 Firefox 中的 Flashgot 插件中,使用集成在 uGet 中的 aria2(一个命令行下载管理器) 来下载 torrent 和 metalink 文件。 +uGet (先前名为 UrlGfe) 是一个开源,免费,且极其强大的基于 GTK 的多平台下载管理器应用程序,它用 C 语言写就,在 GPL 协议下发布。它提供了大量功能,如恢复先前的下载任务,支持多点下载,使用一个独立的配置来支持分类,剪贴板监视,下载队列,从 HTML 文件中导出 URL 地址,集成在 Firefox 中的 Flashgot 插件中,使用集成在 uGet 中的 aria2(一个命令行下载管理器) 来下载 torrent 和 metalink 文件。 我已经在下面罗列出了 uGet 下载管理器的所有关键特点,并附带了详细的解释。 #### uGet 下载管理器的关键特点 #### -- 下载队列: 可以将你的下载任务放入一个队列中。当某些下载任务完成后,将会自动开始下载队列中余下的文件; +- 下载队列: 将你的下载任务放入一个队列中。当某些下载任务完成后,将会自动开始下载队列中余下的文件; - 恢复下载: 假如在某些情况下,你的网络中断了,不要担心,你可以从先前停止的地方继续下载或重新开始; - 下载分类: 支持多种分类来管理下载; - 剪贴板监视: 将要下载的文件类型复制到剪贴板中,便会自动弹出下载提示框以下载刚才复制的文件; - 批量下载: 允许你轻松地一次性下载多个文件; - 支持多种协议: 允许你轻松地使用 aria2 命令行插件通过 HTTP, HTTPS, FTP, BitTorrent 及 Metalink 等协议下载文件; - 多连接: 使用 aria2 插件,每个下载同时支持多达 20 个连接; -- 支持 FTP 登录或匿名 FTP 登录: 同时支持使用用户名和密码来登录 FTP 或匿名 FTP ; +- 支持 FTP 登录或 FTP 匿名登录: 同时支持使用用户名和密码来登录 FTP 或匿名 FTP ; - 队列下载: 新增队列下载,现在你可以对你的所有下载进行安排调度; - 通过 FlashGot 与 FireFox 集成: 与作为一个独立支持的 Firefox 插件的 FlashGot 集成,从而可以处理单个或大量的下载任务; - CLI 界面或虚拟终端支持: 提供命令行或虚拟终端选项来下载文件; - 自动创建目录: 假如你提供了一个先前并不存在的保存路径,uGet 将会自动创建这个目录; - 下载历史管理: 跟踪记录已下载和已删除的下载任务的条目,每个列表支持 9999 个条目,比当前默认支持条目数目更早的条目将会被自动删除; - 多语言支持: uGet 默认使用英语,但它可支持多达 23 种语言; -- Aria2 插件: uGet 集成了 Aria2 插件,来为 aria2 提供更友好的 GUI 界面; +- Aria2 插件: uGet 集成了 Aria2 插件,来为你提供更友好的 GUI 界面; 如若你想了解更加完整的特点描述,请访问 uGet 官方的 [特点页面][1]. @@ -43,7 +43,7 @@ uGet 开发者在 Linux 平台下的各种软件仓库中添加了 uGet 的最 #### 在 Debian 下 #### -在 Debian 的测试版本 (Jessie) 和不稳定版本 (Sid) 中,你可以在一个可信赖的基础上,使用官方的软件仓库轻易地安装和升级 uGet 。 +在 Debian Jessie 和Sid 中,你可以使用官方软件仓库轻易地安装和升级可靠的 uGet 软件包。 $ sudo apt-get update $ sudo apt-get install uget @@ -58,7 +58,7 @@ uGet 开发者在 Linux 平台下的各种软件仓库中添加了 uGet 的最 #### 在 Fedora 下 #### -在 Fedora 20 – 21 下,最新版本的 uGet(2.0) 可以从官方软件仓库中获得,从这些软件仓库中安装是非常值得信赖的。 +在 Fedora 20 – 21 下,最新版本的 uGet(2.0) 可以从官方软件仓库中获得可靠的软件包。 $ sudo yum install uget @@ -70,7 +70,7 @@ uGet 开发者在 Linux 平台下的各种软件仓库中添加了 uGet 的最 默认情况下,uGet 在当今大多数的 Linux 系统中使用 `curl` 来作为后端,但 aria2 插件将 curl 替换为 aria2 来作为 uGet 的后端。 -aria2 是一个单独的软件包,需要独立安装。你可以在你的 Linux 发行版本下,使用受支持的软件仓库来轻易地安装 aria2 的最新版本,或根据 [下载 aria2 页面][4] 来安装它,该页面详细解释了在各个发行版本中如何安装 aria2 。 +aria2 是一个单独的软件包,需要独立安装。你可以在你的 Linux 发行版下,使用受支持的软件仓库来轻易地安装 aria2 的最新版本,或根据 [下载 aria2 页面][4] 来安装它,该页面详细解释了在各个发行版本中如何安装 aria2 。 #### 在 Debian, Ubuntu 和 Linux Mint 下 #### @@ -91,28 +91,34 @@ Fedora 的官方软件仓库中已经添加了 aria2 软件包,所以你可以 为了启动 uGet,从桌面菜单的搜索栏中键入 "uGet"。可参考如下的截图: ![开启 uGet 下载管理器](http://www.tecmint.com/wp-content/uploads/2014/03/Start-uGet.gif) -开启 uGet 下载管理器 + +*开启 uGet 下载管理器* ![uGet 版本: 2.0](http://www.tecmint.com/wp-content/uploads/2014/03/uGet-Version.gif) -uGet 版本: 2.0 + +*uGet 版本: 2.0* #### 在 uGet 中激活 aria2 插件 #### 为了激活 aria2 插件, 从 uGet 菜单接着到 `编辑 –> 设置 –> 插件` , 从下拉菜单中选择 "aria2"。 ![为 uGet 启用 Aria2 插件](http://www.tecmint.com/wp-content/uploads/2014/03/Enable-Aria2-Plugin.gif) -为 uGet 启用 Aria2 插件 + +*为 uGet 启用 Aria2 插件* ### uGet 2.0 截图赏析 ### ![使用 Aria2 下载文件](http://www.tecmint.com/wp-content/uploads/2014/03/Download-Files-Using-Aria2.gif) -使用 Aria2 下载文件 + +*使用 Aria2 下载文件* ![使用 uGet 下载 Torrent 文件](http://www.tecmint.com/wp-content/uploads/2014/03/Download-Torrent-File.gif) -使用 uGet 下载 Torrent 文件 + +*使用 uGet 下载 Torrent 文件* ![使用 uGet 进行批量下载](http://www.tecmint.com/wp-content/uploads/2014/03/Batch-Download-Files.gif) -使用 uGet 进行批量下载 + +*使用 uGet 进行批量下载* 针对其他 Linux 发行版本和 Windows 平台的 RPM 包和 uGet 的源文件都可以在 uGet 的[下载页面][5] 下找到。 @@ -122,7 +128,7 @@ via: http://www.tecmint.com/install-uget-download-manager-in-linux/ 作者:[Ravi Saive][a] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From 3cf1d75d3c571aefabab8a9e57ead90e80d42969 Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 20 Jun 2015 07:08:52 +0800 Subject: [PATCH 144/153] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...oS Attacks Using Mod_Security and Mod_evasive Modules.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/published/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md b/published/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md index 44ba66e7d5..bb69215e74 100644 --- a/published/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md +++ b/published/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md @@ -194,7 +194,7 @@ mod\_evasive被配置为使用/etc/httpd/conf.d/mod\_evasive.conf中的指令。 DOSSystemCommand "sudo /usr/local/bin/scripts-tecmint/ban_ip.sh %s" -上面一行的%s代表了由mod\_evasive检测到的攻击IP地址。 +上面一行的%s代表了由mod_evasive检测到的攻击IP地址。 #####将apache用户添加到sudoers文件##### @@ -233,7 +233,7 @@ mod\_evasive被配置为使用/etc/httpd/conf.d/mod\_evasive.conf中的指令。 我们的测试环境由一个CentOS 7服务器[IP 192.168.0.17]和一个Windows组成,在Windows[IP 192.168.0.103]上我们发起攻击: ![](http://www.tecmint.com/wp-content/uploads/2012/06/Confirm-Host-IPAddress.png) - +I *确认主机IP地址* 请播放下面的视频(YT 视频,请自备梯子: https://www.youtube.com/-U_mdet06Jk ),并跟从列出的步骤来模拟一个Dos攻击: @@ -257,7 +257,7 @@ mod\_evasive被配置为使用/etc/httpd/conf.d/mod\_evasive.conf中的指令。 -------------------------------------------------------------------------------- -via: http://www.tecmint.com/protect-apache-using-mod\_security-and-mod\_evasive-on-rhel-centos-fedora/ +via: http://www.tecmint.com/protect-apache-using-mod_security-and-mod_evasive-on-rhel-centos-fedora/ 作者:[Gabriel Cánepa][a] 译者:[wwy-hust](https://github.com/wwy-hust) From c61c01383bc68076f9e62baf175eccc695aa06c3 Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 20 Jun 2015 07:20:33 +0800 Subject: [PATCH 145/153] PUB:20150518 Linux FAQs with Answers--What is the Apache error log location on Linux @GOLinux --- ... the Apache error log location on Linux.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) rename {translated/tech => published}/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md (74%) diff --git a/translated/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md b/published/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md similarity index 74% rename from translated/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md rename to published/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md index c43ac481e7..cf1ef694c0 100644 --- a/translated/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md +++ b/published/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md @@ -1,8 +1,8 @@ -Linux有问必答——Linux上Apache错误日志的位置在哪里? +Linux有问必答:Linux上Apache错误日志的位置在哪里? ================================================================================ -> **问题**: 我尝试着解决我 Linux 系统上的 Apache 网络服务器的错误,Apache的错误日志文件放在[你的 Linux 版本]的哪个位置呢? +> **问题**: 我尝试着解决我 Linux 系统上的 Apache Web 服务器的错误,Apache的错误日志文件放在[XX Linux 版本]的哪个位置呢? -错误日志和访问日志文件为系统管理员提供了有用的信息,比如,为网络服务器排障,[保护][1]系统不受各种各样的恶意活动侵犯,或者只是进行[各种各样的][2][分析][3]以监控 HTTP 服务器。根据你网络服务器配置的不同,其错误/访问日志可能放在你系统中不同位置。 +错误日志和访问日志文件为系统管理员提供了有用的信息,比如,为 Web 服务器排障,[保护][1]系统不受各种各样的恶意活动侵犯,或者只是进行[各种各样的][2][分析][3]以监控 HTTP 服务器。根据你 Web 服务器配置的不同,其错误/访问日志可能放在你系统中不同位置。 本文可以帮助你**找到Linux上的Apache错误日志**。 @@ -28,7 +28,7 @@ Linux有问必答——Linux上Apache错误日志的位置在哪里? #### 使用虚拟主机自定义的错误日志 #### -如果在 Apache 网络服务器中使用了虚拟主机, ErrorLog 指令可能会在虚拟主机容器内指定,在这种情况下,上面所说的系统范围的错误日志位置将被忽略。 +如果在 Apache Web 服务器中使用了虚拟主机, ErrorLog 指令可能会在虚拟主机容器内指定,在这种情况下,上面所说的系统范围的错误日志位置将被忽略。 启用了虚拟主机后,各个虚拟主机可以定义其自身的自定义错误日志位置。要找出某个特定虚拟主机的错误日志位置,你可以打开 /etc/apache2/sites-enabled/.conf,然后查找 ErrorLog 指令,该指令会显示站点指定的错误日志文件。 @@ -40,11 +40,11 @@ Linux有问必答——Linux上Apache错误日志的位置在哪里? #### 自定义的错误日志 #### -要找出 Apache 错误日志的自定义位置,请用文本编辑器打开 /etc/httpd/conf/httpd.conf,然后查找 ServerRoot,该参数显示了 Apache 服务器目录树的顶层,日志文件和配置都位于该目录树中。例如: +要找出 Apache 错误日志的自定义位置,请用文本编辑器打开 /etc/httpd/conf/httpd.conf,然后查找 ServerRoot,该参数显示了 Apache Web 服务器目录树的顶层,日志文件和配置都位于该目录树中。例如: ServerRoot "/etc/httpd" -现在,查找 ErrorLog 开头的行,该行指出了 Apache 网络服务器将错误日志写到了哪里去。注意,指定的位置是 ServerRoot 值的相对位置。例如: +现在,查找 ErrorLog 开头的行,该行指出了 Apache Web 服务器将错误日志写到了哪里去。注意,指定的位置是 ServerRoot 值的相对位置。例如: ErrorLog "log/error_log" @@ -71,11 +71,11 @@ via: http://ask.xmodulo.com/apache-error-log-location-linux.html 作者:[Dan Nanni][a] 译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://ask.xmodulo.com/author/nanni -[1]:http://xmodulo.com/configure-fail2ban-apache-http-server.html -[2]:http://xmodulo.com/interactive-apache-web-server-log-analyzer-linux.html -[3]:http://xmodulo.com/sql-queries-apache-log-files-linux.html +[1]:https://linux.cn/article-5068-1.html +[2]:https://linux.cn/article-5352-1.html +[3]:https://linux.cn/article-4405-1.html From de9e60ed616ab9a12539b65c656937edef6065ac Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 20 Jun 2015 07:35:10 +0800 Subject: [PATCH 146/153] PUB:20150520 How to compile and install wxWidgets on Ubuntu or Debian or Linux Mint @geekpi --- ...dgets on Ubuntu or Debian or Linux Mint.md | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) rename {translated/tech => published}/20150520 How to compile and install wxWidgets on Ubuntu or Debian or Linux Mint.md (81%) diff --git a/translated/tech/20150520 How to compile and install wxWidgets on Ubuntu or Debian or Linux Mint.md b/published/20150520 How to compile and install wxWidgets on Ubuntu or Debian or Linux Mint.md similarity index 81% rename from translated/tech/20150520 How to compile and install wxWidgets on Ubuntu or Debian or Linux Mint.md rename to published/20150520 How to compile and install wxWidgets on Ubuntu or Debian or Linux Mint.md index 1f733207f3..db8dc669dc 100644 --- a/translated/tech/20150520 How to compile and install wxWidgets on Ubuntu or Debian or Linux Mint.md +++ b/published/20150520 How to compile and install wxWidgets on Ubuntu or Debian or Linux Mint.md @@ -1,16 +1,13 @@ 如何在Ubuntu/Debian/Linux Mint中编译和安装wxWidgets ================================================================================ + ### wxWidgets ### -wxWidgets是一个程序开发框架/库, 允许你在Windows、Mac、Linux中使用相同的代码跨平台开发。 - -它主要用C++写成,但也可以与其他语言绑定比如Python、Perl、Ruby。 +wxWidgets是一个程序开发框架/库, 允许你在Windows、Mac、Linux中使用相同的代码跨平台开发。它主要用C++写成,但也可以与其他语言绑定比如Python、Perl、Ruby。 本教程中我将向你展示如何在基于Debian的linux中如Ubuntu和Linux Mint中编译wxwidgets 3.0+。 -从源码编译wxWidgets并不困难,仅仅需要几分钟。 - -库可以按不同的方式来编译,比如静态或者动态库。 +从源码编译wxWidgets并不困难,仅仅需要几分钟。库可以按不同的方式来编译,比如静态或者动态库。 ### 1. 下载 wxWidgets ### @@ -20,13 +17,13 @@ wxWidgets是一个程序开发框架/库, 允许你在Windows、Mac、Linux中 ### 2. 设置编译环境 ### -要编译wxwidgets,我们需要一些工具包括C++编译器, 在Linux上是g++。所有这些可以通过apt-get工具从仓库中安装。 +要编译wxwidgets,我们需要一些工具包括C++编译器,在Linux上是g++。所有这些可以通过apt-get工具从仓库中安装。 我们还需要wxWidgets依赖的GTK开发库。 $ sudo apt-get install libgtk-3-dev build-essential checkinstall ->checkinstall工具允许我们为wxwidgets创建一个安装包,这样之后就可以轻松的使用包管理器来卸载。 +> 这个叫做checkinstall的工具允许我们为wxwidgets创建一个安装包,这样之后就可以轻松的使用包管理器来卸载。 ### 3. 编译 wxWidgets ### @@ -42,7 +39,7 @@ wxWidgets是一个程序开发框架/库, 允许你在Windows、Mac、Linux中 "--disable-shared"选项将会编译静态库而不是动态库。 -make命令完成后,编译也成功了。是时候安装wxWidgets到正确的目录。 +make命令完成后,编译就成功了。是时候安装wxWidgets到正确的目录。 更多信息请参考install.txt和readme.txt,这可在wxwidgets中的/docs/gtk/目录下找到。 @@ -58,7 +55,7 @@ checkinstall会询问几个问题,请保证在提问后提供一个版本号 ### 5. 追踪安装的文件 ### -如果你想要检查文件安装的位置,使用dpkg命令后面跟上checkinstall提供的报名。 +如果你想要检查文件安装的位置,使用dpkg命令后面跟上checkinstall提供的包名。 $ dpkg -L package_name /. @@ -85,17 +82,17 @@ checkinstall会询问几个问题,请保证在提问后提供一个版本号 $ cd samples/ $ make -make命令完成后,进入sampl子目录,这里就有一个可以马上运行的Demo程序了。 +make命令完成后,进入sample 子目录,这里就有一个可以马上运行的Demo程序了。 ### 7. 编译你的第一个程序 ### 你完成编译demo程序后,可以写你自己的程序来编译了。这个也很简单。 -假设你用的是C++这样你可以使用编辑器的高亮特性。比如gedit、kate、kwrite等等。或者用全功能的IDE像Geany、Codelite、Codeblocks等等。 +假设你用的是C++,这样的话你还可以使用编辑器的高亮特性。比如gedit、kate、kwrite等等。或者用全功能的IDE像Geany、Codelite、Codeblocks等等。 然而你的第一个程序只需要用一个文本编辑器来快速完成。 -这里就是 +如下: #include @@ -155,7 +152,7 @@ via: http://www.binarytides.com/install-wxwidgets-ubuntu/ 作者:[Silver Moon][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From cd0acd37eb19bcc4c8545f3c03648741ab2721ac Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 20 Jun 2015 07:59:00 +0800 Subject: [PATCH 147/153] PUB:20150525 Linux ntopng--Network Monitoring Tool Installation Screenshots @GOLinux --- ...onitoring Tool Installation Screenshots.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) rename {translated/tech => published}/20150525 Linux ntopng--Network Monitoring Tool Installation Screenshots.md (82%) diff --git a/translated/tech/20150525 Linux ntopng--Network Monitoring Tool Installation Screenshots.md b/published/20150525 Linux ntopng--Network Monitoring Tool Installation Screenshots.md similarity index 82% rename from translated/tech/20150525 Linux ntopng--Network Monitoring Tool Installation Screenshots.md rename to published/20150525 Linux ntopng--Network Monitoring Tool Installation Screenshots.md index dc039ba551..72eae8b0bb 100644 --- a/translated/tech/20150525 Linux ntopng--Network Monitoring Tool Installation Screenshots.md +++ b/published/20150525 Linux ntopng--Network Monitoring Tool Installation Screenshots.md @@ -1,8 +1,8 @@ -Linux ntopng——网络监控工具的安装(附截图) +Linux 上网络监控工具 ntopng 的安装 ================================================================================ -当今世界,人们的计算机都相互连接,互联互通。小到你的家庭局域网(LAN),大到最大的一个被我们称为的——互联网。当你管理一台联网的计算机时,你就是在管理最关键的组件之一。由于大多数开发出的应用程序都基于网络,网络就连接起了这些关键点。 +当今世界,人们的计算机都相互连接,互联互通。小到你的家庭局域网(LAN),大到最大的一个被我们称为互联网。当你管理一台联网的计算机时,你就是在管理最关键的组件之一。由于大多数开发出的应用程序都基于网络,网络就连接起了这些关键点。 -这就是为什么我们需要网络监控工具。最好的网络监控工具之一,它叫作ntop。来自[维基百科][1]的知识“ntop是一个网络探测器,它以与top显示进程般类似的方式显示网络使用率。在交互模式中,它显示了用户终端上的网络状态。在网页模式中,它作为网络服务器,创建网络状态的HTML转储文件。它支持NetFlow/sFlowemitter/collector,这是一个基于HTTP的客户端界面,用于创建ntop为中心的监控应用和RRD用于持续地存储通信数据” +这就是为什么我们需要网络监控工具。ntop 是最好的网络监控工具之一。来自[维基百科][1]的知识“ntop是一个网络探测器,它以与top显示进程般类似的方式显示网络使用率。在交互模式中,它显示了用户终端上的网络状态。在网页模式中,它作为网络服务器,创建网络状态的HTML转储文件。它支持NetFlow/sFlowemitter/collector,这是一个基于HTTP的客户端界面,用于创建ntop为中心的监控应用,并使用RRD来持续存储通信数据”。 15年后的今天,你将见到ntopng——下一代ntop。 @@ -15,7 +15,7 @@ Ntopng是一个基于网页的高速通信分析器和流量收集器。Ntopng 从[ntopng网站][2]上,我们可以看到他们说它有众多的特性。这里列出了其中一些: - 按各种协议对网络通信排序 -- 显示网络通信和IPv4/v6激活的主机 +- 显示网络通信和IPv4/v6的激活主机 - 持续不断以RRD格式存储定位主机的通信数据到磁盘 - 通过nDPI,ntop的DPI框架,发现应用协议 - 显示各种协议间的IP通信分布 @@ -24,11 +24,9 @@ Ntopng是一个基于网页的高速通信分析器和流量收集器。Ntopng - 报告按协议类型排序的IP协议使用率 - 生成HTML5/AJAX网络通信数据 -### 安装 ### +### 安装的先决条件 ### -Ntop为CentOS和**基于64位**Ubuntu预编译好了包,你可以在[他们的下载页面][3]找到这些包。对于32位操作系统,你必须从源代码编译。本文在**CentOS 6.4 32位**版本上**测试过**。但是,它也可以在其它基于CentOS/RedHat的Linux版本上工作。让我们开始吧。 - -#### 先决条件 #### +Ntop为CentOS和**基于64位**Ubuntu预编译好了包,你可以在[它们的下载页面][3]找到这些包。对于32位操作系统,你必须从源代码编译。本文在**CentOS 6.4 32位**版本上**测试过**。但是,它也可以在其它基于CentOS/RedHat的Linux版本上工作。让我们开始吧。 #### 开发工具 #### @@ -78,7 +76,7 @@ Ntop为CentOS和**基于64位**Ubuntu预编译好了包,你可以在[他们的 # make # make install -*由于ntopng是一个基于网页的应用,你的系统必须安装有工作良好的网络服务器* +*由于ntopng是一个基于网页的应用,你的系统必须安装有工作良好的 Web 服务器* ### 为ntopng创建配置文件 ### @@ -89,13 +87,16 @@ Ntop为CentOS和**基于64位**Ubuntu预编译好了包,你可以在[他们的 # cd ntopng # vi ntopng.start - 放入这些行: - --local-network “10.0.2.0/24” +放入这些行: + + --local-network "10.0.2.0/24" --interface 1 +--- # vi ntopng.pid - 放入该行: +放入该行: + -G=/var/run/ntopng.pid 保存这些文件,然后继续下一步。 @@ -128,7 +129,7 @@ Ntop为CentOS和**基于64位**Ubuntu预编译好了包,你可以在[他们的 ![Ntopng Flows](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_flows.png) -在**主机菜单**上,你可以看到连接到流的所有主机 +在**主机菜单**上,你可以看到连接到流的所有主机。 ![Ntopng Hosts List](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_hoslist.png) @@ -146,8 +147,7 @@ Ntop为CentOS和**基于64位**Ubuntu预编译好了包,你可以在[他们的 ![Ntopng Apps](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_apps.png) -**界面菜单**将引领你进入更多内部菜单。 -包菜单将给你显示包的分布大小。 +**界面菜单**将引领你进入更多内部菜单。包菜单将给你显示包的大小分布。 ![Ntopng packets](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_packets.png) @@ -157,7 +157,7 @@ Ntop为CentOS和**基于64位**Ubuntu预编译好了包,你可以在[他们的 ![Ntopng protocols - detail](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_protocol_detail.png) -你也可以通过使用**历史活跃度菜单**查看活跃度 +你也可以通过使用**历史活跃度菜单**查看活跃度。 ![Ntopng Historical Activity](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_historical.png) @@ -167,7 +167,7 @@ Ntop为CentOS和**基于64位**Ubuntu预编译好了包,你可以在[他们的 ![Ntopng Users](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_users.png) -Ntopng为你提供了一个范围宽广的时间线,从5分钟到1年都可以。你只需要点击你想要现实的时间线。图标本身是可以点击的,你可以点击它来进行缩放。 +Ntopng为你提供了一个范围宽广的时间线,从5分钟到1年都可以。你只需要点击你想要显示的时间线。图表本身是可以点击的,你可以点击它来进行缩放。 当然,ntopng能做的事比上面图片中展示的还要多得多。你也可以将定位和电子地图服务整合进来。在ntopng自己的网站上,有已付费的模块可供使用,如nprobe可以扩展ntopng可以提供给你的信息。更多关于ntopng的信息,你可以访问[ntopng网站][5]。 @@ -177,7 +177,7 @@ via: http://linoxide.com/monitoring-2/ntopng-network-monitoring-tool/ 作者:[Pungki Arianto][a] 译者:[GOLinux](https://github.com/GOLinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 From 8ca81718f9c2def077b0f67728d8de8165ee2f6e Mon Sep 17 00:00:00 2001 From: wi-cuckoo Date: Sat, 20 Jun 2015 08:53:12 +0800 Subject: [PATCH 148/153] translating wi-cuckoo --- .../20150618 What will be the future of Linux without Linus.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/talk/20150618 What will be the future of Linux without Linus.md b/sources/talk/20150618 What will be the future of Linux without Linus.md index e042fdbe61..92b9e9ee4d 100644 --- a/sources/talk/20150618 What will be the future of Linux without Linus.md +++ b/sources/talk/20150618 What will be the future of Linux without Linus.md @@ -1,3 +1,4 @@ +translating wi-cuckoo What will be the future of Linux without Linus? ================================================================================ ![](http://i2.wp.com/www.linuxveda.com/wp-content/uploads/2015/06/linus-torvalds-painting.jpg) @@ -182,4 +183,4 @@ via: http://www.linuxveda.com/2015/06/17/what-happens-to-linux-after-linus/ 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]:http://www.linuxveda.com/author/arnieswap/ \ No newline at end of file +[a]:http://www.linuxveda.com/author/arnieswap/ From 3ae99e2452d06943e3c2ec9b5b4467d5c8dfc598 Mon Sep 17 00:00:00 2001 From: KS Date: Sat, 20 Jun 2015 12:50:51 +0800 Subject: [PATCH 149/153] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 完成翻译 --- ...w We Designed for Performance and Scale.md | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 translated/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md diff --git a/translated/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md b/translated/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md new file mode 100644 index 0000000000..fcf195115d --- /dev/null +++ b/translated/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md @@ -0,0 +1,174 @@ +NGINX内部: 我们如何设计性能和扩展 +================================================================================ +NGINX是web应用中性能最好的一个,这一切都是由于软件设计。而许多web服务器和应用程序服务器使用一个简单的线程或基于流程的架构,NGINX立足于一个复杂的事件驱动的体系结构,使它能够在现代硬件上扩展到成千上万的并发连接。 + +[NGINX内部][1]信息图从高级流程架构深度挖掘说明了NGINX如何在单进程里保持多连接。这个博客进一步详细地解释了这一切是如何工作的。 + +### 知识 – NGINX进程模型 ### + +![Master Process](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.36.30-PM.png) + +为了更好的理解这个设计,你需要理解NGINX如何运行的。NGINX有一个主进程(它执行特权操作如读取配置和绑定端口)和一些工作进程与辅助进程。 + + # service nginx restart + * Restarting nginx + # ps -ef --forest | grep nginx + root 32475 1 0 13:36 ? 00:00:00 nginx: master process /usr/sbin/nginx \ + -c /etc/nginx/nginx.conf + nginx 32476 32475 0 13:36 ? 00:00:00 \_ nginx: worker process + nginx 32477 32475 0 13:36 ? 00:00:00 \_ nginx: worker process + nginx 32479 32475 0 13:36 ? 00:00:00 \_ nginx: worker process + nginx 32480 32475 0 13:36 ? 00:00:00 \_ nginx: worker process + nginx 32481 32475 0 13:36 ? 00:00:00 \_ nginx: cache manager process + nginx 32482 32475 0 13:36 ? 00:00:00 \_ nginx: cache loader process + +在四核服务器,NGINX主进程创建4工作进程和两个管理磁盘内容缓存的缓存辅助进程。 + +### 为什么架构很重要? ### + +任何Unix应用程序的根本基础是线程或进程。(从Linux操作系统的角度来看,线程和进程大多是相同的,主要的区别是他们共享内存的程度。)一个线程或进程是一个独立的指令,操作系统可以运行在一个CPU核心。大多数复杂的应用程序并行运行多个线程或进程有两个原因: + +- 他们可以同时使用更多的计算核心。 +- 线程或进程可以轻松实现并行操作。(例如,在同一时刻保持多连接)。 + +进程和线程消耗资源。他们每个都使用内存和其他系统资源,他们需要被交换进出核心(一个操作可以叫做上下文切换)。大多数现代服务器可以保持上百小型、活动的并发连接,一旦内存耗尽或高I/O压力引起大量的上下文切换性能会严重下降。 + +网络应用程序设计的常用方法是为每个连接分配一个线程或进程。此体系结构简单、容易实现,但是当应用程序需要处理成千上万的并发连接时这种结构不具规模。 + +### NGINX如何工作? ### + +NGINX使用一种可预测进程模式,被调到了可使用的硬件资源上: + +- 主进程执行特权操作,如读取配置和绑定端口,然后创建一个小数量的子进程(接下来的三种类型)。 +- 缓存加载程序进程在加载磁盘缓存到内存中时开始运行,然后退出。它被适当的安排,所以其资源需求很低。 +- 缓存管理器进程定期修剪磁盘缓存中的记录来保持他们在配置的大小之内。 +- 工作进程做所有的工作!他们保持网络连接、读写内容到磁盘,与上游服务器通信。 + +在大多数情况下建议NGINX的配置 – 每个CPU核心运行一个工作进程 – 最有效地利用硬件资源。你的配置包含了[worker_processes auto][2]指令配置: + + worker_processes auto; + +当一个NGINX服务处于活动状态,只有工作进程是忙碌的。每个工作进程以非阻塞方式保持多连接,减少上下文交换。 + +每个工作进程是一个单线程并且独立运行,获取新链接并处理他们。这些进程可以使用共享内存通信来共享缓存数据,会话持久性数据,和其他共享资源。 + +### NGINX工作进程内部 ### + +![](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.39.48-PM.png) + +NGINX主进程通过NGINX配置初始化每个工作进程并提供一组监听端口。 + +NGINX工作进程首先在监听套接字上等待事件([accept_mutex][3]和[内核套接字分片][4])。事件被新进来的链接初始化。这些连接被分配到一个状态机 – HTTP状态机是最常用的,但NGINX也具备流式(原始的TCP)状态机和大量的邮件协议(SMTP、IMAP和POP3)。 + +![Internet Requests](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.40.32-PM.png) + +状态机本质上是一组指令,告诉NGINX如何处理一个请求。大多数web服务器执行相同的函数作为NGINX使用类似的状态机 - 区别在于实现。 + +### 调度状态机 ### + +把状态机想象成国际象棋的规则。每个HTTP事务是一个象棋游戏。一方面棋盘是web服务器 – 一位大师可以非常迅速地做出决定。另一方面是远程客户端 – 在一个相对较慢的网络下web浏览器访问网站或应用程序。 + +不管咋地,这个游戏规则很复杂。例如,web服务器可能需要与各方沟通(代理一个上游的应用程序)或与身份验证服务器对话。web服务器的第三方模块甚至可以扩展游戏规则。 + +#### 一个阻塞状态机 #### + +回忆我们描述一个进程或线程就像一个独立的指令集,操作系统可以调度运行它在一个CPU核心。大多数web服务器和web应用使用一个进程一个链接或者一个线程一个链接的模式来运行这个“象棋游戏”。每个进程或线程都包含指令来玩“一个游戏”直到结束。一次进程在服务器运行,它花费大部分的时间“阻塞” - 等待客户端完成它的下一步行动。 + +![Blocking I/O](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.40.52-PM.png) + +1. web服务器进程在监听套接字监听新连接(客户端发起新“游戏”) +1. 当它获得一个新游戏,就玩这个游戏,每走一步去等待客户端响应时就阻塞了。 +1. 游戏完成后,web服务器进程可能会等待是否有客户机想要开始一个新游戏(这对应于一个保持连接)。如果这个链接关闭了(客户端离开或者发生超时),web服务器进程返回监听一个新“游戏”。 + +要记住最重要的一点是每个活动的HTTP链接(每局棋)需要一个专用的进程或线程(象棋高手)。这个结构简单容并且易扩展第三方模块(“新规则”)。无论如何,还是有巨大的不平衡:尤其是轻量的HTTP链接,作为代表是一个文件描述符和小量的内存,映射到一个单独的线程或进程,一个非常重量的系统对象。这种方式易于编程,但太过浪费。 + +#### NGINX是一个真正的象棋大师 #### + +也许你听过[同时表演赛][5]游戏,有一个象棋大师同时对战许多对手? + +![Kiril Georgiev](http://cdn.nginx.com/wp-content/uploads/2015/06/Kiril-Georgiev.gif) + +[列夫·吉奥吉夫在保加利亚的索非亚同时对阵360人][6]。他的最终成绩是284胜70平6负。 + +这就是NGINX工作进程如何“下棋”的。每个工作进程(记住 - 通常每个CPU核心上有一个工作进程)是一个可同时对战上百人(事实是,成百上千)的象棋大师。 + +![Event-driven Architecture](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.41.13-PM.png) + +1. 工作进程在监听和链接套接字上等待事件。 +1. 事件发生在套接字并且由工作进程处理它们: + + - 在监听套接字的事件意味着一个客户端已经开始了一局新棋局。工作进程创建了一个新链接套接字。 + - 在链接套接字的事件意味着客户端已经下了一步棋。工作进程快速的响应。 + +一个工作进程在网络流量上从不阻塞,等待它的“对手”(客户端)做出反应。当它下了一步,工作进程立即继续其他的游戏,在那里工作进程正在处理下一步,或者在门口欢迎一个新玩家。 + +### 为什么这个比阻塞式多进程架构更快? ### + +NGINX每个工作进程很好的扩展支撑了成百上千的链接。每个链接在工作进程中创建另一个文件描述符和消耗一小部分额外内存。每个链接很少有额外的开销。NGINX进程可以固定在一些CPU上。上下文交换非常罕见,只发生在没有工作要做。 + +阻塞方式,一个链接一个进程的方法中,每个连接需要大量额外的资源和开销,和上下文切换(从一个进程切换到另一个)非常频繁 + +更详细的解释,看看这个[文章][7]关于NGINX架构,由NGINX公司发展副总裁和创始人之一 Andrew Alexeev 著。 + +适当的[系统优化][8],NGINX的每个工作进程可以扩展来处理成千上万的并发HTTP连接,并能脸不红心不跳的承受峰值流量(大量涌入的新“游戏”)。 + +### 更新配置和升级NGINX ### + +NGINX是过程体系架构,有一小部分工作进程,有助于有效的更新配置文件甚至NGINX程序本身。 + +![Updating Configuration](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.41.33-PM.png) + +更新NGINX配置文件是非常简单、轻量、可靠的操作。它通常意味着运行命令`nginx –s reload`,所做的就是检查磁盘上的配置并发送SIGHUP信号给主进程。 + +当主进程接收到一个SIGHUP信号,它会做两件事: + +- 重载配置文件和分出一组新的工作进程。这些新的工作进程立即开始接受连接和处理流量(使用新的配置设置) +- 通知旧的工作进程优雅的退出。工作进程停止接受新的链接。当前的http请求一完成,工作进程就彻底关闭这个链接(那就是,没有残存的保持链接)。一旦所有链接关闭,这个工作进程就退出。 + +这个重载过程能引发一个CPU和内存使用的小峰值,但是跟活动链接加载的支援比它一般不易察觉。你可以每秒多次重载配置(很多NGINX用户都这么做)。很少情况下,问题发生在很多代的工作进程等待关闭连接时,但即使是那样也很快被解决了。 + +NGINX的程序升级过程中实现了高可用的圣杯 - 你可以随随时更新这个软件,不会丢失连接,停机,或者中断服务。 + +![New Binary](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.41.51-PM.png) + +程序升级过程很像优雅的重载配置的方法。一个新的NGINX主进程与原主进程并行运行,然后他们共享监听套接字。两个进程都是活动的,并且各自的工作进程处理流量。然后你可以通知旧主进程和他的工作进程优雅的退出。 + +整个进程的详细描述在[NGINX管理][9]. + +### 结论 ### + +[NGINX内部信息图][10] 提供一个NGINX功能实现的高级的概况,但在这简单的解释是超过十年的创新和优化,使Nginx在一个范围广泛的硬件上提供尽可能最好的性能同时保持现代Web应用程序需要的安全性和可靠性。 + +如果你想阅读更多关于NGINX的优化,查看这些优秀的资源: + +- [Installing and Tuning NGINX for Performance][11] (webinar; [slides][12] at Speaker Deck) +- [Tuning NGINX for Performance][13] +- [The Architecture of Open Source Applications – NGINX][14] +- [Socket Sharding in NGINX Release 1.9.1][15] (using the SO_REUSEPORT socket option) + +-------------------------------------------------------------------------------- + +via: http://nginx.com/blog/inside-nginx-how-we-designed-for-performance-scale/ + +作者:[Owen Garrett][a] +译者:[wyangsun](https://github.com/wyangsun) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://nginx.com/author/owen/ +[1]:http://nginx.com/resources/library/infographic-inside-nginx/ +[2]:http://nginx.org/en/docs/ngx_core_module.html#worker_processes +[3]:http://nginx.org/en/docs/ngx_core_module.html#accept_mutex +[4]:http://nginx.com/blog/socket-sharding-nginx-release-1-9-1/ +[5]:http://en.wikipedia.org/wiki/Simultaneous_exhibition +[6]:http://gambit.blogs.nytimes.com/2009/03/03/in-chess-records-were-made-to-be-broken/ +[7]:http://www.aosabook.org/en/nginx.html +[8]:http://nginx.com/blog/tuning-nginx/ +[9]:http://nginx.org/en/docs/control.html +[10]:http://nginx.com/resources/library/infographic-inside-nginx/ +[11]:http://nginx.com/resources/webinars/installing-tuning-nginx/ +[12]:https://speakerdeck.com/nginx/nginx-installation-and-tuning +[13]:http://nginx.com/blog/tuning-nginx/ +[14]:http://www.aosabook.org/en/nginx.html +[15]:http://nginx.com/blog/socket-sharding-nginx-release-1-9-1/ From 78961d0aeabd510a170a970075e5030f2154499d Mon Sep 17 00:00:00 2001 From: KS Date: Sat, 20 Jun 2015 12:51:40 +0800 Subject: [PATCH 150/153] Delete 20150612 Inside NGINX--How We Designed for Performance and Scale.md --- ...w We Designed for Performance and Scale.md | 175 ------------------ 1 file changed, 175 deletions(-) delete mode 100644 sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md diff --git a/sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md b/sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md deleted file mode 100644 index 970144275f..0000000000 --- a/sources/tech/20150612 Inside NGINX--How We Designed for Performance and Scale.md +++ /dev/null @@ -1,175 +0,0 @@ -wyangsun 申领 -Inside NGINX: How We Designed for Performance & Scale -================================================================================ -NGINX leads the pack in web performance, and it’s all due to the way the software is designed. Whereas many web servers and application servers use a simple threaded or process-based architecture, NGINX stands out with a sophisticated event-driven architecture that enables it to scale to hundreds of thousands of concurrent connections on modern hardware. - -The [Inside NGINX][1] infographic drills down from the high-level process architecture to illustrate how NGINX handles multiple connections within a single process. This blog explains how it all works in further detail. - -### Setting the Scene – the NGINX Process Model ### - -![Master Process](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.36.30-PM.png) - -To better understand this design, you need to understand how NGINX runs. NGINX has a master process (which performs the privileged operations such as reading configuration and binding to ports) and a number of worker and helper processes. - - # service nginx restart - * Restarting nginx - # ps -ef --forest | grep nginx - root 32475 1 0 13:36 ? 00:00:00 nginx: master process /usr/sbin/nginx \ - -c /etc/nginx/nginx.conf - nginx 32476 32475 0 13:36 ? 00:00:00 \_ nginx: worker process - nginx 32477 32475 0 13:36 ? 00:00:00 \_ nginx: worker process - nginx 32479 32475 0 13:36 ? 00:00:00 \_ nginx: worker process - nginx 32480 32475 0 13:36 ? 00:00:00 \_ nginx: worker process - nginx 32481 32475 0 13:36 ? 00:00:00 \_ nginx: cache manager process - nginx 32482 32475 0 13:36 ? 00:00:00 \_ nginx: cache loader process - -On this 4-core server, the NGINX master process creates 4 worker processes and a couple of cache helper processes which manage the on-disk content cache. - -### Why Is Architecture Important? ### - -The fundamental basis of any Unix application is the thread or process. (From the Linux OS perspective, threads and processes are mostly identical; the major difference is the degree to which they share memory.) A thread or process is a self-contained set of instructions that the operating system can schedule to run on a CPU core. Most complex applications run multiple threads or processes in parallel for two reasons: - -- They can use more compute cores at the same time. -- Threads and processes make it very easy to do operations in parallel (for example, to handle multiple connections at the same time). - -Processes and threads consume resources. They each use memory and other OS resources, and they need to be swapped on and off the cores (an operation called a context switch). Most modern servers can handle hundreds of small, active threads or processes simultaneously, but performance degrades seriously once memory is exhausted or when high I/O load causes a large volume of context switches. - -The common way to design network applications is to assign a thread or process to each connection. This architecture is simple and easy to implement, but it does not scale when the application needs to handle thousands of simultaneous connections. - -### How Does NGINX Work? ### - -NGINX uses a predictable process model that is tuned to the available hardware resources: - -- The master process performs the privileged operations such as reading configuration and binding to ports, and then creates a small number of child processes (the next three types). -- The cache loader process runs at startup to load the disk-based cache into memory, and then exits. It is scheduled conservatively, so its resource demands are low. -- The cache manager process runs periodically and prunes entries from the disk caches to keep them within the configured sizes. -- The worker processes do all of the work! They handle network connections, read and write content to disk, and communicate with upstream servers. - -The NGINX configuration recommended in most cases – running one worker process per CPU core – makes the most efficient use of hardware resources. You configure it by including the [worker_processes auto][2] directive in the configuration: - - worker_processes auto; - -When an NGINX server is active, only the worker processes are busy. Each worker process handles multiple connections in a non-blocking fashion, reducing the number of context switches. - -Each worker process is single-threaded and runs independently, grabbing new connections and processing them. The processes can communicate using shared memory for shared cache data, session persistence data, and other shared resources. - -### Inside the NGINX Worker Process ### - -![](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.39.48-PM.png) - -Each NGINX worker process is initialized with the NGINX configuration and is provided with a set of listen sockets by the master process. - -The NGINX worker processes begin by waiting for events on the listen sockets ([accept_mutex][3] and [kernel socket sharding][4]). Events are initiated by new incoming connections. These connections are assigned to a state machine – the HTTP state machine is the most commonly used, but NGINX also implements state machines for stream (raw TCP) traffic and for a number of mail protocols (SMTP, IMAP, and POP3). - -![Internet Requests](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.40.32-PM.png) - -The state machine is essentially the set of instructions that tell NGINX how to process a request. Most web servers that perform the same functions as NGINX use a similar state machine – the difference lies in the implementation. - -### Scheduling the State Machine ### - -Think of the state machine like the rules for chess. Each HTTP transaction is a chess game. On one side of the chessboard is the web server – a grandmaster who can make decisions very quickly. On the other side is the remote client – the web browser that is accessing the site or application over a relatively slow network. - -However, the rules of the game can be very complicated. For example, the web server might need to communicate with other parties (proxying to an upstream application) or talk to an authentication server. Third-party modules in the web server can even extend the rules of the game. - -#### A Blocking State Machine #### - -Recall our description of a process or thread as a self-contained set of instructions that the operating system can schedule to run on a CPU core. Most web servers and web applications use a process-per-connection or thread-per-connection model to play the chess game. Each process or thread contains the instructions to play one game through to the end. During the time the process is run by the server, it spends most of its time ‘blocked’ – waiting for the client to complete its next move. - -![Blocking I/O](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.40.52-PM.png) - -1. The web server process listens for new connections (new games initiated by clients) on the listen sockets. -1. When it gets a new game, it plays that game, blocking after each move to wait for the client’s response. -1. Once the game completes, the web server process might wait to see if the client wants to start a new game (this corresponds to a keepalive connection). If the connection is closed (the client goes away or a timeout occurs), the web server process returns to listening for new games. - -The important point to remember is that every active HTTP connection (every chess game) requires a dedicated process or thread (a grandmaster). This architecture is simple and easy to extend with third-party modules (‘new rules’). However, there’s a huge imbalance: the rather lightweight HTTP connection, represented by a file descriptor and a small amount of memory, maps to a separate thread or process, a very heavyweight operating system object. It’s a programming convenience, but it’s massively wasteful. - -#### NGINX is a True Grandmaster #### - -Perhaps you’ve heard of [simultaneous exhibition][5] games, where one chess grandmaster plays dozens of opponents at the same time? - -![Kiril Georgiev](http://cdn.nginx.com/wp-content/uploads/2015/06/Kiril-Georgiev.gif) - -[Kiril Georgiev played 360 people simultaneously in Sofia, Bulgaria][6]. His final score was 284 wins, 70 draws and 6 losses. - -That’s how an NGINX worker process plays “chess.” Each worker (remember – there’s usually one worker for each CPU core) is a grandmaster that can play hundreds (in fact, hundreds of thousands) of games simultaneously. - -![Event-driven Architecture](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.41.13-PM.png) - -1. The worker waits for events on the listen and connection sockets. -1. Events occur on the sockets and the worker handles them: - - - An event on the listen socket means that a client has started a new chess game. The worker creates a new connection socket. - - An event on a connection socket means that the client has made a new move. The worker responds promptly. - -A worker never blocks on network traffic, waiting for its “opponent” (the client) to respond. When it has made its move, the worker immediately proceeds to other games where moves are waiting to be processed, or welcomes new players in the door. - -### Why Is This Faster than a Blocking, Multi-Process Architecture? ### - -NGINX scales very well to support hundreds of thousands of connections per worker process. Each new connection creates another file descriptor and consumes a small amount of additional memory in the worker process. There is very little additional overhead per connection. NGINX processes can remain pinned to CPUs. Context switches are relatively infrequent and occur when there is no work to be done. - -In the blocking, connection-per-process approach, each connection requires a large amount of additional resources and overhead, and context switches (swapping from one process to another) are very frequent. - -For a more detailed explanation, check out this [article][7] about NGINX architecture, by Andrew Alexeev, VP of Corporate Development and Co-Founder at NGINX, Inc. - -With appropriate [system tuning][8], NGINX can scale to handle hundreds of thousands of concurrent HTTP connections per worker process, and can absorb traffic spikes (an influx of new games) without missing a beat. - -### Updating Configuration and Upgrading NGINX ### - -NGINX’s process architecture, with a small number of worker processes, makes for very efficient updating of the configuration and even the NGINX binary itself. - -![Updating Configuration](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.41.33-PM.png) - -Updating NGINX configuration is a very simple, lightweight, and reliable operation. It typically just means running the `nginx –s reload` command, which checks the configuration on disk and sends the master process a SIGHUP signal. - -When the master process receives a SIGHUP, it does two things: - -- Reloads the configuration and forks a new set of worker processes. These new worker processes immediately begin accepting connections and processing traffic (using the new configuration settings). -- Signals the old worker processes to gracefully exit. The worker processes stop accepting new connections. As soon as each current HTTP request completes, the worker process cleanly shuts down the connection (that is, there are no lingering keepalives). Once all connections are closed, the worker processes exit. - -This reload process can cause a small spike in CPU and memory usage, but it’s generally imperceptible compared to the resource load from active connections. You can reload the configuration multiple times per second (and many NGINX users do exactly that). Very rarely, issues arise when there are many generations of NGINX worker processes waiting for connections to close, but even those are quickly resolved. - -NGINX’s binary upgrade process achieves the holy grail of high-availability – you can upgrade the software on the fly, without any dropped connections, downtime, or interruption in service. - -![New Binary](http://cdn.nginx.com/wp-content/uploads/2015/06/Screen-Shot-2015-06-08-at-12.41.51-PM.png) - -The binary upgrade process is similar in approach to the graceful reload of configuration. A new NGINX master process runs in parallel with the original master process, and they share the listening sockets. Both processes are active, and their respective worker processes handle traffic. You can then signal the old master and its workers to gracefully exit. - -The entire process is described in more detail in [Controlling NGINX][9]. - -### Conclusion ### - -The [Inside NGINX infographic][10] provides a high-level overview of how NGINX functions, but behind this simple explanation is over ten years of innovation and optimization that enable NGINX to deliver the best possible performance on a wide range of hardware while maintaining the security and reliability that modern web applications require. - -If you’d like to read more about the optimizations in NGINX, check out these great resources: - -- [Installing and Tuning NGINX for Performance][11] (webinar; [slides][12] at Speaker Deck) -- [Tuning NGINX for Performance][13] -- [The Architecture of Open Source Applications – NGINX][14] -- [Socket Sharding in NGINX Release 1.9.1][15] (using the SO_REUSEPORT socket option) - --------------------------------------------------------------------------------- - -via: http://nginx.com/blog/inside-nginx-how-we-designed-for-performance-scale/ - -作者:[Owen Garrett][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://nginx.com/author/owen/ -[1]:http://nginx.com/resources/library/infographic-inside-nginx/ -[2]:http://nginx.org/en/docs/ngx_core_module.html#worker_processes -[3]:http://nginx.org/en/docs/ngx_core_module.html#accept_mutex -[4]:http://nginx.com/blog/socket-sharding-nginx-release-1-9-1/ -[5]:http://en.wikipedia.org/wiki/Simultaneous_exhibition -[6]:http://gambit.blogs.nytimes.com/2009/03/03/in-chess-records-were-made-to-be-broken/ -[7]:http://www.aosabook.org/en/nginx.html -[8]:http://nginx.com/blog/tuning-nginx/ -[9]:http://nginx.org/en/docs/control.html -[10]:http://nginx.com/resources/library/infographic-inside-nginx/ -[11]:http://nginx.com/resources/webinars/installing-tuning-nginx/ -[12]:https://speakerdeck.com/nginx/nginx-installation-and-tuning -[13]:http://nginx.com/blog/tuning-nginx/ -[14]:http://www.aosabook.org/en/nginx.html -[15]:http://nginx.com/blog/socket-sharding-nginx-release-1-9-1/ From 5a08b0f47433bc2a64c1846b85bedaec578e1b91 Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Sun, 21 Jun 2015 03:01:57 +0800 Subject: [PATCH 151/153] Translating by ZTinoZ --- .../tech/20150526 20 Useful Terminal Emulators for Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md index 42a6137296..5e0d237086 100644 --- a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -221,7 +221,7 @@ Xfce Terminal ### 17. xterm ### -xterm应用程序是一款标准的在X Window系统上的终端仿真器。It maintain DEC VT102 and Tektronix 4014 compatible terminals for applications that can’t use the window system directly. +xterm应用程序是一款标准的在X Window系统上的终端仿真器。它保持了DEC VT102和Tektronix 4014,让应用能直接使用X Window系统。 ![xterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/xterm.jpg) @@ -258,7 +258,7 @@ Sakura Terminal ### 20. rxvt-unicode ### -The rxvt-unicode (also known as urxvt) is a yet another highly customizable, lightweight and fast terminal emulator with xft and unicode support was developed by Marc Lehmann. It got some outstanding features such as support for international language via Unicode, the ability to display multiple font types and support for Perl extensions. +rxvt-unicode (也称为urxvt) 是另一个高度可定制、轻量级和快速的终端仿真器,支持xft和unicode,由Marc Lehmann开发。它有许多显著特性比如支持Unicode上的国际语言,能显示多种字体类型并支持Perl扩展。 ![rxvt unicode](http://www.tecmint.com/wp-content/uploads/2014/01/rxvt-unicode.png) From 0016e105d0dcb7bb2d2a1e67ef48805758dc3a7b Mon Sep 17 00:00:00 2001 From: ZTinoZ Date: Sun, 21 Jun 2015 03:05:20 +0800 Subject: [PATCH 152/153] Finish the translation by ZTinoZ --- .../tech/20150526 20 Useful Terminal Emulators for Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20150526 20 Useful Terminal Emulators for Linux.md (100%) diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/translated/tech/20150526 20 Useful Terminal Emulators for Linux.md similarity index 100% rename from sources/tech/20150526 20 Useful Terminal Emulators for Linux.md rename to translated/tech/20150526 20 Useful Terminal Emulators for Linux.md From f1392a0b831d054332fc4121270d2ac6e3f52a34 Mon Sep 17 00:00:00 2001 From: NearTan Date: Sun, 21 Jun 2015 20:02:39 +0800 Subject: [PATCH 153/153] translated --- ... on Ubuntu 15.04 with Different Methods.md | 265 ------------------ ... on Ubuntu 15.04 with Different Methods.md | 264 +++++++++++++++++ 2 files changed, 264 insertions(+), 265 deletions(-) delete mode 100644 sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md create mode 100644 translated/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md diff --git a/sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md b/sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md deleted file mode 100644 index 83b08328e0..0000000000 --- a/sources/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md +++ /dev/null @@ -1,265 +0,0 @@ -translating by NearTan - -How to Setup Node.JS on Ubuntu 15.04 with Different Methods -================================================================================ -This is such an important article to guide you about the installation and setup of Node.js on Ubuntu 15.04. Node.js is basically a server side java script programming to provide you bindings for enabling the input and output socket bios and streams. It has a high through put and non-blocking IO in a single threaded event loop. It’s also a platform layer that provides the functionality to interact with the Operating system to write file, read files and to do networking operations. So in this article we will perform different installation methods to setup Node.Js on Ubuntu 15.04 server. - -### Methods to Install Node.JS ### - -Their are different ways to install Node.Js and we can prefer to choose any one. Following are some important ways to install Node.Js that we will use to guide you about their each setup on Ubuntu 15.04 so make sure to remove the previous previous packages to avoid from any package conflict. - -- Installation of Node.JS from Source Code -- Installation of Node.JS from Package Manager -- Installation of Node.JS from Github Repository -- Installation of Node.JS with NVM - -### 1) Installing from Source Code ### - -Let's start with installation of Node.JS from the Source Code, so make sure that your system is up to date and dependent packages are pre installed. So follow the below steps and start the setup. - -#### STEP 1: System Update #### - -Use following commands and update Operating system and ten install the required packages are necessary for Node.JS setup. - - root@ubuntu-15:~# apt-get update - - root@ubuntu-15:~# apt-get install python gcc make g++ - -#### STEP 2: Get Source Code of Node.JS #### - -After we had installed the dependent packages now from the official web link of Node.JS just download its source code package and extract it as in following commands. - - root@ubuntu-15:~# wget http://nodejs.org/dist/v0.12.4/node-v0.12.4.tar.gz - root@ubuntu-15:~# tar zxvf node-v0.12.4.tar.gz - -#### STEP 3: Starting Installation #### - -Now move to the source code directory and execute the .configuration file - -![NodeJS Configure](http://blog.linoxide.com/wp-content/uploads/2015/06/13.png) - - root@ubuntu-15:~# ls - node-v0.12.4 node-v0.12.4.tar.gz - root@ubuntu-15:~# cd node-v0.12.4/ - root@ubuntu-15:~/node-v0.12.4# ./configure - root@ubuntu-15:~/node-v0.12.4# make install - -### Testing after Installation of Node.Js from Source Code ### - -Once the installation is done after running make installa command, we check its version and test that Node.Js is working fine by executing some test out puts. - - root@ubuntu-15:~/node-v0.12.4# node -v - v0.12.4 - -![Node.Js Test](http://blog.linoxide.com/wp-content/uploads/2015/06/21.png) - -Create a new file with .js extension execute it with Node command. - - root@ubuntu-15:~/node-v0.12.4# touch helo_test.js - root@ubuntu-15:~/node-v0.12.4# vim helo_test.js - console.log('Hello World'); - -Now execute it with Node command. - - root@ubuntu-15:~/node-v0.12.4# node helo_test.js - Hello World - -The out put shows that we had successfully installed Node.JS on Ubuntu 15.04 which is now ready to create applications on it using java scripts. - -### 2) Installing from Package Manager ### - -The installation of Node.JS through Package Manager is also a very simple process to setup on Ubuntu through NodeSource by adding its Personal Package Archives (PPA). - -We will go through the following steps to install Node.JS through PPA. - -#### STEP 1: Get the Source Code using Curl #### - -Before getting the source code by using the Curl command we must update our system and then run the curl command to fetch the NodeSource into local repository. - - root@ubuntu-15:~#apt-get update - root@ubuntu-15:~# curl -sL https://deb.nodesource.com/setup | sudo bash - - -The curl will execute the following tasks. - - ## Installing the NodeSource Node.js 0.10 repo... - ## Populating apt-get cache... - ## Confirming "vivid" is supported... - ## Adding the NodeSource signing key to your keyring... - ## Creating apt sources list file for the NodeSource Node.js 0.10 repo... - ## Running `apt-get update` for you... - Fetched 6,411 B in 5s (1,077 B/s) - Reading package lists... Done - ## Run `apt-get install nodejs` (as root) to install Node.js 0.10 and npm - -#### STEP 2: Installation of NodeJS and NPM #### - -As per the output of Curl we had fetched the NodeSource to our local repository now through apt-get commands we will install the NodeJS and NPM packages. - - root@ubuntu-15:~# apt-get install nodejs - -![NodeJS Install](http://blog.linoxide.com/wp-content/uploads/2015/06/31.png) - -#### STEP 3: Installing Build Essentials Tool #### - -To compile and install native addons from npm we may also need to install build tools using following command as. - - root@ubuntu-15:~# apt-get install -y build-essential - -### Testing With Node.JS Shell ### - -Testing of Node.Js is similar to the one that we did after installation from the source Code. -so lets start with the node command as follow and get its output result to see if Node.JS is fully functional. - - root@ubuntu-15:~# node - > console.log('Node.js Installed Using Package Manager'); - Node.js Installed Using Package Manager - ----------- - - root@ubuntu-15:~# node - > a = [1,2,3,4,5] - [ 1, 2, 3, 4, 5 ] - > typeof a - 'object' - > 5 + 2 - 7 - > - (^C again to quit) - > - root@ubuntu-15:~# - -### REPL For Your NodeJS Apps ### - -REPL is the Node.js shell, any valid Javascript which can be written in a script can be passed to the REPL. So lets see how REPL works with NodeJS. - - root@ubuntu-15:~# node - > var repl = require("repl"); - undefined - > repl.start("> "); - - Press Enter and it will show out put like this: - > { domain: null, - _events: {}, - _maxListeners: 10, - useGlobal: false, - ignoreUndefined: false, - eval: [Function], - inputStream: - { _connecting: false, - _handle: - { fd: 0, - writeQueueSize: 0, - owner: [Circular], - onread: [Function: onread], - reading: true }, - _readableState: - { highWaterMark: 0, - buffer: [], - length: 0, - pipes: null, - ... - ... - -Here is the list of command line help that we can use to work with REPL. - -![REPL Manual](http://blog.linoxide.com/wp-content/uploads/2015/06/4.png) - -### Working with NodeJS Packet Manager ### - -NPM is simple CLI tool for ensuring that a given node script runs continuously. It helps to Install and manage dependencies through the file package.json. We will start its using init command as. - - root@ubuntu-15:~# npm init - -![NPM starting](http://blog.linoxide.com/wp-content/uploads/2015/06/51.png) - -### 3) Installing from Github Repository ### - -In this method to install Node.JS we will consider few simple steps to directory clone the Node.JS repository from the github. - -Before the start of configurations through the the cloned package of Node.JS make sure that we must have following dependent packages installed with us. - - root@ubuntu-15:~# apt-get install g++ curl make libssl-dev apache2-utils git-core - -Now start the clone with git command and change the directory to its configuration file. - - root@ubuntu-15:~# git clone git://github.com/ry/node.git - root@ubuntu-15:~# cd node/ - -![Git Clone NodeJS](http://blog.linoxide.com/wp-content/uploads/2015/06/61.png) - -To install from the cloned repository now lets run the .config command and then make install to complete the setup of Node.Js . - - root@ubuntu-15:~# ./configure - -![Configure Node](http://blog.linoxide.com/wp-content/uploads/2015/06/7.png) - -Run the make install command that will takes few minutes so be patient and get it ready finalize the setup on Node.JS package for you. - - root@ubuntu-15:~/node# make install - - root@ubuntu-15:~/node# node -v - v0.13.0-pre - -### Testing with Node.JS ### - - root@ubuntu-15:~/node# node - > a = [1,2,3,4,5,6,7] - [ 1, 2, 3, 4, 5, 6, 7 ] - > typeof a - 'object' - > 6 + 5 - 11 - > - (^C again to quit) - > - root@ubuntu-15:~/node# - -### 4) Installing Node.JS Using Node Version Manager ### - -In this last method we show you we can easily install Node.JS with NVM method. This is one of the best method to install and configure Node.JS it provides us with facility to control versions. - -So before starting with this method make sure that the previously installed package is not already present there if you are working on the same machine. - -#### STEP 1: Installing Prerequisites #### - -Let's start with the system update and then install the following prerequisites for the Ubuntu Server to setup Node.JS using NodeJS Versions Manager System. Using the Curl command we will get NVM from the git to our local repository. - - root@ubuntu-15:~# apt-get install build-essential libssl-dev - root@ubuntu-15:~# curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh - -![NVM Curl](http://blog.linoxide.com/wp-content/uploads/2015/06/81.png) - -#### STEP 2: Update Home Environment #### - -After the curl command downloads the necessary packages for the NVM in the home directory of the user it also make changes to the bash profile. so in order to update those change and get access to NVM we must relogin to the terminal or we can update it using the source command as below. - - root@ubuntu-15:~# source ~/.profile - -Now we can use the NVM to choose the default NVM version or by moving to the previous version of NVM that we can do so by using the following commands. - - root@ubuntu-15:~# nvm ls - root@ubuntu-15:~# nvm alias default 0.12.4 - -![NVM Default](http://blog.linoxide.com/wp-content/uploads/2015/06/91.png) - -#### STEP 3: Using NodeJS Versions Manager #### - -We have successfully setup the NodeJS with NVM package and now can use it with its useful commands. - -![NVM Manual](http://blog.linoxide.com/wp-content/uploads/2015/06/101.png) - -### CONCLUSION ### - -Now we are ready to go with building server side applications with Node.JS and you are free to choose the best installation setup of your choice as we had done with four optional installations of Node.Js on the latest version of Ubuntu 15.04 with priority installation sequence, now its up to you to follow the one of your own choice and start coding with NodeJS. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/ubuntu-how-to/setup-node-js-ubuntu-15-04-different-methods/ - -作者:[Kashif Siddique][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/kashifs/ \ No newline at end of file diff --git a/translated/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md b/translated/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md new file mode 100644 index 0000000000..fbbaecb067 --- /dev/null +++ b/translated/tech/20150618 How to Setup Node.JS on Ubuntu 15.04 with Different Methods.md @@ -0,0 +1,264 @@ +在Ubuntu下用不同方式安装Node.JS +================================================================================ + +如果你要在Ubuntu 15.04上安装Node.js的话,这篇教程对你来说肯定很重要。Node.js根本上来说就是一个运行在服务端上的封装好了输入输出流的javascript程序。Node.js巧妙的使用单线程的event loop来处理异步IO。同时它在平台层面上,面向系统拥有非常实用的文件读写,网络操作功能。所以这篇文章将展示在Ubuntu 15.04 server上不同的安装Node.Js的方式。 + +### 安装Node.JS 的方法### + +有许多不同的方法安装Node.JS,我们可以选择其一。通过本篇文章我们将手把手带着你在Ubuntu 15.04上安装Node.Js,在此之前请卸载旧版本的包以免发生包冲突。 + +- 从源代码安装Node.JS +- 用包管理器安装Node.JS +- 从Github远程库安装Node.JS +- 用NVM安装Node.JS + +### 1) 从源代码安装Node.JS ### + +让我们开始从从源代码安装Node.JS之前,请确认系统上的所有的依赖包都已经更新到最新版本。然后跟着以下步骤来开始安装: + +#### 步骤1: 升级系统 #### + +用以下命令来升级系统,并且安装一些Node.JS必要的包。 + + root@ubuntu-15:~# apt-get update + + root@ubuntu-15:~# apt-get install python gcc make g++ + +#### 步骤2: 获取Node.JS的源代码 #### + +安装好依赖包之后我们可以从官方网站上下载Node.JS的源代码。下载以及解压的命令如下: + + root@ubuntu-15:~# wget http://nodejs.org/dist/v0.12.4/node-v0.12.4.tar.gz + root@ubuntu-15:~# tar zxvf node-v0.12.4.tar.gz + +#### 步骤3: 开始安装 #### + +现在我们进入源代码的目录然后运行.configuration文件 + +![NodeJS Configure](http://blog.linoxide.com/wp-content/uploads/2015/06/13.png) + + root@ubuntu-15:~# ls + node-v0.12.4 node-v0.12.4.tar.gz + root@ubuntu-15:~# cd node-v0.12.4/ + root@ubuntu-15:~/node-v0.12.4# ./configure + root@ubuntu-15:~/node-v0.12.4# make install + +### 安装后测试 ### + +只要运行一次上面的命令就顺利安装好了Node.JS,现在我们来确认一下版本信息和测试以下Node.JS是否可以运行输出。 + + root@ubuntu-15:~/node-v0.12.4# node -v + v0.12.4 + +![Node.Js Test](http://blog.linoxide.com/wp-content/uploads/2015/06/21.png) + +创建一个以.js为扩展名的文件然后用Node的命令运行 + + root@ubuntu-15:~/node-v0.12.4# touch helo_test.js + root@ubuntu-15:~/node-v0.12.4# vim helo_test.js + console.log('Hello World'); + +现在我们用Node的命令运行文件 + + root@ubuntu-15:~/node-v0.12.4# node helo_test.js + Hello World + +输出的结果证明我们已经成功的在Ubuntu 15.04安装好了Node.JS,同时我们也能运行JavaScript文件。 + +### 2) 利用包管理器安装Node.JS ### + +在Ubuntu下用包管理器安装Node.JS是非常简单的,只要增加NodeSource的个人软件包档案(PPA)即可。 + +我们将下面通过PPA安装Node.JS + +#### 步骤1: 用curl获取源代码 #### + +在我们用curl获取源代码之前,我们必须先升级操作系统然后用curl命令获取NodeSource添加到本地仓库。 + + root@ubuntu-15:~#apt-get update + root@ubuntu-15:~# curl -sL https://deb.nodesource.com/setup | sudo bash - + +curl将运行以下任务 + + ## Installing the NodeSource Node.js 0.10 repo... + ## Populating apt-get cache... + ## Confirming "vivid" is supported... + ## Adding the NodeSource signing key to your keyring... + ## Creating apt sources list file for the NodeSource Node.js 0.10 repo... + ## Running `apt-get update` for you... + Fetched 6,411 B in 5s (1,077 B/s) + Reading package lists... Done + ## Run `apt-get install nodejs` (as root) to install Node.js 0.10 and npm + +#### 步骤2: 安装NodeJS和NPM #### + +运行以上命令之后如果输出如上所示,我们可以用apt-get命令来安装NodeJS和NPM包。 + + root@ubuntu-15:~# apt-get install nodejs + +![NodeJS Install](http://blog.linoxide.com/wp-content/uploads/2015/06/31.png) + +#### STEP 3: Installing Build Essentials Tool #### +#### 步骤3: 安装一些必备的工具 #### + +通过以下命令来安装编译安装一些我们必需的本地插件。 + + root@ubuntu-15:~# apt-get install -y build-essential + +### 通过Node.JS Shell来测试 ### + +测试Node.JS的步骤与之前使用源代码安装相似,通过以下node命令来确认Node.JS是否完全安装好: + + root@ubuntu-15:~# node + > console.log('Node.js Installed Using Package Manager'); + Node.js Installed Using Package Manager + +---------- + + root@ubuntu-15:~# node + > a = [1,2,3,4,5] + [ 1, 2, 3, 4, 5 ] + > typeof a + 'object' + > 5 + 2 + 7 + > + (^C again to quit) + > + root@ubuntu-15:~# + +### 使用NodeJS应用进行简单的测试 ### + +REPL是一个Node.js的shell,任何有效的JavaScript代码都能在REPL下运行通过。所以让我们看看在Node.JS下的REPL是什么样子吧。 + + root@ubuntu-15:~# node + > var repl = require("repl"); + undefined + > repl.start("> "); + + Press Enter and it will show out put like this: + > { domain: null, + _events: {}, + _maxListeners: 10, + useGlobal: false, + ignoreUndefined: false, + eval: [Function], + inputStream: + { _connecting: false, + _handle: + { fd: 0, + writeQueueSize: 0, + owner: [Circular], + onread: [Function: onread], + reading: true }, + _readableState: + { highWaterMark: 0, + buffer: [], + length: 0, + pipes: null, + ... + ... + +以下是可以在REPL下使用的命令列表 + +![REPL Manual](http://blog.linoxide.com/wp-content/uploads/2015/06/4.png) + +### 使用NodeJS的包管理器 ### + +NPM是一个提供给node脚本连续运行的命令行工具,它能通过package.json来安装和管理依赖包。最开始从初始化命令init开始 + + root@ubuntu-15:~# npm init + +![NPM starting](http://blog.linoxide.com/wp-content/uploads/2015/06/51.png) + +### 3) 从Github远程库安装Node.JS ### + +在这个方法中我们需要一些步骤来把Node.JS从Github的远程的仓库克隆到本地仓库目录 + +在开始克隆(clone)包到本地并且配制之前,我们要先安装以下依赖包 + + root@ubuntu-15:~# apt-get install g++ curl make libssl-dev apache2-utils git-core + +现在我们开始用git命令克隆到本地并且转到配制目录 + + root@ubuntu-15:~# git clone git://github.com/ry/node.git + root@ubuntu-15:~# cd node/ + +![Git Clone NodeJS](http://blog.linoxide.com/wp-content/uploads/2015/06/61.png) + +clone仓库之后,通过运行.config命令来编译生成完整的安装包。 + + root@ubuntu-15:~# ./configure + +![Configure Node](http://blog.linoxide.com/wp-content/uploads/2015/06/7.png) + +运行make install命令之后耐心等待几分钟,程序将会安装好Node.JS + + root@ubuntu-15:~/node# make install + + root@ubuntu-15:~/node# node -v + v0.13.0-pre + +### 测试Node.JS ### + + root@ubuntu-15:~/node# node + > a = [1,2,3,4,5,6,7] + [ 1, 2, 3, 4, 5, 6, 7 ] + > typeof a + 'object' + > 6 + 5 + 11 + > + (^C again to quit) + > + root@ubuntu-15:~/node# + +### 4) 通过NVM安装Node.JS ### + +在最后一种方法中我们我们将用NVM来比较容易安装Node.JS。安装和配制Node.JS,这是最好的方法之一,它可以供我们选择要安装的版本。 + +在安装之前,请确认本机以前的安装包已经被卸载 + +#### 步骤1: 安装依赖包 #### + +首先升级Ubuntu Server系统,然后安装以下安装Node.JS和使用NVM所要依赖的包。用curl命令从git上下载NVM到本地仓库: + + root@ubuntu-15:~# apt-get install build-essential libssl-dev + root@ubuntu-15:~# curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh + +![NVM Curl](http://blog.linoxide.com/wp-content/uploads/2015/06/81.png) + +#### 步骤2: 修改Home环境 #### + +用curl从NVM下载必需的包到用户的home目录之后,我们需要修改bash的配制文件添加NVM,之后只要重新登录中断或者用如下命令更新即可 + + root@ubuntu-15:~# source ~/.profile + +现在我们可以用NVM来设置默认的NVM的版本或者用如下命令来指定之前版本: + + root@ubuntu-15:~# nvm ls + root@ubuntu-15:~# nvm alias default 0.12.4 + +![NVM Default](http://blog.linoxide.com/wp-content/uploads/2015/06/91.png) + +#### 步骤3: 使用NVM #### + +我们已经通过NVM成功的安装了Node.JS,所以我们现在可以使用各种有用的命令。 + +![NVM Manual](http://blog.linoxide.com/wp-content/uploads/2015/06/101.png) + +### 总结 ### + +现在我们已经准备好了在服务端安装Node.JS,你可以从我们说的四种方式中选择最合适你的方式在最新的Ubuntu 15.04上来安装Node.JS,安装好之后你就可以利用Node.JS来编写你的代码。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/setup-node-js-ubuntu-15-04-different-methods/ + +作者:[Kashif Siddique][a] +译者:[NearTan](https://github.com/NearTan) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/kashifs/ \ No newline at end of file