Merge pull request #10 from LCTT/master

更新 20150622
This commit is contained in:
Chang Liu 2015-06-22 15:14:41 +08:00
commit ef277a683b
108 changed files with 13020 additions and 3335 deletions

View File

@ -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列表排名
谢谢大家的支持!

View File

@ -0,0 +1,111 @@
在 Linux 上如何用命令行获取 Freely RSS 源
================================================================================
也许你并不知道 Feedly它是世界上最流行的在线新闻聚合服务之一它提供了平滑而一致的新闻阅读体验你可以使用电脑的浏览器扩展Android 和 iOS 设备上的移动应用程序等来体验Feedly。Feedly 在2013年Google Reader 停用后迅速的获得了一大批Google Reader的用户。我就是他们之中的一位。从这以后Feedly就一直是我的默认RSS简易信息聚合阅读器。
除了使用我非常喜欢的Feedly浏览器扩展和手机上的Feedly程序这里还有一种途径来获取FeedlyLinux命令行。没错你可以用命令行来获取Feedly上的新闻概要。听起来非常傻但是对于那些在服务器上工作的系统管理员来说这是非常有用的。
点击进入[Feednix][2]这个用c++编写的开源软件是Feedly的非官方命令行客户端。它允许你在一个基于ncurses的终端界面例如bash下浏览Feedly的新闻。默认模式下Feednix 关联了一个叫做 w3m 的基于控制台的浏览器,允许你在命令行终端的环境下阅读文章。当然你也可以选择使用你喜欢的网页浏览器。
在这个教程中我准备示范一下怎样在命令行下安装和配置Feednix 来获取Feedly。
### 在Linux下安装Feednix ###
你可以通过以下的步骤从源代码中构建Feednix。同时在其官方的github仓库的Ubuntu-stableUbuntu稳定版本的分支上有最新的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

View File

@ -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
</IfModule>
最后,建议您在/etc/httpd/modsecurity.d目录下创建自己的配置文件在那里我们可以用我们自定义的文件夹接下来的示例中我们会将其命名为tecmint.conf而无需修改CRS文件的目录。这样做能够在CRSs发布新版本时更加容易的升级。
最后,建议您在/etc/httpd/modsecurity.d目录下创建自己的配置文件在那里我们可以用我们自定义的文件夹接下来的示例中我们会将其命名为tecmint.conf而无需修改CRS文件的目录。这样做能够在CRS发布新版本时更加容易的升级。
<IfModule mod_security2.c>
SecRuleEngine On
@ -121,13 +108,13 @@ mod_security + mod_evasive 配置文件
SecDataDir /tmp
</IfModule>
您可以在[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开启了下列的目录注意这个文件被详细的注释了因此我们剔掉了注释以重点显示配置指令
<IfModule mod_evasive24.c>
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,23 +156,39 @@ mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。
DOSSystemCommand </command>
这个指令指定当一个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指令应该是这样的
@ -193,7 +196,7 @@ mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。
上面一行的%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地址
I
*确认主机IP地址*
请播放下面的视频并跟从列出的步骤来模拟一个Dos攻击
请播放下面的视频YT 视频,请自备梯子: https://www.youtube.com/-U_mdet06Jk 并跟从列出的步骤来模拟一个Dos攻击
youtube视频发布的时候不行做个链接吧
<iframe width="640" height="405" frameborder="0" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/-U_mdet06Jk"></iframe>
然后攻击者的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地址被加入黑名单之前出现短暂几秒的使用峰值。如果没有这些模块模拟攻击绝对会很快将服务器击溃并使服务器在攻击期间无法提供服务。
我们很高兴听见您打算使用(或已经使用过)这些工具。我们期望得到您的反馈,所以,请在留言处留下您的评价和问题,谢谢!
@ -257,14 +261,14 @@ via: http://www.tecmint.com/protect-apache-using-mod_security-and-mod_evasive-on
作者:[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/

View File

@ -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发行版的标准仓库中因而你需要从源代码来构建它。使用以下针对特定版本的指令来安装Bdsync及其手册页到你的系统中。
#### DebianUbuntu或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)
校对:[wxy](https://github.com/wxy)
本文由 [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]:https://linux.cn/article-5444-1.html

View File

@ -0,0 +1,143 @@
用命令行工具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. 测试上传下载的速度(以字节计算)**
$ 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] ## 这里使用服务器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]。
上面就是所有内容,更多内容敬请关注我们。如果你有任何反馈记得在文章下方评论,如果你喜欢别忘了给我们点个赞,分享我们的文章。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/check-internet-speed-from-command-line-in-linux/
作者:[Avishek Kumar][a]
译者:[NearTan](https://github.com/NearTan)
校对:[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/speedtest-mini-server-to-test-bandwidth-speed/

View File

@ -0,0 +1,149 @@
Linux中7个用来浏览网页和下载文件的命令
================================================================================
上一篇文章中,我们提到了`rTorrent`、`wget`、`cURL`、`w3m`、`Elinks`等几个有用的工具,很多人回信说还有其它几个类似的工具也值得讨论,所以就有了这篇文章。如果错过了第一部分的讨论,可以通过下面的链接来回顾。
- [5 个基于Linux命令行的文件下载和网站浏览工具][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]下载最新的版本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 和 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浏览器之称并且至今仍然处在积极开发中。
通过下面的命令安装lynx。
# 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)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[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/
[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/

View File

@ -1,11 +1,11 @@
在Linux中用chattr和lsattr命令管理文件和目录属性
================================================================================
为了允许添加数据,防止更改或者删除等,文件和文件夹中设定了一定的控制属性。例如,你可以在关键系统文件或者文件夹中启用属性然后没有用户包括root可以删除或者修改它不允许比如dump命令等备份工具去备份一个特定的文件或者文件夹等等。这些属性只可以在ext2ext3或者ext4文件系统中的文件和文件夹上设定。
为了允许添加数据,防止更改或者删除等,文件和文件夹可以设定了特定的控制属性。例如,你可以在关键的系统文件或者文件夹中启用属性,然后没有任何用户包括root可以删除或者修改它比如不允许使用像dump这样的命令等备份工具去备份一个特定的文件或者文件夹等等。这些属性只可以在ext2ext3或者ext4文件系统中的文件和文件夹上设定。
有两个命令 **lsattr****chattr** 用来管理属性。下面是常用属性的列表。
注:表格代码
<table width="482" cellspacing="0" cellpadding="4" style="height: 651px">
<table width="482" cellspacing="0" cellpadding="4" border="1">
<colgroup>
<col width="112">
<col width="514"> </colgroup>
@ -63,7 +63,7 @@
<p align="justify" class="western">e (extent format)</p>
</td>
<td width="514">
<p align="justify" class="western">它表明,该文件使用扩展到映射磁盘上的块</p>
<p align="justify" class="western">它表明,该文件使用磁盘上的块的映射扩展</p>
</td>
</tr>
<tr valign="top">
@ -71,7 +71,7 @@
<p align="justify" class="western">i (immutable)</p>
</td>
<td width="514">
<p align="justify" class="western">在文件上启用这个属性时,我们不能更改重命名或者删除这个文件</p>
<p align="justify" class="western">在文件上启用这个属性时,我们不能更改重命名或者删除这个文件</p>
</td>
</tr>
<tr valign="top">
@ -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/) 荣誉推出

View File

@ -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/) 荣誉推出

View File

@ -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
<HTML>
<HEAD>
@ -71,19 +69,19 @@ The mod_jk 需要两个组件:
</BODY>
</HTML>
一切完毕后我们将使用下面的命令安装和配置mod_jk:
一切完毕后我们将使用下面的命令安装和配置mod\_jk:
sudo apt-get install libapache2-mod-jk
我们使用下面的命令启用Tomcat的8443转发端口
我们需要使用下面的命令启用Tomcat的8443转发端口
sudo vim /etc/tomcat7/server.xml
我们将解除下面的注释行:
解除下面的注释行:
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
之后,我们将用下面的命令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/) 荣誉推出

View File

@ -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/) 荣誉推出

View File

@ -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 ChatHangoutFacebook ChatWhatsappHike和其他一些应用与集成的聊天服务我们都很熟悉了。那你知道Linux的nc命令可以使你的Linux盒子变成一个聊天服务器而仅仅只需要一行命令吗。什么是nc命令它又是怎么工作的呢
nc是Linux netcat命令的旧版。nc就像瑞士军刀一样内建呢大量的功能。nc可用做调式工具调查工具使用TCP/UDP读写网络连接DNS正向/反向检查。
我们大家使用聊天服务都有很长一段时间了。对于Google ChatHangoutFacebook ChatWhatsappHike和其他一些应用与集成的聊天服务我们都很熟悉了。那你知道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命令和脚本 ###
我们一直在TwitterFacebook和Google Plus可能是其他我们没有提到的地方上使用井号标签。那些井号标签使得其他人搜索一个标签更加容易。可是很少人知道我们可以在Linux命令行使用号标签。
我们一直在TwitterFacebook和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

View File

@ -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更为强大因为我们可以通过它很好地格式化输出我们可以让它右对齐、左对齐或者为信息留出专门的空间。让我们从一个简单的例子开始吧。要创建文件请使用你喜欢的文本编辑器katenanovi……然后创建名为note.sh的文件里面写入这些命令
假设我们是某个公司的总服务台经理我们想要创建某个shell脚本来注册呼叫信息电话号码、用户名以及问题的简要描述。我们打算把这些信息存储到普通文本文件data.txt中以便今后统计。脚本它自己就是以对话的方式工作这会让总服务台的工作人员的小日子过得轻松点。那么首先我们需要显示提问。对于显示信息我们可以用echo和printf命令。这两个都是用来显示信息的但是printf更为强大因为我们可以通过它很好地格式化输出我们可以让它右对齐、左对齐或者为信息留出专门的空间。让我们从一个简单的例子开始吧。要创建文件请使用你惯用的文本编辑器katenanovi……然后创建名为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/) 荣誉推出

View File

@ -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/) 荣誉推出

View File

@ -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/) 荣誉推出

View File

@ -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/) 荣誉推出

View File

@ -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 平台上的软件包管理工具,他们的底层使用了 RPMLCTT 译者注RPM 最初指 Redhat Pacakge Manager ,现普遍解释为递归短语 RPM Package Manager 的缩写)。
YastYet 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')。
<pre><code>%> zypper
<pre><code># zypper
Usage:
zypper [--global-options]</code></pre>
2. 获取一个具体的子命令的帮助信息,比如 'in' (install),可以执行下面的命令
<pre><code>%> zypper help in</code></pre>
<pre><code># zypper help in</code></pre>
或者
<pre><code>%> zypper help install
<pre><code># 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 为例)。
<pre><code>%> zypper info -t pattern lamp_server
<pre><code># zypper info -t pattern lamp_server
Loading repository data...
Reading installed packages...
@ -136,9 +136,9 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
5. 开启一个Zypper Shell 的会话。
<pre><code> %>zypper shell </code></pre>
<pre><code># zypper shell </code></pre>
或者
<pre><code> %>zypper sh </code></pre>
<pre><code># zypper sh </code></pre>
<pre><code>zypper> help
Usage:
@ -151,9 +151,9 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
6. 使用 'zypper repos' 或者 'zypper lr' 来列举所有已定以的软件库。
<pre><code>%> zypper repos</code></pre>
<pre><code># zypper repos</code></pre>
或者
<pre><code>%> zypper lr
<pre><code># 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. 根据优先级列举软件库。
<pre><code>%> zypper lr -P
<pre><code># 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 软件库。
<pre><code>%> zypper refresh </code></pre>
<pre><code># zypper refresh </code></pre>
或者
<pre><code>%> zypper ref
<pre><code># 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' 为例 )。
<pre><code>%> zypper refresh repo-non-oss
<pre><code># zypper refresh repo-non-oss
Repository 'openSUSE-13.2-Non-Oss' is up to date.
Specified repositories have been refreshed. </code></pre>
11. 强制更新一个软件库(以 'repo-non-oss' 为例 )。
<pre><code>%> zypper ref -f repo-non-oss
<pre><code># 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' 软件库,那么我们可以通过以下的法来获得该软件库的标志数字。
<pre><code>%> zypper lr
<pre><code># 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</code></pre>
从以上输出的列表中我们可以看到 'repo-oss' 库的标示数字是 6因此通过以下的命令来关闭该库。
<pre><code>%> zypper mr -d 6
<pre><code># zypper mr -d 6
Repository 'repo-oss' has been successfully disabled.</code></pre>
13. 如果需要再次开启软件库 repo-oss, 接上例,与之相关联的标示数字为 6。
<pre><code>%> zypper mr -e 6
<pre><code># zypper mr -e 6
Repository 'repo-oss' has been successfully enabled.</code></pre>
14. 针对某一个软件库(以 'repo-non-oss' 为例 )开启自动刷新( auto-refresh )和 rpm 缓存并设置该软件库的优先级比如85。
<pre><code>%> zypper mr -rk -p 85 repo-non-oss
<pre><code># 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'.</code></pre>
15. 对所有的软件库关闭 rpm 文件缓存。
<pre><code>%> zypper mr -Ka
<pre><code># 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'.</pre></code>
16. 对所有的软件库开启 rpm 文件缓存。
<pre><code> zypper mr -ka
<pre><code># 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'.</code></pre>
17. 关闭远程库的rpm 文件缓存
<pre><code>%> zypper mr -Kt
17. 关闭远程库的 rpm 文件缓存
<pre><code># 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'.</code></pre>
18. 开启远程软件库的 rpm 文件缓存。
<pre><code>%> zypper mr -kt
<pre><code># 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/” 为例 )。
<pre><code>%> zypper ar http://download.opensuse.org/update/11.1/ update
<pre><code># 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',可以使用下面的命令。
<pre><code>%> zypper nr 10 upd8
<pre><code># zypper nr 10 upd8
Repository 'update' renamed to 'upd8'.</code></pre>
#### 删除软件库 ####
21. 删除一个软件库。要从系统删除一个软件库可以使 'zypper removerepo' 或者 'zypper rr'。例如以下的命令可以删除软件库 'upd8'
<pre><code>%> zypper rr upd8
<pre><code># zypper rr upd8
# Removing repository 'upd8' .........................................................................................[done]
Repository 'upd8' has been removed.</code></pre>
@ -339,7 +339,8 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
#### 用 zypper 安装一个软件包 ####
22. 在 zypper 中,我们可以通过软件包的功能名称来安装一个软件包。以 Firefox 为例,以下的命令可以用来安装该软件包。
<pre><code>%> zypper in MozillaFirefox
<pre><code># 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) </code></pre>
23. 安装指定版本号的软件包,(以 gcc 5.1 为例)。
<pre><code> %>zypper in 'gcc<5.1'
23. 安装指定版本号的软件包,(以 gcc 5.1 为例)。
<pre><code># 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 为例)。
<pre><code>%> zypper in gcc.i586
<pre><code># 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 为例)
<pre><code>%> zypper in 'gcc.i586<5.1'
<pre><code># 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) </code></pre>
26. 从指定的软件库里面安装一个软件包,例如从 amarok 中安装 libxine。
<pre><code>%> zypper in amarok upd:libxine1
26. 从指定的软件库里面安装一个软件包,例如从 amarok 中安装 libxine。
<pre><code># zypper in amarok upd:libxine1
Loading repository data...
Reading installed packages...
Resolving package dependencies...
@ -431,7 +434,7 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
27. 通过指定软件包的名字安装软件包。
<pre><code>%> zypper in -n git
<pre><code># 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 </code></pre>
28. 通过通配符来安装软件包,例如,安装所有 php5 的软件包。
<pre><code>%> zypper in php5*
28. 通过通配符来安装软件包,例如,安装所有 php5 的软件包。
<pre><code># 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
....</code></pre>
29. 使用模式名称(模式名称是一类软件包的名字)来批量安装软件包
29. 使用模式名称(模式名称是一类软件包的名字)来批量安装软件包
<pre><code>%> zypper in -t pattern lamp_server
<pre><code># 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): </code></pre>
30. 使用一行命令安一个软件包同时卸载另一个软件包,例如在安装 nano 的同时卸载 vi
30. 使用一行命令安一个软件包同时卸载另一个软件包,例如在安装 nano 的同时卸载 vi
<pre><code># zypper in nano -vi
Loading repository data...
@ -530,7 +534,7 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
31. 使用 zypper 安装 rpm 软件包。
<pre><code>%> zypper in teamviewer*.rpm
<pre><code># zypper in teamviewer*.rpm
Loading repository data...
Reading installed packages...
Resolving package dependencies...
@ -552,9 +556,9 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
32. 命令 zypper removezypper rm 用于卸载软件包。例如卸载 apache2:
<pre><code>%> zypper remove apache2 </code></pre>
<pre><code># zypper remove apache2 </code></pre>
或者
<pre><code>%> zypper rm apache2
<pre><code># zypper rm apache2
Loading repository data...
Reading installed packages...
Resolving package dependencies...
@ -572,9 +576,9 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
33. 更新所有的软件包,可以使用 zypper update 或者 zypper up
<pre><code>%> zypper up </code></pre>
<pre><code># zypper up </code></pre>
或者
<pre><code>%> zypper update
<pre><code># zypper update
Loading repository data...
Reading installed packages...
@ -591,9 +595,9 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
Nothing to do.</code></pre>
35. 安装一个软件库,例如 ariadb如果该库存在则更新之。
35. 安装一个软件库,例如 mariadb如果该库存在则更新之。
<pre><code>%> zypper in mariadb
<pre><code># zypper in mariadb
Loading repository data...
Reading installed packages...
'mariadb' is already installed.
@ -608,7 +612,7 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
36. 安装某一个软件包的源文件及其依赖关系,例如 mariadb。
<pre><code>%> zypper si mariadb
<pre><code># zypper si mariadb
Reading installed packages...
Loading repository data...
Resolving package dependencies...
@ -626,7 +630,7 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
37. 仅为某一个软件包安装源文件,例如 mariadb
<pre><code>%> zypper in -D mariadb
<pre><code># zypper in -D mariadb
Loading repository data...
Reading installed packages...
'mariadb' is already installed.
@ -637,7 +641,7 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
38. 仅为某一个软件包安装依赖关系,例如 mariadb
<pre><code>%> zypper si -d mariadb
<pre><code># 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</code></pre>
#### Zypper in Scripts and Applications ####
#### 在脚本和应用中调用 Zypper (非交互式) ####
39. 安装一个软件包,并且在安装过程中跳过与用户的交互, 例如 mariadb。
<pre><code>%> zypper --non-interactive in mariadb
<pre><code># zypper --non-interactive in mariadb
Loading repository data...
Reading installed packages...
'mariadb' is already installed.
@ -668,7 +672,7 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
40. 卸载一个软件包,并且在卸载过程中跳过与用户的交互,例如 mariadb
<pre><code>%> zypper --non-interactive rm mariadb
<pre><code># 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] </code></pre>
41. 将 zypper 输出用 XML 格式打印
41. 以 XML 格式显示 zypper 的输出
<pre><code>%> zypper --xmlout
<pre><code># zypper --xmlout
Usage:
zypper [--global-options] <command> [--command-options] [arguments]
Global Options
....</code></pre>
42. 禁止详细信息输出到屏幕。
42. 在安装过程中禁止详细信息输出到屏幕。
<pre><code>%> zypper --quiet in mariadb
<pre><code># zypper --quiet in mariadb
The following NEW package is going to be installed:
mariadb
@ -703,10 +707,11 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
43. 在卸载过程中禁止详细信息输出到屏幕
<pre><code>%> zypper --quiet rm mariadb </code></pre>
<pre><code># zypper --quiet rm mariadb </code></pre>
44. 自动地同意版权或者协议。
<pre><code>%> zypper patch --auto-agree-with-licenses
44. 自动地同意版权或者协议。
<pre><code># zypper patch --auto-agree-with-licenses
Loading repository data...
Reading installed packages...
Resolving package dependencies...
@ -717,15 +722,15 @@ Zypper 是软件包管理器ZYpp的命令行接口可用于安装、删除SUS
45. 以下指令可以用来清理Zypper缓存。
<pre><code>%> zypper clean
<pre><code># zypper clean
All repositories have been cleaned up.</code></pre>
如果需要一次性地清理元数据以及软件包缓存,可以通过 -all/-a 选项来达到目的
如果需要一次性地清理元数据以及软件包缓存,可以通过 -all-a 选项来达到目的
<pre><code>%> zypper clean -a
<pre><code># zypper clean -a
All repositories have been cleaned up.</code></pre>
46. 查看 Zypper 的历史信息。籍由 Zypper 所有的软件包管理动作,包括安装、更新以及卸载都会在 /var/log/zypp/history中保留历史信息。可以通过 cat 来查看此文件,或者通过过滤器来筛选希望看到的信息。
46. 查看 Zypper 的历史信息。任何通过 Zypper 进行的软件包管理动作,包括安装、更新以及卸载都会在 /var/log/zypp/history中保留历史信息。可以通过 cat 来查看此文件,或者通过过滤器来筛选希望看到的信息。
<pre><code> 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 升级至最新版本。
<pre><code># 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/) 荣誉推出

View File

@ -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/) 荣誉推出

View File

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

View File

@ -0,0 +1,73 @@
在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交换文件 ####
[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** 的大小.
#### 第二步设置交换文件权限为600 ####
[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]
译者:[strugglingyouth](https://github.com/strugglingyouth)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.linuxtechi.com/author/pradeep/

View File

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

View File

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

View File

@ -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/pythonLCTT译注这一行称之为[释伴行](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/) 荣誉推出

View File

@ -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/) 荣誉推出

View File

@ -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/) 荣誉推出

View File

@ -1,16 +1,16 @@
Linux有问必答——Linux上如何查看某个进程的线程
Linux有问必答Linux上如何查看某个进程的线程
================================================================================
> **问题** 我的程序创建并在它里头执行了多个线程我怎样才能在该程序创建线程后监控其中单个线程我想要看到带有它们名称的单个线程详细情况CPU/内存使用率)。
> **问题** 我的程序在其内部创建并执行了多个线程我怎样才能在该程序创建线程后监控其中单个线程我想要看到带有它们名称的单个线程详细情况CPU/内存使用率)。
线程是现代操作系统上进行并行执行的一个流行的编程方面的抽象概念。当一个程序内有多个线程被叉分出用以执行多个流时,这些线程就会在它们之间共享特定的资源(如,内存地址空间、打开的文件),以使叉分开销最小化,并避免大量花销IPC进程间通信道。这些功能让线程在并发执行时成为一个高效的机制。
线程是现代操作系统上进行并行执行的一个流行的编程方面的抽象概念。当一个程序内有多个线程被叉分出用以执行多个流时,这些线程就会在它们之间共享特定的资源(如,内存地址空间、打开的文件),以使叉分开销最小化,并避免大量高成本的IPC进程间通信道。这些功能让线程在并发执行时成为一个高效的机制。
在Linux中程序中创建的线程也称为轻量级进程LWP会具有和程序的PID相同的“线程组ID”。然后各个线程会获得其自身的线程IDTID。对于Linux内核调度器而言线程不过是恰好共享特定资源的标准的进程。经典的命令行工具如ps或top都可以用来显示线程级别的信息默认情况下它们显示进程级别的信息。
在Linux中程序中创建的线程也称为轻量级进程LWP会具有和程序的PID相同的“线程组ID”。然后各个线程会获得其自身的线程IDTID。对于Linux内核调度器而言线程不过是恰好共享特定资源的标准的进程而已。经典的命令行工具如ps或top都可以用来显示线程级别的信息只是默认情况下它们显示进程级别的信息。
这里提供了**在Linux上显示某个进程的线程**的几种方式。
### 方法一PS ###
在ps命令中“-T”选项可以开启线程查看。下面的命令列出了由进程号为<pid>的进程创建的所有线程。
在ps命令中“-T”选项可以开启线程查看。下面的命令列出了由进程号为\<pid>的进程创建的所有线程。
$ ps -T -p <pid>
@ -26,7 +26,7 @@ top命令可以实时显示各个线程情况。要在top输出中开启线程
![](https://farm9.staticflickr.com/8824/17350561070_3dfe447974_c.jpg)
要让top输出某个特定进程<pid>并检查该进程内运行的线程状况:
要让top输出某个特定进程\<pid>并检查该进程内运行的线程状况:
$ top -H -p <pid>
@ -36,7 +36,7 @@ top命令可以实时显示各个线程情况。要在top输出中开启线程
一个对用户更加友好的方式是通过htop查看单个进程的线程它是一个基于ncurses的交互进程查看器。该程序允许你在树状视图中监控单个独立线程。
要在htop中启用线程查看请开启htop然后按<F2>来进入htop的设置菜单。选择“设置”栏下面的“显示选项”然后开启“树状视图”和“显示自定义线程名”选项。按<F10>退出设置。
要在htop中启用线程查看请开启htop然后按\<F2>来进入htop的设置菜单。选择“设置”栏下面的“显示选项”然后开启“树状视图”和“显示自定义线程名”选项。按\<F10>退出设置。
![](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/) 荣誉推出

View File

@ -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/<your-site>.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

View File

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

View File

@ -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 <wx/wx.h>
@ -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/) 荣誉推出

View File

@ -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/) 荣誉推出

View File

@ -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格式存储定位主机的通信数据到磁盘
- 通过nDPIntop的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/) 荣誉推出

View File

@ -0,0 +1,102 @@
3个开源的Python Shell
=========================================================================
Python是一个高级、通用、结构化且强大的开源编程语言广泛用于各种编程工作。它拥有一个全动态类型系统和自动内存管理与SchemeRubyPerl和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)
对于LinuxBSDOS 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解释器JythonIronPythonPyPy
功能包括:
- 一个新式的交互shell窗口被分成历史区域和代码区域历史区域可以让你看到之前的命令及其输出代码区域是里敲代码的地方。这样你可以编辑任意多的代码就好像在你最喜欢的编辑器里一样并且适当时候可以执行它。你也可以从其他地方复制代码编辑并马上运行它
- “只复制代码”命令可以复制你想要的代码,以便你可以把它存入一个文件。代码已经用四个空格缩进进行格式化
- 自动补全属性和文件名字
- 自动显示函数参数和文档
- 在结果历史中保存你最近的结果,备以后用
- 可以自动折叠很长的输出,以便你可以专注于重要的地方
- 保存会话的历史记录为一个HTML文件备以后查询。你可以加载历史文件到DreamPie里并且快速重复之前的命令。
- 自动添加圆括号与可选的引号当你在函数与方法后按下空格键。例如键入execfile后按下空格会提示execfile("fn")
- 支持交互的matplotlib绘图
- 支持Python 2.5Python 2.6Python 3.1Jython 2.5IronPython 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/
--------------------------------------------------------------------------------

View File

@ -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/) 荣誉推出

View File

@ -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需要一定的技术要求比如在系统上安装ApachePHP扩展和数据库MySQL或MariaDB才能正常运行Opencart。
让我们使用命令行安装ApachePHP和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://<web服务器IP地址>`访问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://<web server IP address>/opencart-master/`然后你会看到类似下面的截屏。
![OpenCart Product Showcase](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart.jpg)
*OpenCart产品示例*
14. 要登录到Opencart管理面板你需要浏览`http://<web server IP address>/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

View File

@ -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
如果后面没有跟上资源idxkill会将鼠标指针变成一个特殊符号类似于“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

View File

@ -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自带有不错的内建功能用于容纳帐号相关的东西像FacebookGoogle以及其它在线帐号。你可以通过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

View File

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

View File

@ -0,0 +1,32 @@
下载年度报告了解The Document Foundation2014年的成果
================================================================================
![](https://documentfoundation.files.wordpress.com/2015/06/tdf-report.jpg)
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项目等本土语言项目基础设施文档项目市场设计与营销。
该报告涉及到的软件开发活动和代码包括工程指导委员会的活动LibreOffice的开发文档解放项目LibreOffice的安卓移植。
报告的最后一部分则把焦点对准了那些做出了极大贡献的人们他们是TDF的工作人员董事会成员委员会成员委托组织成员TDF的核心成员和咨询委员会成员。
TDF 2014年度报告的编辑工作由Sophie Gautier, Alexander Werner, Christian Lohmaier, Florian Effenberger, Italo Vignoli 和 Robinson Tryon完成由Barak Paz设计样式Libreoffice社区协助完成。
为了最大程度的传播该文档采用了CC3 认证发布除非特殊标注TDF成员和自由软件基金会拥有其所有权。
--------------------------------------------------------------------------------
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)
校对:[wxy](https://github.com/wxy)
本文由 [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

View File

@ -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/) 荣誉推出

View File

@ -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 &gt; /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/

View File

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

View File

@ -1,99 +0,0 @@
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.
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.
----------
### 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.
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.
bpython doesn't seek to create anything new or groundbreaking. Instead, it brings together a few neat ideas and focuses on practicality and usefulness.
Features include:
- 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
----------
### IPython ###
![](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 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.
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
- Website: [ipython.org][2]
- Developer: The IPython Development Team
- License: BSD
- Version Number: 3.1
----------
### DreamPie ###
![](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 can use just about any Python interpreter (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.
- Website: [www.dreampie.org][3]
- Developer: Noam Yorav-Raphael
- License: GNU GPL v3
- Version Number: 1.2.1
--------------------------------------------------------------------------------
via: http://www.linuxlinks.com/article/20150523032756576/PythonShells.html
作者Frazer Kline
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[1]:http://www.bpython-interpreter.org/
[2]:http://ipython.org/
[3]:http://www.dreampie.org/

View File

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

View File

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

View File

@ -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 were highlighting today isnt 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. Its the easiest, most manageable way to have news come to me. I can manage and read stuff when I want; theres 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)
Theres 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 hasnt 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 youll 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 thats Tickr. Its not going to change the world but it will keep you abreast of whats 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

View File

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

View File

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

View File

@ -1,153 +0,0 @@
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 Googles 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

View File

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

View File

@ -0,0 +1,186 @@
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)
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: Ive 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. Im 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 dont 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 isnt 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 dont 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 dont 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 theres 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 Im 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 dont think its a horrible licence. I just dont think its 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. Its 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 dont 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.
Dont get me wrong — I think its unlikely. But I do want to make it clear that Im not a licence bigot, per se. I think the GPLv2 is clearly the better licence, but licences arent 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 its a great licence, and for other projects it may well be the right one.
**Q: Currently are there any Indians who youd like to highlight as key contributors to the Linux kernel?**
Linus: I have to admit that I dont directly work with anybody that I actually realise as being from India. That said, I should clarify a bit: Ive very consciously tried to set up the kernel development so that I dont 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 Ive 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 Im in occasional contact with hundreds of developers who send me a random patch or two, Ive 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 thats how people work. Its certainly how I like to work.
Also, in all honesty, I dont even know where a lot of the people I work with live. Location ends up being pretty secondary. So while Im 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: Ive long since come to the realisation that Linux is much bigger than me. Yes, Im 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 wouldnt say that Linux depends heavily on me.
So if I had a heart attack and died tomorrow (happily not likely: Im apparently healthy as anything), people would certainly notice, but there are thousands of people involved in just the kernel, and therere 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 dont 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 cant 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, its equally obviously not the majority in India, and I personally simply dont 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. Im not a great public speaker, and Ive avoided travelling for the last several years because Im not very comfortable being seen as this iconic visionary. Im 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. Id love to go to India for a vacation some day, but if I do, Id 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 youve 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 Ill happily say: “Oh, ok, youre right.”
But no, that didnt happen on SVN/CVS. I suspect a lot of people really dont much like CVS, so I didnt really even expect anybody to argue that CVS was really anything but a legacy system. And while Ive gotten a few people who argued that I shouldnt have been quite so impolite against SVN (and hey, thats fair — Im really not a very polite person!), I dont think anybody actually argued that SVN was good.
SVN is, I think, a classic case of good enough. Its what people are used to, and its good enough to be used fairly widely, but its 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, its, 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, wouldnt 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)? Whats 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 Id 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 didnt have to worry about the whole confusion of voting, different parties, coalitions, etc.
But in the end, choice may be inefficient, but its 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, wed 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 hell 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 dont 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 well 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 couldnt 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 didnt answer the question he asked, but the question I thought hed 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 doesnt end up being the act of importing itself, but just having to get used to the new model!
And quite frankly, I dont 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. Youd 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. Youd 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 youd basically migrate one module at a time, until you get to the point where youre 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. Thats how a lot of git users use it: they may use git, but sometimes the people they work with dont 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 cant really talk about them. And I wasnt 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? Dont 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 theres 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 doesnt actually happen (and it did, in the BSD cases — with BSDi), people cant 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 wont 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 wouldnt 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. Its 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. Its 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 its, “I give you my source code, so if you use it, youd 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 Im not talking about the CFS)?**
Linus: I wont guarantee that everything from -rt will ever be merged into the standard kernel (there may be pieces that simply dont end up making sense in the generic kernel), but yes, over the years weve actually integrated most of it, and the remaining parts could end up making it one of these days.
Im a big fan of low-latency work, but at the same time Im 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 dont 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; its 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: Im 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 Suns 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 doesnt 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 Im 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, theyre 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 Googles basic office applications, are making an impact. Where do you think operating systems are headed?**
Linus: I dont 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 isnt 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 its really a fairly stable and well-known area of endeavour. People really shouldnt expect the OS to magically change: its not like people were stupid back in the 60s either, or even that hardware was that fundamentally different back then!
So dont expect a revolution. I think OSs will largely continue to do what they do, and while well certainly evolve, I dont think theyll 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 thats what people obviously care about.
The OS? Its just that hidden thing that makes it all possible. You really shouldnt 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 wasnt 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: Its some of all of that. Its a hobby, but a deeply meaningful one. The best hobbies are the ones that you care really deeply about. And these days its obviously also my work, and Im very happy to be able to combine it all.
I dont know about a philosophy, and I dont really do Linux for any really deeply held moral or philosophical reasons (I literally do it because its interesting and fun), but its 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 Microsofts Men in Black ever talk to you?**
Linus: Ive never really talked to MS, no. Ive occasionally been at the same conferences with some MS people (I used to go to more conferences than I do these days), but Ive 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/

View File

@ -1,82 +0,0 @@
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]:

View File

@ -1,106 +0,0 @@
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/

View File

@ -1,80 +0,0 @@
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

View File

@ -1,132 +0,0 @@
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 isnt 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 cant 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 dont 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. Dont 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].
Thats all for now, till then stay tuned and connected to Tecmint. Dont 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/

View File

@ -1,152 +0,0 @@
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 youve 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 dont 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 youre interested to know more at aria2 and their switches, read the following article.
- [Aria2 A Multi-Protocol Command-Line Download Manager for Linux][7]
Thats all for now. Ill be here again with another interesting topic you people will love to read. Till then stay tuned and connected to Tecmint. Dont 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/

View File

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

View File

@ -1,188 +0,0 @@
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
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. 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. What is and why use 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.
#### Features exclusive to Percona ####
- Partitioned Adaptive Hash Search
- Fast Checksum Algorithm
- Buffer Pool Pre-Load
- Support for FlashCache
#### MySQL Enterprise and Percona specific features ####
- Import Tables From Different Servers
- PAM authentication
- Audit Log
- Threadpool
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. Backup your databases ###
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
Copy the current configuration file, you can also skip this in fresh setups
cp my.cnf my.cnf.bkp
### 3. Remove your previous SQL Server ###
Stop the MySQL/MariaDB if it's running.
systemctl stop mysql.service
Uninstall MariaDB and MySQL
yum remove MariaDB-server MariaDB-client MariaDB-shared mysql mysql-server
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. Installing Percona binaries ###
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:
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
And then install Percona with:
yum install Percona-Server-client-56 Percona-Server-server-56
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/

View File

@ -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 lets 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.
注:表格
<table width="666" style="height: 181px;">
<tbody>
<tr>
<td width="670" colspan="2"><b>Plex Home Media Server</b></td>
</tr>
<tr>
<td width="236"><b>Base Operating System</b></td>
<td width="425">Ubuntu 15.04 / CentOS 7.1 / Fedora 22 Work Station</td>
</tr>
<tr>
<td width="236"><b>Plex Media Server</b></td>
<td width="425">Version 0.9.12.3.1173-937aac3</td>
</tr>
<tr>
<td width="236"><b>RAM and CPU</b></td>
<td width="425">1 GB&nbsp; , 2.0 GHZ</td>
</tr>
<tr>
<td width="236"><b>Hard Disk</b></td>
<td width="425">30 GB</td>
</tr>
</tbody>
</table>
### 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 lets 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/

View File

@ -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 isnt any fun, then youre 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.
Thats 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/

View File

@ -1,301 +0,0 @@
Translating by ZTinoZ
20 Useful Terminal Emulators for 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
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.
### 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.
#### Features of 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)
Terminator Terminal
- [Terminator Homepage][1]
- [Download and Installation Instructions][2]
### 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.
#### Features of Tilda ####
Interface with Highly customization option.
You can set the transparency level for Tilda window.
Excellent built-in colour schemes.
![Tilda Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Tilda-Emulator.jpeg)
Tilda Terminal
- [Tilda Homepage][3]
### 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 is very much similar to Yakuaka and Tilda, but its 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 Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Guake-Terminal.jpeg)
Guake Terminal
- [Guake Homepage][4]
### 4. Yakuake ###
Yakuake (Yet Another Kuake) is a KDE based drop-down terminal emulator very much similar to Guake terminal emulator in functionality. Its design was inspired from fps consoles games such as 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 Features ####
- 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)
Yakuake Terminal
- [Yakuake Homepage][5]
### 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 its role has shifted to bringing a higher range of features for power users.
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.
![Roxterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Roxterm-Terminal.jpeg)
Roxterm Terminal
- [ROXTerm Homepage][6]
### 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 Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Eterm-Terminal.jpeg)
Eterm Terminal
- [Eterm Homepage][7]
### 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 dont need to have a feature such as Tektronix 4014 emulation and toolkit-style configurability.
![Rxvt Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Rxvt-Terminal.jpeg)
Rxvt Terminal
- [Rxvt Homepage][8]
### 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 Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/wterm-Terminal-.jpeg)
wterm Terminal
- [Wterm Homepage][9]
### 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
- Supports common commands like cp, cd, dir, mkdir, mvdir.
- Feature to hide the menu bar for saving space
- Change the color scheme.
![lxterminal Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/lxterminal-Terminal.jpeg)
lxterminal Terminal
- [LXTerminal Homepage][10]
### 10. Konsole ###
Konsole is yet another powerful KDE based free terminal emulator was originally created by Lars Doelle.
Konsole Features
- 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 Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Konsole-Terminal.jpeg)
Konsole Terminal
- [Konsole Homepage][11]
### 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 Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/TermKit-Terminal.jpeg)
TermKit Terminal
- [TermKit Homepage][12]
12. st
st is a simple terminal implementation for X Window.
![st terminal](http://www.tecmint.com/wp-content/uploads/2014/01/st-terminal.png)
st terminal
- [st Homepage][13]
### 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.
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 Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Gnome-terminal.jpg)
Gnome Terminal
- [Gnome Terminal][14]
### 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.
![FinalTerm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/FinalTerm.gif)
FinalTerm Terminal
- [Final Term][15]
### 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.
Apart features, terminology offers even more things that you wouldnt 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.
You can watch a following demonstrations video created by the Terminology developer (the video quality isnt clear, but still its enough to get the idea about Terminology).
<iframe width="630" height="480" frameborder="0" allowfullscreen="" src="//www.youtube.com/embed/ibPziLRGvkg"></iframe>
- [Terminology][16]
### 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 Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/xfce-terminal.jpg)
Xfce Terminal
- [Xfce4 Terminal][17]
### 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 cant use the window system directly.
![xterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/xterm.jpg)
xterm Terminal
- [xterm][18]
### 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:
- 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.
![Lilyterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Lilyterm.jpg)
Lilyterm Terminal
- [LilyTerm][19]
### 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 Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/sakura.jpg)
Sakura Terminal
- [Sakura][20]
### 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](http://www.tecmint.com/wp-content/uploads/2014/01/rxvt-unicode.png)
rxvt unicode
- [rxvt-unicode][21]
If you know any other capable Linux terminal emulators that Ive not included in the above list, please do share with me using our comment section.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/linux-terminal-emulators/
作者:[Ravi Saive][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/admin/
[1]:https://launchpad.net/terminator
[2]:http://www.tecmint.com/terminator-a-linux-terminal-emulator-to-manage-multiple-terminal-windows/
[3]:http://tilda.sourceforge.net/tildaabout.php
[4]:https://github.com/Guake/guake
[5]:http://extragear.kde.org/apps/yakuake/
[6]:http://roxterm.sourceforge.net/index.php?page=index&lang=en
[7]:http://www.eterm.org/
[8]:http://sourceforge.net/projects/rxvt/
[9]:http://sourceforge.net/projects/wterm/
[10]:http://wiki.lxde.org/en/LXTerminal
[11]:http://konsole.kde.org/
[12]:https://github.com/unconed/TermKit
[13]:http://st.suckless.org/
[14]:https://help.gnome.org/users/gnome-terminal/stable/
[15]:http://finalterm.org/
[16]:http://www.enlightenment.org/p.php?p=about/terminology
[17]:http://docs.xfce.org/apps/terminal/start
[18]:http://invisible-island.net/xterm/
[19]:http://lilyterm.luna.com.tw/
[20]:https://launchpad.net/sakura
[21]:http://software.schmorp.de/pkg/rxvt-unicode

View File

@ -1,225 +0,0 @@
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 100s 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 dont 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.
Lets 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://<web server IP address>` 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://<web server IP address>/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://<web server IP address>/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 didnt 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 wont 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

View File

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

View File

@ -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/
[1]:http://www.tecmint.com/install-webmin-web-based-system-administration-tool-for-rhel-centos-fedora/

View File

@ -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=<node_ip>:2375 token://<cluster_id>
![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 <node_ip> and <cluster_id> 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 <swarm_port>:2375 swarm manage token://<cluster_id>
![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://<manager_ip:manager_port> info
![Accessing Swarm Clusters](http://blog.linoxide.com/wp-content/uploads/2015/05/accessing-swarm-cluster.png)
**Note**: We'll need to replace <manager_ip:manager_port> 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://<manager_ip:manager_port> info
# docker -H tcp://<manager_ip:manager_port> 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://<cluster_id>
![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/

View File

@ -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, were 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 isnt 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**: Dont 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 wont 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/

View File

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

View File

@ -0,0 +1,238 @@
Installing LAMP (Linux, Apache, MariaDB, PHP/PhpMyAdmin) in RHEL/CentOS 7.0
================================================================================
Skipping the LAMP introduction, as Im 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 its set to /var/www/html system path, which by default doesnt 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 <LocationMach> 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 "<?php phpinfo(); ?>" > /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 doesnt 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
Thats 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

View File

@ -0,0 +1,179 @@
FSSlc translating
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)
Heres our souped-up prompt on steroids. Its a bit long for this small terminal window, but you can tweak it to your liking.
As a Linux user, youre probably familiar with the shell (aka command line). You may pop up the occasional terminal now and then for some essential jobs that you cant 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, youre probably using the stock Bash configuration that came with your distro and while its powerful enough for most jobs, it could still be a lot better. In this tutorial well show you how to pimp up your shell to make it more informative, useful and pleasant to work in. Well customise the prompt to make it provide better feedback than the defaults, and well show you how to manage sessions and run multiple programs together with the incredibly cool tmux tool. And for a bit of eye candy, well 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** youll 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 were 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.
Heres 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, youll see the whole path for the directory in which youre 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, lets finish off this section by creating the mother of all prompts, using the escape sequences and colours weve 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 youre 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 youre 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. Its 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 theres 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** (its 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 youre using SSH to connect to another machine, doing some work, and dont 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, weve 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 were going to focus on it here. Some distros include **tmux** by default; in others its usually just an **apt-get, yum install** or **pacman -S** command away.
Once you have it installed, enter **tmux** to start it. Youll notice right away that theres a green line of information along the bottom. This is very much like a taskbar from a traditional window manager: theres 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, youll 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 youll 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. Youre 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 dont 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, lets 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 youre 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)
Heres 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. Its mature, reliable and well documented but its 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 arent other paths containing **u**, **lo** and **bi**). Or try **cd** on its own followed by Tab, and youll 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 didnt 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 havent moved on much. Sure, we have anti-aliased fonts now, better colours and the ability to click on URLs, but by and large theyve 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 theres Xiki ([www.xiki.org][4]), which describes itself as “the command revolution”. Its 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. Its 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 its useful for reading text-heavy websites such as Wikipedia.
> ### Fine-tune your colour scheme ###
>
> Were not obsessed with eye-candy at Linux Voice, but we do recognise the importance of aesthetics when youre 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 were 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] youll 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, its worth using a well-crafted palette there as well. **Solarized at** [http://ethanschoonover.com/solarized][6] is an excellent scheme thats 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

View File

@ -0,0 +1,265 @@
zpl1025
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 youd expect from a new release. This shouldnt affect the remote software though, and it should work on both existing **XBMC** systems, and newer Kodi systems.
Weve 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 didnt need to be able to access the full capabilities of XBMC, because for tasks other than music, wed 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. Theres no problem running more than one web server on a computer at a time, but they cant run on the same port.
There are quite a few web frameworks available. Weve used Bottle because its a simple, fast framework, and we dont need any complex functions. Bottle is a Python module, so thats the language in which well write the server.
Youll 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 well interact with **XBMC** using its JSON API. This enables us to control the media player by sending JSON-encoded information.
Were going to use a simple wrapper around the XBMC JSON API called xbmcjson. Its 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. Its 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 lets 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/<name>)
def index(name):
return template(<h1>Hello {{name}}!</h1>, name=name)
run(host=”0.0.0.0”, port=8000)
This connects to **XBMC** (though doesnt 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 (weve 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 thats generated via a template, but it doesnt have to be (as well see later).
As we go on, well 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. Well 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 weve been using for testing the remote control. However, we found that it didnt 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 whats currently playing, we need to get the ID of the active player, and through that find out the ID of the current playlist. Weve 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 isnt 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 weve 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 arent removed from the playlist after theyve 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 thats currently playing (since we dont care about stuff thats 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 its 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 its well supported by most programming languages, so if Pythons 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:
<h2>Currently Playing:</h2>
% if playlist is not None:
% position = offset
% for song in playlist:
<strong> {{song[title]}} </strong>
% if song[type] == unknown:
Radio
% else:
{{song[artist][0]}}
% end
% if position != offset:
<a href=”/remove/{{position}}”>remove</a>
% else:
<a href=”/skip/{{position}}”>skip</a>
% end
<br>
% 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 arent used, you need a % end to close any code block (such as a loop or if statement).
This template first checks that the playlist isnt 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 its 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 isnt 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/<position>)
def index(position):
print xbmc.Player.GoTo({playerid:0, to:next})
redirect(“/juke”)
@route(/remove/<position>)
def index(position):
playlistid = get_playlistid()
if playlistid >= 0:
xbmc.Playlist.Remove({playlistid:int(playlistid), position:int(position)})
redirect(“/juke”)
Of course, its no good being able to manage your playlist if you cant 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 theres 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/<songid>. This page is handled by:
@route(/play/<id>)
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 isnt 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 its working.
> ### Logging ###
>
> Its 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, its 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 dont change based on the user input. That could be a CSS file, an image or an MP3. In our simple controller theres 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 youre transferring large amounts of data, its 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/<id>)
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.
Weve 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 youve developed your remote control, youll 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 dont have as much time as wed like to program. However, weve set up a GitHub project where we hope to keep working on it, and if you think youd benefit from the project as well, wed love your input.
>
> To see whats going on, head over to [https://github.com/ben-ev/xbmc-remote][4] and take a look at what state its 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

View File

@ -0,0 +1,436 @@
Translating by GOLinux!
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 <<EOF ...`.
- In Bash, redirect both standard output and standard error via: `some-command >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 `</dev/null`.
- Use `man ascii` for a good ASCII table, with hex and decimal values. For general encoding info, `man unicode`, `man utf-8`, and `man latin1` are helpful.
- Use `screen` or `tmux` to multiplex the screen, especially useful on remote ssh sessions and to detach and re-attach to a session. A more minimal alternative for session persistence only is `dtach`.
- In ssh, knowing how to port tunnel with `-L` or `-D` (and occasionally `-R`) is useful, e.g. to access web sites from a remote server.
- It can be useful to make a few optimizations to your ssh configuration; for example, this `~/.ssh/config` contains settings to avoid dropped connections in certain network environments, use compression (which is helpful with scp over low-bandwidth connections), and multiplex channels to the same server with a local control file:
```
TCPKeepAlive=yes
ServerAliveInterval=15
ServerAliveCountMax=6
Compression=yes
ControlMaster auto
ControlPath /tmp/%r@%h:%p
ControlPersist yes
```
- A few other options relevant to ssh are security sensitive and should be enabled with care, e.g. per subnet or host or in trusted networks: `StrictHostKeyChecking=no`, `ForwardAgent=yes`
- To get the permissions on a file in octal form, which is useful for system configuration but not available in `ls` and easy to bungle, use something like
```sh
stat -c '%A %a %n' /etc/timezone
```
- For interactive selection of values from the output of another command, use [`percol`](https://github.com/mooz/percol).
- For interaction with files based on the output of another command (like `git`), use `fpp` ([PathPicker](https://github.com/facebook/PathPicker)).
- For a simple web server for all files in the current directory (and subdirs), available to anyone on your network, use:
`python -m SimpleHTTPServer 7777` (for port 7777 and Python 2).
## Processing files and data
- To locate a file by name in the current directory, `find . -iname '*something*'` (or similar). To find a file anywhere by name, use `locate something` (but bear in mind `updatedb` may not have indexed recently created files).
- For general searching through source or data files (more advanced than `grep -r`), use [`ag`](https://github.com/ggreer/the_silver_searcher).
- To convert HTML to text: `lynx -dump -stdin`
- For Markdown, HTML, and all kinds of document conversion, try [`pandoc`](http://pandoc.org/).
- If you must handle XML, `xmlstarlet` is old but good.
- For JSON, use `jq`.
- For Excel or CSV files, [csvkit](https://github.com/onyxfish/csvkit) provides `in2csv`, `csvcut`, `csvjoin`, `csvgrep`, etc.
- For Amazon S3, [`s3cmd`](https://github.com/s3tools/s3cmd) is convenient and [`s4cmd`](https://github.com/bloomreach/s4cmd) is faster. Amazon's [`aws`](https://github.com/aws/aws-cli) is essential for other AWS-related tasks.
- Know about `sort` and `uniq`, including uniq's `-u` and `-d` options -- see one-liners below.
- Know about `cut`, `paste`, and `join` to manipulate text files. Many people use `cut` but forget about `join`.
- Know that locale affects a lot of command line tools in subtle ways, including sorting order (collation) and performance. Most Linux installations will set `LANG` or other locale variables to a local setting like US English. But be aware sorting will change if you change locale. And know i18n routines can make sort or other commands run *many times* slower. In some situations (such as the set operations or uniqueness operations below) you can safely ignore slow i18n routines entirely and use traditional byte-based sort order, using `export LC_ALL=C`.
- Know basic `awk` and `sed` for simple data munging. For example, summing all numbers in the third column of a text file: `awk '{ x += $3 } END { print x }'`. This is probably 3X faster and 3X shorter than equivalent Python.
- To replace all occurrences of a string in place, in one or more files:
```sh
perl -pi.bak -e 's/old-string/new-string/g' my-files-*.txt
```
- To rename many files at once according to a pattern, use `rename`. For complex renames, [`repren`](https://github.com/jlevy/repren) may help.
```sh
# Recover backup files foo.bak -> 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 <pid>` 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]:

View File

@ -0,0 +1,208 @@
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 ours 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 dont 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
- Oses 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 dont allow you to access certain websites or if you dont want others to look into your private business or you dont want to provide your digital footprints to NSA.
**Note**: Tor Browser dont 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. Thats all for now. Ill be here again with another interesting article you people will love to read. Till then stay tuned and connected to Tecmint. Dont 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

View File

@ -0,0 +1,315 @@
[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.
![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 shells 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视频
<iframe width="640" height="405" frameborder="0" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/f02w4WT73LE"></iframe>
**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视频
<iframe width="640" height="405" frameborder="0" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/69vafdSMfU4"></iframe>
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 dont cope well with tabs. Or maybe we just want to convert tabs into spaces. Thats where the expand tool (provided by the GNU coreutils package) comes in handy.
For example, given the file NumbersList.txt, lets 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 os 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, lets 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, its 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/

View File

@ -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 programs 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 files 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 theyre 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.
注:表格
<table cellspacing="0" border="0">
<colgroup width="226"></colgroup>
<colgroup width="743"></colgroup>
<tbody>
<tr>
<td align="CENTER" height="24" bgcolor="#999999" style="border: 1px solid #000000;"><b><span style="font-size: medium;">Redirection Operator</span></b></td>
<td align="CENTER" bgcolor="#999999" style="border: 1px solid #000000;"><b><span style="font-size: medium;">Effect</span></b></td>
</tr>
<tr class="alt">
<td align="CENTER" height="18" style="border: 1px solid #000000;"><b><span style="font-family: Courier New;">&gt;</span></b></td>
<td align="LEFT" style="border: 1px solid #000000;">Redirects standard output to a file containing standard output. If the destination file exists, it will be overwritten.</td>
</tr>
<tr>
<td align="CENTER" height="18" style="border: 1px solid #000000;"><b><span style="font-family: Courier New;">&gt;&gt;</span></b></td>
<td align="LEFT" style="border: 1px solid #000000;">Appends standard output to a file.</td>
</tr>
<tr class="alt">
<td align="CENTER" height="18" style="border: 1px solid #000000;"><b><span style="font-family: Courier New;">2&gt;</span></b></td>
<td align="LEFT" style="border: 1px solid #000000;">Redirects standard error to a file containing standard output. If the destination file exists, it will be overwritten.</td>
</tr>
<tr>
<td align="CENTER" height="18" style="border: 1px solid #000000;"><b><span style="font-family: Courier New;">2&gt;&gt;</span></b></td>
<td align="LEFT" style="border: 1px solid #000000;">Appends standard error to the existing file.</td>
</tr>
<tr class="alt">
<td align="CENTER" height="18" style="border: 1px solid #000000;"><b><span style="font-family: Courier New;">&amp;&gt;</span></b></td>
<td align="LEFT" style="border: 1px solid #000000;">Redirects both standard output and standard error to a file; if the specified file exists, it will be overwritten.</td>
</tr>
<tr>
<td align="CENTER" height="18" style="border: 1px solid #000000;"><b><span style="font-family: Courier New;">&lt;</span></b></td>
<td align="LEFT" style="border: 1px solid #000000;">Uses the specified file as standard input.</td>
</tr>
<tr class="alt">
<td align="CENTER" height="18" style="border: 1px solid #000000;"><b><span style="font-family: Courier New;">&lt;&gt;</span></b></td>
<td align="LEFT" style="border: 1px solid #000000;">The specified file is used for both standard input and standard output.</td>
</tr>
</tbody>
</table>
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.
注:表格
<table cellspacing="0" border="0">
<colgroup width="165"></colgroup>
<colgroup width="137"></colgroup>
<colgroup width="366"></colgroup>
<tbody>
<tr>
<td align="CENTER" height="24" bgcolor="#999999" style="border: 1px solid #000000;"><b><span style="font-size: medium;">Command</span></b></td>
<td align="CENTER" bgcolor="#999999" style="border: 1px solid #000000;"><b><span style="font-size: medium;">Abbreviation</span></b></td>
<td align="CENTER" bgcolor="#999999" style="border: 1px solid #000000;"><b><span style="font-size: medium;">Description</span></b></td>
</tr>
<tr class="alt">
<td align="LEFT" height="18" style="border: 1px solid #000000;"><span style="font-family: Courier New;"> &ndash;create</span></td>
<td align="LEFT" style="border: 1px solid #000000;">c</td>
<td align="LEFT" style="border: 1px solid #000000;">Creates a tar archive</td>
</tr>
<tr>
<td align="LEFT" height="18" style="border: 1px solid #000000;"><span style="font-family: Courier New;"> &ndash;concatenate</span></td>
<td align="LEFT" style="border: 1px solid #000000;">A</td>
<td align="LEFT" style="border: 1px solid #000000;">Appends tar files to an archive</td>
</tr>
<tr class="alt">
<td align="LEFT" height="18" style="border: 1px solid #000000;"><span style="font-family: Courier New;"> &ndash;append</span></td>
<td align="LEFT" style="border: 1px solid #000000;">r</td>
<td align="LEFT" style="border: 1px solid #000000;">Appends non-tar files to an archive</td>
</tr>
<tr>
<td align="LEFT" height="18" style="border: 1px solid #000000;"><span style="font-family: Courier New;"> &ndash;update</span></td>
<td align="LEFT" style="border: 1px solid #000000;">u</td>
<td align="LEFT" style="border: 1px solid #000000;">Appends files that are newer than those in an archive</td>
</tr>
<tr class="alt">
<td align="LEFT" height="18" style="border: 1px solid #000000;"><span style="font-family: Courier New;"> &ndash;diff or &ndash;compare</span></td>
<td align="LEFT" style="border: 1px solid #000000;">d</td>
<td align="LEFT" style="border: 1px solid #000000;">Compares an archive to files on disk</td>
</tr>
<tr>
<td align="LEFT" height="20" style="border: 1px solid #000000;"><span style="font-family: Courier New;"> &ndash;list</span></td>
<td align="LEFT" style="border: 1px solid #000000;">t</td>
<td align="LEFT" style="border: 1px solid #000000;">Lists the contents of a tarball</td>
</tr>
<tr class="alt">
<td align="LEFT" height="18" style="border: 1px solid #000000;"><span style="font-family: Courier New;"> &ndash;extract or &ndash;get</span></td>
<td align="LEFT" style="border: 1px solid #000000;">x</td>
<td align="LEFT" style="border: 1px solid #000000;">Extracts files from an archive</td>
</tr>
</tbody>
</table>
注:表格
<table cellspacing="0" border="0">
<colgroup width="258"></colgroup>
<colgroup width="152"></colgroup>
<colgroup width="803"></colgroup>
<tbody>
<tr>
<td align="CENTER" height="24" bgcolor="#999999" style="border: 1px solid #000001;"><b><span style="font-size: medium;">Operation modifier</span></b></td>
<td align="CENTER" bgcolor="#999999" style="border: 1px solid #000001;"><b><span style="font-size: medium;">Abbreviation</span></b></td>
<td align="CENTER" bgcolor="#999999" style="border: 1px solid #000001;"><b><span style="font-size: medium;">Description</span></b></td>
</tr>
<tr class="alt">
<td align="LEFT" height="24" style="border: 1px solid #000001;"><span style="font-family: Courier New;">&mdash;</span>directory dir</td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Courier New;"> C</span></td>
<td align="LEFT" style="border: 1px solid #000001;">Changes to directory dir before performing operations</td>
</tr>
<tr>
<td align="LEFT" height="24" style="border: 1px solid #000001;"><span style="font-family: Courier New;">&mdash;</span>same-permissions and <span style="font-family: Courier New;">&mdash;</span>same-owner</td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Courier New;"> p</span></td>
<td align="LEFT" style="border: 1px solid #000001;">Preserves permissions and ownership information, respectively.</td>
</tr>
<tr class="alt">
<td align="LEFT" height="24" style="border: 1px solid #000001;"><span style="font-family: Courier New;"> &ndash;verbose</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Courier New;"> v</span></td>
<td align="LEFT" style="border: 1px solid #000001;">Lists all files as they are read or extracted; if combined with &ndash;list, it also displays file sizes, ownership, and timestamps</td>
</tr>
<tr>
<td align="LEFT" height="24" style="border: 1px solid #000001;"><span style="font-family: Courier New;">&mdash;</span>exclude file</td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Courier New;"> &mdash;</span></td>
<td align="LEFT" style="border: 1px solid #000001;">Excludes file from the archive. In this case, file can be an actual file or a pattern.</td>
</tr>
<tr class="alt">
<td align="LEFT" height="24" style="border: 1px solid #000001;"><span style="font-family: Courier New;">&mdash;</span>gzip or <span style="font-family: Courier New;">&mdash;</span>gunzip</td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Courier New;"> z</span></td>
<td align="LEFT" style="border: 1px solid #000001;">Compresses an archive through gzip</td>
</tr>
<tr>
<td align="LEFT" height="24" style="border: 1px solid #000001;"><span style="font-family: Courier New;"> &ndash;bzip2</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Courier New;"> j</span></td>
<td align="LEFT" height="24" style="border: 1px solid #000001;">Compresses an archive through bzip2</td>
</tr>
<tr class="alt">
<td align="LEFT" height="24" style="border: 1px solid #000001;"><span style="font-family: Courier New;"> &ndash;xz</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Courier New;"> J</span></td>
<td align="LEFT" style="border: 1px solid #000001;">Compresses an archive through xz</td>
</tr>
</tbody>
</table>
#### 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 youre 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 theres 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 administrators 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/

View File

@ -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 users 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 users 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 users home directory and / or changing its shell ####
If for some reason you need to change the default location of the users 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 users 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 users 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, youll 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 directorys 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 files 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 files owner, the files 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 files 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 files 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 files 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 files mode using an expression that indicates the owners rights with the letter `u`, the group owners 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 files 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 dont 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/

View File

@ -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. Its 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 vims 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 were working on) by pressing the Esc key.
Lets see how we can perform the same operations that we outlined for nano in the previous section, but now with vim. Dont forget to hit the Enter key to confirm the vim command!
To access vims 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, lets 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.**
注:表格
<table cellspacing="0" border="0">
<colgroup width="201"></colgroup>
<colgroup width="440"></colgroup>
<tbody>
<tr>
<td align="center" height="25" bgcolor="#999999" style="border: 1px solid #000000;"><b>Character Class</b></td>
<td align="center" bgcolor="#999999" style="border: 1px solid #000000;"><b>Matches…</b></td>
</tr>
<tr class="alt">
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:alnum:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any alphanumeric [a-zA-Z0-9] character</td>
</tr>
<tr>
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:alpha:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any alphabetic [a-zA-Z] character</td>
</tr>
<tr class="alt">
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:blank:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Spaces or tabs</td>
</tr>
<tr>
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:cntrl:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any control characters (ASCII 0 to 32)</td>
</tr>
<tr class="alt">
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:digit:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any numeric digits [0-9]</td>
</tr>
<tr>
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:graph:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any visible characters</td>
</tr>
<tr class="alt">
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:lower:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any lowercase [a-z] character</td>
</tr>
<tr>
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:print:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any non-control characters</td>
</tr>
<tr class="alt">
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:space:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any whitespace</td>
</tr>
<tr>
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:punct:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any punctuation marks</td>
</tr>
<tr class="alt">
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:upper:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any uppercase [A-Z] character</td>
</tr>
<tr>
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[[:xdigit:]]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any hex digits [0-9a-fA-F]</td>
</tr>
<tr class="alt">
<td align="left" height="21" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;[:word:]</td>
<td align="left" bgcolor="#FFFFFF" style="border: 1px solid #000000;">&nbsp;Any letters, numbers, and underscores [a-zA-Z0-9_]</td>
</tr>
</tbody>
</table>
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/

View File

@ -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 RAMbased 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. Systemds 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:
注:表格
<table cellspacing="0" border="0">
<colgroup width="237"></colgroup>
<colgroup width="256"></colgroup>
<colgroup width="1945"></colgroup>
<tbody>
<tr>
<td align="left" height="25" bgcolor="#B7B7B7" style="border: 1px solid #000000;"><b><span style="color: black; font-family: Arial; font-size: small;">Legacy tool</span></b></td>
<td align="left" bgcolor="#B7B7B7" style="border: 1px solid #000000;"><b><span style="color: black; font-family: Arial; font-size: small;">Systemctl equivalent</span></b></td>
<td align="left" bgcolor="#B7B7B7" style="border: 1px solid #000000;"><b><span style="color: black; font-family: Arial; font-size: small;">Description</span></b></td>
</tr>
<tr class="alt">
<td align="left" height="21" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">service name start</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl start name</span></td>
<td align="left" style="border: 1px solid #000000;">Start name (where name is a service)</td>
</tr>
<tr>
<td align="left" height="21" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">service name stop</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl stop name</span></td>
<td align="left" style="border: 1px solid #000000;">Stop name</td>
</tr>
<tr class="alt">
<td align="left" height="21" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">service name condrestart</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl try-restart name</span></td>
<td align="left" style="border: 1px solid #000000;">Restarts name (if its already running)</td>
</tr>
<tr>
<td align="left" height="21" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">service name restart</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl restart name</span></td>
<td align="left" style="border: 1px solid #000000;">Restarts name</td>
</tr>
<tr class="alt">
<td align="left" height="21" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">service name reload</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl reload name</span></td>
<td align="left" style="border: 1px solid #000000;">Reloads the configuration for name</td>
</tr>
<tr>
<td align="left" height="21" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">service name status</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl status name</span></td>
<td align="left" style="border: 1px solid #000000;">Displays the current status of name</td>
</tr>
<tr class="alt">
<td align="left" height="23" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">service &ndash;status-all</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Arial;">Displays the status of all current services</span></td>
</tr>
<tr>
<td align="left" height="21" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">chkconfig name on</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl enable name</span></td>
<td align="left" style="border: 1px solid #000000;">Enable 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.</td>
</tr>
<tr class="alt">
<td align="left" height="21" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">chkconfig name off</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl disable name</span></td>
<td align="left" style="border: 1px solid #000000;">Disables name to run on startup as specified in the unit file (the file to which the symlink points)</td>
</tr>
<tr>
<td align="left" height="21" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">chkconfig &ndash;list name</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl is-enabled name</span></td>
<td align="left" style="border: 1px solid #000000;">Verify whether name (a specific service) is currently enabled</td>
</tr>
<tr class="alt">
<td align="left" height="23" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">chkconfig &ndash;list</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl &ndash;type=service</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Arial;">Displays all services and tells whether they are enabled or disabled</span></td>
</tr>
<tr>
<td align="left" height="23" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">shutdown -h now</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl poweroff</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Arial;">Power-off the machine (halt)</span></td>
</tr>
<tr class="alt">
<td align="left" height="23" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">shutdown -r now</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Courier New;">systemctl reboot</span></td>
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-family: Arial;">Reboot the system</span></td>
</tr>
</tbody>
</table>
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/

View File

@ -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 youre 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 youre 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 drives 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 its 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 youre 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 lets 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 LVs 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/

View File

@ -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 ACLs 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 dont 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. Lets 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 lets 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
Lets 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 lets 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 dont 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
Lets give user gacanepa read and write access to /mnt/playground/testfile.txt.
Run as root,
# setfacl -R -m u:gacanepa:rwx /mnt/playground
and youll 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 roots 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 roots 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

View File

@ -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 its 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, lets 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 dont 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 networks 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 systems 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/

View File

@ -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 its 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, its 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 servers 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 dont 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 cant 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 chrooted 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 users 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

View File

@ -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 dont 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 dont 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 its not already present or attempt to update it if its 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 Im 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 users 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.
Dont 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/

View File

@ -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. Heres 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 dont 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/

View File

@ -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 youre 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 were ready to kick off the kickstart installation.
Regardless of how you choose to create the kickstart file, its 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 theres 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 roots 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 youre 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/

View File

@ -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 ACLs 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 youre experiencing a certain problem, and the same goes away when you set it to permissive, you can be confident youre 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.
Lets 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. Lets 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 dont!) 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 lets 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 youre 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:
<html>
<h2>SELinux test</h2>
</html>
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 cant 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 dont forget to update the corresponding Directory block. Then, restart Apache.
c). Browse to `http://<web server IP address>`, 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://<web server IP address>` 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 Users and Administrators][5] guide.
Dont 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

View File

@ -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 fingertips distance (man ldapadd, for example).
That said, lets 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, lets 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 its time to add some entries to our LDAP directory. Attributes and values are separated by a colon `(:)` in the following file, which well 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 doesnt 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 administrators 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

View File

@ -0,0 +1,214 @@
适合于远程编辑以及更多环境的简洁文本编辑器
================================================================================
文本编辑器是用来编辑纯文本的软件。这种软件有许多用处,包括修改配置文件,编写程序源代码,记下一些想法或者甚至写一份购物列表。由于这种编辑器能都用于许多不同的活动,因此值得花些时间找一个最适合您喜好的编辑器。
不论编辑器有多么复杂,它们通常有一个共同的功能集,包括查找/替换文本,格式化文本,导入文件以及在文件中移动文本。
所有这些文本编辑器都是基于终端的应用,因此他们很适合在远程主机上编辑文件。文本编辑器通常也会提供一个图形化的用户界面,但依旧会保证快速和最小化。
基于终端的应用程序在系统资源方面也是轻量级的在低配置机器上很有用比起它的图形化版本来也会更快、更高效由于它们在X需要重启时也不会停止工作因此非常适合编写脚本。
我选择了一些我最喜欢的开源文本编辑器,他们在使用系统资源方面都非常节俭。
----------
### Textadept ###
![](http://www.linuxlinks.com/portal/content/reviews/Editors/Screenshot-Textadept.png)
Textadept是一款适合程序员的快速、最小化、可扩展、跨平台的开源文本编辑器。这个开源程序由C和Lua写就并且于这些年间在速度和最小化方面进行了优化。
Textadept是那些想要无限的扩展性且不愿牺牲速度或屈服于代码膨胀的程序员们的理想编辑器。
它也有一个用于终端的版本仅仅依赖ncurses适合在远程主机上进行编辑。
#### 功能包括: ####
- 轻量级
- 最小化设计以最大化屏幕
- 自包含的执行文件 - 无需安装
- 全键盘驱动
- 无限制的分割视图GUI版本以您所好任意水平或垂直的分割编辑器窗口。请注意Textadept没有打开文件标签。
- 支持多于80种的编程语言
- 强大的片段快捷命令
- 代码自动补全和API查询
- 无与伦比的扩展性
- 书签
- 查找和替换
- 在文件中查找
- 基于缓存的单词补全
- 成熟的编程语言符号自动补全以及显示API文档的功能
- 主题:明亮、黑暗、终端
- 使用词法分析器将名称分配给缓冲元素,如评论、字符串、关键词
- 远程会话
- 快速打开
- 许多可用的模块包括对Java、Python、Ruby和近期打开文件列表的支持
- 符合Gnome HIG用户接口的指导
- 支持编辑Lua代码。语法自动补全LuaDoc许多Textadept对象和Lua的标准库。
- 网址: [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 模式
- 无限制的撤销
- 多个窗口和缓冲区
- 平滑的输入模式
- 根据所编辑的文件的类型使用不同的颜色或风格进行语法高亮
- 交互命令
- - 标记一行
- - vi 行缓冲
- - 移动代码块
- 块操作
- 命令历史
- 扩展的正则表达式
- 编辑压缩/打包文件 (gzip, bzip2, zip, tar)
- 文件名补全
- 标记跳转
- 折叠文本
- 缩进
- ctags和cscope整合
- 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对于新手来说易于使用但也非常强大并有完全可配置的引导程序并且在资源使用上十分节约。
#### 功能包括: ####
- 三种用户接口: 控制击键,命令行和菜单;击键和菜单都可配置
- 语法高亮
- 对于UTF-8文件的完全支持包括多列字符
- 文档,剪切,显示的维度和文件/行号长度都有编号,并且仅受制于机器的整型字长
- 简单的脚本语言,脚本可以用简单易理解的录制/播放的方式制作
- 无限制的撤销/重做功能(可以通过命令禁用)
- 基于被编辑的文件扩展的自动个性化配置系统
- 使用您文档中的词语做字典来进行自动前缀补全
- 易用的文件存取功能
- 扩展的正则表达式可用于查找和替换类似emacs和vi
- 非常紧凑的内存模型,在加载和修改大型文件时十分快速
- 可编辑二进制文件
- 网址: [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)
Zile是Lossy EmacsEmacs精简版它是一个小型的Emacs的克隆版。Zile是一个可定制的自文档化实时显示的编辑器在编写Zile时像Emacs一样尽可能的小每个Emacs用户都会对Zile感到亲切。
Zile以它极小的RAM用量大约130KB以及快速开始编辑而闻名。它是8比特清洁的允许用于编写任何种类的文件。
#### 功能包括: ####
- 小型但快速、强大
- 多个缓冲区,允许多级的撤销
- 多窗口
- 好用,有力【不太清楚怎么翻译】
- 以最小的缓冲区完成补全
- 自动填充 (自动换行)
- 寄存器视图
- 看起来像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的邮件客户端。
nano像Pico一样是以键盘为导向的设计可以用控制键来控制。
#### 功能包括: ####
- 交互式的查找和替换
- 彩色语法高亮
- 转到行号和列号处
- 自动缩进
- 功能开关
- 支持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/

View File

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

View File

@ -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.04Vivid 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.04Vivid 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]:

View File

@ -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-1101和102LPIC-2201和202和LPIC-3300303或者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 AssociateSCSAS而为人所知。
- **认证代码**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
- 课程代码RH124RH134和RH199
- 考试代码EX200
- 考试时长21-22小时取决于选择的课程
- 要求无。有一些Linux基础知识更好
- 分数线300总分210过70%
- 有效期3年
### 6. RHCE ###
RHCE也叫做红帽认证工程师是一个中到高级水平的认证程序为一些红帽认证系统管理员RHCSA想学习一个负责红帽企业Linux的高级系统管理员要求的额外技能和知识而开设的RHCE有能力知识和技能配置静态的路由包过滤网络地址转换(NAT)设定内核运行参数配置一个互联网小型计算机系统接口ISCSI初始化程序产生并推送系统使用的报告使用shell脚本自动完成系统维护任务配置系统登入包括远程登录提供网络服务如HTTP/HTTPS文件传输协议FTP网络文件系统NFS服务信息块SMB简单邮件传输协议SMTP安全shellSSH和网络时间协议NTP等等。RHCSAs希望获得更多高级水平的认证并且已经完成系统管理员III和III或者RHCE认证建议的RHCE快速跟进课程。
- **认证代码**RHCE
- 课程代码RH124RH134RH254和RH199
- 考试代码EX200和EX300
- 考试时长21-22个小时取决于所选课程
- 要求一个RHCSA证书
- 分数线300总分210过70%
- 有效期3年
### 7. RHCA ###
RHCA就是红帽认证架构师是红帽公司的一个认证程序。它的关注点在系统管理的实际能力包括安装和配置一个红帽Linux系统并加入到一个可用网络中运行网络服务。RHCA是所有红帽认证中最高水平的认证。考生需要选择他们希望关注的集合或者选择合格的红帽认证的任意组合以此来创建一个他们自己的集合。这里有三个主要的集合数据中心云和应用平台。精通数据中心集合的RHCA能够运行管理数据中心而熟悉云的可以创建配置和管理私有的混合的云云应用平台以及使用红帽企业Linux平台的灵活存储方案。精通应用平台集合的RHCA拥有技能如安装配置和管理红帽JBoss企业应用平台和应用云应用平台和混合云环境借助红帽的OpenShift企业版使用红帽JBoss数据虚拟化技术从多个资源里组合数据。
- **认证代码**RHCA
- 课程代码CL210CL220.CL280RH236RH318RH413RH436RH442JB248和JB450
- 考试代码EX333EX401EX423或者EX318EX436和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管理LinuxLinux进程和服务存储配置网络远程接入SLE 11 SP2模拟器任务自动化和管理用户访问和安全工作。我们可以同时获得LPI的SUSE CLALPIC-1和CompTIA Linux因为SUSELinux Professional Institute和CompATI合作提供给你这个机会去获得三个Linux认证。
- **认证代码**SUSE CLA
- 课程代码31153116
- 考试代码050-720050-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
- 课程代码31153116和3117
- 考试代码050-721050-697
- 考试类型:手写
- 考试时长180分钟
- 要求SUSE CLA 认证
### 10. SUSE CLE ###
SUSE认证Linux工程师(CLE)是一个工程师级别的高级认证为那些已经通过CLE考试的人准备。为了获得CLE认证人们需要获得SUSE CLA和CLP的认证。获得CLE认证的人员拥有架设复杂SUSE Linux企业服务器环境的技能。CLE认证过的人可以配置基本的网络服务管理打印配置和使用Open LDAPsambaIPv6完成健康检测和这里不知道创建和执行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
- 课程代码LFCS201LFCS220可选
- 考试代码LFCS 考试
- 考试时长2小时
- 要求:无
- 分数线74%
- 语言:英语
- 有效期:两年
### 12. LFCE ###
Linux基金会认证工程师LFCE是Linux基金会为Linux工程师推出的认证。通过LFCE认证的人员拥有一个对于Linux较宽范围的技能相比于LFCS。这是一个工程师级别的高级认证程序。LFCE认证的人具备一些网络管理方面的技能和能力如配置网络服务包过滤网络运行模拟器IP连通配置文件系统和文件服务网络文件系统从仓库安装升级软件包管理网络安全配置iptableshttp服务代理服务邮件服务等等。由于其为高级工程级别的认证程序所以普遍认为相比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/

View File

@ -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是一个创业想法但其创始人决定创建一个开源项目将其取代。此想法在社区传播开来很快不少贡献者加入到项目中来。项目发起仅仅两个月后这款游戏就被收入Googles 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上大会上谷歌这个互联网巨头开源了KubernetesKubernetes的开发是为了满足迅速增长的Docker生态系统的需要。通过和其它的组织、项目合作比如 Red Hat和CoreOSKubernetes的管理者们促使它登上了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 是一个全球的点对点式的分布式版本文件系统。它综合了GitBitTorrentHTTP的思想开启了一个新的数据和数据结构传输协议。
开源被人们所知晓的原因是它本意用简单的方法解决复杂的问题这样产生许多新颖的想法但是着些强大的项目仅仅是开源社区的冰山一角。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

View File

@ -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吸纳越来越多的编程语言分支演变为第三版和之后的版本她从来没有失去连接的特性。通过仓库如PECLPHP Extension Community LibraryPHP可以把库都连在一起暴露他们的函数给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应用包括WordPressDrupalJoomla和MediaWiki。这些应用占据了所有规模的商业的网络形式从小型的夫妻店到站点如whitehouse.gov和Wikipeida。Alexa前十的站点中6个使用PHP在一天内服务数十亿的页面。结果PHP应用已成加速需要的首选 -- 并且许多创新也加入到PHP的核心来提升表现。
在2010年Facebook公开了其用作PHP源对源的编译器的HipHop翻译PHP代码为C++代码并且编译为一个单独的可执行二进制应用。Facebook的规模和成长需要从标准互用的PHP代码迁移到更快最佳的可执行的代码。尽管如此Facebook想继续使用PHP由于PHP的易用和快速开发周期。HipHop进化为HHVM一个针对PHP的JITjust-in-time编译基础的执行引擎其包含一个基于PHP的新的语言[Hack][7]。
Facebook的创新和其他的VM项目创建了在引擎水平上的比较引起了关于Zend引擎未来的讨论。Zend引擎依然占据PHP和一种语言表述的问题的核心。在2004年一个语言表述项目被创建“为提供一个完整的简明的语句定义和PHP语言的语义学”使得对编译器项目来说创建共用的PHP实现成为可能。
下一个PHP的主要版本成为了激烈争论的话题一个著名的pgpng项目下一代作为一个能清理重构优化和提升PHP代码基础的选项被提出来这也展示了对真实世界应用的性能的实质上的提升。由于之前未发布的PHP 6.0版本在决定命名下一个主要版本为“PHP 7”后phpng分支被合并了并制定了计划开发PHP 7Hack提供了很多语言中拥有的功能如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社区的其他人致敬感谢他们把这个“愚蠢的小项目”变成了一个如今网络上持久的强大的组块。

View File

@ -0,0 +1,67 @@
Linux下优秀的音频编辑软件
================================================================================
不论您是一个音乐爱好者或只是一个要记录您导师声音的学生您都需要录制音频和编辑音频。长久以来这样的工作都要靠Macintosh如今那个时代已经过去现在Linux也可以胜任这些工作了。简而言之这里有一份不完全的音频编辑器软件列表适用于不同的任务和需求。
### 1. Audacity ###
![](https://farm9.staticflickr.com/8572/15405018653_83ba3e718d_c.jpg)
让我们从我个人最喜欢的软件开始。[Audacity][1]可以运行在Windows、Mac和Linux上。它是开源的且易于使用。你会觉得Audacity几乎是完美的。它可以让您在干净的界面上操作音频波形。简单地说您可以覆盖音轨、剪切和修改音轨、增加特效、执行高级的声音分析然后将它们导出到一大堆可用的格式。我喜欢它的原因是它将基本的功能和复杂的功能结合在一起并且保持一个简单的学习曲线。然而它并不是一个完全最优化的软件尤其是对于音乐家和有着专业知识的人。
### 2. Jokosher ###
![](https://farm8.staticflickr.com/7524/15998875136_82903a9b4a_c.jpg)
在不同的层次上,[Jokosher][2]更多的聚焦在多音轨方面。它使用Python和GTK+作为前端借口并使用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对您来说过于简单但基于Qt的程序却有些吸引力那么对您来说也许[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烧录的功能。另外它对我来说是介于简单的软件和专业的软件之间的程序。它的界面是KDE样式的其键盘配置很简单。更有趣的是Traverso会监视您的系统资源以确定不会超过您的CPU或者硬件的能力。
总而言之能在Linux系统上看到这么多不同的应用程序是一件开心的事。它使得您永远可以找到最适合自己的那一款。虽然我最喜欢的应用是Audacity但我非常震惊于LMMS和Jokosher的设计。
我们有漏掉什么么您在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

View File

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

View File

@ -0,0 +1,220 @@
如何在CentOS 7上安装Percona Server
================================================================================
在这篇文章中我们将了解关于Percona Server一个开源简易的MySQLMariaDB的替代。InnoDB的数据库引擎使得Percona Server非常有吸引力如果你需要的高性能高可靠性和高性价比的解决方案它将是一个很好的选择。
在下文中将介绍在CentOS 7上Percona的服务器的安装以及备份当前数据,配置的步骤和如何恢复备份。
###目录###
1.什么是Percona为什么使用它
2.备份你的数据库
3.删除之前的SQL服务器
4.使用二进制包安装Percona
5.配置Percona
6.保护你的数据
7.恢复你的备份
### 1.什么是Percona为什么使用它 ###
Percona是一个开源简易的MySQLMariaDB数据库的替代它是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/

View File

@ -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'来查看哪个文件是可执行文件。因此我应该重新输入整个命令么?不,我不需要。我仅需要在新的命令中带上最后的参数,类似:
$ 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 [arguments]`来打印两个不同的参数。
$ 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)
以关键字为基础执行命令
### 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`用来以某用户运行特定的命令,最重要的部分是`!!`它将被替换为上次运行的命令。对的您需要提供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.检查某个文件夹(比如/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)
校对:[校对者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/

View File

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

View File

@ -0,0 +1,302 @@
20款优秀的Linux终端仿真器
================================================================================
终端仿真器是一款用其它显示结构重现可视终端的计算机程序。换句话说就是终端仿真器能使哑终端看似像一台客户机连接上了服务器。终端仿真器允许最终用户像文本用户界面和命令行界面一样连接控制台和应用程序。
![Linux Terminal Emulators](http://www.tecmint.com/wp-content/uploads/2014/01/Linux-Terminal-Emulators1.jpeg)
20款Linux终端仿真器
你能从开源世界中找到大量的终端仿真器来使用有些拥有大量的特性而有些则反之。为了能更好地理解它们所能提供的质量我们收集了一份不可思议的Linux终端仿真器清单。每一款都列出了它们各自的描述和特性以及软件界面截图和下载链接。
### 1. Terminator ###
Terminator是一款先进且强大的终端仿真器它支持多终端窗口。这款仿真器可以完全自定义。你可以更改它的界面尺寸、颜色给它设置不同的形状。拥有高用户友好性且使用起来很有乐趣。
#### Terminator的特性 ####
- 自定义外形和配色方案,根据你的需要设置尺寸。
- 使用插件来获取更多功能。
- 快捷键可以加快普通操作。
- 可以把终端窗口分裂成几个虚拟终端并把它们重新设置成你需要的尺寸。
![Terminator Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Terminator-Emulator.jpeg)
Terminator Terminal
- [Terminator Homepage][1]
- [Download and Installation Instructions][2]
### 2. Tilda ###
Tilda是一款漂亮的基于GTK+的下拉式终端敲击一个键你就可以呼出一个新的或隐藏着的Tilda窗口。你也可以添加你所选择的颜色来更改文本颜色和终端背景颜色。
#### Tilda的特性 ####
- 高度定制的选项界面设置。
- 你可以给Tilda设置透明度。
- 优秀的嵌入式配色方案。
![Tilda Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Tilda-Emulator.jpeg)
Tilda Terminal
- [Tilda Homepage][3]
### 3. Guake ###
Guake是一款基于python的下拉式终端诞生于GNOME桌面环境。按一个键就能调出再按一下就能隐藏。它的设计构思来源于FPS (第一人称射击) 游戏例如Quake其目标显而易见。
Guake与Yakuaka和Tilda非常相似不过它是一个集上述二者的优点于一体的基于GTK的程序。Guake完全是用Python和小片的C写成的(全局热键部分)。
![Guake Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Guake-Terminal.jpeg)
Guake Terminal
- [Guake Homepage][4]
### 4. Yakuake ###
Yakuake (Yet Another Kuake) 是一款基于KDE的下拉式终端仿真器它与Guake再功能上非常相似。它的射击构思也是受FPS游戏的启发例如Quake。
Yakuake主要是一款KDE应用程序它能非常轻松地安装在KDE桌面上但是如果你试着将它安装在GNOME桌面上你将会安装大量的依赖包。
#### Yakuake的特性 ####
- 从屏幕顶端弹回顺畅
- 选项卡式界面
- 可配置的尺寸和动画速度
- 可定制
![Yakuake Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Yakuake-Terminal.jpeg)
Yakuake Terminal
- [Yakuake Homepage][5]
### 5. ROXTerm ###
ROXterm又是一款轻量级终端仿真器旨在提供与GNOME终端相似的特性。它原本创造出来是为了通过不使用Gnome库从而拥有更少的占用空间和更快的启动速度并使用独立的小程序来建立配置界面(GUI), 但是随着时间的流逝,它的角色就转变为给那些高级用户带来更高一层的特性。
然而它比GNOME终端更加具有可制定性并且对于那些经常使用终端的高级用户更令人期望。它能和GNOME桌面环境完美结合并在终端中提供像拖拽项目那样的特性。
![Roxterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Roxterm-Terminal.jpeg)
Roxterm Terminal
- [ROXTerm Homepage][6]
### 6. Eterm ###
Eterm是最轻量级的一款彩色终端仿真器是作为xterm的替代品而被设计出来。它是以一种选择自由的思想、避免臃肿、灵活性和自由在用户手中是触手可及的理念而开发出来的。
![Eterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Eterm-Terminal.jpeg)
Eterm Terminal
- [Eterm Homepage][7]
### 7. Rxvt ###
代表着扩展虚拟终端的Rxvt是一款彩色终端仿真器为那些不需要一些特性例如Tektronix 4014仿真和toolkit-style可配置性的高级用户而生的xterm的替代品。
![Rxvt Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Rxvt-Terminal.jpeg)
Rxvt Terminal
- [Rxvt Homepage][8]
### 8. Wterm ###
Wterm是另一款以rxvt项目为基础的轻量级彩色终端仿真器。它所包含的特性包括设置背景图片、透明度、反向透明度和大量的设置或运行环境选项让它成为一款可高度自定义的终端仿真器。
![wterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/wterm-Terminal-.jpeg)
wterm Terminal
- [Wterm Homepage][9]
### 9. LXTerminal ###
LXTerminal是一款基于VTE的终端仿真器默认运行于没有任何多余依赖的LXDE(轻量级X桌面环境)下。这款终端有很多很棒的特性。
#### LXTerminal的特性 ####
- 多标签支持
- 支持普通命令如cp, cd, dir, mkdir, mvdir
- 隐藏菜单栏以保证足够界面空间
- 更改配色方案
![lxterminal Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/lxterminal-Terminal.jpeg)
lxterminal Terminal
- [LXTerminal Homepage][10]
### 10. Konsole ###
Konsole是另一款强大的基于KDE的免费终端仿真器最初由Lars Doelle创造。
#### Konsole的特性 ####
- 多标签式终端
- 半透明背景
- 支持拆分视图模式
- 目录和SSH书签化
- 可定制的配色方案
- 可定制的按键绑定
- 终端中的活动通知警告
- 增量搜索
- 支持Dolphin文件管理器
- 普通文本和HTML格式输出出口
![Konsole Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Konsole-Terminal.jpeg)
Konsole Terminal
- [Konsole Homepage][11]
### 11. 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)
TermKit Terminal
- [TermKit Homepage][12]
### 12. st ###
st是一款简单的X Window终端实现接口。
![st terminal](http://www.tecmint.com/wp-content/uploads/2014/01/st-terminal.png)
st terminal
- [st Homepage][13]
### 13. Gnome-Terminal ###
GNOME终端是一款在GNOME桌面环境下的嵌入式终端仿真器由Havoc Pennington和其他一些人共同开发。它允许用户在GNOME环境下的同时使用一个真实的Linux shell来运行命令。GNOME终端是模拟的xterm终端仿真器并带来了一些相似的特性。
Gnome终端支持多用户用户可以为他们的账户创建多个用户每个用户能自定义配置选项如字体、颜色、背景图片、行为习惯等等并能分别给它们取名。它也支持鼠标事件、url探测、多标签等。
![Gnome Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Gnome-terminal.jpg)
Gnome Terminal
- [Gnome Terminal][14]
### 14. Final Term ###
Final Term是一款漂亮的开源终端仿真器在这一个界面里蕴藏着一些令人激动的功能和特性。虽然它仍然有待改进但是它提供了一些重要的特性比如Semantic文本菜单、智能的命令行实现、GUI终端控制、全能的快捷键、彩色支持等等。以下动图抓取并演示了它们的一些特性点开来看看吧。
![FinalTerm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/FinalTerm.gif)
FinalTerm Terminal
- [Final Term][15]
### 15. Terminology ###
Terminology是一款新的现代化终端仿真器为Enlightenment桌面创造但也能用于其它桌面环境。它有一些独一无二的棒极了的特性这是其它终端仿真器所不具备的。
抛开这些特性terminology甚至还提供了你无法从其它仿真器看到的东西比如图像、视频和文档的缩略图预览它允许你从Terminology直接就能看到那些文件。
你可以来看看Terminology的开发人员制作的小视频(视频画质不太清晰但足以让你了解Terminology了)。
<iframe width="630" height="480" frameborder="0" allowfullscreen="" src="//www.youtube.com/embed/ibPziLRGvkg"></iframe>
- [Terminology][16]
### 16. Xfce4 terminal ###
Xfce终端是一款轻量级的现代化终端仿真器它简单易用为Xfce桌面环境设计。它最新的一个版本有许多新的炫酷特性比如搜索会话、标签颜色转换器、像Guake或Yakuake一样的下拉式控制台等等。
![Xfce Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/xfce-terminal.jpg)
Xfce Terminal
- [Xfce4 Terminal][17]
### 17. xterm ###
xterm应用程序是一款标准的在X Window系统上的终端仿真器。它保持了DEC VT102和Tektronix 4014让应用能直接使用X Window系统。
![xterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/xterm.jpg)
xterm Terminal
- [xterm][18]
### 18. LilyTerm ###
LilyTerm是一款基于libvte的开源终端仿真器这款不太出名的仿真器追求的是快速和轻量级。LilyTerm也包括一些关键特性
- 支持标签移动、着色以及标签重新排序
- 通过快捷键管理标签
- 支持背景透明化和饱和度调整
- 支持为特定用户创建配置文件
- 若干个自定义选项
- 广泛支持UTF-8
![Lilyterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Lilyterm.jpg)
Lilyterm Terminal
- [LilyTerm][19]
### 19. Sakura ###
Sakura是另一款不知名的Unix风格终端仿真器按照命令行模式和基于文本的终端程序开发。Sakura基于GTK和livte自身特性不多不过还是有一些自定义选项比如多标签支持、自定义文本颜色、字体和背景图片、快速命令处理等等。
![Sakura Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/sakura.jpg)
Sakura Terminal
- [Sakura][20]
### 20. rxvt-unicode ###
rxvt-unicode (也称为urxvt) 是另一个高度可定制、轻量级和快速的终端仿真器支持xft和unicode由Marc Lehmann开发。它有许多显著特性比如支持Unicode上的国际语言能显示多种字体类型并支持Perl扩展。
![rxvt unicode](http://www.tecmint.com/wp-content/uploads/2014/01/rxvt-unicode.png)
rxvt unicode
- [rxvt-unicode][21]
如果你知道任何其它强大的Linux终端仿真器而上文未提及欢迎在评论中与我们分享。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/linux-terminal-emulators/
作者:[Ravi Saive][a]
译者:[ZTinoZ](https://github.com/ZTinoZ)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/admin/
[1]:https://launchpad.net/terminator
[2]:http://www.tecmint.com/terminator-a-linux-terminal-emulator-to-manage-multiple-terminal-windows/
[3]:http://tilda.sourceforge.net/tildaabout.php
[4]:https://github.com/Guake/guake
[5]:http://extragear.kde.org/apps/yakuake/
[6]:http://roxterm.sourceforge.net/index.php?page=index&lang=en
[7]:http://www.eterm.org/
[8]:http://sourceforge.net/projects/rxvt/
[9]:http://sourceforge.net/projects/wterm/
[10]:http://wiki.lxde.org/en/LXTerminal
[11]:http://konsole.kde.org/
[12]:https://github.com/unconed/TermKit
[13]:http://st.suckless.org/
[14]:https://help.gnome.org/users/gnome-terminal/stable/
[15]:http://finalterm.org/
[16]:http://www.enlightenment.org/p.php?p=about/terminology
[17]:http://docs.xfce.org/apps/terminal/start
[18]:http://invisible-island.net/xterm/
[19]:http://lilyterm.luna.com.tw/
[20]:https://launchpad.net/sakura
[21]:http://software.schmorp.de/pkg/rxvt-unicode

View File

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

View File

@ -1,113 +0,0 @@
安装Fedora 22后要做的事
================================================================================
Fedora 22Red 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自带有不错的内建功能用于容纳帐号相关的东西像FacebookGoogle以及其它在线帐号。你可以通过主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

View File

@ -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和它的变种BSDLinux。它们一直深深的吸引着我。我在存储方面有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 ChainPOSTROUTING Chain和OUTPUT Chain。
>
> Mangle表 : 正如它的名字一样这个表用于校正网络包。它用来对特殊的包进行修改。它能够修改不同包的头部和内容。Mangle表不能用于地址伪装。支持的链包括PREROUTING ChainOUTPUT ChainForward ChainInputChain和POSTROUTING Chain。
>
> Filter表 : Filter表是iptables中使用的默认表它用来过滤网络包。如果没有定义任何规则Filter表则被当作默认的表并且基于它来过滤。支持的链有INPUT ChainOUTPUT ChainFORWARD 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中添加规则以ACCEPTREJECTDENY和DROP ssh的服务 ###
> **答案** : 但愿ssh运行在22端口那也是ssh的默认端口我们可以在iptables中添加规则来ACCEPT ssh的tcp包在22号端口上
>
> # iptables -A INPUT -s -p tcp --dport 22 -j ACCEPT
>
> REJECT ssh服务22号端口的tcp包。
>
> # iptables -A INPUT -s -p tcp --dport 22 -j REJECT
>
> DENY ssh服务22号端口的tcp包。
>
>
> # iptables -A INPUT -s -p tcp --dport 22 -j DENY
>
> DROP ssh服务22号端口的tcp包。
>
>
> # iptables -A INPUT -s -p tcp --dport 22 -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/

View File

@ -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。不像apachenginx模块不是动态加载的因此你必须在编译之前就选择完需要的模块。
--------------------------------------------------------------------------------
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/

Some files were not shown because too many files have changed in this diff Show More